diff options
author | Lluís Batlle i Rossell <viric@vicerveza.homeunix.net> | 2009-11-21 02:42:52 +0000 |
---|---|---|
committer | Lluís Batlle i Rossell <viric@vicerveza.homeunix.net> | 2009-11-21 02:42:52 +0000 |
commit | a263cb814e42965d08d9dfe2d6e847e6be2e06c2 (patch) | |
tree | 299b226febc9bb588c398d0e8658923ac39931ef /pkgs/build-support/gcc-cross-wrapper | |
parent | a5fee3325a61b9ae33a0132a653d19079710002e (diff) |
Fixed some details on cross compilation. Among others:
- Stating better the guile dependencies (native/host) for guile to build - Fixing cross-linking, through --rpath-link (ld(1) explains well about it - Made gcc call the linker and the assembler through the gcc wrapper instead of directly. I thought this was the source of missing -rpath's, but the source of the problem ended up being the lack of --rpath-link. But I think the native gcc calls the wrapped ld and as, so let's do the same cross compiling. - Removed the binutilsCross from the glibc expressions. Now they are built using the gcc-cross-wrapper, and they were built with the direct gcc and binutils before this change. - I think patchelf and strip don't break the cross-compiled binaries, so I reallow them on cross compilation. - I disable the checkPhase on cross compilation. This made gmp and libtool fail when cross compiled, iirc. svn path=/nixpkgs/branches/stdenv-updates/; revision=18498
Diffstat (limited to 'pkgs/build-support/gcc-cross-wrapper')
5 files changed, 11 insertions, 7 deletions
diff --git a/pkgs/build-support/gcc-cross-wrapper/builder.sh b/pkgs/build-support/gcc-cross-wrapper/builder.sh index 2299574e85ac9..aaf52cd7745d5 100644 --- a/pkgs/build-support/gcc-cross-wrapper/builder.sh +++ b/pkgs/build-support/gcc-cross-wrapper/builder.sh @@ -17,7 +17,7 @@ if test -n "$nativeTools"; then else ldflags="$ldflags -L$gcc/lib" gccPath="$gcc/bin" - ldPath="$binutils/bin" + ldPath="$binutils/$crossConfig/bin" fi @@ -40,7 +40,8 @@ doSubstitute() { --subst-var "cflagsLink" \ --subst-var "ldflags" \ --subst-var "ldflagsBefore" \ - --subst-var-by "ld" "$ldPath/$crossConfig-ld" + --subst-var "ldPath" \ + --subst-var-by "ld" "$ldPath/ld" } diff --git a/pkgs/build-support/gcc-cross-wrapper/default.nix b/pkgs/build-support/gcc-cross-wrapper/default.nix index a9042dddf1956..140432adfbca1 100644 --- a/pkgs/build-support/gcc-cross-wrapper/default.nix +++ b/pkgs/build-support/gcc-cross-wrapper/default.nix @@ -5,13 +5,13 @@ # stdenv.mkDerivation provides a wrapper that sets up the right environment # variables so that the compiler and the linker just "work". -{ name ? "", stdenv, nativeTools, nativeLibc, nativePrefix ? "" +{ name ? "", stdenv, nativeTools, nativeLibc, noLibc ? false, nativePrefix ? "" , gcc ? null, libc ? null, binutils ? null, shell ? "", cross ? "" }: assert nativeTools -> nativePrefix != ""; assert !nativeTools -> gcc != null && binutils != null; -assert !nativeLibc -> libc != null; +assert !noLibc -> (!nativeLibc -> libc != null); stdenv.mkDerivation { builder = ./builder.sh; diff --git a/pkgs/build-support/gcc-cross-wrapper/gcc-wrapper.sh b/pkgs/build-support/gcc-cross-wrapper/gcc-wrapper.sh index d514b57e28a0c..e5a2f5e65bb11 100644 --- a/pkgs/build-support/gcc-cross-wrapper/gcc-wrapper.sh +++ b/pkgs/build-support/gcc-cross-wrapper/gcc-wrapper.sh @@ -112,6 +112,8 @@ if test -n "$NIX_GCC_WRAPPER_EXEC_HOOK"; then source "$NIX_GCC_WRAPPER_EXEC_HOOK" fi +# We want gcc to call the wrapper linker, not that of binutils. +export PATH="@ldPath@:$PATH" # Call the real `gcc'. Filter out warnings from stderr about unused # `-B' flags, since they confuse some programs. Deep bash magic to diff --git a/pkgs/build-support/gcc-cross-wrapper/ld-wrapper.sh b/pkgs/build-support/gcc-cross-wrapper/ld-wrapper.sh index cc1b125804a43..f3ff33f5c2516 100644 --- a/pkgs/build-support/gcc-cross-wrapper/ld-wrapper.sh +++ b/pkgs/build-support/gcc-cross-wrapper/ld-wrapper.sh @@ -121,7 +121,7 @@ if test "$NIX_DONT_SET_RPATH" != "1"; then # Finally, add `-rpath' switches. for i in $rpath; do - extra=(${extra[@]} -rpath $i) + extra=(${extra[@]} -rpath $i -rpath-link $i) done fi diff --git a/pkgs/build-support/gcc-cross-wrapper/setup-hook.sh b/pkgs/build-support/gcc-cross-wrapper/setup-hook.sh index 81735a4feffe4..99618cb21124c 100644 --- a/pkgs/build-support/gcc-cross-wrapper/setup-hook.sh +++ b/pkgs/build-support/gcc-cross-wrapper/setup-hook.sh @@ -26,5 +26,6 @@ if test -n "@libc@"; then fi configureFlags="$configureFlags --build=$system --host=$crossConfig" -dontPatchELF=1 -dontStrip=1 +# Disabling the tests when cross compiling, as usually the tests are meant for +# native compilations. +doCheck="" |