Author: viric
Date: Sun Aug  8 18:47:48 2010
New Revision: 23040
URL: https://svn.nixos.org/websvn/nix/?rev=23040&sc=1

Log:
Making the cross-built packages not depend on the gcc cross compiler directly,
but on a nix-store path only having the cross-built gcc libraries.
This trims down a lot the runtime dependency tree for cross-built packages.

I also remove the glibc dependency on the native bash.

Modified:
   
nixpkgs/branches/stdenv-updates/pkgs/build-support/gcc-cross-wrapper/builder.sh
   
nixpkgs/branches/stdenv-updates/pkgs/build-support/gcc-cross-wrapper/default.nix
   
nixpkgs/branches/stdenv-updates/pkgs/development/libraries/glibc-2.11/default.nix

Modified: 
nixpkgs/branches/stdenv-updates/pkgs/build-support/gcc-cross-wrapper/builder.sh
==============================================================================
--- 
nixpkgs/branches/stdenv-updates/pkgs/build-support/gcc-cross-wrapper/builder.sh 
    Sun Aug  8 18:46:57 2010        (r23039)
+++ 
nixpkgs/branches/stdenv-updates/pkgs/build-support/gcc-cross-wrapper/builder.sh 
    Sun Aug  8 18:47:48 2010        (r23040)
@@ -38,7 +38,10 @@
     gccPath="$nativePrefix/bin"
     ldPath="$nativePrefix/bin"
 else
-    ldflags="$ldflags -L$gcc/lib"
+    if test -n "$gccLibs"; then
+        ldflags="$ldflags -L$gccLibs/lib -L$gccLibs/lib64"
+    fi
+    ldflags="$ldflags -L$gcc/lib -L$gcc/lib64"
     gccPath="$gcc/bin"
     ldPath="$binutils/$crossConfig/bin"
 fi

Modified: 
nixpkgs/branches/stdenv-updates/pkgs/build-support/gcc-cross-wrapper/default.nix
==============================================================================
--- 
nixpkgs/branches/stdenv-updates/pkgs/build-support/gcc-cross-wrapper/default.nix
    Sun Aug  8 18:46:57 2010        (r23039)
+++ 
nixpkgs/branches/stdenv-updates/pkgs/build-support/gcc-cross-wrapper/default.nix
    Sun Aug  8 18:47:48 2010        (r23040)
@@ -13,6 +13,20 @@
 assert !nativeTools -> gcc != null && binutils != null;
 assert !noLibc -> (!nativeLibc -> libc != null);
 
+let
+  chosenName = if name == "" then gcc.name else name;
+  gccLibs = stdenv.mkDerivation {
+    name = chosenName + "-libs";
+    phases = [ "installPhase" ];
+    installPhase = ''
+      ensureDir $out
+      cp -Rd ${gcc}/lib $out/lib
+      if [ -d ${gcc}/lib64 ]; then
+          cp -Rd ${gcc}/lib64 $out/lib64
+      fi
+    '';
+  };
+in
 stdenv.mkDerivation {
   builder = ./builder.sh;
   setupHook = ./setup-hook.sh;
@@ -22,7 +36,8 @@
   addFlags = ./add-flags;
   inherit nativeTools nativeLibc nativePrefix gcc libc binutils;
   crossConfig = if (cross != null) then cross.config else null;
-  name = if name == "" then gcc.name else name;
+  gccLibs = if gcc != null then gccLibs else null;
+  name = chosenName;
   langC = if nativeTools then true else gcc.langC;
   langCC = if nativeTools then true else gcc.langCC;
   langF77 = if nativeTools then false else gcc ? langFortran;

Modified: 
nixpkgs/branches/stdenv-updates/pkgs/development/libraries/glibc-2.11/default.nix
==============================================================================
--- 
nixpkgs/branches/stdenv-updates/pkgs/development/libraries/glibc-2.11/default.nix
   Sun Aug  8 18:46:57 2010        (r23039)
+++ 
nixpkgs/branches/stdenv-updates/pkgs/development/libraries/glibc-2.11/default.nix
   Sun Aug  8 18:47:48 2010        (r23040)
@@ -74,5 +74,10 @@
 
         dontStrip=1
       '';
-   }
+
+      # To avoid a dependency on the build system 'bash'.
+      preFixup = ''
+        rm $out/bin/{ldd,tzselect,catchsegv,xtrace}
+      '';
+    }
    else {}))
_______________________________________________
nix-commits mailing list
[email protected]
http://mail.cs.uu.nl/mailman/listinfo/nix-commits

Reply via email to