about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMatthew Bauer <mjbauer95@gmail.com>2020-03-05 20:30:35 -0500
committerGitHub <noreply@github.com>2020-03-05 20:30:35 -0500
commitb8102aa32e556a7a7f9e174a9cd0601ff94f0d05 (patch)
tree1dc189cea21c427de5cf26ea0078b74e19df834d
parent19f7c641cca4e26d15aae76d60c29c77237bbd9a (diff)
parentd9feea58aeded06aded50eee7e9d69ebe1086e7e (diff)
downloadnixlib-b8102aa32e556a7a7f9e174a9cd0601ff94f0d05.tar
nixlib-b8102aa32e556a7a7f9e174a9cd0601ff94f0d05.tar.gz
nixlib-b8102aa32e556a7a7f9e174a9cd0601ff94f0d05.tar.bz2
nixlib-b8102aa32e556a7a7f9e174a9cd0601ff94f0d05.tar.lz
nixlib-b8102aa32e556a7a7f9e174a9cd0601ff94f0d05.tar.xz
nixlib-b8102aa32e556a7a7f9e174a9cd0601ff94f0d05.tar.zst
nixlib-b8102aa32e556a7a7f9e174a9cd0601ff94f0d05.zip
Merge pull request #81844 from lopsided98/gcc-separate-output-cross
gcc: place cross-compiled target libraries in lib output
-rw-r--r--pkgs/build-support/cc-wrapper/default.nix4
-rw-r--r--pkgs/development/compilers/gcc/builder.sh33
2 files changed, 16 insertions, 21 deletions
diff --git a/pkgs/build-support/cc-wrapper/default.nix b/pkgs/build-support/cc-wrapper/default.nix
index b078bf2fbbd3..9bac8feef6d4 100644
--- a/pkgs/build-support/cc-wrapper/default.nix
+++ b/pkgs/build-support/cc-wrapper/default.nix
@@ -41,7 +41,9 @@ let
   libc_bin = if libc == null then null else getBin libc;
   libc_dev = if libc == null then null else getDev libc;
   libc_lib = if libc == null then null else getLib libc;
-  cc_solib = getLib cc;
+  cc_solib = getLib cc
+    + optionalString (targetPlatform != hostPlatform) "/${targetPlatform.config}";
+
   # The wrapper scripts use 'cat' and 'grep', so we may need coreutils.
   coreutils_bin = if nativeTools then "" else getBin coreutils;
 
diff --git a/pkgs/development/compilers/gcc/builder.sh b/pkgs/development/compilers/gcc/builder.sh
index 07a003691d6b..b153687980a0 100644
--- a/pkgs/development/compilers/gcc/builder.sh
+++ b/pkgs/development/compilers/gcc/builder.sh
@@ -133,7 +133,7 @@ if test "$noSysDirs" = "1"; then
 
     if test "$crossStageStatic" == 1; then
         # We don't want the gcc build to assume there will be a libc providing
-        # limits.h in this stagae
+        # limits.h in this stage
         makeFlagsArray+=(
             'LIMITS_H_TEST=false'
         )
@@ -203,31 +203,31 @@ postConfigure() {
 preInstall() {
     # Make ‘lib64’ symlinks to ‘lib’.
     if [ -n "$is64bit" -a -z "$enableMultilib" ]; then
-        mkdir -p "$out/lib"
-        ln -s lib "$out/lib64"
-        mkdir -p "$lib/lib"
-        ln -s lib "$lib/lib64"
+        mkdir -p "$out/${targetConfig}/lib"
+        ln -s lib "$out/${targetConfig}/lib64"
+        mkdir -p "$lib/${targetConfig}/lib"
+        ln -s lib "$lib/${targetConfig}/lib64"
     fi
 }
 
 
 postInstall() {
     # Move runtime libraries to $lib.
-    moveToOutput "lib/lib*.so*" "$lib"
-    moveToOutput "lib/lib*.la"  "$lib"
-    moveToOutput "lib/lib*.dylib" "$lib"
+    moveToOutput "${targetConfig+$targetConfig/}lib/lib*.so*" "$lib"
+    moveToOutput "${targetConfig+$targetConfig/}lib/lib*.la"  "$lib"
+    moveToOutput "${targetConfig+$targetConfig/}lib/lib*.dylib" "$lib"
     moveToOutput "share/gcc-*/python" "$lib"
 
-    for i in "$lib"/lib/*.{la,py}; do
+    for i in "$lib/${targetConfig}"/lib/*.{la,py}; do
         substituteInPlace "$i" --replace "$out" "$lib"
     done
 
     if [ -n "$enableMultilib" ]; then
-        moveToOutput "lib64/lib*.so*" "$lib"
-        moveToOutput "lib64/lib*.la"  "$lib"
-        moveToOutput "lib64/lib*.dylib" "$lib"
+        moveToOutput "${targetConfig+$targetConfig/}lib64/lib*.so*" "$lib"
+        moveToOutput "${targetConfig+$targetConfig/}lib64/lib*.la"  "$lib"
+        moveToOutput "${targetConfig+$targetConfig/}lib64/lib*.dylib" "$lib"
 
-        for i in "$lib"/lib64/*.{la,py}; do
+        for i in "$lib/${targetConfig}"/lib64/*.{la,py}; do
             substituteInPlace "$i" --replace "$out" "$lib"
         done
     fi
@@ -247,13 +247,6 @@ postInstall() {
             NEW_RPATH=`echo "$PREV_RPATH" | sed 's,:[^:]*bootstrap-tools/lib,,g'`
             patchelf --set-rpath "$NEW_RPATH" "$i" && echo OK
         done
-
-        # For some reason the libs retain RPATH to $out
-        for i in "$lib"/lib/{libtsan,libasan,libubsan}.so.*.*.*; do
-            PREV_RPATH=`patchelf --print-rpath "$i"`
-            NEW_RPATH=`echo "$PREV_RPATH" | sed "s,:${out}[^:]*,,g"`
-            patchelf --set-rpath "$NEW_RPATH" "$i" && echo OK
-        done
     fi
 
     if type "install_name_tool"; then