feat: Require DDS 3.5.13.7

This commit is contained in:
Dennis Klein
2021-06-23 20:14:55 +02:00
committed by Dennis Klein
parent 81b1ba1f20
commit 1df338b262
6 changed files with 6 additions and 85 deletions

View File

@@ -1,5 +1,5 @@
/********************************************************************************
* Copyright (C) 2019 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
* Copyright (C) 2019-2021 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
* *
* This software is distributed under the terms of the *
* GNU Lesser General Public Licence (LGPL) version 3, *
@@ -27,27 +27,10 @@ struct DDSEnvironment::Impl
: fLocation(DDSInstallPrefix)
, fConfigHome(std::move(configHome))
{
SetupLocation();
SetupDynamicLoader();
SetupPath();
SetupConfigHome();
}
auto SetupLocation() -> void
{
std::string location(GetEnv("DDS_LOCATION"));
if (location != DDSInstallPrefix) {
if (location.empty()) {
setenv("DDS_LOCATION", DDSInstallPrefix.c_str(), 1);
} else {
LOG(debug) << "$DDS_LOCATION appears to point to a different installation than this"
<< "program was linked against. Things might still work out, so not"
<< "touching it.";
fLocation = location;
}
}
}
auto SetupConfigHome() -> void
{
if (fConfigHome.empty()) {
@@ -55,22 +38,6 @@ struct DDSEnvironment::Impl
} else {
setenv("HOME", fConfigHome.c_str(), 1);
}
std::stringstream cmd;
#ifdef __APPLE__
// On macOS System Integrity Protection might filter out the DYLD_LIBRARY_PATH, so we pass it
// through explicitely here.
cmd << "export " << fgLdVar << "=" << GetEnv(fgLdVar) << "\n";
#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";
auto rc(std::system(cmd.str().c_str()));
if (rc != 0) {
LOG(warn) << "DDSEnvironment::SetupConfigHome failed";
}
}
auto SetupPath() -> void
@@ -81,22 +48,6 @@ struct DDSEnvironment::Impl
setenv("PATH", path.c_str(), 1);
}
auto GenerateDDSLibDir() const -> Path
{
return {(fLocation == DDSInstallPrefix) ? DDSLibraryDir : fLocation / Path("lib")};
}
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());
@@ -112,11 +63,6 @@ struct DDSEnvironment::Impl
Path fLocation;
Path fConfigHome;
#ifdef __APPLE__
std::string const fgLdVar = "DYLD_LIBRARY_PATH";
#else
std::string const fgLdVar = "LD_LIBRARY_PATH";
#endif
};
DDSEnvironment::DDSEnvironment()