summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBernhard Kaindl <contact@bernhard.kaindl.dev>2024-06-08 02:08:55 +0200
committerGitHub <noreply@github.com>2024-06-07 18:08:55 -0600
commit528c1ed9ba2ee09710c1cf46cdcce6c8fc9404c0 (patch)
treeb400261f7d49f0a122a13bcb63c92d5c70becb90
parent52cc6032456419d49b6fdbbec930a925943c77a8 (diff)
downloadspack-528c1ed9ba2ee09710c1cf46cdcce6c8fc9404c0.tar.gz
spack-528c1ed9ba2ee09710c1cf46cdcce6c8fc9404c0.tar.bz2
spack-528c1ed9ba2ee09710c1cf46cdcce6c8fc9404c0.tar.xz
spack-528c1ed9ba2ee09710c1cf46cdcce6c8fc9404c0.zip
binutils: detect the "gold" and "headers" variants (#40214)
Co-authored-by: Massimiliano Culpo <massimiliano.culpo@gmail.com>
-rw-r--r--var/spack/repos/builtin/packages/binutils/package.py15
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