summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHarmen Stoppels <me@harmenstoppels.nl>2024-05-02 14:40:10 +0200
committerGitHub <noreply@github.com>2024-05-02 06:40:10 -0600
commit2eb7add8c43af833fd665f7b617ae8b6890cebd9 (patch)
treeb6cc6908608656f94262a2ee84c466a98c39276c
parenta9fea9f6110379acc100c2c77870548f09dda3dc (diff)
downloadspack-2eb7add8c43af833fd665f7b617ae8b6890cebd9.tar.gz
spack-2eb7add8c43af833fd665f7b617ae8b6890cebd9.tar.bz2
spack-2eb7add8c43af833fd665f7b617ae8b6890cebd9.tar.xz
spack-2eb7add8c43af833fd665f7b617ae8b6890cebd9.zip
gcc: write builtin specs before modifications (#43956)
-rw-r--r--var/spack/repos/builtin/packages/gcc/package.py17
1 files changed, 8 insertions, 9 deletions
diff --git a/var/spack/repos/builtin/packages/gcc/package.py b/var/spack/repos/builtin/packages/gcc/package.py
index 6d94e2785d..0ed2f2f3b8 100644
--- a/var/spack/repos/builtin/packages/gcc/package.py
+++ b/var/spack/repos/builtin/packages/gcc/package.py
@@ -980,17 +980,18 @@ class Gcc(AutotoolsPackage, GNUMirrorPackage):
specs_file = join_path(self.spec_dir, "specs")
with open(specs_file, "w") as f:
+ # can't extend the builtins without dumping them first
+ f.write(self.spec["gcc"].command("-dumpspecs", output=str, error=os.devnull).strip())
+
+ f.write("\n\n# Generated by Spack\n\n")
+
# rpath
if rpath_dir:
- print("*link_libgcc:", file=f)
- print(f"+ -rpath={rpath_dir}", file=f)
- print(file=f)
+ f.write(f"*link_libgcc:\n+ -rpath={rpath_dir}\n\n")
# programs search path
if self.spec.satisfies("+binutils"):
- print("*self_spec:", file=f)
- print(f"+ -B{self.spec['binutils'].prefix.bin}", file=f)
- print(file=f)
+ f.write(f"*self_spec:\n+ -B{self.spec['binutils'].prefix.bin}\n\n")
set_install_permissions(specs_file)
tty.info(f"Wrote new spec file to {specs_file}")
@@ -1210,6 +1211,4 @@ class Gcc(AutotoolsPackage, GNUMirrorPackage):
if relocation_args:
with open(specs_file, "a") as f:
- print("*self_spec:", file=f)
- print(f"+ {' '.join(relocation_args)}", file=f)
- print(file=f)
+ f.write(f"*self_spec:\n+ {' '.join(relocation_args)}\n\n")