diff options
author | Peter Scheibel <scheibel1@llnl.gov> | 2021-04-28 04:16:57 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-28 13:16:57 +0200 |
commit | 10e4eeec9c90114e88da1aa91417a5ecca5b4d2e (patch) | |
tree | 0d12e5b81d4da0d1c6fb39f3e548943401ea63d7 | |
parent | 19c2ad818561a34f156b66428401d12fb7f54add (diff) | |
download | spack-10e4eeec9c90114e88da1aa91417a5ecca5b4d2e.tar.gz spack-10e4eeec9c90114e88da1aa91417a5ecca5b4d2e.tar.bz2 spack-10e4eeec9c90114e88da1aa91417a5ecca5b4d2e.tar.xz spack-10e4eeec9c90114e88da1aa91417a5ecca5b4d2e.zip |
bzip2: add pic/debug options (#23230)
* Add pic (for static) and debug variants
* explicitly add -g flag for +debug (even though it is in Makefile)
-rw-r--r-- | var/spack/repos/builtin/packages/bzip2/package.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/var/spack/repos/builtin/packages/bzip2/package.py b/var/spack/repos/builtin/packages/bzip2/package.py index 067a2ceadf..437dc14dec 100644 --- a/var/spack/repos/builtin/packages/bzip2/package.py +++ b/var/spack/repos/builtin/packages/bzip2/package.py @@ -25,6 +25,8 @@ class Bzip2(Package, SourcewarePackage): version('1.0.6', sha256='a2848f34fcd5d6cf47def00461fcb528a0484d8edef8208d6d2e2909dc61d9cd') variant('shared', default=True, description='Enables the build of shared libraries.') + variant('pic', default=False, description='Build static libraries with PIC') + variant('debug', default=False, description='Enable debug symbols and disable optimization') depends_on('diffutils', type='build') @@ -43,7 +45,20 @@ class Bzip2(Package, SourcewarePackage): 'libbz2', root=self.prefix, shared=shared, recursive=True ) + def flag_handler(self, name, flags): + if name == 'cflags': + if '+pic' in self.spec: + flags.append(self.compiler.cc_pic_flag) + if '+debug' in self.spec: + flags.append('-g') + return(flags, None, None) + def patch(self): + if spec.satisfies('+debug'): + for makefile in ['Makefile', 'Makefile-libbz2_so']: + filter_file(r'-O ', '-O0 ', makefile) + filter_file(r'-O2 ', '-O0 ', makefile) + # bzip2 comes with two separate Makefiles for static and dynamic builds # Tell both to use Spack's compiler wrapper instead of GCC filter_file(r'^CC=gcc', 'CC={0}'.format(spack_cc), 'Makefile') |