* 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;
}

View File

@ -7,21 +7,21 @@
staticToolsURL = {
url = file:///tmp/tarballs/static-tools.tar.bz2;
sha1 = "806f9644bf155069315bdd66138764b3d8619348";
sha1 = "4c72845335b373966341f1d4ca0b4b06904d1214";
};
binutilsURL = {
url = file:///tmp/tarballs/binutils.tar.bz2;
sha1 = "b55055c50cfcd2ab02e20f49ad8ca72315252a1c";
sha1 = "5ad0bdf99a427ebb8e08ca90db952c3eeb5119a4";
};
gccURL = {
url = file:///tmp/tarballs/gcc.tar.bz2;
sha1 = "a2ac17b6e7ce6d07c01e090b801c1622f56d8b39";
sha1 = "7398e021fdd5d7c4b5a3bb158db6e7573fc1dc0f";
};
glibcURL = {
url = file:///tmp/tarballs/glibc.tar.bz2;
sha1 = "59d4d5a25ecd8b2f741d80e80d172bd6e7e06d89";
sha1 = "710b4a53425977858490f77188c7e2138b55a2dd";
};
}

View File

@ -43,7 +43,7 @@ let
binutils = pkgsDiet.binutils217;
gcc = import ../../development/compilers/gcc-static-4.1 {
inherit (pkgs) fetchurl stdenv glibc;
inherit (pkgs) fetchurl stdenv;
profiledCompiler = false;
langCC = false;
};

View File

@ -84,9 +84,7 @@ chmod -R +w gcc
nukeRefs gcc/libexec/gcc/*/*/cc1
nukeRefs gcc/libexec/gcc/*/*/collect2
rm -f gcc/lib/libmud* gcc/lib/libiberty* gcc/lib/libssp*
if test -e gcc/lib/libgcc_s.so.1; then
nukeRefs gcc/lib/libgcc_s.so.1
fi
nukeRefs gcc/lib/libgcc_s.so.1
rm -rf gcc/lib/gcc/*/*/install-tools
rm -rf gcc/lib/gcc/*/*/include/root
rm -rf gcc/lib/gcc/*/*/include/linux