root: Fix root+x breakage from #11129 (#14224)

* Fix root+x breakage from #11129

* Separate out +opengl breakage

* Not strictly X11-related, but more breakage from  #11129

* Another X11 breakage found while building 6.08.x

* Don't put system headers in SPACK_INCLUDE_DIRS + deduplicate

* xextproto is only a dependency in +x builds
This commit is contained in:
Hadrien G 2020-01-23 18:42:25 +01:00 committed by Chris Green
parent c9e01ff9d7
commit 1a385a5178

View File

@ -5,6 +5,7 @@
from spack import *
from spack.util.environment import is_system_path
import sys
@ -427,8 +428,36 @@ def setup_build_environment(self, env):
if 'lz4' in self.spec:
env.append_path('CMAKE_PREFIX_PATH',
self.spec['lz4'].prefix)
# This hack is made necessary by a header name collision between
# asimage's "import.h" and Python's "import.h" headers...
env.set('SPACK_INCLUDE_DIRS', '', force=True)
# ...but it breaks header search for any ROOT dependency which does not
# use CMake. To resolve this, we must bring back those dependencies's
# include paths into SPACK_INCLUDE_DIRS.
#
# But in doing so, we must be careful not to inject system header paths
# into SPACK_INCLUDE_DIRS, even in a deprioritized form, because some
# system/compiler combinations don't like having -I/usr/include around.
def add_include_path(dep_name):
include_path = self.spec[dep_name].prefix.include
if not is_system_path(include_path):
env.append_path('SPACK_INCLUDE_DIRS', include_path)
# With that done, let's go fixing those deps
if self.spec.satisfies('+x @:6.08.99'):
add_include_path('xextproto')
if self.spec.satisfies('@:6.12.99'):
add_include_path('zlib')
if '+x' in self.spec:
add_include_path('fontconfig')
add_include_path('libx11')
add_include_path('xproto')
if '+opengl' in self.spec:
add_include_path('glew')
add_include_path('mesa-glu')
def setup_run_environment(self, env):
env.set('ROOTSYS', self.prefix)
env.set('ROOT_VERSION', 'v{0}'.format(self.version.up_to(1)))