diff options
author | Michael Kuhn <michael.kuhn@ovgu.de> | 2021-05-10 10:03:24 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-10 10:03:24 +0200 |
commit | d2cc2481928915a207309a866321cc7e7a65c4de (patch) | |
tree | 1dbb188dba0e8b1bde4f15c876f4b899a5f77658 | |
parent | ecb7d6dca1ac9e322135c9fc00522b784b3ba75f (diff) | |
download | spack-d2cc2481928915a207309a866321cc7e7a65c4de.tar.gz spack-d2cc2481928915a207309a866321cc7e7a65c4de.tar.bz2 spack-d2cc2481928915a207309a866321cc7e7a65c4de.tar.xz spack-d2cc2481928915a207309a866321cc7e7a65c4de.zip |
binutils: Improve flag_handler (#22642)
`flag_handler` currently passes all flags via injection. This makes it
impossible to override the default flags provided by autotools (for
instance, `binutils cflags='-O2'` will still build with `-O2 -g`).
Instead, use injection for our workaround flags and pass other flags to
the build system.
-rw-r--r-- | var/spack/repos/builtin/packages/binutils/package.py | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/var/spack/repos/builtin/packages/binutils/package.py b/var/spack/repos/builtin/packages/binutils/package.py index 7fc8013afe..3edab97c8f 100644 --- a/var/spack/repos/builtin/packages/binutils/package.py +++ b/var/spack/repos/builtin/packages/binutils/package.py @@ -132,17 +132,20 @@ class Binutils(AutotoolsPackage, GNUMirrorPackage): extradir) def flag_handler(self, name, flags): + # Use a separate variable for injecting flags. This way, installing + # `binutils cflags='-O2'` will still work as expected. + iflags = [] # To ignore the errors of narrowing conversions for # the Fujitsu compiler if name == 'cxxflags' and ( self.spec.satisfies('@:2.31.1') and self.compiler.name in ('fj', 'clang', 'apple-clang') ): - flags.append('-Wno-narrowing') + iflags.append('-Wno-narrowing') elif name == 'cflags': if self.spec.satisfies('@:2.34 %gcc@10:'): - flags.append('-fcommon') - return (flags, None, None) + iflags.append('-fcommon') + return (iflags, None, flags) def test(self): spec_vers = str(self.spec.version) |