2005-12-05 15:11:09 +01:00
|
|
|
source $stdenv/setup
|
2004-06-29 10:25:55 +02:00
|
|
|
|
|
|
|
|
2004-06-29 19:33:54 +02:00
|
|
|
export NIX_FIXINC_DUMMY=$NIX_BUILD_TOP/dummy
|
|
|
|
mkdir $NIX_FIXINC_DUMMY
|
2004-06-29 10:25:55 +02:00
|
|
|
|
|
|
|
|
2004-06-29 19:33:54 +02:00
|
|
|
if test "$noSysDirs" = "1"; then
|
2004-06-29 10:25:55 +02:00
|
|
|
|
|
|
|
if test "$noSysDirs" = "1"; then
|
2004-06-29 19:33:54 +02:00
|
|
|
# Figure out what extra flags to pass to the gcc compilers
|
|
|
|
# being generated to make sure that they use our glibc.
|
2004-06-29 10:25:55 +02:00
|
|
|
if test -e $NIX_GCC/nix-support/orig-glibc; then
|
|
|
|
glibc=$(cat $NIX_GCC/nix-support/orig-glibc)
|
2005-12-06 01:12:45 +01:00
|
|
|
|
2004-06-29 10:25:55 +02:00
|
|
|
# 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.
|
2004-06-29 19:33:54 +02:00
|
|
|
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"
|
2004-06-29 10:25:55 +02:00
|
|
|
|
|
|
|
# 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
|
2005-12-06 01:12:45 +01:00
|
|
|
|
|
|
|
# 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
|
2004-06-29 10:25:55 +02:00
|
|
|
fi
|
|
|
|
|
2004-06-29 19:33:54 +02:00
|
|
|
export NIX_EXTRA_CFLAGS=$extraCFlags
|
|
|
|
export NIX_EXTRA_LDFLAGS=$extraLDFlags
|
|
|
|
export CFLAGS=$extraCFlags
|
|
|
|
export LDFLAGS=$extraLDFlags
|
2004-06-29 10:25:55 +02:00
|
|
|
fi
|
2004-06-29 19:33:54 +02:00
|
|
|
|
|
|
|
else
|
|
|
|
patches=""
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
2004-07-05 14:20:23 +02:00
|
|
|
preConfigure=preConfigure
|
2004-06-29 19:33:54 +02:00
|
|
|
preConfigure() {
|
|
|
|
|
|
|
|
# Determine the frontends to build.
|
|
|
|
langs="c"
|
|
|
|
if test -n "$langCC"; then
|
|
|
|
langs="$langs,c++"
|
|
|
|
fi
|
|
|
|
if test -n "$langF77"; then
|
|
|
|
langs="$langs,f77"
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Perform the build in a different directory.
|
|
|
|
mkdir ../build
|
|
|
|
cd ../build
|
|
|
|
|
|
|
|
configureScript=../$sourceRoot/configure
|
|
|
|
configureFlags="--enable-languages=$langs"
|
2004-06-29 10:25:55 +02:00
|
|
|
}
|
|
|
|
|
2004-07-05 14:20:23 +02:00
|
|
|
|
|
|
|
postInstall=postInstall
|
|
|
|
postInstall() {
|
|
|
|
# Remove precompiled headers for now. They are very big and
|
|
|
|
# probably not very useful yet.
|
|
|
|
find $out/include -name "*.gch" -exec rm -rf {} \; -prune
|
2004-09-18 19:23:18 +02:00
|
|
|
|
|
|
|
# Remove `fixincl' to prevent a retained dependency on the
|
|
|
|
# previous gcc.
|
|
|
|
rm -rf $out/libexec/gcc/*/*/install-tools
|
2004-07-05 14:20:23 +02:00
|
|
|
}
|
2004-06-29 10:25:55 +02:00
|
|
|
|
|
|
|
|
2004-07-01 14:17:53 +02:00
|
|
|
if test -z "$profiledCompiler"; then
|
|
|
|
makeFlags="bootstrap"
|
|
|
|
else
|
|
|
|
makeFlags="profiledbootstrap"
|
|
|
|
fi
|
2004-06-29 10:25:55 +02:00
|
|
|
|
|
|
|
genericBuild
|