* Build a static GCC, properly. (Reminder: when building GCC on an

impure x86_64 environment, make sure that the 32-bit GCC / Glibc
  libraries are installed, such as /usr/lib/crti.o.)

svn path=/nixpkgs/trunk/; revision=6818
This commit is contained in:
Eelco Dolstra
2006-10-24 11:36:19 +00:00
parent d4578254b0
commit 0cf5154681
5 changed files with 20 additions and 15 deletions

View File

@@ -14,7 +14,7 @@ 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 -n $glibc; then
if test -n "$glibc"; then
# Ugh. Copied from gcc-wrapper/builder.sh. We can't just
# source in $NIX_GCC/nix-support/add-flags, since that would
@@ -22,7 +22,7 @@ if test "$noSysDirs" = "1"; then
# 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 -static"
-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.
@@ -40,6 +40,11 @@ if test "$noSysDirs" = "1"; then
# that does not include Glibc's limits.h (notably missing
# SSIZE_MAX, which breaks the build).
export NIX_FIXINC_DUMMY=$glibc/include
else
extraCFlags="-isystem /usr/include"
extraLDFlags="-L/usr/lib64 -L/usr/lib"
export NIX_FIXINC_DUMMY=/usr/include
fi
export NIX_EXTRA_CFLAGS=$extraCFlags
@@ -50,6 +55,9 @@ if test "$noSysDirs" = "1"; then
fi
export makeFlags="LDFLAGS=-static"
preConfigure=preConfigure
preConfigure() {
@@ -66,10 +74,9 @@ preConfigure() {
mkdir ../build
cd ../build
export LDFLFAGS="-static"
configureScript=../$sourceRoot/configure
configureFlags="--enable-languages=c --disable-libstdcxx-pch \
--disable-shared --disable-libmudflap --disable-libssp"
--disable-libmudflap --disable-libssp"
}

View File

@@ -1,7 +1,6 @@
{ stdenv, fetchurl
, langC ? true, langCC ? true, langF77 ? false
, profiledCompiler ? false
, glibc
}:
assert langC;
@@ -13,7 +12,8 @@ stdenv.mkDerivation {
url = http://nix.cs.uu.nl/dist/tarballs/gcc-4.1.1.tar.bz2;
md5 = "ad9f97a4d04982ccf4fd67cb464879f3";
};
patches = [./pass-cxxcpp.patch ./no-sys-dirs.patch];
inherit langC langCC langF77 profiledCompiler glibc;
patches = [./no-sys-dirs.patch];
inherit langC langCC langF77 profiledCompiler;
noSysDirs = 1;
glibc = if stdenv ? glibc then stdenv.glibc else null;
}