From 63abc2ed86acfc39022d7674ccee66663a3451b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Wed, 19 May 2010 21:32:19 +0000 Subject: [PATCH] GCC 4.5: Add support for a separate libpthread; rearrange target flags handling. svn path=/nixpkgs/trunk/; revision=21905 --- pkgs/development/compilers/gcc-4.5/builder.sh | 19 +++++++------------ .../development/compilers/gcc-4.5/default.nix | 19 +++++++++++++++++-- pkgs/top-level/all-packages.nix | 8 +++++++- 3 files changed, 31 insertions(+), 15 deletions(-) diff --git a/pkgs/development/compilers/gcc-4.5/builder.sh b/pkgs/development/compilers/gcc-4.5/builder.sh index be2a2b11c167..6c3ced85d754 100644 --- a/pkgs/development/compilers/gcc-4.5/builder.sh +++ b/pkgs/development/compilers/gcc-4.5/builder.sh @@ -54,14 +54,9 @@ if test "$noSysDirs" = "1"; then EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,$i" done - if test -n "$targetConfig"; then - if test -z "$crossStageStatic" -o -n "$crossMingw"; then - EXTRA_FLAGS_TARGET="-g0 -O2 -B${libcCross}/lib -idirafter ${libcCross}/include" - EXTRA_LDFLAGS_TARGET="-Wl,-L${libcCross}/lib" - fi - else - EXTRA_FLAGS_TARGET="$EXTRA_FLAGS" - EXTRA_LDFLAGS_TARGET="$EXTRA_LDFLAGS" + if test -z "$targetConfig"; then + EXTRA_TARGET_CFLAGS="$EXTRA_FLAGS" + EXTRA_TARGET_LDFLAGS="$EXTRA_LDFLAGS" fi # 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" \ SYSTEM_HEADER_DIR="$NIX_FIXINC_DUMMY" \ CFLAGS_FOR_BUILD="$EXTRA_FLAGS $EXTRA_LDFLAGS" \ - CFLAGS_FOR_TARGET="$EXTRA_FLAGS_TARGET $EXTRA_LDFLAGS_TARGET" \ - FLAGS_FOR_TARGET="$EXTRA_FLAGS_TARGET $EXTRA_LDFLAGS_TARGET" \ + CFLAGS_FOR_TARGET="$EXTRA_TARGET_CFLAGS" \ + FLAGS_FOR_TARGET="$EXTRA_TARGET_CFLAGS $EXTRA_TARGET_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 makeFlagsArray=( \ "${makeFlagsArray[@]}" \ BOOT_CFLAGS="$EXTRA_FLAGS $EXTRA_LDFLAGS" \ - BOOT_LDFLAGS="$EXTRA_FLAGS_TARGET $EXTRA_LDFLAGS_TARGET" \ + BOOT_LDFLAGS="$EXTRA_FLAGS $EXTRA_LDFLAGS" \ ) fi diff --git a/pkgs/development/compilers/gcc-4.5/default.nix b/pkgs/development/compilers/gcc-4.5/default.nix index 8ec79d7c43d9..f5e4c67761e9 100644 --- a/pkgs/development/compilers/gcc-4.5/default.nix +++ b/pkgs/development/compilers/gcc-4.5/default.nix @@ -24,6 +24,7 @@ , libcCross ? null , crossStageStatic ? true , gnat ? null +, libpthread ? null, libpthreadCross ? null # required for GNU/Hurd }: assert langTreelang -> bison != null && flex != null; @@ -212,15 +213,29 @@ stdenv.mkDerivation ({ (optionals (zlib != null) [ zlib ] ++ optionals langJava [ boehmgc ] ++ optionals javaAwtGtk xlibs - ++ optionals javaAwtGtk [ gmp mpfr ]))); + ++ optionals javaAwtGtk [ gmp mpfr ] + ++ optional (libpthread != null) libpthread + ++ optional (libpthreadCross != null) libpthreadCross))); LIBRARY_PATH = concatStrings (intersperse ":" (map (x: x + "/lib") (optionals (zlib != null) [ zlib ] ++ optionals langJava [ boehmgc ] ++ 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 enableMultilib; }; diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 61da353a7c7a..0d87a3c09877 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -2103,7 +2103,13 @@ let }; 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; binutils = binutilsCross; cross = assert crossSystem != null; crossSystem;