Spec: Add a new virtual-customizable home
attribute (#30917)
* Spec: Add a new virtual-customizable home attribute * java: Use the new builtin home attribute * python: Use the new builtin home attribute
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
# Copyright 2013-2022 Lawrence Livermore National Security, LLC and other
|
||||
# Spack Project Developers. See the top-level COPYRIGHT file for details.
|
||||
#
|
||||
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
||||
|
||||
from spack.package import *
|
||||
|
||||
|
||||
class AttributesFooApp(BundlePackage):
|
||||
version('1.0')
|
||||
depends_on('bar')
|
||||
depends_on('baz')
|
@@ -0,0 +1,69 @@
|
||||
# Copyright 2013-2022 Lawrence Livermore National Security, LLC and other
|
||||
# Spack Project Developers. See the top-level COPYRIGHT file for details.
|
||||
#
|
||||
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
||||
|
||||
from spack.package import *
|
||||
|
||||
|
||||
class AttributesFoo(BundlePackage):
|
||||
phases = ['install']
|
||||
version('1.0')
|
||||
|
||||
provides('bar')
|
||||
provides('baz')
|
||||
|
||||
def install(self, spec, prefix):
|
||||
if 'platform=windows' in spec:
|
||||
lib_suffix = '.lib'
|
||||
elif 'platform=darwin' in spec:
|
||||
lib_suffix = '.dylib'
|
||||
else:
|
||||
lib_suffix = '.so'
|
||||
|
||||
mkdirp(prefix.include)
|
||||
touch(prefix.include.join('foo.h'))
|
||||
mkdirp(prefix.include.bar)
|
||||
touch(prefix.include.bar.join('bar.h'))
|
||||
mkdirp(prefix.lib64)
|
||||
touch(prefix.lib64.join('libFoo' + lib_suffix))
|
||||
touch(prefix.lib64.join('libFooBar' + lib_suffix))
|
||||
mkdirp(prefix.baz.include.baz)
|
||||
touch(prefix.baz.include.baz.join('baz.h'))
|
||||
mkdirp(prefix.baz.lib)
|
||||
touch(prefix.baz.lib.join('libFooBaz' + lib_suffix))
|
||||
|
||||
# Headers provided by Foo
|
||||
@property
|
||||
def headers(self):
|
||||
return find_headers('foo', root=self.home.include, recursive=False)
|
||||
|
||||
# Libraries provided by Foo
|
||||
@property
|
||||
def libs(self):
|
||||
return find_libraries('libFoo', root=self.home, recursive=True)
|
||||
|
||||
# Header provided by the bar virutal package
|
||||
@property
|
||||
def bar_headers(self):
|
||||
return find_headers('bar/bar', root=self.home.include, recursive=False)
|
||||
|
||||
# Libary provided by the bar virtual package
|
||||
@property
|
||||
def bar_libs(self):
|
||||
return find_libraries('libFooBar', root=self.home, recursive=True)
|
||||
|
||||
# The baz virtual package home
|
||||
@property
|
||||
def baz_home(self):
|
||||
return self.home.baz
|
||||
|
||||
# Header provided by the baz virtual package
|
||||
@property
|
||||
def baz_headers(self):
|
||||
return find_headers('baz/baz', root=self.baz_home.include, recursive=False)
|
||||
|
||||
# Library provided by the baz virtual package
|
||||
@property
|
||||
def baz_libs(self):
|
||||
return find_libraries('libFooBaz', root=self.baz_home, recursive=True)
|
@@ -60,10 +60,6 @@ def url_for_version(self, version):
|
||||
|
||||
return url
|
||||
|
||||
@property
|
||||
def home(self):
|
||||
return self.prefix
|
||||
|
||||
@property
|
||||
def libs(self):
|
||||
return find_libraries(['libjvm'], root=self.home, recursive=True)
|
||||
@@ -74,9 +70,6 @@ def setup_run_environment(self, env):
|
||||
def setup_dependent_build_environment(self, env, dependent_spec):
|
||||
env.set('JAVA_HOME', self.home)
|
||||
|
||||
def setup_dependent_package(self, module, dependent_spec):
|
||||
self.spec.home = self.home
|
||||
|
||||
def install(self, spec, prefix):
|
||||
archive = os.path.basename(self.stage.archive_file)
|
||||
|
||||
|
@@ -118,12 +118,6 @@ class Icedtea(AutotoolsPackage):
|
||||
# can symlink all *.jar files to `prefix.lib.ext`
|
||||
extendable = True
|
||||
|
||||
@property
|
||||
def home(self):
|
||||
"""For compatibility with the ``jdk`` package, so that other packages
|
||||
can say ``spec['java'].home`` regardless of the Java provider."""
|
||||
return self.prefix
|
||||
|
||||
def configure_args(self):
|
||||
os.environ['POTENTIAL_CXX'] = os.environ['CXX']
|
||||
os.environ['POTENTIAL_CC'] = os.environ['CC']
|
||||
@@ -155,7 +149,7 @@ def configure_args(self):
|
||||
'--with-nashorn-checksum=no', '--disable-maintainer-mode'
|
||||
'--disable-downloading', '--disable-system-pcsc',
|
||||
'--disable-system-sctp', '--disable-system-kerberos',
|
||||
'--with-jdk-home=' + self.spec['jdk'].prefix
|
||||
'--with-jdk-home=' + self.spec['jdk'].home
|
||||
]
|
||||
return args
|
||||
|
||||
@@ -191,8 +185,3 @@ def setup_dependent_run_environment(self, env, dependent_spec):
|
||||
class_paths = find(dependent_spec.prefix, '*.jar')
|
||||
classpath = os.pathsep.join(class_paths)
|
||||
env.prepend_path('CLASSPATH', classpath)
|
||||
|
||||
def setup_dependent_package(self, module, dependent_spec):
|
||||
"""Allows spec['java'].home to work."""
|
||||
|
||||
self.spec.home = self.home
|
||||
|
@@ -202,8 +202,3 @@ def setup_dependent_run_environment(self, env, dependent_spec):
|
||||
class_paths = find(dependent_spec.prefix, '*.jar')
|
||||
classpath = os.pathsep.join(class_paths)
|
||||
env.prepend_path('CLASSPATH', classpath)
|
||||
|
||||
def setup_dependent_package(self, module, dependent_spec):
|
||||
"""Allows spec['java'].home to work."""
|
||||
|
||||
self.spec.home = self.home
|
||||
|
@@ -207,8 +207,3 @@ def setup_dependent_run_environment(self, env, dependent_spec):
|
||||
class_paths = find(dependent_spec.prefix, '*.jar')
|
||||
classpath = os.pathsep.join(class_paths)
|
||||
env.prepend_path('CLASSPATH', classpath)
|
||||
|
||||
def setup_dependent_package(self, module, dependent_spec):
|
||||
"""Allows spec['java'].home to work."""
|
||||
|
||||
self.spec.home = self.home
|
||||
|
@@ -1300,8 +1300,6 @@ def setup_dependent_package(self, module, dependent_spec):
|
||||
module.python_platlib = join_path(dependent_spec.prefix, self.platlib)
|
||||
module.python_purelib = join_path(dependent_spec.prefix, self.purelib)
|
||||
|
||||
self.spec.home = self.home
|
||||
|
||||
# Make the site packages directory for extensions
|
||||
if dependent_spec.package.is_extension:
|
||||
mkdirp(module.python_platlib)
|
||||
|
Reference in New Issue
Block a user