From eb4584c0cbe9bb02dbb99afa025428ba35980a9d Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Thu, 26 Oct 2006 11:25:29 +0000 Subject: [PATCH] * Merge the gcc-4.1 changes into 3.4. svn path=/nixpkgs/trunk/; revision=6855 --- pkgs/development/compilers/gcc-3.4/builder.sh | 62 +++++++------------ .../development/compilers/gcc-3.4/default.nix | 5 +- 2 files changed, 26 insertions(+), 41 deletions(-) diff --git a/pkgs/development/compilers/gcc-3.4/builder.sh b/pkgs/development/compilers/gcc-3.4/builder.sh index 2ae98d17fbd..17b0e57f2f0 100644 --- a/pkgs/development/compilers/gcc-3.4/builder.sh +++ b/pkgs/development/compilers/gcc-3.4/builder.sh @@ -7,47 +7,31 @@ mkdir $NIX_FIXINC_DUMMY if test "$noSysDirs" = "1"; then - if test "$noSysDirs" = "1"; then + if test -e $NIX_GCC/nix-support/orig-libc; then + # Figure out what extra flags to pass to the gcc compilers # being generated to make sure that they use our glibc. - if test -e $NIX_GCC/nix-support/orig-glibc; then - glibc=$(cat $NIX_GCC/nix-support/orig-glibc) - - # Ugh. Copied from gcc-wrapper/builder.sh. We can't just - # source in $NIX_GCC/nix-support/add-flags, since that - # would cause *this* GCC to be linked against the - # *previous* GCC. Need some more modularity there. - extraCFlags="-B$glibc/lib -isystem $glibc/include" - extraLDFlags="-B$glibc/lib -L$glibc/lib -Wl,-s \ - -Wl,-dynamic-linker,$glibc/lib/ld-linux.so.2" + extraCFlags="$(cat $NIX_GCC/nix-support/libc-cflags)" + extraLDFlags="$(cat $NIX_GCC/nix-support/libc-ldflags) $(cat $NIX_GCC/nix-support/libc-ldflags-before)" - # Oh, what a hack. I should be shot for this. - # In stage 1, we should link against the previous GCC, but - # not afterwards. Otherwise we retain a dependency. - # However, ld-wrapper, which adds the linker flags for the - # previous GCC, is also used in stage 2/3. We can prevent - # it from adding them by NIX_GLIBC_FLAGS_SET, but then - # gcc-wrapper will also not add them, thereby causing - # stage 1 to fail. So we use a trick to only set the - # flags in gcc-wrapper. - hook=$(pwd)/ld-wrapper-hook - echo "NIX_GLIBC_FLAGS_SET=1" > $hook - export NIX_LD_WRAPPER_START_HOOK=$hook - - # Use *real* header files, otherwise a limits.h is - # generated that does not include Glibc's limits.h - # (notably missing SSIZE_MAX, which breaks the build). - export NIX_FIXINC_DUMMY=$glibc/include - fi - - export NIX_EXTRA_CFLAGS=$extraCFlags - export NIX_EXTRA_LDFLAGS=$extraLDFlags - export CFLAGS=$extraCFlags - export LDFLAGS=$extraLDFlags + # Use *real* header files, otherwise a limits.h is generated + # that does not include Glibc's limits.h (notably missing + # SSIZE_MAX, which breaks the build). + export NIX_FIXINC_DUMMY=$(cat $NIX_GCC/nix-support/orig-libc)/include + + else + # Hack: support impure environments. + extraCFlags="-isystem /usr/include" + extraLDFlags="-L/usr/lib64 -L/usr/lib" + export NIX_FIXINC_DUMMY=/usr/include fi -else - patches="" + export NIX_EXTRA_CFLAGS=$extraCFlags + for i in $extraLDFlags; do + export NIX_EXTRA_LDFLAGS="$NIX_EXTRA_LDFLAGS -Wl,$i" + done + export CFLAGS=$extraCFlags + export CXXFLAGS=$extraCFlags fi @@ -68,7 +52,7 @@ preConfigure() { cd ../build configureScript=../$sourceRoot/configure - configureFlags="--enable-languages=$langs" + configureFlags="--enable-languages=$langs $configureFlags" } @@ -85,9 +69,9 @@ postInstall() { if test -z "$profiledCompiler"; then - makeFlags="bootstrap" + makeFlags="bootstrap $makeFlags" else - makeFlags="profiledbootstrap" + makeFlags="profiledbootstrap $makeFlags" fi genericBuild diff --git a/pkgs/development/compilers/gcc-3.4/default.nix b/pkgs/development/compilers/gcc-3.4/default.nix index dbb6baf526a..3ceeb7b5d99 100644 --- a/pkgs/development/compilers/gcc-3.4/default.nix +++ b/pkgs/development/compilers/gcc-3.4/default.nix @@ -12,8 +12,9 @@ stdenv.mkDerivation { url = http://nix.cs.uu.nl/dist/tarballs/gcc-3.4.6.tar.bz2; md5 = "4a21ac777d4b5617283ce488b808da7b"; }; - # !!! apply only if noSysDirs is set - patches = [./no-sys-dirs.patch]; + + patches = if noSysDirs then [./no-sys-dirs.patch] else []; + inherit noSysDirs langC langCC langF77 profiledCompiler; meta = {