GCC 4.5: Add support for a separate libpthread; rearrange target flags handling.

svn path=/nixpkgs/trunk/; revision=21905
This commit is contained in:
Ludovic Courtès
2010-05-19 21:32:19 +00:00
parent 91e3147622
commit 63abc2ed86
3 changed files with 31 additions and 15 deletions
+7 -12
View File
@@ -54,14 +54,9 @@ if test "$noSysDirs" = "1"; then
EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,$i" EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,$i"
done done
if test -n "$targetConfig"; then if test -z "$targetConfig"; then
if test -z "$crossStageStatic" -o -n "$crossMingw"; then EXTRA_TARGET_CFLAGS="$EXTRA_FLAGS"
EXTRA_FLAGS_TARGET="-g0 -O2 -B${libcCross}/lib -idirafter ${libcCross}/include" EXTRA_TARGET_LDFLAGS="$EXTRA_LDFLAGS"
EXTRA_LDFLAGS_TARGET="-Wl,-L${libcCross}/lib"
fi
else
EXTRA_FLAGS_TARGET="$EXTRA_FLAGS"
EXTRA_LDFLAGS_TARGET="$EXTRA_LDFLAGS"
fi fi
# CFLAGS_FOR_TARGET are needed for the libstdc++ configure script to find # CFLAGS_FOR_TARGET are needed for the libstdc++ configure script to find
@@ -73,17 +68,17 @@ if test "$noSysDirs" = "1"; then
NATIVE_SYSTEM_HEADER_DIR="$NIX_FIXINC_DUMMY" \ NATIVE_SYSTEM_HEADER_DIR="$NIX_FIXINC_DUMMY" \
SYSTEM_HEADER_DIR="$NIX_FIXINC_DUMMY" \ SYSTEM_HEADER_DIR="$NIX_FIXINC_DUMMY" \
CFLAGS_FOR_BUILD="$EXTRA_FLAGS $EXTRA_LDFLAGS" \ CFLAGS_FOR_BUILD="$EXTRA_FLAGS $EXTRA_LDFLAGS" \
CFLAGS_FOR_TARGET="$EXTRA_FLAGS_TARGET $EXTRA_LDFLAGS_TARGET" \ CFLAGS_FOR_TARGET="$EXTRA_TARGET_CFLAGS" \
FLAGS_FOR_TARGET="$EXTRA_FLAGS_TARGET $EXTRA_LDFLAGS_TARGET" \ FLAGS_FOR_TARGET="$EXTRA_TARGET_CFLAGS $EXTRA_TARGET_LDFLAGS" \
LDFLAGS_FOR_BUILD="$EXTRA_FLAGS $EXTRA_LDFLAGS" \ LDFLAGS_FOR_BUILD="$EXTRA_FLAGS $EXTRA_LDFLAGS" \
LDFLAGS_FOR_TARGET="$EXTRA_FLAGS_TARGET $EXTRA_LDFLAGS_TARGET" \ LDFLAGS_FOR_TARGET="$EXTRA_TARGET_LDFLAGS" \
) )
if test -z "$targetConfig"; then if test -z "$targetConfig"; then
makeFlagsArray=( \ makeFlagsArray=( \
"${makeFlagsArray[@]}" \ "${makeFlagsArray[@]}" \
BOOT_CFLAGS="$EXTRA_FLAGS $EXTRA_LDFLAGS" \ BOOT_CFLAGS="$EXTRA_FLAGS $EXTRA_LDFLAGS" \
BOOT_LDFLAGS="$EXTRA_FLAGS_TARGET $EXTRA_LDFLAGS_TARGET" \ BOOT_LDFLAGS="$EXTRA_FLAGS $EXTRA_LDFLAGS" \
) )
fi fi
+17 -2
View File
@@ -24,6 +24,7 @@
, libcCross ? null , libcCross ? null
, crossStageStatic ? true , crossStageStatic ? true
, gnat ? null , gnat ? null
, libpthread ? null, libpthreadCross ? null # required for GNU/Hurd
}: }:
assert langTreelang -> bison != null && flex != null; assert langTreelang -> bison != null && flex != null;
@@ -212,15 +213,29 @@ stdenv.mkDerivation ({
(optionals (zlib != null) [ zlib ] (optionals (zlib != null) [ zlib ]
++ optionals langJava [ boehmgc ] ++ optionals langJava [ boehmgc ]
++ optionals javaAwtGtk xlibs ++ optionals javaAwtGtk xlibs
++ optionals javaAwtGtk [ gmp mpfr ]))); ++ optionals javaAwtGtk [ gmp mpfr ]
++ optional (libpthread != null) libpthread
++ optional (libpthreadCross != null) libpthreadCross)));
LIBRARY_PATH = concatStrings LIBRARY_PATH = concatStrings
(intersperse ":" (map (x: x + "/lib") (intersperse ":" (map (x: x + "/lib")
(optionals (zlib != null) [ zlib ] (optionals (zlib != null) [ zlib ]
++ optionals langJava [ boehmgc ] ++ optionals langJava [ boehmgc ]
++ optionals javaAwtGtk xlibs ++ optionals javaAwtGtk xlibs
++ optionals javaAwtGtk [ gmp mpfr ]))); ++ optionals javaAwtGtk [ gmp mpfr ]
++ optional (libpthread != null) libpthread)));
EXTRA_TARGET_CFLAGS =
if cross != null && libcCross != null
then "-g0 -O2 -idirafter ${libcCross}/include"
else null;
EXTRA_TARGET_LDFLAGS =
if cross != null && libcCross != null
then "-B${libcCross}/lib -Wl,-L${libcCross}/lib" +
(optionalString (libpthreadCross != null)
" -L${libpthreadCross}/lib ${libpthreadCross.TARGET_LDFLAGS}")
else null;
passthru = { inherit langC langCC langAda langFortran langTreelang langVhdl passthru = { inherit langC langCC langAda langFortran langTreelang langVhdl
enableMultilib; }; enableMultilib; };
+7 -1
View File
@@ -2103,7 +2103,13 @@ let
}; };
gccCrossStageFinal = wrapGCCCross { gccCrossStageFinal = wrapGCCCross {
gcc = forceBuildDrv gcc_realCross; gcc = forceBuildDrv (gcc_realCross.override {
libpthreadCross =
# FIXME: Don't explicitly refer to `i586-pc-gnu'.
if crossSystem != null && crossSystem.config == "i586-pc-gnu"
then hurdLibpthreadCross
else null;
});
libc = libcCross; libc = libcCross;
binutils = binutilsCross; binutils = binutilsCross;
cross = assert crossSystem != null; crossSystem; cross = assert crossSystem != null; crossSystem;