summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--var/spack/repos/builtin/packages/root/package.py28
1 files changed, 21 insertions, 7 deletions
diff --git a/var/spack/repos/builtin/packages/root/package.py b/var/spack/repos/builtin/packages/root/package.py
index c441dea5c1..eab2be9e5c 100644
--- a/var/spack/repos/builtin/packages/root/package.py
+++ b/var/spack/repos/builtin/packages/root/package.py
@@ -4,6 +4,7 @@
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
+import os
import sys
from spack.operating_systems.mac_os import macos_version
@@ -773,6 +774,15 @@ class Root(CMakePackage):
# warnings when building against ROOT
env.unset("MACOSX_DEPLOYMENT_TARGET")
+ @property
+ def root_library_path(self):
+ # Where possible, we do not use LD_LIBRARY_PATH as that is non-portable
+ # and pollutes the standard library-loading mechanisms on Linux systems.
+ # The ROOT_LIBRARY_PATH environment variable was added to ROOT 6.26.
+ if self.spec.satisfies("@:6.25"):
+ return "LD_LIBRARY_PATH"
+ return "ROOT_LIBRARY_PATH"
+
def setup_run_environment(self, env):
env.set("ROOTSYS", self.prefix)
env.set("ROOT_VERSION", "v{0}".format(self.version.up_to(1)))
@@ -780,6 +790,8 @@ class Root(CMakePackage):
# the following vars are copied from thisroot.sh; silence a cppyy warning
env.set("CLING_STANDARD_PCH", "none")
env.set("CPPYY_API_PATH", "none")
+ if "+rpath" not in self.spec:
+ env.prepend_path(self.root_library_path, self.prefix.lib.root)
def setup_dependent_build_environment(
self, env: spack.util.environment.EnvironmentModifications, dependent_spec
@@ -791,7 +803,7 @@ class Root(CMakePackage):
env.append_path("CMAKE_MODULE_PATH", self.prefix.cmake)
env.prepend_path("ROOT_INCLUDE_PATH", dependent_spec.prefix.include)
if "+rpath" not in self.spec:
- env.prepend_path("LD_LIBRARY_PATH", self.prefix.lib.root)
+ env.prepend_path(self.root_library_path, self.prefix.lib.root)
if "platform=darwin" in self.spec:
# Newer deployment targets cause fatal errors in rootcling
env.unset("MACOSX_DEPLOYMENT_TARGET")
@@ -799,10 +811,12 @@ class Root(CMakePackage):
def setup_dependent_run_environment(
self, env: spack.util.environment.EnvironmentModifications, dependent_spec
):
- env.set("ROOTSYS", self.prefix)
- env.set("ROOT_VERSION", "v{0}".format(self.version.up_to(1)))
- env.prepend_path("PYTHONPATH", self.prefix.lib.root)
- env.prepend_path("PATH", self.prefix.bin)
env.prepend_path("ROOT_INCLUDE_PATH", dependent_spec.prefix.include)
- if "+rpath" not in self.spec:
- env.prepend_path("LD_LIBRARY_PATH", self.prefix.lib.root)
+ # For dependents that build dictionaries, ROOT needs to know where the
+ # dictionaries have been installed. This can be facilitated by
+ # automatically prepending dependent package library paths to
+ # ROOT_LIBRARY_PATH (for @6.26:) or LD_LIBRARY_PATH (for older
+ # versions).
+ for lib_path in (dependent_spec.prefix.lib, dependent_spec.prefix.lib64):
+ if os.path.exists(lib_path):
+ env.prepend_path(self.root_library_path, lib_path)