diff options
Diffstat (limited to 'var/spack/repos/builtin/packages/binutils/package.py')
-rw-r--r-- | var/spack/repos/builtin/packages/binutils/package.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/var/spack/repos/builtin/packages/binutils/package.py b/var/spack/repos/builtin/packages/binutils/package.py index 3f7b25cb79..5661c26521 100644 --- a/var/spack/repos/builtin/packages/binutils/package.py +++ b/var/spack/repos/builtin/packages/binutils/package.py @@ -3,6 +3,7 @@ # # SPDX-License-Identifier: (Apache-2.0 OR MIT) import os +import pathlib import re import spack.build_systems.autotools @@ -177,6 +178,20 @@ class Binutils(AutotoolsPackage, GNUMirrorPackage): match = re.search(r"GNU (nm|readelf).* (\S+)", output) return Version(match.group(2)).dotted.up_to(3) if match else None + @classmethod + def determine_variants(cls, exes, version_str): + bin_dir = pathlib.Path(exes[0]).parent + include_dir = bin_dir.parent / "include" + plugin_h = include_dir / "plugin-api.h" + + variants = "+gold" if find(str(bin_dir), "gold", recursive=False) else "~gold" + if find(str(include_dir), str(plugin_h), recursive=False): + variants += "+headers" + else: + variants += "~headers" + + return variants + def flag_handler(self, name, flags): spec = self.spec |