From b768d7bb09b6913bd1885e7e57654a75bba6fdf3 Mon Sep 17 00:00:00 2001 From: Harmen Stoppels Date: Wed, 12 May 2021 12:31:02 +0200 Subject: [PATCH] lzo, lz4, xz, binutils: add libs multi-valued variant (#23474) --- var/spack/repos/builtin/packages/binutils/package.py | 4 +++- var/spack/repos/builtin/packages/lz4/package.py | 8 +++++++- var/spack/repos/builtin/packages/lzo/package.py | 10 ++++++---- var/spack/repos/builtin/packages/xz/package.py | 6 ++++++ 4 files changed, 22 insertions(+), 6 deletions(-) diff --git a/var/spack/repos/builtin/packages/binutils/package.py b/var/spack/repos/builtin/packages/binutils/package.py index 3edab97c8f..91c80f67c9 100644 --- a/var/spack/repos/builtin/packages/binutils/package.py +++ b/var/spack/repos/builtin/packages/binutils/package.py @@ -39,6 +39,8 @@ class Binutils(AutotoolsPackage, GNUMirrorPackage): variant('ld', default=False, description='Enable ld.') variant('gas', default=False, description='Enable as assembler.') variant('interwork', default=False, description='Enable interwork.') + variant('libs', default='shared,static', values=('shared', 'static'), + multi=True, description='Build shared libs, static libs or both') patch('cr16.patch', when='@:2.29.1') patch('update_symbol-2.26.patch', when='@2.26') @@ -78,13 +80,13 @@ def configure_args(self): '--disable-dependency-tracking', '--disable-werror', '--enable-multilib', - '--enable-shared', '--enable-64-bit-bfd', '--enable-targets=all', '--with-system-zlib', '--with-sysroot=/', ] + args += self.enable_or_disable('libs') args += self.enable_or_disable('lto') args += self.enable_or_disable('ld') args += self.enable_or_disable('gas') diff --git a/var/spack/repos/builtin/packages/lz4/package.py b/var/spack/repos/builtin/packages/lz4/package.py index 4294210ac5..35c33e5720 100644 --- a/var/spack/repos/builtin/packages/lz4/package.py +++ b/var/spack/repos/builtin/packages/lz4/package.py @@ -26,6 +26,9 @@ class Lz4(MakefilePackage): depends_on('valgrind', type='test') + variant('libs', default='shared,static', values=('shared', 'static'), + multi=True, description='Build shared libs, static libs or both') + def url_for_version(self, version): url = "https://github.com/lz4/lz4/archive" @@ -47,7 +50,10 @@ def build(self, spec, prefix): make(parallel=par) def install(self, spec, prefix): - make('install', 'PREFIX={0}'.format(prefix)) + make('install', + 'PREFIX={0}'.format(prefix), + 'BUILD_SHARED={0}'.format('yes' if 'libs=shared' in self.spec else 'no'), + 'BUILD_STATIC={0}'.format('yes' if 'libs=static' in self.spec else 'no')) def patch(self): # Remove flags not recognized by the NVIDIA compiler diff --git a/var/spack/repos/builtin/packages/lzo/package.py b/var/spack/repos/builtin/packages/lzo/package.py index 38b111f88c..855a85d05a 100644 --- a/var/spack/repos/builtin/packages/lzo/package.py +++ b/var/spack/repos/builtin/packages/lzo/package.py @@ -19,8 +19,10 @@ class Lzo(AutotoolsPackage): version('2.06', sha256='ff79e6f836d62d3f86ef6ce893ed65d07e638ef4d3cb952963471b4234d43e73') version('2.05', sha256='449f98186d76ba252cd17ff1241ca2a96b7f62e0d3e4766f88730dab0ea5f333') + variant('libs', default='shared,static', values=('shared', 'static'), + multi=True, description='Build shared libs, static libs or both') + def configure_args(self): - return [ - '--disable-dependency-tracking', - '--enable-shared' - ] + args = ['--disable-dependency-tracking'] + args += self.enable_or_disable('libs') + return args diff --git a/var/spack/repos/builtin/packages/xz/package.py b/var/spack/repos/builtin/packages/xz/package.py index 1162d21e65..5197fb1349 100644 --- a/var/spack/repos/builtin/packages/xz/package.py +++ b/var/spack/repos/builtin/packages/xz/package.py @@ -29,6 +29,12 @@ class Xz(AutotoolsPackage, SourceforgePackage): variant('pic', default=False, description='Compile with position independent code.') + variant('libs', default='shared,static', values=('shared', 'static'), + multi=True, description='Build shared libs, static libs or both') + + def configure_args(self): + return self.enable_or_disable('libs') + def flag_handler(self, name, flags): if name == 'cflags' and '+pic' in self.spec: flags.append(self.compiler.cc_pic_flag)