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
This commit is contained in:
Lluís Batlle i Rossell 2010-08-08 18:47:48 +00:00
parent eddc9d6ab5
commit ae3383e001
3 changed files with 26 additions and 3 deletions

View File

@ -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

View File

@ -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;

View File

@ -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 {}))