mirror of
https://github.com/FairRootGroup/FairMQ.git
synced 2025-10-13 16:46:47 +00:00
SDK: Support DYLD_LIBRARY_PATH from parent env in sdk::DDSEnv
Fixes #235
This commit is contained in:
parent
278cd62049
commit
3785fd9ff9
|
@ -55,12 +55,17 @@ struct DDSEnvironment::Impl
|
||||||
setenv("HOME", fConfigHome.c_str(), 1);
|
setenv("HOME", fConfigHome.c_str(), 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::istringstream cmd;
|
std::stringstream cmd;
|
||||||
cmd.str("DDS_CFG=`dds-user-defaults --ignore-default-sid -p`\n"
|
#ifdef __APPLE__
|
||||||
"if [ -z \"$DDS_CFG\" ]; then\n"
|
// On macOS System Integrity Protection might filter out the DYLD_LIBRARY_PATH, so we pass it
|
||||||
" mkdir -p \"$HOME/.DDS\"\n"
|
// through explicitely here.
|
||||||
" dds-user-defaults --ignore-default-sid -d -c \"$HOME/.DDS/DDS.cfg\"\n"
|
cmd << "export " << fgLdVar << "=" << GetEnv(fgLdVar) << "\n";
|
||||||
"fi");
|
#endif
|
||||||
|
cmd << "DDS_CFG=`dds-user-defaults --ignore-default-sid -p`\n"
|
||||||
|
"if [ -z \"$DDS_CFG\" ]; then\n"
|
||||||
|
" mkdir -p \"$HOME/.DDS\"\n"
|
||||||
|
" dds-user-defaults --ignore-default-sid -d -c \"$HOME/.DDS/DDS.cfg\"\n"
|
||||||
|
"fi\n";
|
||||||
std::system(cmd.str().c_str());
|
std::system(cmd.str().c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -72,20 +77,23 @@ struct DDSEnvironment::Impl
|
||||||
setenv("PATH", path.c_str(), 1);
|
setenv("PATH", path.c_str(), 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
auto SetupDynamicLoader() -> void
|
auto GenerateDDSLibDir() const -> Path
|
||||||
{
|
{
|
||||||
#ifdef __APPLE__
|
return {(fLocation == DDSInstallPrefix) ? DDSLibraryDir : fLocation / Path("lib")};
|
||||||
std::string ldVar("DYLD_LIBRARY_PATH");
|
|
||||||
#else
|
|
||||||
std::string ldVar("LD_LIBRARY_PATH");
|
|
||||||
#endif
|
|
||||||
std::string ld(GetEnv(ldVar));
|
|
||||||
Path ddsLibDir = (fLocation == DDSInstallPrefix) ? DDSLibraryDir : fLocation / Path("lib");
|
|
||||||
ld = ddsLibDir.string() + std::string(":") + ld;
|
|
||||||
setenv(ldVar.c_str(), ld.c_str(), 1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
auto GetEnv(const std::string& key) -> std::string
|
auto SetupDynamicLoader() -> void
|
||||||
|
{
|
||||||
|
std::string ld(GetEnv(fgLdVar));
|
||||||
|
if (ld.empty()) {
|
||||||
|
ld = GenerateDDSLibDir().string();
|
||||||
|
} else {
|
||||||
|
ld = GenerateDDSLibDir().string() + std::string(":") + ld;
|
||||||
|
}
|
||||||
|
setenv(fgLdVar.c_str(), ld.c_str(), 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
auto GetEnv(const std::string& key) const -> std::string
|
||||||
{
|
{
|
||||||
auto value = std::getenv(key.c_str());
|
auto value = std::getenv(key.c_str());
|
||||||
if (value) {
|
if (value) {
|
||||||
|
@ -100,6 +108,11 @@ struct DDSEnvironment::Impl
|
||||||
|
|
||||||
Path fLocation;
|
Path fLocation;
|
||||||
Path fConfigHome;
|
Path fConfigHome;
|
||||||
|
#ifdef __APPLE__
|
||||||
|
std::string const fgLdVar = "DYLD_LIBRARY_PATH";
|
||||||
|
#else
|
||||||
|
std::string const fgLdVar = "LD_LIBRARY_PATH";
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
DDSEnvironment::DDSEnvironment()
|
DDSEnvironment::DDSEnvironment()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user