From ae3383e0019b7a61bce226a64ee72d5ab97050c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Llu=C3=ADs=20Batlle=20i=20Rossell?= Date: Sun, 8 Aug 2010 18:47:48 +0000 Subject: [PATCH] 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. svn path=/nixpkgs/branches/stdenv-updates/; revision=23040 --- pkgs/build-support/gcc-cross-wrapper/builder.sh | 5 ++++- .../build-support/gcc-cross-wrapper/default.nix | 17 ++++++++++++++++- .../libraries/glibc-2.11/default.nix | 7 ++++++- 3 files changed, 26 insertions(+), 3 deletions(-) diff --git a/pkgs/build-support/gcc-cross-wrapper/builder.sh b/pkgs/build-support/gcc-cross-wrapper/builder.sh index a3a4d01e3c4..ef46cc110f2 100644 --- a/pkgs/build-support/gcc-cross-wrapper/builder.sh +++ b/pkgs/build-support/gcc-cross-wrapper/builder.sh @@ -38,7 +38,10 @@ if test -n "$nativeTools"; then 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 diff --git a/pkgs/build-support/gcc-cross-wrapper/default.nix b/pkgs/build-support/gcc-cross-wrapper/default.nix index 362e378273d..ea5e5d0dd56 100644 --- a/pkgs/build-support/gcc-cross-wrapper/default.nix +++ b/pkgs/build-support/gcc-cross-wrapper/default.nix @@ -13,6 +13,20 @@ assert nativeTools -> nativePrefix != ""; 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 @@ stdenv.mkDerivation { 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; diff --git a/pkgs/development/libraries/glibc-2.11/default.nix b/pkgs/development/libraries/glibc-2.11/default.nix index 7063008fe91..31a8ef13a4f 100644 --- a/pkgs/development/libraries/glibc-2.11/default.nix +++ b/pkgs/development/libraries/glibc-2.11/default.nix @@ -74,5 +74,10 @@ in dontStrip=1 ''; - } + + # To avoid a dependency on the build system 'bash'. + preFixup = '' + rm $out/bin/{ldd,tzselect,catchsegv,xtrace} + ''; + } else {}))