* Make GCC 4.1.1 the default compiler for Nixpkgs.

svn path=/nixpkgs/trunk/; revision=5481
This commit is contained in:
Eelco Dolstra 2006-06-21 15:54:18 +00:00
parent 2c1e5d0cfa
commit 9af9b95298
5 changed files with 70 additions and 64 deletions

View File

@ -8,41 +8,38 @@ mkdir $NIX_FIXINC_DUMMY
# libstdc++ needs this; otherwise it will use /lib/cpp, which is a Bad # libstdc++ needs this; otherwise it will use /lib/cpp, which is a Bad
# Thing. # Thing.
export CPP="gcc -E" export CPP="gcc -E"
export CXXCPP="gcc -E"
if test "$noSysDirs" = "1"; then if test "$noSysDirs" = "1"; then
if test "$noSysDirs" = "1"; then # Figure out what extra flags to pass to the gcc compilers being
# Figure out what extra flags to pass to the gcc compilers # generated to make sure that they use our glibc.
# being generated to make sure that they use our glibc.
if test -e $NIX_GCC/nix-support/orig-glibc; then if test -e $NIX_GCC/nix-support/orig-glibc; then
glibc=$(cat $NIX_GCC/nix-support/orig-glibc) glibc=$(cat $NIX_GCC/nix-support/orig-glibc)
# Ugh. Copied from gcc-wrapper/builder.sh. We can't just # Ugh. Copied from gcc-wrapper/builder.sh. We can't just
# source in $NIX_GCC/nix-support/add-flags, since that # source in $NIX_GCC/nix-support/add-flags, since that would
# would cause *this* GCC to be linked against the # cause *this* GCC to be linked against the *previous* GCC.
# *previous* GCC. Need some more modularity there. # Need some more modularity there.
extraCFlags="-B$glibc/lib -isystem $glibc/include" extraCFlags="-B$glibc/lib -isystem $glibc/include"
extraLDFlags="-B$glibc/lib -L$glibc/lib -Wl,-s \ extraLDFlags="-B$glibc/lib -L$glibc/lib -Wl,-s \
-Wl,-dynamic-linker,$glibc/lib/ld-linux.so.2" -Wl,-dynamic-linker,$glibc/lib/ld-linux.so.2"
# Oh, what a hack. I should be shot for this. # Oh, what a hack. I should be shot for this. In stage 1, we
# In stage 1, we should link against the previous GCC, but # should link against the previous GCC, but not afterwards.
# not afterwards. Otherwise we retain a dependency. # Otherwise we retain a dependency. However, ld-wrapper,
# However, ld-wrapper, which adds the linker flags for the # which adds the linker flags for the previous GCC, is also
# previous GCC, is also used in stage 2/3. We can prevent # used in stage 2/3. We can prevent it from adding them by
# it from adding them by NIX_GLIBC_FLAGS_SET, but then # NIX_GLIBC_FLAGS_SET, but then gcc-wrapper will also not add
# gcc-wrapper will also not add them, thereby causing # them, thereby causing stage 1 to fail. So we use a trick to
# stage 1 to fail. So we use a trick to only set the # only set the flags in gcc-wrapper.
# flags in gcc-wrapper.
hook=$(pwd)/ld-wrapper-hook hook=$(pwd)/ld-wrapper-hook
echo "NIX_GLIBC_FLAGS_SET=1" > $hook echo "NIX_GLIBC_FLAGS_SET=1" > $hook
export NIX_LD_WRAPPER_START_HOOK=$hook export NIX_LD_WRAPPER_START_HOOK=$hook
# Use *real* header files, otherwise a limits.h is # Use *real* header files, otherwise a limits.h is generated
# generated that does not include Glibc's limits.h # that does not include Glibc's limits.h (notably missing
# (notably missing SSIZE_MAX, which breaks the build). # SSIZE_MAX, which breaks the build).
export NIX_FIXINC_DUMMY=$glibc/include export NIX_FIXINC_DUMMY=$glibc/include
fi fi
@ -51,10 +48,6 @@ if test "$noSysDirs" = "1"; then
export CFLAGS=$extraCFlags export CFLAGS=$extraCFlags
export CXXFLAGS=$extraCFlags export CXXFLAGS=$extraCFlags
export LDFLAGS=$extraLDFlags export LDFLAGS=$extraLDFlags
fi
else
patches=""
fi fi
@ -75,7 +68,7 @@ preConfigure() {
cd ../build cd ../build
configureScript=../$sourceRoot/configure configureScript=../$sourceRoot/configure
configureFlags="--enable-languages=$langs" configureFlags="--enable-languages=$langs --disable-libstdcxx-pch"
} }
@ -91,10 +84,4 @@ postInstall() {
} }
#if test -z "$profiledCompiler"; then
# makeFlags="bootstrap"
#else
# makeFlags="profiledbootstrap"
#fi
genericBuild genericBuild

View File

@ -6,14 +6,14 @@
assert langC; assert langC;
stdenv.mkDerivation { stdenv.mkDerivation {
name = "gcc-4.1.0"; name = "gcc-4.1.1";
builder = ./builder.sh; builder = ./builder.sh;
src = fetchurl { src = fetchurl {
url = ftp://ftp.nluug.nl/pub/gnu/gcc/gcc-4.1.0/gcc-4.1.0.tar.bz2; url = ftp://ftp.nluug.nl/pub/gnu/gcc/gcc-4.1.1/gcc-4.1.1.tar.bz2;
md5 = "88785071f29ed0e0b6b61057a1079442"; md5 = "ad9f97a4d04982ccf4fd67cb464879f3";
}; };
# !!! apply only if noSysDirs is set patches =
patches = [./no-sys-dirs.patch]; [./pass-cxxcpp.patch]
#patches = [./no-sys-dirs.patch ./gcc-4.0.2-cxx.patch]; ++ (if noSysDirs then [./no-sys-dirs.patch] else []);
inherit noSysDirs langC langCC langF77 profiledCompiler; inherit noSysDirs langC langCC langF77 profiledCompiler;
} }

View File

@ -1,12 +0,0 @@
diff -ruN gcc-4.0.2/configure gcc-4.0.2.new/configure
--- gcc-4.0.2/configure 2005-09-13 09:01:28.000000000 +0200
+++ gcc-4.0.2.new/configure 2006-01-20 20:38:09.000000000 +0100
@@ -3471,7 +3471,7 @@
# being built; programs in there won't even run.
if test "${build}" = "${host}" && test -d ${srcdir}/gcc; then
# Search for pre-installed headers if nothing else fits.
- FLAGS_FOR_TARGET=$FLAGS_FOR_TARGET' -B$(build_tooldir)/bin/ -B$(build_tooldir)/lib/ -isystem $(build_tooldir)/include -isystem $(build_tooldir)/sys-include'
+ FLAGS_FOR_TARGET=$FLAGS_FOR_TARGET' -B$(build_tooldir)/bin/ -B$(build_tooldir)/lib/ -isystem $(build_tooldir)/include -isystem $(build_tooldir)/sys-include $(NIX_EXTRA_CFLAGS)'
fi
if test "x${use_gnu_ld}" = x &&

View File

@ -0,0 +1,21 @@
diff -rc gcc-orig/Makefile.in gcc-4.1.1/Makefile.in
*** gcc-orig/Makefile.in Wed Jun 21 13:40:23 2006
--- gcc-4.1.1/Makefile.in Wed Jun 21 14:19:44 2006
***************
*** 213,219 ****
RAW_CXX_TARGET_EXPORTS = \
$(BASE_TARGET_EXPORTS) \
CXX_FOR_TARGET="$(RAW_CXX_FOR_TARGET)"; export CXX_FOR_TARGET; \
! CXX="$(RAW_CXX_FOR_TARGET)"; export CXX;
NORMAL_TARGET_EXPORTS = \
$(BASE_TARGET_EXPORTS) \
--- 213,220 ----
RAW_CXX_TARGET_EXPORTS = \
$(BASE_TARGET_EXPORTS) \
CXX_FOR_TARGET="$(RAW_CXX_FOR_TARGET)"; export CXX_FOR_TARGET; \
! CXX="$(RAW_CXX_FOR_TARGET)"; export CXX; \
! CXXCPP="$(RAW_CXX_FOR_TARGET) $(CFLAGS_FOR_BUILD) -E"; export CXXCPP;
NORMAL_TARGET_EXPORTS = \
$(BASE_TARGET_EXPORTS) \

View File

@ -534,7 +534,7 @@ rec {
m4 = gnum4; m4 = gnum4;
}; };
gcc = (import ../development/compilers/gcc-3.4) { gcc = (import ../development/compilers/gcc-4.1) {
inherit fetchurl stdenv noSysDirs; inherit fetchurl stdenv noSysDirs;
langCC = gccWithCC; langCC = gccWithCC;
profiledCompiler = gccWithProfiling; profiledCompiler = gccWithProfiling;
@ -569,6 +569,16 @@ rec {
inherit stdenv; inherit stdenv;
}; };
gcc34 = (import ../build-support/gcc-wrapper) {
nativeTools = false;
nativeGlibc = false;
gcc = (import ../development/compilers/gcc-3.4) {
inherit fetchurl stdenv noSysDirs;
};
inherit (stdenv.gcc) binutils glibc;
inherit stdenv;
};
gcc40sparc = (import ../build-support/gcc-cross-wrapper) { gcc40sparc = (import ../build-support/gcc-cross-wrapper) {
nativeTools = false; nativeTools = false;
nativeGlibc = false; nativeGlibc = false;