diff --git a/packages/hxtorch/package.py b/packages/hxtorch/package.py
index 5cd9febe872408a212007b377388480c974d1c2e..95413009906392fe1feace25dd7e95622f07a717 100644
--- a/packages/hxtorch/package.py
+++ b/packages/hxtorch/package.py
@@ -62,76 +62,6 @@ class Hxtorch(WafPackage):
depends_on('yaml-cpp+shared', type=('build', 'link', 'run'))
extends('python')
- def setup_build_environment(self, env):
- """waf needs to find headers and libraries by itself (mostly `boost`
- tool, but also `gtest`); it also needs to run executables during
- configuration."""
-
- include = []
- include_exclude_dirs = set(['/usr/include'])
- for dep in self.spec.traverse(deptype='build', root=False):
- query = self.spec[dep.name]
- if dep.name in ['pthreadpool', 'fxdiv']:
- print('skipping {} in SPACK_INCLUDE_DIRS/CPATH/C{{,_PLUS}}_INCLUDE_PATH\n'.format(dep.name))
- for d in query.headers.directories:
- if os.path.exists(d):
- env.remove_path('SPACK_INCLUDE_DIRS', d)
- continue
- try:
- include_dirs = set(query.headers.directories)
- include_dirs -= include_exclude_dirs
- print('headers (', dep.name, '):', include_dirs, "\n")
- include.extend(list(include_dirs))
- except spack.error.NoHeadersError:
- # we don't care if no header directories are found
- pass
-
- library = []
- library_exclude_dirs = set(['/lib', '/lib64', '/usr/lib', '/usr/lib64'])
- for dep in self.spec.traverse(deptype=('link', 'run'), root=False):
- query = self.spec[dep.name]
- try:
- library_dirs = set(query.libs.directories)
- library_dirs -= library_exclude_dirs
- print('libs (', dep.name, '):', library_dirs, "\n")
- library.extend(list(library_dirs))
- except spack.error.NoLibrariesError:
- # we don't care if no library directories are found
- pass
-
- path = []
- for dep in self.spec.traverse(deptype=('build', 'link', 'run'), root=False):
- if dep.name in ['pthreadpool', 'fxdiv']:
- print('skipping {} for bin'.format(dep.name))
- continue
- query = self.spec[dep.name]
- if os.path.exists(self.prefix.bin):
- path.append(query.prefix.bin)
- print('bin (', dep.name, '):', query.prefix.bin, "\n")
-
- # llvm might be built with ~shared_libs but still builds shared libs
- if not any('llvm' in lib for lib in library):
- print("libs: manually adding ", self.spec['llvm'].prefix.lib)
- library.append(self.spec['llvm'].prefix.lib)
-
- # explicitly add googletest library if it isn't found above;
- # adding in front of the list of libraries is a hack to circumvent
- # issues from vendoring packages like pthreadpool
- if not any('googletest' in lib for lib in library):
- if os.path.isdir(self.spec['googletest'].prefix.lib64):
- print("libs: manually inserting at front ", self.spec['googletest'].prefix.lib64)
- library.insert(0, self.spec['googletest'].prefix.lib64)
- if os.path.isdir(self.spec['googletest'].prefix.lib):
- print("libs: manually inserting at front ", self.spec['googletest'].prefix.lib)
- library.insert(0, self.spec['googletest'].prefix.lib)
-
- env.set('CPATH', ':'.join(include))
- env.set('C_INCLUDE_PATH', ':'.join(include))
- env.set('CPLUS_INCLUDE_PATH', ':'.join(include))
- env.set('LIBRARY_PATH', ':'.join(library))
- env.set('WAF_CONFIGURE_LD_LIBRARY_PATH', ':'.join(library))
- env.prepend_path('PATH', ':'.join(path))
-
def _setup_common_env(self, env):
# grenade needs to find some libraries for the JIT-compilation of
# programs for BrainScaleS-2's embedded processor.
@@ -157,10 +87,19 @@ class Hxtorch(WafPackage):
def configure(self, spec, prefix):
"""Setup and configure the project."""
+ # spack tries to find headers and libraries by itself (i.e. it's not
+ # relying on the compiler to find it); we explicitly expose the
+ # spack-provided env vars that contain include and library paths
env = os.environ
+ if 'SPACK_INCLUDE_DIRS' in env:
+ env['C_INCLUDE_PATH'] = env['SPACK_INCLUDE_DIRS']
+ env['CPLUS_INCLUDE_PATH'] = env['SPACK_INCLUDE_DIRS']
+ if 'SPACK_LINK_DIRS' in env:
+ env['LIBRARY_PATH'] = env['SPACK_LINK_DIRS']
+ env['LD_LIBRARY_PATH'] = env['SPACK_LINK_DIRS']
if 'SPACK_COMPILER_IMPLICIT_RPATHS' in env:
env['LIBRARY_PATH'] = env['SPACK_COMPILER_IMPLICIT_RPATHS'] + ':' + env['LIBRARY_PATH']
- env['WAF_CONFIGURE_LD_LIBRARY_PATH'] = env['SPACK_COMPILER_IMPLICIT_RPATHS'] + ':' + env['WAF_CONFIGURE_LD_LIBRARY_PATH']
+ env['WAF_CONFIGURE_LD_LIBRARY_PATH'] = env['SPACK_COMPILER_IMPLICIT_RPATHS'] + ':' + env['LD_LIBRARY_PATH']
self.waf('setup', '--repo-db-url=https://github.com/electronicvisions/projects',
'--without-munge',
diff --git a/packages/pynn-brainscales/package.py b/packages/pynn-brainscales/package.py
index 7f6811db0779594939d901922292f0a0837bba49..fda6b1501f18e750e2830c5ecc0314c0cb74b5c4 100644
--- a/packages/pynn-brainscales/package.py
+++ b/packages/pynn-brainscales/package.py
@@ -59,56 +59,6 @@ class PynnBrainscales(WafPackage):
depends_on('yaml-cpp+shared', type=('build', 'link', 'run'))
extends('python')
- def setup_build_environment(self, env):
- """waf needs to find headers and libraries by itself (mostly `boost`
- tool, but also `gtest`); it also needs to run executables during
- configuration."""
-
- include = []
- include_exclude_dirs = set(['/usr/include'])
- for dep in self.spec.traverse(deptype='build', root=False):
- query = self.spec[dep.name]
- try:
- include_dirs = set(query.headers.directories)
- include_dirs -= include_exclude_dirs
- print('headers (', dep.name, '):', include_dirs, "\n")
- include.extend(list(include_dirs))
- except spack.error.NoHeadersError:
- # we don't care if no header directories are found
- pass
-
- library = []
- library_exclude_dirs = set(['/lib', '/lib64', '/usr/lib', '/usr/lib64'])
- for dep in self.spec.traverse(deptype=('link', 'run'), root=False):
- query = self.spec[dep.name]
- try:
- library_dirs = set(query.libs.directories)
- library_dirs -= library_exclude_dirs
- print('libs (', dep.name, '):', library_dirs, "\n")
- library.extend(list(library_dirs))
- except spack.error.NoLibrariesError:
- # we don't care if no library directories are found
- pass
-
- path = []
- for dep in self.spec.traverse(deptype=('build', 'link', 'run'), root=False):
- query = self.spec[dep.name]
- if os.path.exists(self.prefix.bin):
- path.append(query.prefix.bin)
- print('bin (', dep.name, '):', query.prefix.bin, "\n")
-
- # llvm might be built with ~shared_libs but still builds shared libs
- if not any('llvm' in lib for lib in library):
- print("libs: manually adding ", self.spec['llvm'].prefix.lib)
- library.append(self.spec['llvm'].prefix.lib)
-
- env.set('CPATH', ':'.join(include))
- env.set('C_INCLUDE_PATH', ':'.join(include))
- env.set('CPLUS_INCLUDE_PATH', ':'.join(include))
- env.set('LIBRARY_PATH', ':'.join(library))
- env.set('WAF_CONFIGURE_LD_LIBRARY_PATH', ':'.join(library))
- env.prepend_path('PATH', ':'.join(path))
-
def _setup_common_env(self, env):
# grenade needs to find some libraries for the JIT-compilation of
# programs for BrainScaleS-2's embedded processor.
@@ -134,10 +84,19 @@ class PynnBrainscales(WafPackage):
def configure(self, spec, prefix):
"""Setup and configure the project."""
+ # spack tries to find headers and libraries by itself (i.e. it's not
+ # relying on the compiler to find it); we explicitly expose the
+ # spack-provided env vars that contain include and library paths
env = os.environ
+ if 'SPACK_INCLUDE_DIRS' in env:
+ env['C_INCLUDE_PATH'] = env['SPACK_INCLUDE_DIRS']
+ env['CPLUS_INCLUDE_PATH'] = env['SPACK_INCLUDE_DIRS']
+ if 'SPACK_LINK_DIRS' in env:
+ env['LIBRARY_PATH'] = env['SPACK_LINK_DIRS']
+ env['LD_LIBRARY_PATH'] = env['SPACK_LINK_DIRS']
if 'SPACK_COMPILER_IMPLICIT_RPATHS' in env:
env['LIBRARY_PATH'] = env['SPACK_COMPILER_IMPLICIT_RPATHS'] + ':' + env['LIBRARY_PATH']
- env['WAF_CONFIGURE_LD_LIBRARY_PATH'] = env['SPACK_COMPILER_IMPLICIT_RPATHS'] + ':' + env['WAF_CONFIGURE_LD_LIBRARY_PATH']
+ env['WAF_CONFIGURE_LD_LIBRARY_PATH'] = env['SPACK_COMPILER_IMPLICIT_RPATHS'] + ':' + env['LD_LIBRARY_PATH']
self.waf('setup', '--repo-db-url=https://github.com/electronicvisions/projects',
'--without-munge',