* Ensure that when building gcc, libstdc++ is linked against the
libgcc of the gcc being built, not the gcc building it. * Only include a directory in the rpath of an executable/library if it is actually used. Before, the `/lib' directory of every build input was added to the rpath, causing many unnecessary retained dependencies. For instance, Perl has a `/lib' directory, but most applications whose build process uses Perl don't actually link against Perl. (Also added a test for this.) * After building glibc, remove glibcbug, to prevent a retained dependency on gcc. * Add a newline after `building X' in GNU Make. svn path=/nixpkgs/trunk/; revision=911
This commit is contained in:
@@ -40,21 +40,38 @@ postConfigure() {
|
||||
if test "$noSysDirs" = "1"; then
|
||||
# Patch some of the makefiles to force linking against our own
|
||||
# glibc.
|
||||
. $NIX_GCC/nix-support/add-flags # add glibc/gcc flags
|
||||
extraflags="-Wl,-s $NIX_CFLAGS_COMPILE $NIX_CFLAGS_LINK"
|
||||
for i in $NIX_LDFLAGS; do
|
||||
extraflags="$extraflags -Wl,$i"
|
||||
done
|
||||
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.
|
||||
extraFlags="-Wl,-s -B$glibc/lib -isystem $glibc/include \
|
||||
-L$glibc/lib -Wl,-dynamic-linker -Wl,$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
|
||||
fi
|
||||
|
||||
mf=Makefile
|
||||
sed \
|
||||
-e "s^FLAGS_FOR_TARGET =\(.*\)^FLAGS_FOR_TARGET = \1 $extraflags^" \
|
||||
-e "s^FLAGS_FOR_TARGET =\(.*\)^FLAGS_FOR_TARGET = \1 $extraFlags^" \
|
||||
< $mf > $mf.tmp
|
||||
mv $mf.tmp $mf
|
||||
|
||||
mf=gcc/Makefile
|
||||
sed \
|
||||
-e "s^X_CFLAGS =\(.*\)^X_CFLAGS = \1 $extraflags^" \
|
||||
-e "s^X_CFLAGS =\(.*\)^X_CFLAGS = \1 $extraFlags^" \
|
||||
< $mf > $mf.tmp
|
||||
mv $mf.tmp $mf
|
||||
|
||||
|
||||
@@ -4,13 +4,6 @@ export NIX_NO_SELF_RPATH=1
|
||||
. $stdenv/setup
|
||||
|
||||
|
||||
# !!! Toss the linker flags. Any sort of rpath is fatal.
|
||||
# This probably will cause a failure when building in a pure Nix
|
||||
# environment.
|
||||
export NIX_LDFLAGS=
|
||||
export NIX_GLIBC_FLAGS_SET=1
|
||||
|
||||
|
||||
postUnpack() {
|
||||
cd $sourceRoot
|
||||
unpackFile $linuxthreadsSrc
|
||||
@@ -35,6 +28,8 @@ postInstall() {
|
||||
make localedata/install-locales
|
||||
rm $out/etc/ld.so.cache
|
||||
(cd $out/include && ln -s $kernelHeaders/include/* .) || exit 1
|
||||
# `glibcbug' causes a retained dependency on the C compiler.
|
||||
rm $out/bin/glibcbug
|
||||
}
|
||||
|
||||
postInstall=postInstall
|
||||
|
||||
@@ -108,14 +108,14 @@ diff -rc make-3.80-orig/make.h make-3.80/make.h
|
||||
+ extern int logNestingStderr;
|
||||
diff -rc make-3.80-orig/remake.c make-3.80/remake.c
|
||||
*** make-3.80-orig/remake.c 2002-08-08 02:11:19.000000000 +0200
|
||||
--- make-3.80/remake.c 2004-04-02 17:43:00.000000000 +0200
|
||||
--- make-3.80/remake.c 2004-04-04 23:10:19.000000000 +0200
|
||||
***************
|
||||
*** 1049,1055 ****
|
||||
--- 1049,1059 ----
|
||||
/* The normal case: start some commands. */
|
||||
if (!touch_flag || file->cmds->any_recurse)
|
||||
{
|
||||
+ fprintf(stderr, "\e[pbuilding %s", file->name);
|
||||
+ fprintf(stderr, "\e[pbuilding %s\n", file->name);
|
||||
+ logNestingStderr++;
|
||||
execute_file_commands (file);
|
||||
+ fprintf(stderr, "\e[q");
|
||||
|
||||
Reference in New Issue
Block a user