about summary refs log tree commit diff
path: root/pkgs/development/compilers
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2009-07-03 18:54:28 +0000
committerLudovic Courtès <ludo@gnu.org>2009-07-03 18:54:28 +0000
commit85d950b8fb4c0814d073aec3e4e4d0af98290080 (patch)
tree132d63269a6e2f48bc020d26b2dbda06e867fd21 /pkgs/development/compilers
parentdcdf4a41533754c5edc09c1e8dc477591353dc42 (diff)
Add GCC 4.4.0 (and hope for the best).
svn path=/nixpkgs/trunk/; revision=16168
Diffstat (limited to 'pkgs/development/compilers')
-rw-r--r--pkgs/development/compilers/gcc-4.4/builder.sh96
-rw-r--r--pkgs/development/compilers/gcc-4.4/default.nix98
-rw-r--r--pkgs/development/compilers/gcc-4.4/java-jvgenmain-link.patch17
-rw-r--r--pkgs/development/compilers/gcc-4.4/no-sys-dirs-fortran.patch15
-rw-r--r--pkgs/development/compilers/gcc-4.4/no-sys-dirs.patch132
-rw-r--r--pkgs/development/compilers/gcc-4.4/pass-cxxcpp.patch21
6 files changed, 379 insertions, 0 deletions
diff --git a/pkgs/development/compilers/gcc-4.4/builder.sh b/pkgs/development/compilers/gcc-4.4/builder.sh
new file mode 100644
index 0000000000000..2bc011e3e6e13
--- /dev/null
+++ b/pkgs/development/compilers/gcc-4.4/builder.sh
@@ -0,0 +1,96 @@
+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
+
+    extraCFlags="-g0 -I$gmp/include -I$mpfr/include $extraCFlags"
+    extraLDFlags="--strip-debug $extraLDFlags"
+
+    export NIX_EXTRA_CFLAGS=$extraCFlags
+    for i in $extraLDFlags; do
+        export NIX_EXTRA_LDFLAGS="$NIX_EXTRA_LDFLAGS -Wl,$i"
+    done
+
+    makeFlagsArray=( \
+        "${makeFlagsArray[@]}" \
+        NATIVE_SYSTEM_HEADER_DIR="$NIX_FIXINC_DUMMY" \
+        SYSTEM_HEADER_DIR="$NIX_FIXINC_DUMMY" \
+        LIMITS_H_TEST=true \
+        X_CFLAGS="$NIX_EXTRA_CFLAGS $NIX_EXTRA_LDFLAGS" \
+        LDFLAGS="$NIX_EXTRA_CFLAGS $NIX_EXTRA_LDFLAGS" \
+        LDFLAGS_FOR_TARGET="$NIX_EXTRA_CFLAGS $NIX_EXTRA_LDFLAGS" \
+        )
+fi
+
+
+preConfigure() {
+    # Perform the build in a different directory.
+    mkdir ../build
+    cd ../build
+    configureScript=../$sourceRoot/configure
+}
+
+
+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
+    rm -rf $out/lib/gcc/*/*/install-tools
+
+    # Get rid of some "fixed" header files
+    rm -rf $out/lib/gcc/*/*/include/root
+
+    # Replace hard links for i686-pc-linux-gnu-gcc etc. with symlinks.
+    for i in $out/bin/*-gcc*; do
+        if cmp -s $out/bin/gcc $i; then
+            ln -sfn gcc $i
+        fi
+    done
+
+    for i in $out/bin/*-c++* $out/bin/*-g++*; do
+        if cmp -s $out/bin/g++ $i; then
+            ln -sfn g++ $i
+        fi
+    done
+}
+
+
+if test -z "$profiledCompiler"; then
+    buildFlags="bootstrap $buildFlags"
+else    
+    buildFlags="profiledbootstrap $buildFlags"
+fi
+
+genericBuild
diff --git a/pkgs/development/compilers/gcc-4.4/default.nix b/pkgs/development/compilers/gcc-4.4/default.nix
new file mode 100644
index 0000000000000..d009acb6879a6
--- /dev/null
+++ b/pkgs/development/compilers/gcc-4.4/default.nix
@@ -0,0 +1,98 @@
+{ stdenv, fetchurl, noSysDirs
+, langC ? true, langCC ? true, langFortran ? false, langTreelang ? false
+, langJava ? false
+, profiledCompiler ? false
+, staticCompiler ? false
+, texinfo ? null
+, gmp, mpfr
+, bison ? null, flex ? null
+, zlib ? null, boehmgc ? null
+, enableMultilib ? false
+, name ? "gcc"
+}:
+
+assert langTreelang -> bison != null && flex != null;
+
+with stdenv.lib;
+
+let version = "4.4.0"; in
+
+stdenv.mkDerivation ({
+  name = "${name}-${version}";
+  
+  builder = ./builder.sh;
+  
+  src =
+    optional /*langC*/ true (fetchurl {
+      url = "mirror://gcc/releases/gcc-${version}/gcc-core-${version}.tar.bz2";
+      sha256 = "0p0gis4xrw363kf2yxlx2022cnhyy1dgngwvy1z1z2s0238av7v1";
+    }) ++
+
+
+    optional langCC (fetchurl {
+      url = "mirror://gcc/releases/gcc-${version}/gcc-g++-${version}.tar.bz2";
+      sha256 = "1rdv2fi1vif306yjlxx8a4lh7yc89fi54xyl2p6l60pj9v9xq291";
+    }) ++
+
+    /* FIXME: Fortran omitted for now.
+
+    optional langFortran (fetchurl {
+      url = "mirror://gcc/releases/gcc-${version}/gcc-fortran-${version}.tar.bz2";
+      sha256 = "";
+    }) ++
+
+     */
+    optional langJava (fetchurl {
+      url = "mirror://gcc/releases/gcc-${version}/gcc-java-${version}.tar.bz2";
+      sha256 = "0i60llrllgm4sbplw2rc9b0gi0mxr88la07a72mvlbblzpxn22hb";
+    });
+    
+  patches =
+    [./pass-cxxcpp.patch]
+    ++ optional noSysDirs ./no-sys-dirs.patch
+    ++ optional (noSysDirs && langFortran) ./no-sys-dirs-fortran.patch
+    ++ optional langJava ./java-jvgenmain-link.patch;
+    
+  inherit noSysDirs profiledCompiler staticCompiler;
+
+  buildInputs = [texinfo gmp mpfr]
+    ++ (optionals langTreelang [bison flex])
+    ++ (optional (zlib != null) zlib)
+    ++ (optional (boehmgc != null) boehmgc)
+    ;
+
+  configureFlags = "
+    ${if enableMultilib then "" else "--disable-multilib"}
+    --disable-libstdcxx-pch
+    --with-system-zlib
+    --enable-languages=${
+      concatStrings (intersperse ","
+        (  optional langC        "c"
+        ++ optional langCC       "c++"
+        ++ optional langFortran  "fortran"
+        ++ optional langJava     "java"
+        ++ optional langTreelang "treelang"
+        )
+      )
+    }
+    ${if stdenv.isi686 then "--with-arch=i686" else ""}
+  ";
+
+  NIX_EXTRA_LDFLAGS = if staticCompiler then "-static" else "";
+
+  inherit gmp mpfr;
+  
+  passthru = { inherit langC langCC langFortran langTreelang enableMultilib; };
+
+  meta = {
+    homepage = "http://gcc.gnu.org/";
+    license = "GPL/LGPL";
+    description = "GNU Compiler Collection, 4.3.x";
+  };
+} // (if langJava then {
+  postConfigure = ''
+    make configure-gcc
+    sed -i gcc/Makefile -e 's@^CFLAGS = .*@& -I${zlib}/include@ ; s@^LDFLAGS = .*@& -L${zlib}/lib@'
+    sed -i gcc/Makefile -e 's@^CFLAGS = .*@& -I${boehmgc}/include@ ; s@^LDFLAGS = .*@& -L${boehmgc}/lib -lgc@'
+  '';
+} else {}))
diff --git a/pkgs/development/compilers/gcc-4.4/java-jvgenmain-link.patch b/pkgs/development/compilers/gcc-4.4/java-jvgenmain-link.patch
new file mode 100644
index 0000000000000..2612e8bfbbbcd
--- /dev/null
+++ b/pkgs/development/compilers/gcc-4.4/java-jvgenmain-link.patch
@@ -0,0 +1,17 @@
+The `jvgenmain' executable must be linked against `vec.o', among others,
+since it uses its vector API.
+
+--- gcc-4.3.3/gcc/java/Make-lang.in	2008-12-05 00:00:19.000000000 +0100
++++ gcc-4.3.3/gcc/java/Make-lang.in	2009-07-03 16:11:41.000000000 +0200
+@@ -109,9 +109,9 @@ jcf-dump$(exeext): $(JCFDUMP_OBJS) $(LIB
+ 	$(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ $(JCFDUMP_OBJS) \
+ 		$(CPPLIBS) $(ZLIB) $(LDEXP_LIB) $(LIBS)
+ 
+-jvgenmain$(exeext): $(JVGENMAIN_OBJS) $(LIBDEPS)
++jvgenmain$(exeext): $(JVGENMAIN_OBJS) $(LIBDEPS) $(BUILD_RTL)
+ 	rm -f $@
+-	$(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ $(JVGENMAIN_OBJS) $(LIBS)
++	$(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ $(JVGENMAIN_OBJS) $(BUILD_RTL) $(LIBS)
+ 
+ #
+ # Build hooks:
diff --git a/pkgs/development/compilers/gcc-4.4/no-sys-dirs-fortran.patch b/pkgs/development/compilers/gcc-4.4/no-sys-dirs-fortran.patch
new file mode 100644
index 0000000000000..4568e57819b20
--- /dev/null
+++ b/pkgs/development/compilers/gcc-4.4/no-sys-dirs-fortran.patch
@@ -0,0 +1,15 @@
+diff -ru gcc-4.3.1-orig/libgfortran/configure gcc-4.3.1/libgfortran/configure
+--- gcc-4.3.1-orig/libgfortran/configure	2008-06-06 16:49:11.000000000 +0200
++++ gcc-4.3.1/libgfortran/configure	2008-06-27 08:25:08.000000000 +0200
+@@ -35405,6 +35405,11 @@
+ # A language specific compiler.
+ CC=$lt_compiler
+ 
++# 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_CFLAGS $NIX_EXTRA_LDFLAGS"
++
+ # Is the compiler the GNU compiler?
+ with_gcc=$GCC
+ 
diff --git a/pkgs/development/compilers/gcc-4.4/no-sys-dirs.patch b/pkgs/development/compilers/gcc-4.4/no-sys-dirs.patch
new file mode 100644
index 0000000000000..4d843891a03c2
--- /dev/null
+++ b/pkgs/development/compilers/gcc-4.4/no-sys-dirs.patch
@@ -0,0 +1,132 @@
+diff -ru gcc-4.3.1-orig/gcc/cppdefault.c gcc-4.3.1/gcc/cppdefault.c
+--- gcc-4.3.1-orig/gcc/cppdefault.c	2007-07-26 10:37:01.000000000 +0200
++++ gcc-4.3.1/gcc/cppdefault.c	2008-06-25 17:48:23.000000000 +0200
+@@ -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 -ru gcc-4.3.1-orig/gcc/gcc.c gcc-4.3.1/gcc/gcc.c
+--- gcc-4.3.1-orig/gcc/gcc.c	2008-03-02 23:55:19.000000000 +0100
++++ gcc-4.3.1/gcc/gcc.c	2008-06-25 17:52:53.000000000 +0200
+@@ -1478,10 +1478,10 @@
+ /* Default prefixes to attach to command names.  */
+ 
+ #ifndef STANDARD_STARTFILE_PREFIX_1
+-#define STANDARD_STARTFILE_PREFIX_1 "/lib/"
++#define STANDARD_STARTFILE_PREFIX_1 ""
+ #endif
+ #ifndef STANDARD_STARTFILE_PREFIX_2
+-#define STANDARD_STARTFILE_PREFIX_2 "/usr/lib/"
++#define STANDARD_STARTFILE_PREFIX_2 ""
+ #endif
+ 
+ #ifdef CROSS_DIRECTORY_STRUCTURE  /* Don't use these prefixes for a cross compiler.  */
+@@ -1515,8 +1515,8 @@
+ /* For native compilers, these are well-known paths containing
+    components that may be provided by the system.  For cross
+    compilers, these paths are not used.  */
+-static const char *const standard_exec_prefix_1 = "/usr/libexec/gcc/";
+-static const char *const standard_exec_prefix_2 = "/usr/lib/gcc/";
++static const char *const standard_exec_prefix_1 = "/no-such-path/";
++static const char *const standard_exec_prefix_2 = "/no-such-path/";
+ static const char *md_exec_prefix = MD_EXEC_PREFIX;
+ static const char *md_startfile_prefix = MD_STARTFILE_PREFIX;
+ static const char *md_startfile_prefix_1 = MD_STARTFILE_PREFIX_1;
+diff -ru gcc-4.3.1-orig/gcc/Makefile.in gcc-4.3.1/gcc/Makefile.in
+--- gcc-4.3.1-orig/gcc/Makefile.in	2008-05-11 20:54:15.000000000 +0200
++++ gcc-4.3.1/gcc/Makefile.in	2008-06-25 17:48:23.000000000 +0200
+@@ -378,7 +378,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@
+ 
+@@ -3277,7 +3281,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\" \
+   -DPREFIX=\"$(prefix)/\" \
+diff -ru gcc-4.3.1-orig/libgomp/configure gcc-4.3.1/libgomp/configure
+--- gcc-4.3.1-orig/libgomp/configure	2008-01-24 17:23:13.000000000 +0100
++++ gcc-4.3.1/libgomp/configure	2008-06-26 11:23:49.000000000 +0200
+@@ -21493,6 +21493,11 @@
+ # A language specific compiler.
+ CC=$lt_compiler
+ 
++# 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_CFLAGS $NIX_EXTRA_LDFLAGS"
++
+ # Is the compiler the GNU compiler?
+ with_gcc=$GCC
+ 
+Only in gcc-4.3.1/libgomp: configure~
+diff -ru gcc-4.3.1-orig/libmudflap/configure gcc-4.3.1/libmudflap/configure
+--- gcc-4.3.1-orig/libmudflap/configure	2008-01-24 17:30:08.000000000 +0100
++++ gcc-4.3.1/libmudflap/configure	2008-06-26 11:23:11.000000000 +0200
+@@ -14229,6 +14229,11 @@
+ # A language specific compiler.
+ CC=$lt_compiler
+ 
++# 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_CFLAGS $NIX_EXTRA_LDFLAGS"
++
+ # Is the compiler the GNU compiler?
+ with_gcc=$GCC
+ 
+Only in gcc-4.3.1/libmudflap: configure~
+diff -ru gcc-4.3.1-orig/libssp/configure gcc-4.3.1/libssp/configure
+--- gcc-4.3.1-orig/libssp/configure	2008-01-24 17:33:29.000000000 +0100
++++ gcc-4.3.1/libssp/configure	2008-06-26 11:23:25.000000000 +0200
+@@ -12142,6 +12142,11 @@
+ # A language specific compiler.
+ CC=$lt_compiler
+ 
++# 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_CFLAGS $NIX_EXTRA_LDFLAGS"
++
+ # Is the compiler the GNU compiler?
+ with_gcc=$GCC
+ 
+Only in gcc-4.3.1/libssp: configure~
+diff -ru gcc-4.3.1-orig/Makefile.in gcc-4.3.1/Makefile.in
+--- gcc-4.3.1-orig/Makefile.in	2007-12-13 10:30:49.000000000 +0100
++++ gcc-4.3.1/Makefile.in	2008-06-25 17:48:23.000000000 +0200
+@@ -405,6 +405,14 @@
+ @host_makefile_frag@
+ ###
+ 
++CFLAGS += $(NIX_EXTRA_CFLAGS)
++CPPFLAGS_FOR_TARGET += $(NIX_EXTRA_CFLAGS)
++CXXFLAGS += $(NIX_EXTRA_CFLAGS)
++LDFLAGS += $(NIX_EXTRA_LDFLAGS)
++LDFLAGS_FOR_TARGET += $(NIX_EXTRA_LDFLAGS)
++BOOT_CFLAGS += $(NIX_EXTRA_CFLAGS)
++BOOT_LDFLAGS += $(NIX_EXTRA_LDFLAGS)
++
+ # This is the list of directories that may be needed in RPATH_ENVVAR
+ # so that prorgams built for the target machine work.
+ TARGET_LIB_PATH = $(TARGET_LIB_PATH_libstdc++-v3)$(TARGET_LIB_PATH_libmudflap)$(TARGET_LIB_PATH_libssp)$(TARGET_LIB_PATH_libgomp)$(HOST_LIB_PATH_gcc)
diff --git a/pkgs/development/compilers/gcc-4.4/pass-cxxcpp.patch b/pkgs/development/compilers/gcc-4.4/pass-cxxcpp.patch
new file mode 100644
index 0000000000000..9b0676d4fdc95
--- /dev/null
+++ b/pkgs/development/compilers/gcc-4.4/pass-cxxcpp.patch
@@ -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) \