From 5929f9d3bdb2094a85202d55d5e2c50ee3c82ae9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Wed, 28 Apr 2010 12:37:11 +0000 Subject: [PATCH] GCC 4.5.0. svn path=/nixpkgs/trunk/; revision=21403 --- pkgs/development/compilers/gcc-4.5/builder.sh | 171 ++++++++++++ .../development/compilers/gcc-4.5/default.nix | 264 ++++++++++++++++++ .../compilers/gcc-4.5/ghdl-ortho-cflags.patch | 111 ++++++++ .../compilers/gcc-4.5/gnat-cflags.patch | 33 +++ .../gcc-4.5/java-jvgenmain-link.patch | 17 ++ .../compilers/gcc-4.5/no-sys-dirs.patch | 54 ++++ .../compilers/gcc-4.5/pr41818.patch | 26 ++ .../development/compilers/gcc-4.5/sources.nix | 26 ++ .../compilers/gcc-4.5/update-gcc.sh | 1 + pkgs/top-level/all-packages.nix | 21 ++ 10 files changed, 724 insertions(+) create mode 100644 pkgs/development/compilers/gcc-4.5/builder.sh create mode 100644 pkgs/development/compilers/gcc-4.5/default.nix create mode 100644 pkgs/development/compilers/gcc-4.5/ghdl-ortho-cflags.patch create mode 100644 pkgs/development/compilers/gcc-4.5/gnat-cflags.patch create mode 100644 pkgs/development/compilers/gcc-4.5/java-jvgenmain-link.patch create mode 100644 pkgs/development/compilers/gcc-4.5/no-sys-dirs.patch create mode 100644 pkgs/development/compilers/gcc-4.5/pr41818.patch create mode 100644 pkgs/development/compilers/gcc-4.5/sources.nix create mode 120000 pkgs/development/compilers/gcc-4.5/update-gcc.sh diff --git a/pkgs/development/compilers/gcc-4.5/builder.sh b/pkgs/development/compilers/gcc-4.5/builder.sh new file mode 100644 index 000000000000..b9724e7ad50e --- /dev/null +++ b/pkgs/development/compilers/gcc-4.5/builder.sh @@ -0,0 +1,171 @@ +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 "$staticCompiler" = "1"; then + EXTRA_LDFLAGS="-static" +else + EXTRA_LDFLAGS="" +fi + +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. + extraFlags="$(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 + + # The path to the Glibc binaries such as `crti.o'. + glibc_libdir="$(cat $NIX_GCC/nix-support/orig-libc)/lib" + + else + # Hack: support impure environments. + extraFlags="-isystem /usr/include" + extraLDFlags="-L/usr/lib64 -L/usr/lib" + glibc_libdir="/usr/lib" + export NIX_FIXINC_DUMMY=/usr/include + fi + + extraFlags="-g0 -O2 -I$NIX_FIXINC_DUMMY $extraFlags" + extraLDFlags="--strip-debug -L$glibc_libdir -rpath $glibc_libdir $extraLDFlags" + + EXTRA_FLAGS="$extraFlags" + for i in $extraLDFlags; do + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,$i" + done + + if test -n "$targetConfig"; then + # Cross-compiling, we need gcc not to read ./specs in order to build + # the g++ compiler (after the specs for the cross-gcc are created). + # Having LIBRARY_PATH= makes gcc read the specs from ., and the build + # breaks. Having this variable comes from the default.nix code to bring + # gcj in. + unset LIBRARY_PATH + unset CPATH + if test -z "$crossStageStatic"; then + EXTRA_FLAGS_TARGET="-g0 -O2 -B${libcCross}/lib -idirafter ${libcCross}/include" + EXTRA_LDFLAGS_TARGET="-Wl,-L${libcCross}/lib" + fi + else + EXTRA_FLAGS_TARGET="$EXTRA_FLAGS" + EXTRA_LDFLAGS_TARGET="$EXTRA_LDFLAGS" + fi + + # CFLAGS_FOR_TARGET are needed for the libstdc++ configure script to find + # the startfiles. + # FLAGS_FOR_TARGET are needed for the target libraries to receive the -Bxxx + # for the startfiles. + makeFlagsArray=( \ + "${makeFlagsArray[@]}" \ + NATIVE_SYSTEM_HEADER_DIR="$NIX_FIXINC_DUMMY" \ + SYSTEM_HEADER_DIR="$NIX_FIXINC_DUMMY" \ + CFLAGS_FOR_BUILD="$EXTRA_FLAGS $EXTRA_LDFLAGS" \ + CFLAGS_FOR_TARGET="$EXTRA_FLAGS_TARGET $EXTRA_LDFLAGS_TARGET" \ + FLAGS_FOR_TARGET="$EXTRA_FLAGS_TARGET $EXTRA_LDFLAGS_TARGET" \ + LDFLAGS_FOR_BUILD="$EXTRA_FLAGS $EXTRA_LDFLAGS" \ + LDFLAGS_FOR_TARGET="$EXTRA_FLAGS_TARGET $EXTRA_LDFLAGS_TARGET" \ + ) + + if test -z "$targetConfig"; then + makeFlagsArray=( \ + "${makeFlagsArray[@]}" \ + BOOT_CFLAGS="$EXTRA_FLAGS $EXTRA_LDFLAGS" \ + BOOT_LDFLAGS="$EXTRA_FLAGS_TARGET $EXTRA_LDFLAGS_TARGET" \ + ) + fi + + if test -n "$targetConfig" -a "$crossStageStatic" == 1; then + # We don't want the gcc build to assume there will be a libc providing + # limits.h in this stagae + makeFlagsArray=( \ + "${makeFlagsArray[@]}" \ + LIMITS_H_TEST=false \ + ) + else + makeFlagsArray=( \ + "${makeFlagsArray[@]}" \ + LIMITS_H_TEST=true \ + ) + fi +fi + +if test -n "$targetConfig"; then + # The host strip will destroy some important details of the objects + dontStrip=1 +fi + +preConfigure() { + if test -n "$newlibSrc"; then + tar xvf "$newlibSrc" -C .. + ln -s ../newlib-*/newlib newlib + # Patch to get armvt5el working: + sed -i -e 's/ arm)/ arm*)/' newlib/configure.host + fi + # Bug - they packaged zlib + if test -d "zlib"; then + # This breaks the build without-headers, which should build only + # the target libgcc as target libraries. + # See 'configure:5370' + rm -Rf zlib + fi + + # 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 + + eval "$postInstallGhdl" +} + + +if test -z "$targetConfig"; then + if test -z "$profiledCompiler"; then + buildFlags="bootstrap $buildFlags" + else + buildFlags="profiledbootstrap $buildFlags" + fi +fi + +genericBuild diff --git a/pkgs/development/compilers/gcc-4.5/default.nix b/pkgs/development/compilers/gcc-4.5/default.nix new file mode 100644 index 000000000000..a70de4f4e504 --- /dev/null +++ b/pkgs/development/compilers/gcc-4.5/default.nix @@ -0,0 +1,264 @@ +{ stdenv, fetchurl, noSysDirs +, langC ? true, langCC ? true, langFortran ? false, langTreelang ? false +, langJava ? false +, langAda ? false +, langVhdl ? false +, profiledCompiler ? false +, staticCompiler ? false +, enableShared ? true +, texinfo ? null +, gmp, mpfr, mpc, gettext, which +, libelf # optional, for link-time optimizations (LTO) +, ppl ? null, cloogppl ? null # optional, for the Graphite optimization framework +, bison ? null, flex ? null +, zlib ? null, boehmgc ? null +, zip ? null, unzip ? null, pkgconfig ? null, gtk ? null, libart_lgpl ? null +, libX11 ? null, libXt ? null, libSM ? null, libICE ? null, libXtst ? null +, libXrender ? null, xproto ? null, renderproto ? null, xextproto ? null +, libXrandr ? null, libXi ? null, inputproto ? null, randrproto ? null +, gnatboot ? null +, enableMultilib ? false +, name ? "gcc" +, cross ? null +, binutilsCross ? null +, libcCross ? null +, crossStageStatic ? true +, gnat ? null +}: + +assert langTreelang -> bison != null && flex != null; +assert langJava -> zip != null && unzip != null + && zlib != null && boehmgc != null; +assert langAda -> gnatboot != null; +assert langVhdl -> gnat != null; + +# LTO needs libelf and zlib. +assert libelf != null -> zlib != null; + +with stdenv.lib; + +let version = "4.5.0"; + javaEcj = fetchurl { + # The `$(top_srcdir)/ecj.jar' file is automatically picked up at + # `configure' time. + + # XXX: Eventually we might want to take it from upstream. + url = "ftp://sourceware.org/pub/java/ecj-4.3.jar"; + sha256 = "0jz7hvc0s6iydmhgh5h2m15yza7p2rlss2vkif30vm9y77m97qcx"; + }; + + # Antlr (optional) allows the Java `gjdoc' tool to be built. We want a + # binary distribution here to allow the whole chain to be bootstrapped. + javaAntlr = fetchurl { + url = http://www.antlr.org/download/antlr-3.1.3.jar; + sha256 = "1f41j0y4kjydl71lqlvr73yagrs2jsg1fjymzjz66mjy7al5lh09"; + }; + + xlibs = [ + libX11 libXt libSM libICE libXtst libXrender libXrandr libXi + xproto renderproto xextproto inputproto randrproto + ]; + + javaAwtGtk = langJava && gtk != null; + + /* Cross-gcc settings */ + gccArch = stdenv.lib.attrByPath [ "gcc" "arch" ] null cross; + gccCpu = stdenv.lib.attrByPath [ "gcc" "cpu" ] null cross; + gccAbi = stdenv.lib.attrByPath [ "gcc" "abi" ] null cross; + withArch = if gccArch != null then " --with-arch=${gccArch}" else ""; + withCpu = if gccCpu != null then " --with-cpu=${gccCpu}" else ""; + withAbi = if gccAbi != null then " --with-abi=${gccAbi}" else ""; + + crossConfigureFlags = + "--target=${cross.config}" + + withArch + + withCpu + + withAbi + + (if crossStageStatic then + " --disable-libssp --disable-nls" + + " --without-headers" + + " --disable-threads " + + " --disable-libmudflap " + + " --disable-libgomp " + + " --disable-shared" + + " --disable-decimal-float" # libdecnumber requires libc + " --disable-multilib" + else + " --with-headers=${libcCross}/include" + + " --enable-__cxa_atexit" + + " --enable-long-long" + + " --enable-threads=posix" + + " --enable-nls" + + " --disable-decimal-float" # No final libdecnumber (it may work only in 386) + ); + stageNameAddon = if (crossStageStatic) then "-stage-static" else + "-stage-final"; + crossNameAddon = if (cross != null) then "-${cross.config}" + stageNameAddon else ""; + +in + +# We need all these X libraries when building AWT with GTK+. +assert gtk != null -> (filter (x: x == null) xlibs) == []; + +stdenv.mkDerivation ({ + name = "${name}-${version}" + crossNameAddon; + + builder = ./builder.sh; + + src = (import ./sources.nix) { + inherit fetchurl optional version; + inherit langC langCC langFortran langJava langAda; + }; + + patches = + [ ] + ++ optional noSysDirs ./no-sys-dirs.patch + # The GNAT Makefiles did not pay attention to CFLAGS_FOR_TARGET for its + # target libraries and tools. + ++ optional langAda ./gnat-cflags.patch + ++ optional langVhdl ./ghdl-ortho-cflags.patch + ++ optional (cross != null && cross.arch == "sparc64") ./pr41818.patch; + + inherit noSysDirs profiledCompiler staticCompiler langJava crossStageStatic + libcCross; + + buildInputs = [ texinfo gmp mpfr mpc libelf gettext which ] + ++ (optional (ppl != null) ppl) + ++ (optional (cloogppl != null) cloogppl) + ++ (optionals langTreelang [bison flex]) + ++ (optional (zlib != null) zlib) + ++ (optional (boehmgc != null) boehmgc) + ++ (optionals langJava [zip unzip]) + ++ (optionals javaAwtGtk [gtk pkgconfig libart_lgpl] ++ xlibs) + ++ (optionals (cross != null) [binutilsCross]) + ++ (optionals langAda [gnatboot]) + ++ (optionals langVhdl [gnat]) + ; + + configureFlags = " + ${if enableMultilib then "" else "--disable-multilib"} + ${if enableShared then "" else "--disable-shared"} + ${if ppl != null then "--with-ppl=${ppl}" else ""} + ${if cloogppl != null then "--with-cloog=${cloogppl}" else ""} + ${if langJava then "--with-ecj-jar=${javaEcj}" else ""} + ${if javaAwtGtk then "--enable-java-awt=gtk" else ""} + ${if langJava && javaAntlr != null then "--with-antlr-jar=${javaAntlr}" else ""} + --with-gmp=${gmp} + --with-mpfr=${mpfr} + --with-mpc=${mpc} + ${if (libelf != null) then "--with-libelf=${libelf}" else ""} + --disable-libstdcxx-pch + --without-included-gettext + --with-system-zlib + --enable-languages=${ + concatStrings (intersperse "," + ( optional langC "c" + ++ optional langCC "c++" + ++ optional langFortran "fortran" + ++ optional langJava "java" + ++ optional langTreelang "treelang" + ++ optional langAda "ada" + ++ optional langVhdl "vhdl" + ) + ) + } + ${if langAda then " --enable-libada" else ""} + ${if (cross == null && stdenv.isi686) then "--with-arch=i686" else ""} + ${if cross != null then crossConfigureFlags else ""} + "; + + targetConfig = if (cross != null) then cross.config else null; + + # Needed for the cross compilation to work + AR = "ar"; + LD = "ld"; + CC = "gcc"; + + # Setting $CPATH and $LIBRARY_PATH to make sure both `gcc' and `xgcc' find + # the library headers and binaries, regarless of the language being + # compiled. + + # Note: When building the Java AWT GTK+ peer, the build system doesn't + # honor `--with-gmp' et al., e.g., when building + # `libjava/classpath/native/jni/java-math/gnu_java_math_GMP.c', so we just + # add them to $CPATH and $LIBRARY_PATH in this case. + # + # Likewise, the LTO code doesn't find zlib. + + CPATH = concatStrings + (intersperse ":" (map (x: x + "/include") + (optionals (zlib != null) [ zlib ] + ++ optionals langJava [ boehmgc ] + ++ optionals javaAwtGtk xlibs + ++ optionals javaAwtGtk [ gmp mpfr ]))); + + LIBRARY_PATH = concatStrings + (intersperse ":" (map (x: x + "/lib") + (optionals (zlib != null) [ zlib ] + ++ optionals langJava [ boehmgc ] + ++ optionals javaAwtGtk xlibs + ++ optionals javaAwtGtk [ gmp mpfr ]))); + + + passthru = { inherit langC langCC langAda langFortran langTreelang langVhdl + enableMultilib; }; + + meta = { + homepage = http://gcc.gnu.org/; + license = "GPLv3+"; # runtime support libraries are typically LGPLv3+ + description = "GNU Compiler Collection, version ${version}"; + + longDescription = '' + The GNU Compiler Collection includes compiler front ends for C, C++, + Objective-C, Fortran, OpenMP for C/C++/Fortran, Java, and Ada, as well + as libraries for these languages (libstdc++, libgcj, libgomp,...). + + GCC development is a part of the GNU Project, aiming to improve the + compiler used in the GNU system including the GNU/Linux variant. + ''; + + maintainers = [ + stdenv.lib.maintainers.ludo + stdenv.lib.maintainers.viric + ]; + + # Volunteers needed for the {Cyg,Dar}win ports of *PPL. + # gnatboot is not available out of linux platforms, so we disable the darwin build + # for the gnat (ada compiler). + platforms = stdenv.lib.platforms.linux ++ optionals (langAda == false) [ "i686-darwin" ]; + }; +} +// (if langVhdl then rec { + name = "ghdl-0.29"; + + ghdlSrc = fetchurl { + url = "http://ghdl.free.fr/ghdl-0.29.tar.bz2"; + sha256 = "15mlinr1lwljwll9ampzcfcrk9bk0qpdks1kxlvb70xf9zhh2jva"; + }; + + # Ghdl has some timestamps checks, storing file timestamps in '.cf' files. + # As we will change the timestamps to 1970-01-01 00:00:01, we also set the + # content of that .cf to that value. This way ghdl does not complain on + # the installed object files from the basic libraries (ieee, ...) + postInstallGhdl = '' + pushd $out + find . -name "*.cf" -exec \ + sed 's/[0-9]*\.000" /19700101000001.000" /g' -i {} \; + popd + ''; + + postUnpack = '' + tar xvf ${ghdlSrc} + mv ghdl-*/vhdl gcc*/gcc + rm -Rf ghdl-* + ''; + + meta = { + homepage = "http://ghdl.free.fr/"; + license = "GPLv2+"; + description = "Complete VHDL simulator, using the GCC technology (gcc ${version})"; + maintainers = with stdenv.lib.maintainers; [viric]; + platforms = with stdenv.lib.platforms; linux; + }; + +} else {})) diff --git a/pkgs/development/compilers/gcc-4.5/ghdl-ortho-cflags.patch b/pkgs/development/compilers/gcc-4.5/ghdl-ortho-cflags.patch new file mode 100644 index 000000000000..901534591c8f --- /dev/null +++ b/pkgs/development/compilers/gcc-4.5/ghdl-ortho-cflags.patch @@ -0,0 +1,111 @@ +diff --git a/gcc/vhdl/Make-lang.in b/gcc/vhdl/Make-lang.in +index 8f481df..681ac59 100644 +--- a/gcc/vhdl/Make-lang.in ++++ b/gcc/vhdl/Make-lang.in +@@ -96,7 +96,7 @@ AGCC_GCCOBJ_DIR=../ + AGCC_INC_FLAGS=-I$(AGCC_GCCOBJ_DIR)/gcc -I$(AGCC_GCCSRC_DIR)/include \ + -I$(AGCC_GCCSRC_DIR)/gcc -I$(AGCC_GCCSRC_DIR)/gcc/config \ + -I$(AGCC_GCCSRC_DIR)/libcpp/include +-AGCC_CFLAGS=-g -Wall -DIN_GCC $(AGCC_INC_FLAGS) ++AGCC_CFLAGS=-g -Wall -DIN_GCC $(AGCC_INC_FLAGS) $(CFLAGS) $(INCLUDES) + + AGCC_LOCAL_OBJS=ortho-lang.o + +@@ -140,7 +140,7 @@ ghdl$(exeext): force + + # Ghdl libraries. + ghdllib: ghdl$(exeext) $(GCC_PASSES) force +- $(MAKE_IN_VHDL) GRT_FLAGS="-O -g" ghdllib ++ $(MAKE_IN_VHDL) GRT_FLAGS="-O -g $(CFLAGS)" ghdllib + + # Build hooks: + +diff --git a/gcc/vhdl/Makefile.in b/gcc/vhdl/Makefile.in +index d754c6c..07abc4a 100644 +--- a/gcc/vhdl/Makefile.in ++++ b/gcc/vhdl/Makefile.in +@@ -80,7 +80,8 @@ T_CPPFLAGS = + X_ADAFLAGS = + T_ADAFLAGS = + +-ADAC = $(CC) ++# Never use the bootstrapped compiler, as it may not be built for ada ++ADAC = gcc + + ECHO = echo + CHMOD = chmod +diff --git a/gcc/vhdl/ortho-lang.c b/gcc/vhdl/ortho-lang.c +index 84aeb92..8eddd42 100644 +--- a/gcc/vhdl/ortho-lang.c ++++ b/gcc/vhdl/ortho-lang.c +@@ -16,6 +16,7 @@ + #include "options.h" + #include "real.h" +-#include "tree-gimple.h" ++#include "gimple.h" ++#include "tree.h" + #include "function.h" + #include "cgraph.h" + #include "target.h" +@@ -680,38 +681,10 @@ type_for_mode (enum machine_mode mode, int unsignedp) + + const struct lang_hooks lang_hooks = LANG_HOOKS_INITIALIZER; + +-/* Tree code classes. */ +- +-#define DEFTREECODE(SYM, NAME, TYPE, LENGTH) TYPE, +- +-const enum tree_code_class tree_code_type[] = { +-#include "tree.def" +- 'x' +-}; +-#undef DEFTREECODE +- +-/* Table indexed by tree code giving number of expression +- operands beyond the fixed part of the node structure. +- Not used for types or decls. */ +- +-#define DEFTREECODE(SYM, NAME, TYPE, LENGTH) LENGTH, +- +-const unsigned char tree_code_length[] = { +-#include "tree.def" +- 0 +-}; +-#undef DEFTREECODE +- +-#define DEFTREECODE(SYM, NAME, TYPE, LENGTH) NAME, +-const char * const tree_code_name[] = { +-#include "tree.def" +- "@@dummy" +-}; +-#undef DEFTREECODE + + union lang_tree_node + GTY((desc ("0"), +- chain_next ("(union lang_tree_node *) GENERIC_NEXT (&%h.generic)"))) ++ chain_next ("(union lang_tree_node *) TREE_CHAIN (&%h.generic)"))) + { + union tree_node GTY ((tag ("0"))) generic; + }; +@@ -1162,7 +1135,7 @@ new_access_type (tree dtype) + res = make_node (POINTER_TYPE); + TREE_TYPE (res) = NULL_TREE; + /* Seems necessary. */ +- TYPE_MODE (res) = Pmode; ++ SET_TYPE_MODE (res, Pmode); + layout_type (res); + return res; + } +diff --git a/gcc/vhdl/Make-lang.in b/gcc/vhdl/Make-lang.in +index e201f64..f36fb97 100644 +--- a/gcc/vhdl/Make-lang.in ++++ b/gcc/vhdl/Make-lang.in +@@ -132,7 +132,7 @@ ghdl1$(exeext): $(AGCC_OBJS) $(AGCC_DEPS) force + -cargs $(CFLAGS) $(GHDL_ADAFLAGS) + $(GNATMAKE) -o $@ -aI$(srcdir)/vhdl -aOvhdl ortho_gcc-main \ + -bargs -E -cargs $(CFLAGS) $(GHDL_ADAFLAGS) \ +- -largs $(AGCC_OBJS) $(LIBS) $(GMPLIBS) ++ -largs $(AGCC_OBJS) $(LIBS) $(GMPLIBS) $(CLOOGLIBS) $(PPLLIBS) + + # The driver for ghdl. + ghdl$(exeext): force diff --git a/pkgs/development/compilers/gcc-4.5/gnat-cflags.patch b/pkgs/development/compilers/gcc-4.5/gnat-cflags.patch new file mode 100644 index 000000000000..e85e5076be69 --- /dev/null +++ b/pkgs/development/compilers/gcc-4.5/gnat-cflags.patch @@ -0,0 +1,33 @@ +diff --git a/libada/Makefile.in b/libada/Makefile.in +index f5057a0..337e0c6 100644 +--- a/libada/Makefile.in ++++ b/libada/Makefile.in +@@ -55,7 +55,7 @@ GCC_WARN_CFLAGS = $(LOOSE_WARN) + WARN_CFLAGS = @warn_cflags@ + + TARGET_LIBGCC2_CFLAGS= +-GNATLIBCFLAGS= -g -O2 ++GNATLIBCFLAGS= -g -O2 $(CFLAGS) + GNATLIBCFLAGS_FOR_C = $(GNATLIBCFLAGS) $(TARGET_LIBGCC2_CFLAGS) -fexceptions \ + -DIN_RTS @have_getipinfo@ + +--- a/gcc/ada/gcc-interface/Makefile.in ++++ b/gcc/ada/gcc-interface/Makefile.in +@@ -105,7 +105,7 @@ ADAFLAGS = -W -Wall -gnatpg -gnata + SOME_ADAFLAGS =-gnata + FORCE_DEBUG_ADAFLAGS = -g + GNATLIBFLAGS = -gnatpg -nostdinc +-GNATLIBCFLAGS = -g -O2 ++GNATLIBCFLAGS = -g -O2 $(CFLAGS_FOR_TARGET) + # Pretend that _Unwind_GetIPInfo is available for the target by default. This + # should be autodetected during the configuration of libada and passed down to + # here, but we need something for --disable-libada and hope for the best. +@@ -1838,7 +1838,7 @@ ADA_INCLUDE_SRCS =\ + + LIBGNAT=../$(RTSDIR)/libgnat.a + +-GCC_LINK=$(CC) -static-libgcc $(ADA_INCLUDES) ++GCC_LINK=$(CC) -static-libgcc $(CFLAGS_FOR_TARGET) $(ADA_INCLUDES) + + # when compiling the tools, the runtime has to be first on the path so that + # it hides the runtime files lying with the rest of the sources diff --git a/pkgs/development/compilers/gcc-4.5/java-jvgenmain-link.patch b/pkgs/development/compilers/gcc-4.5/java-jvgenmain-link.patch new file mode 100644 index 000000000000..2612e8bfbbbc --- /dev/null +++ b/pkgs/development/compilers/gcc-4.5/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.5/no-sys-dirs.patch b/pkgs/development/compilers/gcc-4.5/no-sys-dirs.patch new file mode 100644 index 000000000000..8128fa87da5f --- /dev/null +++ b/pkgs/development/compilers/gcc-4.5/no-sys-dirs.patch @@ -0,0 +1,54 @@ +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. */ +--- 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 --git a/pkgs/development/compilers/gcc-4.5/pr41818.patch b/pkgs/development/compilers/gcc-4.5/pr41818.patch new file mode 100644 index 000000000000..98731c460679 --- /dev/null +++ b/pkgs/development/compilers/gcc-4.5/pr41818.patch @@ -0,0 +1,26 @@ +From . This fixes compilation +of the sparc64-linux-gnu cross-compiler with shared libraries. + +--- trunk/Makefile.in 2010/01/07 19:21:46 155705 ++++ trunk/Makefile.in 2010/01/07 19:53:50 155706 +@@ -259,7 +259,7 @@ + # directories built for the target. + TARGET_CONFIGARGS = @target_configargs@ --with-target-subdir="$(TARGET_SUBDIR)" + # This is the list of variables to export in the environment when +-# configuring subdirectories for the host system. ++# configuring subdirectories for the target system. + BASE_TARGET_EXPORTS = \ + $(BASE_EXPORTS) \ + AR="$(AR_FOR_TARGET)"; export AR; \ +@@ -281,7 +281,10 @@ + STRIP="$(STRIP_FOR_TARGET)"; export STRIP; \ + WINDRES="$(WINDRES_FOR_TARGET)"; export WINDRES; \ + WINDMC="$(WINDMC_FOR_TARGET)"; export WINDMC; \ +- $(RPATH_ENVVAR)=`echo "$(HOST_LIB_PATH)$(TARGET_LIB_PATH)$$$(RPATH_ENVVAR)" | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'`; export $(RPATH_ENVVAR); ++@if gcc-bootstrap ++ $(RPATH_ENVVAR)=`echo "$(TARGET_LIB_PATH)$$$(RPATH_ENVVAR)" | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'`; export $(RPATH_ENVVAR); \ ++@endif gcc-bootstrap ++ $(RPATH_ENVVAR)=`echo "$(HOST_LIB_PATH)$$$(RPATH_ENVVAR)" | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'`; export $(RPATH_ENVVAR); + + RAW_CXX_TARGET_EXPORTS = \ + $(BASE_TARGET_EXPORTS) \ diff --git a/pkgs/development/compilers/gcc-4.5/sources.nix b/pkgs/development/compilers/gcc-4.5/sources.nix new file mode 100644 index 000000000000..4a9201d08eb4 --- /dev/null +++ b/pkgs/development/compilers/gcc-4.5/sources.nix @@ -0,0 +1,26 @@ +/* Automatically generated by `update-gcc.sh', do not edit. + For GCC 4.5.0. */ +{ fetchurl, optional, version, langC, langCC, langFortran, langJava, langAda }: + +assert version == "4.5.0"; +optional /* langC */ true (fetchurl { + url = "mirror://gcc/releases/gcc-${version}/gcc-core-${version}.tar.bz2"; + sha256 = "19ykzyd938d4pblsihrsalk9ch1s23z57s0r5an8sqs7acv51r0g"; +}) ++ +optional langCC (fetchurl { + url = "mirror://gcc/releases/gcc-${version}/gcc-g++-${version}.tar.bz2"; + sha256 = "0hialil4v2hi7klr14x6h5z7b9ryzzy9kchr96s2p9hmsm7famlk"; +}) ++ +optional langFortran (fetchurl { + url = "mirror://gcc/releases/gcc-${version}/gcc-fortran-${version}.tar.bz2"; + sha256 = "0anby974dikygjmxr6h1pd9s24fdps84fki1dijzhqqvq6lr3hbb"; +}) ++ +optional langJava (fetchurl { + url = "mirror://gcc/releases/gcc-${version}/gcc-java-${version}.tar.bz2"; + sha256 = "0mlbxyhj7svjgby5vrpc49l2vk0k0878nlx0ap6jqq7xdyysvlcn"; +}) ++ +optional langAda (fetchurl { + url = "mirror://gcc/releases/gcc-${version}/gcc-ada-${version}.tar.bz2"; + sha256 = "1yar842bixmh2n9siy8s383lg8mz611xjdbbacgcznwab601czzv"; +}) ++ +[] diff --git a/pkgs/development/compilers/gcc-4.5/update-gcc.sh b/pkgs/development/compilers/gcc-4.5/update-gcc.sh new file mode 120000 index 000000000000..dd7bcd60c1b4 --- /dev/null +++ b/pkgs/development/compilers/gcc-4.5/update-gcc.sh @@ -0,0 +1 @@ +../gcc-4.4/update-gcc.sh \ No newline at end of file diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 8ad2d4fb48f0..18b90e1cbbc4 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -2059,6 +2059,13 @@ let profiledCompiler = true; })); + gcc45 = lowPrio (wrapGCC (makeOverridable (import ../development/compilers/gcc-4.5) { + inherit fetchurl stdenv texinfo gmp mpfr mpc libelf zlib + ppl cloogppl + gettext which noSysDirs; + profiledCompiler = true; + })); + gccApple = wrapGCC ( (if stdenv.system == "i686-darwin" then import ../development/compilers/gcc-apple else import ../development/compilers/gcc-apple64) { inherit fetchurl stdenv noSysDirs; @@ -2126,6 +2133,20 @@ let libXrandr xproto renderproto xextproto inputproto randrproto; }); + gcj45 = wrapGCC (gcc45.gcc.override { + name = "gcj"; + langJava = true; + langFortran = false; + langCC = true; + langC = false; + profiledCompiler = false; + inherit zip unzip zlib boehmgc gettext pkgconfig; + inherit (gtkLibs) gtk; + inherit (gnome) libart_lgpl; + inherit (xlibs) libX11 libXt libSM libICE libXtst libXi libXrender + libXrandr xproto renderproto xextproto inputproto randrproto; + }); + gnat = gnat44; gnat44 = wrapGCC (gcc44_real.gcc.override {