summary refs log tree commit diff
path: root/pkgs/development/compilers/gcc/7
diff options
context:
space:
mode:
authorTuomas Tynkkynen <tuomas@tuxera.com>2018-02-15 15:45:37 +0200
committerTuomas Tynkkynen <tuomas@tuxera.com>2018-02-15 15:45:37 +0200
commitb1916b45a374815c9f6101b9f6a30b35b7c92ecb (patch)
tree08d7be26385fe1f69922cd985d7f2e68f27884f6 /pkgs/development/compilers/gcc/7
parent0a941e0b66ab86cf359d4f158bda86c9742c4b2b (diff)
parent79e7f7af9a2262f8d8e6bea2b32d18f24b668a0c (diff)
downloadnixlib-b1916b45a374815c9f6101b9f6a30b35b7c92ecb.tar
nixlib-b1916b45a374815c9f6101b9f6a30b35b7c92ecb.tar.gz
nixlib-b1916b45a374815c9f6101b9f6a30b35b7c92ecb.tar.bz2
nixlib-b1916b45a374815c9f6101b9f6a30b35b7c92ecb.tar.lz
nixlib-b1916b45a374815c9f6101b9f6a30b35b7c92ecb.tar.xz
nixlib-b1916b45a374815c9f6101b9f6a30b35b7c92ecb.tar.zst
nixlib-b1916b45a374815c9f6101b9f6a30b35b7c92ecb.zip
Merge remote-tracking branch 'upstream/staging' into gcc-7
Conflicts:
	pkgs/development/libraries/libidn/default.nix
	pkgs/top-level/all-packages.nix
Diffstat (limited to 'pkgs/development/compilers/gcc/7')
-rw-r--r--pkgs/development/compilers/gcc/7/default.nix22
1 files changed, 17 insertions, 5 deletions
diff --git a/pkgs/development/compilers/gcc/7/default.nix b/pkgs/development/compilers/gcc/7/default.nix
index 15ddd9e70091..bbf87eccac75 100644
--- a/pkgs/development/compilers/gcc/7/default.nix
+++ b/pkgs/development/compilers/gcc/7/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, targetPackages, fetchurl, noSysDirs
+{ stdenv, targetPackages, fetchurl, fetchpatch, noSysDirs
 , langC ? true, langCC ? true, langFortran ? false
 , langObjC ? targetPlatform.isDarwin
 , langObjCpp ? targetPlatform.isDarwin
@@ -66,6 +66,10 @@ let version = "7.3.0";
       [ ]
       ++ optional (targetPlatform != hostPlatform) ../libstdc++-target.patch
       ++ optional noSysDirs ../no-sys-dirs.patch
+      ++ optional (hostPlatform != buildPlatform) (fetchpatch { # XXX: Refine when this should be applied
+        url = "https://git.busybox.net/buildroot/plain/package/gcc/7.1.0/0900-remove-selftests.patch?id=11271540bfe6adafbc133caf6b5b902a816f5f02";
+        sha256 = "0mrvxsdwip2p3l17dscpc1x8vhdsciqw1z5q9i6p5g9yg1cqnmgs";
+      })
       # The GNAT Makefiles did not pay attention to CFLAGS_FOR_TARGET for its
       # target libraries and tools.
       ++ optional langAda ../gnat-cflags.patch
@@ -155,7 +159,7 @@ let version = "7.3.0";
           # To keep ABI compatibility with upstream mingw-w64
           "--enable-fully-dynamic-string"
         ] else
-          optionals (targetPlatform.libc == "uclibc") [
+          optionals (targetPlatform.libc == "uclibc" || targetPlatform.libc == "musl") [
             # libsanitizer requires netrom/netrom.h which is not
             # available in uclibc.
             "--disable-libsanitizer"
@@ -253,15 +257,22 @@ stdenv.mkDerivation ({
       let
         libc = if libcCross != null then libcCross else stdenv.cc.libc;
       in
-        '' echo "fixing the \`GLIBC_DYNAMIC_LINKER' and \`UCLIBC_DYNAMIC_LINKER' macros..."
+        (
+        '' echo "fixing the \`GLIBC_DYNAMIC_LINKER', \`UCLIBC_DYNAMIC_LINKER', and \`MUSL_DYNAMIC_LINKER' macros..."
            for header in "gcc/config/"*-gnu.h "gcc/config/"*"/"*.h
            do
-             grep -q LIBC_DYNAMIC_LINKER "$header" || continue
+             grep -q _DYNAMIC_LINKER "$header" || continue
              echo "  fixing \`$header'..."
              sed -i "$header" \
-                 -e 's|define[[:blank:]]*\([UCG]\+\)LIBC_DYNAMIC_LINKER\([0-9]*\)[[:blank:]]"\([^\"]\+\)"$|define \1LIBC_DYNAMIC_LINKER\2 "${libc.out}\3"|g'
+                 -e 's|define[[:blank:]]*\([UCG]\+\)LIBC_DYNAMIC_LINKER\([0-9]*\)[[:blank:]]"\([^\"]\+\)"$|define \1LIBC_DYNAMIC_LINKER\2 "${libc.out}\3"|g' \
+                 -e 's|define[[:blank:]]*MUSL_DYNAMIC_LINKER\([0-9]*\)[[:blank:]]"\([^\"]\+\)"$|define MUSL_DYNAMIC_LINKER\1 "${libc.out}\2"|g'
            done
         ''
+        + stdenv.lib.optionalString (hostPlatform.libc == "musl")
+        ''
+            sed -i gcc/config/linux.h -e '1i#undef LOCAL_INCLUDE_DIR'
+        ''
+        )
     else null;
 
   # TODO(@Ericson2314): Make passthru instead. Weird to avoid mass rebuild,
@@ -391,6 +402,7 @@ stdenv.mkDerivation ({
       # On Illumos/Solaris GNU as is preferred
       "--with-gnu-as" "--without-gnu-ld"
     ]
+    ++ optional (targetPlatform == hostPlatform && targetPlatform.libc == "musl") "--disable-libsanitizer"
   ;
 
   targetConfig = if targetPlatform != hostPlatform then targetPlatform.config else null;