summary refs log tree commit diff
path: root/pkgs/build-support/gcc-wrapper/builder.sh
diff options
context:
space:
mode:
authorVladimír Čunát <vcunat@gmail.com>2014-08-23 16:04:53 +0200
committerVladimír Čunát <vcunat@gmail.com>2014-08-23 16:04:53 +0200
commit96cec2a7bdf2482ae58fe04cce5e87a1eec644f9 (patch)
treeea48b901c9ba0ac2b4a249ae94bd966c4a025001 /pkgs/build-support/gcc-wrapper/builder.sh
parentdb83d9a35b09a7cc548d9b8b2ad63c1f8ca8ba28 (diff)
parent084626deecaffcaa017af07eaab00682eff5d6f3 (diff)
downloadnixlib-96cec2a7bdf2482ae58fe04cce5e87a1eec644f9.tar
nixlib-96cec2a7bdf2482ae58fe04cce5e87a1eec644f9.tar.gz
nixlib-96cec2a7bdf2482ae58fe04cce5e87a1eec644f9.tar.bz2
nixlib-96cec2a7bdf2482ae58fe04cce5e87a1eec644f9.tar.lz
nixlib-96cec2a7bdf2482ae58fe04cce5e87a1eec644f9.tar.xz
nixlib-96cec2a7bdf2482ae58fe04cce5e87a1eec644f9.tar.zst
nixlib-96cec2a7bdf2482ae58fe04cce5e87a1eec644f9.zip
Merge 'staging' into multiple-outputs
Conflicts:
	pkgs/applications/audio/flac/default.nix
	pkgs/build-support/gcc-wrapper/builder.sh
	pkgs/development/libraries/apr-util/default.nix
	pkgs/development/libraries/apr/default.nix
	pkgs/development/libraries/atk/default.nix
	pkgs/development/libraries/freetype/default.nix
	pkgs/development/libraries/gdk-pixbuf/default.nix
	pkgs/development/libraries/glib/default.nix
	pkgs/development/libraries/glibc/2.17/builder.sh
	pkgs/development/libraries/glibc/2.17/locales.nix
	pkgs/development/libraries/libjpeg/default.nix
	pkgs/development/libraries/libogg/default.nix
	pkgs/development/libraries/libsamplerate/default.nix
	pkgs/development/libraries/libtiff/default.nix
	pkgs/development/libraries/libvorbis/default.nix
	pkgs/development/libraries/mesa/default.nix
	pkgs/development/libraries/pango/default.nix
	pkgs/development/web/nodejs/default.nix
	pkgs/os-specific/linux/pam/default.nix
	pkgs/os-specific/linux/systemd/default.nix
	pkgs/stdenv/generic/setup.sh
	pkgs/stdenv/linux/default.nix
	pkgs/top-level/all-packages.nix
	pkgs/top-level/release-small.nix
Diffstat (limited to 'pkgs/build-support/gcc-wrapper/builder.sh')
-rw-r--r--pkgs/build-support/gcc-wrapper/builder.sh23
1 files changed, 21 insertions, 2 deletions
diff --git a/pkgs/build-support/gcc-wrapper/builder.sh b/pkgs/build-support/gcc-wrapper/builder.sh
index b499aa612f8c..dbd955054373 100644
--- a/pkgs/build-support/gcc-wrapper/builder.sh
+++ b/pkgs/build-support/gcc-wrapper/builder.sh
@@ -66,13 +66,23 @@ else
     echo "$gccCFlags" > $out/nix-support/gcc-cflags
     
     gccPath="$gcc/bin"
-    ldPath="$binutils/bin"
+    # On Illumos/Solaris we might prefer native ld
+    if test -n "$nativePrefix"; then
+      ldPath="$nativePrefix/bin"
+    else
+      ldPath="$binutils/bin"
+    fi;
 fi
 
 
 doSubstitute() {
     local src=$1
     local dst=$2
+    local ld="$ldPath/ld"
+    if $ld -V 2>&1 |grep Solaris; then
+      # Use Solaris specific linker wrapper
+      ld="$out/bin/ld-solaris"
+    fi
     # Can't use substitute() here, because replace may not have been
     # built yet (in the bootstrap).
     sed \
@@ -86,7 +96,7 @@ doSubstitute() {
         -e "s^@coreutils@^$coreutils^g" \
         -e "s^@libc@^$libc^g" \
         -e "s^@libc_bin@^$libc_bin^g" \
-        -e "s^@ld@^$ldPath/ld^g" \
+        -e "s^@ld@^$ld^g" \
         < "$src" > "$dst" 
 }
 
@@ -145,6 +155,8 @@ then
     ln -sv g++ $out/bin/c++
 fi
 
+mkGccWrapper $out/bin/cpp $gccPath/cpp || true
+
 if mkGccWrapper $out/bin/gfortran $gccPath/gfortran
 then
     ln -sv gfortran $out/bin/g77
@@ -175,6 +187,13 @@ ln -s $ldPath/as $out/bin/as
 doSubstitute "$ldWrapper" "$out/bin/ld"
 chmod +x "$out/bin/ld"
 
+# Copy solaris ld wrapper if needed
+if $ldPath/ld -V 2>&1 |grep Solaris; then
+  # Use Solaris specific linker wrapper
+  sed -e "s^@ld@^$ldPath/ld^g" < "$ldSolarisWrapper" > "$out/bin/ld-solaris"
+  chmod +x "$out/bin/ld-solaris"
+fi
+
 
 # Emit a setup hook.  Also store the path to the original GCC and
 # Glibc.