* Fix static linking in gcc.
* Use the coreutils in dietlibc. * Add objdump to the binutils static tarball. svn path=/nixpkgs/trunk/; revision=6879
This commit is contained in:
parent
0f7883d12f
commit
3ea7d9d272
84
pkgs/development/compilers/gcc-4.1-temp/builder.sh
Normal file
84
pkgs/development/compilers/gcc-4.1-temp/builder.sh
Normal file
@ -0,0 +1,84 @@
|
|||||||
|
source $stdenv/setup
|
||||||
|
|
||||||
|
|
||||||
|
export NIX_FIXINC_DUMMY=$NIX_BUILD_TOP/dummy
|
||||||
|
mkdir $NIX_FIXINC_DUMMY
|
||||||
|
|
||||||
|
|
||||||
|
# libstdc++ needs this; otherwise it will use /lib/cpp, which is a Bad
|
||||||
|
# Thing.
|
||||||
|
export CPP="gcc -E"
|
||||||
|
|
||||||
|
|
||||||
|
if test "$noSysDirs" = "1"; then
|
||||||
|
|
||||||
|
if test -e $NIX_GCC/nix-support/orig-libc; then
|
||||||
|
|
||||||
|
# Figure out what extra flags to pass to the gcc compilers
|
||||||
|
# being generated to make sure that they use our glibc.
|
||||||
|
extraCFlags="$(cat $NIX_GCC/nix-support/libc-cflags)"
|
||||||
|
extraLDFlags="$(cat $NIX_GCC/nix-support/libc-ldflags) $(cat $NIX_GCC/nix-support/libc-ldflags-before)"
|
||||||
|
|
||||||
|
# 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=$(cat $NIX_GCC/nix-support/orig-libc)/include
|
||||||
|
|
||||||
|
else
|
||||||
|
# Hack: support impure environments.
|
||||||
|
extraCFlags="-isystem /usr/include"
|
||||||
|
extraLDFlags="-L/usr/lib64 -L/usr/lib"
|
||||||
|
export NIX_FIXINC_DUMMY=/usr/include
|
||||||
|
fi
|
||||||
|
|
||||||
|
export NIX_EXTRA_CFLAGS=$extraCFlags
|
||||||
|
for i in $extraLDFlags; do
|
||||||
|
export NIX_EXTRA_LDFLAGS="$NIX_EXTRA_LDFLAGS -Wl,$i"
|
||||||
|
done
|
||||||
|
export CFLAGS=$extraCFlags
|
||||||
|
export CXXFLAGS=$extraCFlags
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
preConfigure=preConfigure
|
||||||
|
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 $configureFlags"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
# Remove `fixincl' to prevent a retained dependency on the
|
||||||
|
# previous gcc.
|
||||||
|
rm -rf $out/libexec/gcc/*/*/install-tools
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if test -z "$staticCompiler"; then
|
||||||
|
if test -z "$profiledCompiler"; then
|
||||||
|
makeFlags="bootstrap $makeFlags"
|
||||||
|
else
|
||||||
|
makeFlags="profiledbootstrap $makeFlags"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
genericBuild
|
47
pkgs/development/compilers/gcc-4.1-temp/default.nix
Normal file
47
pkgs/development/compilers/gcc-4.1-temp/default.nix
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
{ stdenv, fetchurl, noSysDirs
|
||||||
|
, langC ? true, langCC ? true, langF77 ? false
|
||||||
|
, profiledCompiler ? false
|
||||||
|
, staticCompiler ? false
|
||||||
|
}:
|
||||||
|
|
||||||
|
assert langC;
|
||||||
|
|
||||||
|
stdenv.mkDerivation {
|
||||||
|
name = "gcc-4.1.1";
|
||||||
|
builder = ./builder.sh;
|
||||||
|
|
||||||
|
src =
|
||||||
|
[(fetchurl {
|
||||||
|
url = http://ftp.gnu.org/pub/gnu/gcc/gcc-4.1.1/gcc-core-4.1.1.tar.bz2;
|
||||||
|
md5 = "a1b189c98aa7d7f164036bbe89b9b2a2";
|
||||||
|
})] ++
|
||||||
|
(if /*langCC*/ true then [(fetchurl {
|
||||||
|
url = http://ftp.gnu.org/pub/gnu/gcc/gcc-4.1.1/gcc-g++-4.1.1.tar.bz2;
|
||||||
|
md5 = "70c786bf8ca042e880a87fecb9e4dfcd";
|
||||||
|
})] else []) ++
|
||||||
|
(if langF77 then [(fetchurl {
|
||||||
|
url = http://ftp.gnu.org/pub/gnu/gcc/gcc-4.1.1/gcc-fortran-4.1.1.tar.bz2;
|
||||||
|
md5 = "b088a28a1963d16bf505262f8bfd09db";
|
||||||
|
})] else []);
|
||||||
|
|
||||||
|
patches =
|
||||||
|
[./pass-cxxcpp.patch]
|
||||||
|
++ (if noSysDirs then [./no-sys-dirs.patch] else []);
|
||||||
|
|
||||||
|
inherit noSysDirs langC langCC langF77 profiledCompiler staticCompiler;
|
||||||
|
|
||||||
|
configureFlags = "
|
||||||
|
--disable-multilib
|
||||||
|
--disable-libstdcxx-pch
|
||||||
|
--disable-libmudflap
|
||||||
|
--disable-libssp
|
||||||
|
";
|
||||||
|
|
||||||
|
makeFlags = if staticCompiler then "LDFLAGS=-static" else "";
|
||||||
|
|
||||||
|
meta = {
|
||||||
|
homepage = "http://gcc.gnu.org/";
|
||||||
|
license = "GPL/LGPL";
|
||||||
|
description = "GNU Compiler Collection, 4.1.x";
|
||||||
|
};
|
||||||
|
}
|
126
pkgs/development/compilers/gcc-4.1-temp/no-sys-dirs.patch
Normal file
126
pkgs/development/compilers/gcc-4.1-temp/no-sys-dirs.patch
Normal file
@ -0,0 +1,126 @@
|
|||||||
|
diff -ruN gcc-4.1.0/gcc/cppdefault.c gcc-4.1.0.new/gcc/cppdefault.c
|
||||||
|
--- gcc-4.1.0/gcc/cppdefault.c 2005-06-25 04:02:01.000000000 +0200
|
||||||
|
+++ gcc-4.1.0.new/gcc/cppdefault.c 2006-03-01 18:48:58.000000000 +0100
|
||||||
|
@@ -41,6 +41,10 @@
|
||||||
|
# undef CROSS_INCLUDE_DIR
|
||||||
|
#endif
|
||||||
|
|
||||||
|
+#undef LOCAL_INCLUDE_DIR
|
||||||
|
+#undef SYSTEM_INCLUDE_DIR
|
||||||
|
+#undef STANDARD_INCLUDE_DIR
|
||||||
|
+
|
||||||
|
const struct default_include cpp_include_defaults[]
|
||||||
|
#ifdef INCLUDE_DEFAULTS
|
||||||
|
= INCLUDE_DEFAULTS;
|
||||||
|
diff -ruN gcc-4.1.0/gcc/Makefile.in gcc-4.1.0.new/gcc/Makefile.in
|
||||||
|
--- gcc-4.1.0/gcc/Makefile.in 2006-02-16 16:23:24.000000000 +0100
|
||||||
|
+++ gcc-4.1.0.new/gcc/Makefile.in 2006-03-01 18:55:12.000000000 +0100
|
||||||
|
@@ -219,7 +219,7 @@
|
||||||
|
CPPFLAGS = @CPPFLAGS@
|
||||||
|
|
||||||
|
# These exists to be overridden by the x-* and t-* files, respectively.
|
||||||
|
-X_CFLAGS =
|
||||||
|
+X_CFLAGS = $(NIX_EXTRA_CFLAGS) $(NIX_EXTRA_LDFLAGS)
|
||||||
|
T_CFLAGS =
|
||||||
|
|
||||||
|
X_CPPFLAGS =
|
||||||
|
@@ -383,7 +383,11 @@
|
||||||
|
MD5_H = $(srcdir)/../include/md5.h
|
||||||
|
|
||||||
|
# Default native SYSTEM_HEADER_DIR, to be overridden by targets.
|
||||||
|
-NATIVE_SYSTEM_HEADER_DIR = /usr/include
|
||||||
|
+# Nix: we override NATIVE_SYSTEM_HEADER_DIR in order to prevent
|
||||||
|
+# `fixinc' from fixing header files in /usr/include. However,
|
||||||
|
+# NATIVE_SYSTEM_HEADER_DIR must point to an existing directory, so set
|
||||||
|
+# it to some dummy directory.
|
||||||
|
+NATIVE_SYSTEM_HEADER_DIR = $(NIX_FIXINC_DUMMY)
|
||||||
|
# Default cross SYSTEM_HEADER_DIR, to be overridden by targets.
|
||||||
|
CROSS_SYSTEM_HEADER_DIR = @CROSS_SYSTEM_HEADER_DIR@
|
||||||
|
|
||||||
|
@@ -395,7 +399,7 @@
|
||||||
|
STMP_FIXINC = @STMP_FIXINC@
|
||||||
|
|
||||||
|
# Test to see whether <limits.h> exists in the system header files.
|
||||||
|
-LIMITS_H_TEST = [ -f $(SYSTEM_HEADER_DIR)/limits.h ]
|
||||||
|
+LIMITS_H_TEST = true
|
||||||
|
|
||||||
|
# Directory for prefix to system directories, for
|
||||||
|
# each of $(system_prefix)/usr/include, $(system_prefix)/usr/lib, etc.
|
||||||
|
@@ -3002,7 +3006,7 @@
|
||||||
|
-DGPLUSPLUS_INCLUDE_DIR=\"$(gcc_gxx_include_dir)\" \
|
||||||
|
-DGPLUSPLUS_TOOL_INCLUDE_DIR=\"$(gcc_gxx_include_dir)/$(target_noncanonical)\" \
|
||||||
|
-DGPLUSPLUS_BACKWARD_INCLUDE_DIR=\"$(gcc_gxx_include_dir)/backward\" \
|
||||||
|
- -DLOCAL_INCLUDE_DIR=\"$(local_includedir)\" \
|
||||||
|
+ -DLOCAL_INCLUDE_DIR=\"/no-such-dir\" \
|
||||||
|
-DCROSS_INCLUDE_DIR=\"$(CROSS_SYSTEM_HEADER_DIR)\" \
|
||||||
|
-DTOOL_INCLUDE_DIR=\"$(gcc_tooldir)/include\" \
|
||||||
|
@TARGET_SYSTEM_ROOT_DEFINE@
|
||||||
|
diff -ruN gcc-4.1.0/libstdc++-v3/include/Makefile.in gcc-4.1.0.new/libstdc++-v3/include/Makefile.in
|
||||||
|
--- gcc-4.1.0/libstdc++-v3/include/Makefile.in 2006-01-10 18:14:00.000000000 +0100
|
||||||
|
+++ gcc-4.1.0.new/libstdc++-v3/include/Makefile.in 2006-03-01 18:57:32.000000000 +0100
|
||||||
|
@@ -1257,8 +1257,8 @@
|
||||||
|
if [ ! -d "${pch_output_builddir}" ]; then \
|
||||||
|
mkdir -p ${pch_output_builddir}; \
|
||||||
|
fi; \
|
||||||
|
- $(CXX) $(PCHFLAGS) $(AM_CPPFLAGS) ${pch_source} -O0 -g -o ${pch_output_builddir}/O0g.gch; \
|
||||||
|
- $(CXX) $(PCHFLAGS) $(AM_CPPFLAGS) ${pch_source} -O2 -g -o ${pch_output_builddir}/O2g.gch;
|
||||||
|
+ $(CXX) $(CFLAGS) $(PCHFLAGS) $(AM_CPPFLAGS) ${pch_source} -O0 -g -o ${pch_output_builddir}/O0g.gch; \
|
||||||
|
+ $(CXX) $(CFLAGS) $(PCHFLAGS) $(AM_CPPFLAGS) ${pch_source} -O2 -g -o ${pch_output_builddir}/O2g.gch;
|
||||||
|
|
||||||
|
# For robustness sake (in light of junk files or in-source
|
||||||
|
# configuration), copy from the build or source tree to the install
|
||||||
|
diff -ruN gcc-4.1.0/ltcf-cxx.sh gcc-4.1.0.new/ltcf-cxx.sh
|
||||||
|
--- gcc-4.1.0/ltcf-cxx.sh 2005-07-16 04:30:53.000000000 +0200
|
||||||
|
+++ gcc-4.1.0.new/ltcf-cxx.sh 2006-03-01 18:58:15.000000000 +0100
|
||||||
|
@@ -989,7 +989,7 @@
|
||||||
|
# the conftest object file.
|
||||||
|
pre_test_object_deps_done=no
|
||||||
|
|
||||||
|
- for p in `eval $output_verbose_link_cmd`; do
|
||||||
|
+ for p in `true`; do
|
||||||
|
|
||||||
|
case $p in
|
||||||
|
|
||||||
|
diff -ruN gcc-4.1.0/ltconfig gcc-4.1.0.new/ltconfig
|
||||||
|
--- gcc-4.1.0/ltconfig 2005-07-16 04:30:53.000000000 +0200
|
||||||
|
+++ gcc-4.1.0.new/ltconfig 2006-03-01 18:59:58.000000000 +0100
|
||||||
|
@@ -2322,6 +2322,11 @@
|
||||||
|
# A language-specific compiler.
|
||||||
|
CC=$CC
|
||||||
|
|
||||||
|
+# Ugly hack to get libmudflap (and possibly other libraries) to build.
|
||||||
|
+# Libtool filters out \`-B' flags when linking (why?), so the \`-B' flag
|
||||||
|
+# to Glibc gets lost. Here we forcibly add it to any invocation.
|
||||||
|
+CC="\$CC $NIX_EXTRA_LDFLAGS"
|
||||||
|
+
|
||||||
|
# Is the compiler the GNU C compiler?
|
||||||
|
with_gcc=$with_gcc
|
||||||
|
|
||||||
|
diff -ruN gcc-4.1.0/Makefile.in gcc-4.1.0.new/Makefile.in
|
||||||
|
--- gcc-4.1.0/Makefile.in 2005-12-15 15:02:02.000000000 +0100
|
||||||
|
+++ gcc-4.1.0.new/Makefile.in 2006-03-01 19:41:04.000000000 +0100
|
||||||
|
@@ -286,7 +286,7 @@
|
||||||
|
WINDRES = @WINDRES@
|
||||||
|
|
||||||
|
CFLAGS = @CFLAGS@
|
||||||
|
-LDFLAGS =
|
||||||
|
+LDFLAGS = $(NIX_EXTRA_LDFLAGS)
|
||||||
|
LIBCFLAGS = $(CFLAGS)
|
||||||
|
CXXFLAGS = @CXXFLAGS@
|
||||||
|
LIBCXXFLAGS = $(CXXFLAGS) -fno-implicit-templates
|
||||||
|
@@ -329,12 +329,12 @@
|
||||||
|
# CFLAGS will be just -g. We want to ensure that TARGET libraries
|
||||||
|
# (which we know are built with gcc) are built with optimizations so
|
||||||
|
# prepend -O2 when setting CFLAGS_FOR_TARGET.
|
||||||
|
-CFLAGS_FOR_TARGET = -O2 $(CFLAGS) $(SYSROOT_CFLAGS_FOR_TARGET)
|
||||||
|
+CFLAGS_FOR_TARGET = -O2 $(CFLAGS) $(SYSROOT_CFLAGS_FOR_TARGET) $(NIX_EXTRA_CFLAGS)
|
||||||
|
SYSROOT_CFLAGS_FOR_TARGET = @SYSROOT_CFLAGS_FOR_TARGET@
|
||||||
|
-CXXFLAGS_FOR_TARGET = $(CXXFLAGS) $(SYSROOT_CFLAGS_FOR_TARGET)
|
||||||
|
+CXXFLAGS_FOR_TARGET = $(CXXFLAGS) $(SYSROOT_CFLAGS_FOR_TARGET) $(NIX_EXTRA_CFLAGS)
|
||||||
|
LIBCFLAGS_FOR_TARGET = $(CFLAGS_FOR_TARGET)
|
||||||
|
LIBCXXFLAGS_FOR_TARGET = $(CXXFLAGS_FOR_TARGET) -fno-implicit-templates
|
||||||
|
-LDFLAGS_FOR_TARGET =
|
||||||
|
+LDFLAGS_FOR_TARGET = $(NIX_EXTRA_LDFLAGS)
|
||||||
|
PICFLAG_FOR_TARGET =
|
||||||
|
|
||||||
|
# ------------------------------------
|
21
pkgs/development/compilers/gcc-4.1-temp/pass-cxxcpp.patch
Normal file
21
pkgs/development/compilers/gcc-4.1-temp/pass-cxxcpp.patch
Normal 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) $(CFLAGS_FOR_BUILD)"; export CXX; \
|
||||||
|
! CXXCPP="$(RAW_CXX_FOR_TARGET) $(CFLAGS_FOR_BUILD) -E"; export CXXCPP;
|
||||||
|
|
||||||
|
NORMAL_TARGET_EXPORTS = \
|
||||||
|
$(BASE_TARGET_EXPORTS) \
|
@ -23,20 +23,16 @@ let
|
|||||||
generator = pkgs.stdenv.mkDerivation {
|
generator = pkgs.stdenv.mkDerivation {
|
||||||
name = "bootstrap-tools-generator";
|
name = "bootstrap-tools-generator";
|
||||||
builder = ./make-bootstrap-tools.sh;
|
builder = ./make-bootstrap-tools.sh;
|
||||||
|
|
||||||
inherit (pkgsDiet)
|
inherit (pkgsDiet)
|
||||||
gnugrep gzip bzip2 gnumake bash patch binutils;
|
coreutils findutils diffutils gnugrep
|
||||||
|
gzip bzip2 gnumake bash patch binutils;
|
||||||
|
|
||||||
gnused = pkgsDiet.gnused412; # 4.1.5 gives "Memory exhausted" errors
|
gnused = pkgsDiet.gnused412; # 4.1.5 gives "Memory exhausted" errors
|
||||||
|
|
||||||
# patchelf is C++, won't work with dietlibc.
|
# patchelf is C++, won't work with dietlibc.
|
||||||
inherit (pkgsStatic) patchelf;
|
inherit (pkgsStatic) patchelf;
|
||||||
|
|
||||||
# Coreutils won't build on dietlibc on x86_64 (and by extension,
|
|
||||||
# findutils and diffutils).
|
|
||||||
inherit (if pkgs.stdenv.system == "powerpc-linux" then pkgsStatic else pkgsDiet)
|
|
||||||
coreutils findutils diffutils;
|
|
||||||
|
|
||||||
gnutar =
|
gnutar =
|
||||||
# Tar seems to be broken on dietlibc on x86_64.
|
# Tar seems to be broken on dietlibc on x86_64.
|
||||||
if pkgs.stdenv.system == "i686-linux"
|
if pkgs.stdenv.system == "i686-linux"
|
||||||
@ -50,10 +46,9 @@ let
|
|||||||
then pkgsDiet.gawk
|
then pkgsDiet.gawk
|
||||||
else pkgsStatic.gawk;
|
else pkgsStatic.gawk;
|
||||||
|
|
||||||
gcc = import ../../development/compilers/gcc-4.1 {
|
gcc = import ../../development/compilers/gcc-4.1-temp {
|
||||||
inherit (pkgs) fetchurl stdenv;
|
inherit (pkgs) fetchurl stdenv;
|
||||||
noSysDirs = true;
|
noSysDirs = true;
|
||||||
profiledCompiler = true;
|
|
||||||
langCC = false;
|
langCC = false;
|
||||||
staticCompiler = true;
|
staticCompiler = true;
|
||||||
};
|
};
|
||||||
|
@ -72,7 +72,7 @@ fi
|
|||||||
# Create the binutils tarball.
|
# Create the binutils tarball.
|
||||||
mkdir binutils
|
mkdir binutils
|
||||||
mkdir binutils/bin
|
mkdir binutils/bin
|
||||||
for i in as ld ar ranlib nm strip readelf; do
|
for i in as ld ar ranlib nm strip readelf objdump; do
|
||||||
cp $binutils/bin/$i binutils/bin
|
cp $binutils/bin/$i binutils/bin
|
||||||
nukeRefs binutils/bin/$i
|
nukeRefs binutils/bin/$i
|
||||||
done
|
done
|
||||||
@ -150,3 +150,9 @@ done
|
|||||||
for i in $out/in-nixpkgs/*.bz2; do
|
for i in $out/in-nixpkgs/*.bz2; do
|
||||||
(cd $out/check-only && bunzip2 < $i > $(basename $i .bz2))
|
(cd $out/check-only && bunzip2 < $i > $(basename $i .bz2))
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
||||||
|
# Check that everything is statically linked
|
||||||
|
for i in $(find $out -type x); do
|
||||||
|
ldd $i
|
||||||
|
done
|
||||||
|
@ -226,7 +226,10 @@ rec {
|
|||||||
};
|
};
|
||||||
|
|
||||||
coreutils = useFromStdenv (stdenv ? coreutils) stdenv.coreutils
|
coreutils = useFromStdenv (stdenv ? coreutils) stdenv.coreutils
|
||||||
(import ../tools/misc/coreutils {
|
((if stdenv ? isDietLibC
|
||||||
|
then import ../tools/misc/coreutils-5
|
||||||
|
else import ../tools/misc/coreutils)
|
||||||
|
{
|
||||||
inherit fetchurl stdenv;
|
inherit fetchurl stdenv;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user