summary refs log tree commit diff
path: root/pkgs/development/compilers/gcc/6
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2018-11-15 21:02:42 +0000
committerAlyssa Ross <hi@alyssa.is>2019-01-30 18:19:17 +0000
commitb9b83748f32b105b2cca0242ae4131521ad18290 (patch)
tree52dc932929c0eab660c8ee706a93ce69ef610384 /pkgs/development/compilers/gcc/6
parent4abc6ff9e86e32a59be69f2a2200c091b1aea7f1 (diff)
downloadnixpkgs-b9b83748f32b105b2cca0242ae4131521ad18290.tar
nixpkgs-b9b83748f32b105b2cca0242ae4131521ad18290.tar.gz
nixpkgs-b9b83748f32b105b2cca0242ae4131521ad18290.tar.bz2
nixpkgs-b9b83748f32b105b2cca0242ae4131521ad18290.tar.lz
nixpkgs-b9b83748f32b105b2cca0242ae4131521ad18290.tar.xz
nixpkgs-b9b83748f32b105b2cca0242ae4131521ad18290.tar.zst
nixpkgs-b9b83748f32b105b2cca0242ae4131521ad18290.zip
gcj: fix build on Darwin
Partially addresses https://github.com/NixOS/nixpkgs/issues/29715.
Diffstat (limited to 'pkgs/development/compilers/gcc/6')
-rw-r--r--pkgs/development/compilers/gcc/6/default.nix31
1 files changed, 18 insertions, 13 deletions
diff --git a/pkgs/development/compilers/gcc/6/default.nix b/pkgs/development/compilers/gcc/6/default.nix
index adaf4e36ce9..6fd1995354f 100644
--- a/pkgs/development/compilers/gcc/6/default.nix
+++ b/pkgs/development/compilers/gcc/6/default.nix
@@ -180,18 +180,23 @@ stdenv.mkDerivation ({
 
   hardeningDisable = [ "format" "pie" ];
 
-  # 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"
-  '';
+  prePatch =
+    (stdenv.lib.optionalString (langJava || langGo) ''
+      export lib=$out
+    '')
+
+    # This should kill all the stdinc frameworks that gcc and friends like to
+    # insert into default search paths.
+    + 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 targetPlatform != hostPlatform || stdenv.cc.libc != null then
@@ -447,7 +452,7 @@ stdenv.mkDerivation ({
 
 // optionalAttrs (enableMultilib) { dontMoveLib64 = true; }
 
-// optionalAttrs (langJava) {
+// optionalAttrs (langJava && !stdenv.hostPlatform.isDarwin) {
      postFixup = ''
        target="$(echo "$out/libexec/gcc"/*/*/ecj*)"
        patchelf --set-rpath "$(patchelf --print-rpath "$target"):$out/lib" "$target"