binutils: add external detection (#29022)

This commit is contained in:
Tom Scogland 2022-02-16 23:45:24 -08:00 committed by GitHub
parent dcdf5022ad
commit a0bd6c8817
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2,6 +2,7 @@
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
import re
class Binutils(AutotoolsPackage, GNUMirrorPackage):
@ -12,6 +13,8 @@ class Binutils(AutotoolsPackage, GNUMirrorPackage):
maintainers = ['alalazo']
executables = ['^nm$', '^readelf$']
version('2.37', sha256='67fc1a4030d08ee877a4867d3dcab35828148f87e1fd05da6db585ed5a166bd4')
version('2.36.1', sha256='5b4bd2e79e30ce8db0abd76dd2c2eae14a94ce212cfc59d3c37d23e24bc6d7a3')
version('2.35.2', sha256='cfa7644dbecf4591e136eb407c1c1da16578bd2b03f0c2e8acdceba194bb9d61')
@ -80,6 +83,12 @@ class Binutils(AutotoolsPackage, GNUMirrorPackage):
# --disable-ld flag
conflicts('~ld', '+gold')
@classmethod
def determine_version(cls, exe):
output = Executable(exe)('--version', output=str, error=str)
match = re.search(r'GNU Binutils.*\) (\S+)', output)
return match.group(1) if match else None
def setup_build_environment(self, env):
if self.spec.satisfies('%cce'):