Renamed some old glibcCross to libcCross (we can use uclibc in cross builds already). Dealt with the gcc 4.4 expression for it to work well for a native and a cross compiler, adding a pair of patches to get the job done without much side effects. One (libtool problems on -B) comes from the gcc 4.3 expression, while the other fixes a bug already fixed in gcc 4.4.3.


svn path=/nixpkgs/branches/stdenv-updates/; revision=18833

+120 -54
+2 -2
pkgs/development/compilers/gcc-4.3/builder.sh
··· 42 43 if test -n "$targetConfig"; then 44 if test -z "$crossStageStatic"; then 45 - extraXCFlags="-B${glibcCross}/lib -idirafter ${glibcCross}/include" 46 - extraXLDFlags="-L${glibcCross}/lib" 47 export NIX_EXTRA_CFLAGS_TARGET=$extraXCFlags 48 for i in $extraXLDFlags; do 49 export NIX_EXTRA_LDFLAGS_TARGET="$NIX_EXTRA_LDFLAGS_TARGET -Wl,$i"
··· 42 43 if test -n "$targetConfig"; then 44 if test -z "$crossStageStatic"; then 45 + extraXCFlags="-B${libcCross}/lib -idirafter ${libcCross}/include" 46 + extraXLDFlags="-L${libcCross}/lib" 47 export NIX_EXTRA_CFLAGS_TARGET=$extraXCFlags 48 for i in $extraXLDFlags; do 49 export NIX_EXTRA_LDFLAGS_TARGET="$NIX_EXTRA_LDFLAGS_TARGET -Wl,$i"
+40 -41
pkgs/development/compilers/gcc-4.4/builder.sh
··· 10 export CPP="gcc -E" 11 12 if test "$staticCompiler" = "1"; then 13 - EXTRA_LDFLAGS="-static" 14 else 15 - EXTRA_LDFLAGS="" 16 fi 17 18 if test "$noSysDirs" = "1"; then ··· 40 export NIX_FIXINC_DUMMY=/usr/include 41 fi 42 43 - # We should not allow gcc find the headers of the native glibc 44 - # (Here I only think of c,c++ compilers) 45 - if test -z "$targetConfig"; then 46 - # Setting $CPATH makes sure both `gcc' and `xgcc' find the C 47 - # library headers, regarless of the language being compiled. 48 - export CPATH="$NIX_FIXINC_DUMMY${CPATH:+:}$CPATH" 49 50 - # Likewise, to help it find `crti.o' and similar files. 51 - export LIBRARY_PATH="$glibc_libdir${LIBRARY_PATH:+:}$LIBRARY_PATH" 52 - 53 - echo "setting \$CPATH to \`$CPATH'" 54 - echo "setting \$LIBRARY_PATH to \`$LIBRARY_PATH'" 55 - fi 56 - 57 - extraCFlags="-g0 $extraCFlags" 58 - extraLDFlags="--strip-debug $extraLDFlags" 59 - 60 for i in $extraLDFlags; do 61 - export EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,$i" 62 done 63 64 if test -n "$targetConfig"; then 65 if test -z "$crossStageStatic"; then 66 - extraXCFlags="-B${glibcCross}/lib -idirafter ${glibcCross}/include" 67 - extraXLDFlags="-L${glibcCross}/lib" 68 - export EXTRA_CFLAGS_TARGET=$extraXCFlags 69 - for i in $extraXLDFlags; do 70 - export EXTRA_LDFLAGS_TARGET="$EXTRA_LDFLAGS_TARGET -Wl,$i" 71 - done 72 fi 73 74 makeFlagsArray=( \ 75 "${makeFlagsArray[@]}" \ 76 - NATIVE_SYSTEM_HEADER_DIR="$NIX_FIXINC_DUMMY" \ 77 - SYSTEM_HEADER_DIR="$NIX_FIXINC_DUMMY" \ 78 - CFLAGS_FOR_TARGET="$EXTRA_CFLAGS_TARGET $EXTRA_LDFLAGS_TARGET" \ 79 - LDFLAGS_FOR_TARGET="$EXTRA_CFLAGS_TARGET $EXTRA_LDFLAGS_TARGET" \ 80 - ) 81 - else 82 - export EXTRA_CFLAGS_TARGET=$EXTRA_CFLAGS 83 - export EXTRA_LDFLAGS_TARGET=$EXTRA_LDFLAGS 84 - makeFlagsArray=( \ 85 - "${makeFlagsArray[@]}" \ 86 - NATIVE_SYSTEM_HEADER_DIR="$NIX_FIXINC_DUMMY" \ 87 - SYSTEM_HEADER_DIR="$NIX_FIXINC_DUMMY" \ 88 - CFLAGS_FOR_BUILD="$extraCflags $EXTRA_CFLAGS $EXTRA_LDFLAGS" \ 89 - CFLAGS_FOR_TARGET="$EXTRA_CFLAGS $EXTRA_LDFLAGS" \ 90 - LDFLAGS_FOR_BUILD="$extraCflags $EXTRA_CFLAGS $EXTRA_LDFLAGS" \ 91 - LDFLAGS_FOR_TARGET="$EXTRA_CFLAGS $EXTRA_LDFLAGS" \ 92 ) 93 fi 94 ··· 118 ln -s ../newlib-*/newlib newlib 119 # Patch to get armvt5el working: 120 sed -i -e 's/ arm)/ arm*)/' newlib/configure.host 121 fi 122 123 # Perform the build in a different directory.
··· 10 export CPP="gcc -E" 11 12 if test "$staticCompiler" = "1"; then 13 + NIX_EXTRA_LDFLAGS="-static" 14 else 15 + NIX_EXTRA_LDFLAGS="" 16 fi 17 18 if test "$noSysDirs" = "1"; then ··· 40 export NIX_FIXINC_DUMMY=/usr/include 41 fi 42 43 + extraCFlags="-g0 -O2 -I$NIX_FIXINC_DUMMY $extraCFlags" 44 + extraLDFlags="--strip-debug -L$glibc_libdir -rpath $glibc_libdir $extraLDFlags" 45 46 + export NIX_EXTRA_CFLAGS="$extraCFlags" 47 for i in $extraLDFlags; do 48 + export NIX_EXTRA_LDFLAGS="$NIX_EXTRA_LDFLAGS -Wl,$i" 49 done 50 51 if test -n "$targetConfig"; then 52 + # Cross-compiling, we need gcc not to read ./specs in order to build 53 + # the g++ compiler (after the specs for the cross-gcc are created). 54 + # Having LIBRARY_PATH= makes gcc read the specs from ., and the build 55 + # breaks. Having this variable comes from the default.nix code to bring 56 + # gcj in. 57 + unset LIBRARY_PATH 58 + unset CPATH 59 if test -z "$crossStageStatic"; then 60 + export NIX_EXTRA_CFLAGS_TARGET="-g0 -O2 -B${libcCross}/lib -idirafter ${libcCross}/include" 61 + export NIX_EXTRA_LDFLAGS_TARGET="-Wl,-L${libcCross}/lib" 62 fi 63 + else 64 + # To be read by configure scripts (libtool-glibc.patch) 65 + export NIX_EXTRA_CFLAGS_TARGET="$NIX_EXTRA_CFLAGS" 66 + export NIX_EXTRA_LDFLAGS_TARGET="$NIX_EXTRA_LDFLAGS" 67 + fi 68 69 + makeFlagsArray=( \ 70 + "${makeFlagsArray[@]}" \ 71 + NATIVE_SYSTEM_HEADER_DIR="$NIX_FIXINC_DUMMY" \ 72 + SYSTEM_HEADER_DIR="$NIX_FIXINC_DUMMY" \ 73 + CFLAGS_FOR_BUILD="$NIX_EXTRA_CFLAGS $NIX_EXTRA_LDFLAGS" \ 74 + CFLAGS_FOR_TARGET="$NIX_EXTRA_CFLAGS_TARGET $NIX_EXTRA_LDFLAGS_TARGET" \ 75 + LDFLAGS_FOR_BUILD="$NIX_EXTRA_CFLAGS $NIX_EXTRA_LDFLAGS" \ 76 + LDFLAGS_FOR_TARGET="$NIX_EXTRA_CFLAGS_TARGET $NIX_EXTRA_LDFLAGS_TARGET" \ 77 + ) 78 + 79 + if test -z "$targetConfig"; then 80 makeFlagsArray=( \ 81 "${makeFlagsArray[@]}" \ 82 + BOOT_CFLAGS="$NIX_EXTRA_CFLAGS $NIX_EXTRA_LDFLAGS" \ 83 + BOOT_LDFLAGS="$NIX_EXTRA_CFLAGS_TARGET $NIX_EXTRA_LDFLAGS_TARGET" \ 84 ) 85 fi 86 ··· 110 ln -s ../newlib-*/newlib newlib 111 # Patch to get armvt5el working: 112 sed -i -e 's/ arm)/ arm*)/' newlib/configure.host 113 + fi 114 + # Bug - they packaged zlib 115 + if test -d "zlib"; then 116 + # This breaks the build without-headers, which should build only 117 + # the target libgcc as target libraries. 118 + # See 'configure:5370' 119 + rm -Rf zlib 120 fi 121 122 # Perform the build in a different directory.
+8 -4
pkgs/development/compilers/gcc-4.4/default.nix
··· 17 , name ? "gcc" 18 , cross ? null 19 , binutilsCross ? null 20 - , glibcCross ? null 21 , crossStageStatic ? true 22 }: 23 ··· 61 " --disable-libgomp " + 62 " --disable-shared" 63 else 64 - " --with-headers=${glibcCross}/include" + 65 " --enable-__cxa_atexit" + 66 " --enable-long-long" + 67 " --enable-threads=posix" + ··· 87 }; 88 89 patches = 90 - [./pass-cxxcpp.patch] 91 ++ optional noSysDirs ./no-sys-dirs.patch; 92 93 - inherit noSysDirs profiledCompiler staticCompiler langJava; 94 95 buildInputs = [ texinfo gmp mpfr gettext which ] 96 ++ (optional (ppl != null) ppl)
··· 17 , name ? "gcc" 18 , cross ? null 19 , binutilsCross ? null 20 + , libcCross ? null 21 , crossStageStatic ? true 22 }: 23 ··· 61 " --disable-libgomp " + 62 " --disable-shared" 63 else 64 + " --with-headers=${libcCross}/include" + 65 " --enable-__cxa_atexit" + 66 " --enable-long-long" + 67 " --enable-threads=posix" + ··· 87 }; 88 89 patches = 90 + [./pass-cxxcpp.patch 91 + ./libtool-glibc.patch # some libraries don't let the proper -Btargetglibcpath pass 92 + ./libstdc++-target.patch # (fixed in gcc 4.4.3) bad mixture of build/target flags 93 + ] 94 ++ optional noSysDirs ./no-sys-dirs.patch; 95 96 + inherit noSysDirs profiledCompiler staticCompiler langJava crossStageStatic 97 + libcCross; 98 99 buildInputs = [ texinfo gmp mpfr gettext which ] 100 ++ (optional (ppl != null) ppl)
+15
pkgs/development/compilers/gcc-4.4/libstdc++-target.patch
···
··· 1 + diff --git a/Makefile.in b/Makefile.in 2 + index 245c770..8545b60 100644 3 + --- a/Makefile.in 4 + +++ b/Makefile.in 5 + @@ -250,8 +250,8 @@ BASE_TARGET_EXPORTS = \ 6 + RAW_CXX_TARGET_EXPORTS = \ 7 + $(BASE_TARGET_EXPORTS) \ 8 + CXX_FOR_TARGET="$(RAW_CXX_FOR_TARGET)"; export CXX_FOR_TARGET; \ 9 + - CXX="$(RAW_CXX_FOR_TARGET) $(CFLAGS_FOR_BUILD)"; export CXX; \ 10 + - CXXCPP="$(RAW_CXX_FOR_TARGET) $(CFLAGS_FOR_BUILD) -E"; export CXXCPP; 11 + + CXX="$(RAW_CXX_FOR_TARGET) $(CFLAGS_FOR_TARGET)"; export CXX; \ 12 + + CXXCPP="$(RAW_CXX_FOR_TARGET) $(CFLAGS_FOR_TARGET) -E"; export CXXCPP; 13 + 14 + NORMAL_TARGET_EXPORTS = \ 15 + $(BASE_TARGET_EXPORTS) \
+48
pkgs/development/compilers/gcc-4.4/libtool-glibc.patch
···
··· 1 + diff --git a/libgomp/configure b/libgomp/configure 2 + index deef673..9e4a790 100755 3 + --- a/libgomp/configure 4 + +++ b/libgomp/configure 5 + @@ -23848,6 +23848,11 @@ old_archive_cmds=$lt_old_archive_cmds 6 + # A language specific compiler. 7 + CC=$lt_compiler 8 + 9 + +# Ugly hack to get libmudflap (and other libraries) to build. 10 + +# Libtool filters out \`-B' flags when linking (why?), so the \`-B' flag 11 + +# to Glibc gets lost. Here we forcibly add it to any invocation. 12 + +CC="\$CC $NIX_EXTRA_CFLAGS_TARGET $NIX_EXTRA_LDFLAGS_TARGET" 13 + + 14 + # Is the compiler the GNU compiler? 15 + with_gcc=$GCC 16 + 17 + diff --git a/libmudflap/configure b/libmudflap/configure 18 + index ae1be92..4ee1e18 100755 19 + --- a/libmudflap/configure 20 + +++ b/libmudflap/configure 21 + @@ -15044,6 +15044,11 @@ old_archive_cmds=$lt_old_archive_cmds 22 + # A language specific compiler. 23 + CC=$lt_compiler 24 + 25 + +# Ugly hack to get libmudflap (and other libraries) to build. 26 + +# Libtool filters out \`-B' flags when linking (why?), so the \`-B' flag 27 + +# to Glibc gets lost. Here we forcibly add it to any invocation. 28 + +CC="\$CC $NIX_EXTRA_CFLAGS_TARGET $NIX_EXTRA_LDFLAGS_TARGET" 29 + + 30 + # Is the compiler the GNU compiler? 31 + with_gcc=$GCC 32 + 33 + diff --git a/libssp/configure b/libssp/configure 34 + index ee2a41f..7f3e1fd 100755 35 + --- a/libssp/configure 36 + +++ b/libssp/configure 37 + @@ -12926,6 +12926,11 @@ old_archive_cmds=$lt_old_archive_cmds 38 + # A language specific compiler. 39 + CC=$lt_compiler 40 + 41 + +# Ugly hack to get libmudflap (and other libraries) to build. 42 + +# Libtool filters out \`-B' flags when linking (why?), so the \`-B' flag 43 + +# to Glibc gets lost. Here we forcibly add it to any invocation. 44 + +CC="\$CC $NIX_EXTRA_CFLAGS_TARGET $NIX_EXTRA_LDFLAGS_TARGET" 45 + + 46 + # Is the compiler the GNU compiler? 47 + with_gcc=$GCC 48 +
+7 -7
pkgs/top-level/all-packages.nix
··· 1784 gcc43_realCross = cross : makeOverridable (import ../development/compilers/gcc-4.3) { 1785 inherit stdenv fetchurl texinfo gmp mpfr noSysDirs cross; 1786 binutilsCross = binutilsCross cross; 1787 - glibcCross = libcCross cross; 1788 profiledCompiler = false; 1789 enableMultilib = true; 1790 crossStageStatic = false; ··· 1794 inherit stdenv fetchurl texinfo gmp mpfr ppl cloogppl noSysDirs cross 1795 gettext which; 1796 binutilsCross = binutilsCross cross; 1797 - glibcCross = libcCross cross; 1798 profiledCompiler = false; 1799 enableMultilib = true; 1800 crossStageStatic = false; 1801 }; 1802 1803 gccCrossStageStatic = cross: wrapGCCCross { 1804 - gcc = forceBuildDrv ((gcc43_realCross cross).override { 1805 crossStageStatic = true; 1806 langCC = false; 1807 - glibcCross = null; 1808 }); 1809 libc = null; 1810 binutils = binutilsCross cross; ··· 1812 }; 1813 1814 gccCrossStageFinal = cross: wrapGCCCross { 1815 - gcc = forceBuildDrv (gcc43_realCross cross); 1816 libc = libcCross cross; 1817 binutils = binutilsCross cross; 1818 inherit cross; ··· 3484 }); 3485 3486 # We can choose: 3487 - # glibcCross = cross: glibc211Cross cross; 3488 - libcCross = cross: uclibcCross cross; 3489 3490 eglibc = import ../development/libraries/eglibc { 3491 inherit fetchsvn stdenv kernelHeaders;
··· 1784 gcc43_realCross = cross : makeOverridable (import ../development/compilers/gcc-4.3) { 1785 inherit stdenv fetchurl texinfo gmp mpfr noSysDirs cross; 1786 binutilsCross = binutilsCross cross; 1787 + libcCross = libcCross cross; 1788 profiledCompiler = false; 1789 enableMultilib = true; 1790 crossStageStatic = false; ··· 1794 inherit stdenv fetchurl texinfo gmp mpfr ppl cloogppl noSysDirs cross 1795 gettext which; 1796 binutilsCross = binutilsCross cross; 1797 + libcCross = libcCross cross; 1798 profiledCompiler = false; 1799 enableMultilib = true; 1800 crossStageStatic = false; 1801 }; 1802 1803 gccCrossStageStatic = cross: wrapGCCCross { 1804 + gcc = forceBuildDrv ((gcc44_realCross cross).override { 1805 crossStageStatic = true; 1806 langCC = false; 1807 + libcCross = null; 1808 }); 1809 libc = null; 1810 binutils = binutilsCross cross; ··· 1812 }; 1813 1814 gccCrossStageFinal = cross: wrapGCCCross { 1815 + gcc = forceBuildDrv (gcc44_realCross cross); 1816 libc = libcCross cross; 1817 binutils = binutilsCross cross; 1818 inherit cross; ··· 3484 }); 3485 3486 # We can choose: 3487 + libcCross = cross: glibc211Cross cross; 3488 + # libcCross = cross: uclibcCross cross; 3489 3490 eglibc = import ../development/libraries/eglibc { 3491 inherit fetchsvn stdenv kernelHeaders;