summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHarmen Stoppels <harmenstoppels@gmail.com>2022-04-11 17:30:30 +0200
committerGitHub <noreply@github.com>2022-04-11 09:30:30 -0600
commit8deb50fea548ab7b88f03a5516f9cbb88c992340 (patch)
tree69c4bf9b44e51e63a5224740165e6ff0d8f6ecae
parentb71661eaa6792e12e9a50ebfb58b5123b3aba8e9 (diff)
downloadspack-8deb50fea548ab7b88f03a5516f9cbb88c992340.tar.gz
spack-8deb50fea548ab7b88f03a5516f9cbb88c992340.tar.bz2
spack-8deb50fea548ab7b88f03a5516f9cbb88c992340.tar.xz
spack-8deb50fea548ab7b88f03a5516f9cbb88c992340.zip
zstd: bring back libs=shared,static and compression=zlib,lz4,lzma variants (#29995)
* zstd: bring back libs=shared,static and compression=zlib,lz4,lzma variants Should make building `gcc+binutils ^zstd libs=static` a bit easier (this is the case where we don't control the compiler wrappers of gcc because of bootstrapping, nor of ld because of how gcc invokes the linker).
-rw-r--r--var/spack/repos/builtin/packages/zstd/package.py54
1 files changed, 35 insertions, 19 deletions
diff --git a/var/spack/repos/builtin/packages/zstd/package.py b/var/spack/repos/builtin/packages/zstd/package.py
index 9b82773eb2..c27d735d4e 100644
--- a/var/spack/repos/builtin/packages/zstd/package.py
+++ b/var/spack/repos/builtin/packages/zstd/package.py
@@ -33,34 +33,50 @@ class Zstd(MakefilePackage):
version('1.1.2', sha256='980b8febb0118e22f6ed70d23b5b3e600995dbf7489c1f6d6122c1411cdda8d8')
variant('programs', default=False, description='Build executables')
+ variant('libs', default='shared,static', values=('shared', 'static'),
+ multi=True, description='Build shared libs, static libs or both')
+ variant('compression', when='+programs',
+ values=any_combination_of('zlib', 'lz4', 'lzma'),
+ description='Enable support for additional compression methods in programs')
- depends_on('zlib', when='+programs')
- depends_on('lz4', when='+programs')
- depends_on('xz', when='+programs')
+ depends_on('zlib', when='compression=zlib')
+ depends_on('lz4', when='compression=lz4')
+ depends_on('xz', when='compression=lzma')
# +programs builds vendored xxhash, which uses unsupported builtins
# (last tested: nvhpc@22.3)
conflicts('+programs %nvhpc')
- def _make(self, *args, **kwargs):
- # PREFIX must be defined on macOS even when building the library, since
- # it gets hardcoded into the library's install_path
- def_args = ['VERBOSE=1', 'PREFIX=' + self.prefix]
+ def build(self, spec, prefix):
+ pass
+
+ def install(self, spec, prefix):
+ args = ['VERBOSE=1', 'PREFIX=' + prefix]
# Tested %nvhpc@22.3. No support for -MP
if '%nvhpc' in self.spec:
- def_args.append('DEPFLAGS=-MT $@ -MMD -MF')
+ args.append('DEPFLAGS=-MT $@ -MMD -MF')
- def_args.append('-C')
- def_args.extend(args)
- make(*def_args, **kwargs)
+ # library targets
+ lib_args = ['-C', 'lib'] + args + ['install-pc', 'install-includes']
+ if 'libs=shared' in spec:
+ lib_args.append('install-shared')
+ if 'libs=static' in spec:
+ lib_args.append('install-static')
- def build(self, spec, prefix):
- self._make('lib')
- if spec.variants['programs'].value:
- self._make('programs')
+ # install the library
+ make(*lib_args)
- def install(self, spec, prefix):
- self._make('lib', 'install', parallel=False)
- if spec.variants['programs'].value:
- self._make('programs', 'install')
+ # install the programs
+ if '+programs' in spec:
+ programs_args = ['-C', 'programs'] + args
+ # additional compression programs have to be turned off, otherwise the
+ # makefile will detect them.
+ if 'compression=zlib' not in spec:
+ programs_args.append('HAVE_ZLIB=0')
+ if 'compression=lzma' not in spec:
+ programs_args.append('HAVE_LZMA=0')
+ if 'compression=lz4' not in spec:
+ programs_args.append('HAVE_LZ4=0')
+ programs_args.append('install')
+ make(*programs_args)