summary refs log tree commit diff
path: root/pkgs/development/compilers/gcc/7/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/compilers/gcc/7/default.nix')
-rw-r--r--pkgs/development/compilers/gcc/7/default.nix15
1 files changed, 14 insertions, 1 deletions
diff --git a/pkgs/development/compilers/gcc/7/default.nix b/pkgs/development/compilers/gcc/7/default.nix
index 5d3126ea0e9..67b7dee446f 100644
--- a/pkgs/development/compilers/gcc/7/default.nix
+++ b/pkgs/development/compilers/gcc/7/default.nix
@@ -228,6 +228,19 @@ stdenv.mkDerivation ({
 
   hardeningDisable = [ "format" ];
 
+  # This should kill all the stdinc frameworks that gcc and friends like to
+  # insert into default search paths.
+  prePatch = stdenv.lib.optionalString hostPlatform.isDarwin ''
+    substituteInPlace gcc/config/darwin-c.c \
+      --replace 'if (stdinc)' 'if (0)'
+
+    substituteInPlace libgcc/config/t-slibgcc-darwin \
+      --replace "-install_name @shlib_slibdir@/\$(SHLIB_INSTALL_NAME)" "-install_name $lib/lib/\$(SHLIB_INSTALL_NAME)"
+
+    substituteInPlace libgfortran/configure \
+      --replace "-install_name \\\$rpath/\\\$soname" "-install_name $lib/lib/\\\$soname"
+  '';
+
   postPatch =
     if (hostPlatform.isHurd
         || (libcCross != null                  # e.g., building `gcc.crossDrv'
@@ -470,7 +483,7 @@ stdenv.mkDerivation ({
 
     # On GNU/Hurd glibc refers to Mach & Hurd
     # headers.
-    ++ optionals (libcCross != null && libcCross ? "propagatedBuildInputs")
+    ++ optionals (libcCross != null && libcCross ? propagatedBuildInputs)
                  libcCross.propagatedBuildInputs);
 
   LIBRARY_PATH = makeLibraryPath ([]