summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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")