* 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,53 +8,46 @@ mkdir $NIX_FIXINC_DUMMY
# libstdc++ needs this; otherwise it will use /lib/cpp, which is a Bad
# Thing.
export CPP="gcc -E"
export CXXCPP="gcc -E"
if test "$noSysDirs" = "1"; then
if test "$noSysDirs" = "1"; 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)
# 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"
# 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"
# 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
# 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 CXXFLAGS=$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=$glibc/include
fi
else
patches=""
export NIX_EXTRA_CFLAGS=$extraCFlags
export NIX_EXTRA_LDFLAGS=$extraLDFlags
export CFLAGS=$extraCFlags
export CXXFLAGS=$extraCFlags
export LDFLAGS=$extraLDFlags
fi
@ -75,7 +68,7 @@ preConfigure() {
cd ../build
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

View File

@ -6,14 +6,14 @@
assert langC;
stdenv.mkDerivation {
name = "gcc-4.1.0";
name = "gcc-4.1.1";
builder = ./builder.sh;
src = fetchurl {
url = ftp://ftp.nluug.nl/pub/gnu/gcc/gcc-4.1.0/gcc-4.1.0.tar.bz2;
md5 = "88785071f29ed0e0b6b61057a1079442";
url = ftp://ftp.nluug.nl/pub/gnu/gcc/gcc-4.1.1/gcc-4.1.1.tar.bz2;
md5 = "ad9f97a4d04982ccf4fd67cb464879f3";
};
# !!! apply only if noSysDirs is set
patches = [./no-sys-dirs.patch];
#patches = [./no-sys-dirs.patch ./gcc-4.0.2-cxx.patch];
patches =
[./pass-cxxcpp.patch]
++ (if noSysDirs then [./no-sys-dirs.patch] else []);
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;
};
gcc = (import ../development/compilers/gcc-3.4) {
gcc = (import ../development/compilers/gcc-4.1) {
inherit fetchurl stdenv noSysDirs;
langCC = gccWithCC;
profiledCompiler = gccWithProfiling;
@ -569,6 +569,16 @@ rec {
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) {
nativeTools = false;
nativeGlibc = false;