Use ROOT_LIBRARY_PATH and adjust other environment variables (#45109)
* Use ROOT_LIBRARY_PATH and adjust other environment variables * Accommodate versions older than ROOT 6.26 * Use os instead of pathlib
This commit is contained in:
parent
12e7c1569c
commit
53f71fc4a7
@ -4,6 +4,7 @@
|
|||||||
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
||||||
|
|
||||||
|
|
||||||
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
from spack.operating_systems.mac_os import macos_version
|
from spack.operating_systems.mac_os import macos_version
|
||||||
@ -773,6 +774,15 @@ def add_include_path(dep_name):
|
|||||||
# warnings when building against ROOT
|
# warnings when building against ROOT
|
||||||
env.unset("MACOSX_DEPLOYMENT_TARGET")
|
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):
|
def setup_run_environment(self, env):
|
||||||
env.set("ROOTSYS", self.prefix)
|
env.set("ROOTSYS", self.prefix)
|
||||||
env.set("ROOT_VERSION", "v{0}".format(self.version.up_to(1)))
|
env.set("ROOT_VERSION", "v{0}".format(self.version.up_to(1)))
|
||||||
@ -780,6 +790,8 @@ def setup_run_environment(self, env):
|
|||||||
# the following vars are copied from thisroot.sh; silence a cppyy warning
|
# the following vars are copied from thisroot.sh; silence a cppyy warning
|
||||||
env.set("CLING_STANDARD_PCH", "none")
|
env.set("CLING_STANDARD_PCH", "none")
|
||||||
env.set("CPPYY_API_PATH", "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(
|
def setup_dependent_build_environment(
|
||||||
self, env: spack.util.environment.EnvironmentModifications, dependent_spec
|
self, env: spack.util.environment.EnvironmentModifications, dependent_spec
|
||||||
@ -791,7 +803,7 @@ def setup_dependent_build_environment(
|
|||||||
env.append_path("CMAKE_MODULE_PATH", self.prefix.cmake)
|
env.append_path("CMAKE_MODULE_PATH", self.prefix.cmake)
|
||||||
env.prepend_path("ROOT_INCLUDE_PATH", dependent_spec.prefix.include)
|
env.prepend_path("ROOT_INCLUDE_PATH", dependent_spec.prefix.include)
|
||||||
if "+rpath" not in self.spec:
|
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:
|
if "platform=darwin" in self.spec:
|
||||||
# Newer deployment targets cause fatal errors in rootcling
|
# Newer deployment targets cause fatal errors in rootcling
|
||||||
env.unset("MACOSX_DEPLOYMENT_TARGET")
|
env.unset("MACOSX_DEPLOYMENT_TARGET")
|
||||||
@ -799,10 +811,12 @@ def setup_dependent_build_environment(
|
|||||||
def setup_dependent_run_environment(
|
def setup_dependent_run_environment(
|
||||||
self, env: spack.util.environment.EnvironmentModifications, dependent_spec
|
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)
|
env.prepend_path("ROOT_INCLUDE_PATH", dependent_spec.prefix.include)
|
||||||
if "+rpath" not in self.spec:
|
# For dependents that build dictionaries, ROOT needs to know where the
|
||||||
env.prepend_path("LD_LIBRARY_PATH", self.prefix.lib.root)
|
# 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)
|
||||||
|
Loading…
Reference in New Issue
Block a user