From 642b07f9887482c973609d7421b7965ec37a5873 Mon Sep 17 00:00:00 2001 From: Peter Simons Date: Thu, 4 Apr 2013 13:55:20 +0200 Subject: [PATCH] gcc: add version 4.8.0 --- .../compilers/gcc/4.8/arm-eabi.patch | 230 ++++++++ pkgs/development/compilers/gcc/4.8/builder.sh | 245 ++++++++ .../development/compilers/gcc/4.8/default.nix | 525 ++++++++++++++++++ .../compilers/gcc/4.8/gfortran-driving.patch | 20 + .../compilers/gcc/4.8/gnat-cflags.patch | 33 ++ .../gcc/4.8/java-jvgenmain-link.patch | 17 + .../compilers/gcc/4.8/libstdc++-target.patch | 32 ++ .../compilers/gcc/4.8/no-sys-dirs.patch | 41 ++ pkgs/top-level/all-packages.nix | 26 + 9 files changed, 1169 insertions(+) create mode 100644 pkgs/development/compilers/gcc/4.8/arm-eabi.patch create mode 100644 pkgs/development/compilers/gcc/4.8/builder.sh create mode 100644 pkgs/development/compilers/gcc/4.8/default.nix create mode 100644 pkgs/development/compilers/gcc/4.8/gfortran-driving.patch create mode 100644 pkgs/development/compilers/gcc/4.8/gnat-cflags.patch create mode 100644 pkgs/development/compilers/gcc/4.8/java-jvgenmain-link.patch create mode 100644 pkgs/development/compilers/gcc/4.8/libstdc++-target.patch create mode 100644 pkgs/development/compilers/gcc/4.8/no-sys-dirs.patch diff --git a/pkgs/development/compilers/gcc/4.8/arm-eabi.patch b/pkgs/development/compilers/gcc/4.8/arm-eabi.patch new file mode 100644 index 000000000000..63b017062b5b --- /dev/null +++ b/pkgs/development/compilers/gcc/4.8/arm-eabi.patch @@ -0,0 +1,230 @@ +Index: gcc-4_7-branch/libstdc++-v3/configure.host +=================================================================== +--- gcc-4_7-branch/libstdc++-v3/configure.host (revision 194579) ++++ gcc-4_7-branch/libstdc++-v3/configure.host (revision 194580) +@@ -340,7 +340,7 @@ + fi + esac + case "${host}" in +- arm*-*-linux-*eabi) ++ arm*-*-linux-*eabi*) + port_specific_symbol_files="\$(srcdir)/../config/os/gnu-linux/arm-eabi-extra.ver" + ;; + esac +Index: gcc-4_7-branch/libstdc++-v3/testsuite/20_util/make_signed/requirements/typedefs-2.cc +=================================================================== +--- gcc-4_7-branch/libstdc++-v3/testsuite/20_util/make_signed/requirements/typedefs-2.cc (revision 194579) ++++ gcc-4_7-branch/libstdc++-v3/testsuite/20_util/make_signed/requirements/typedefs-2.cc (revision 194580) +@@ -1,5 +1,5 @@ + // { dg-options "-std=gnu++0x -funsigned-char -fshort-enums" } +-// { dg-options "-std=gnu++0x -funsigned-char -fshort-enums -Wl,--no-enum-size-warning" { target arm*-*-linux*eabi } } ++// { dg-options "-std=gnu++0x -funsigned-char -fshort-enums -Wl,--no-enum-size-warning" { target arm*-*-linux*eabi* } } + + // 2007-05-03 Benjamin Kosnik + // +Index: gcc-4_7-branch/libstdc++-v3/testsuite/20_util/make_unsigned/requirements/typedefs-2.cc +=================================================================== +--- gcc-4_7-branch/libstdc++-v3/testsuite/20_util/make_unsigned/requirements/typedefs-2.cc (revision 194579) ++++ gcc-4_7-branch/libstdc++-v3/testsuite/20_util/make_unsigned/requirements/typedefs-2.cc (revision 194580) +@@ -1,5 +1,5 @@ + // { dg-options "-std=gnu++0x -funsigned-char -fshort-enums" } +-// { dg-options "-std=gnu++0x -funsigned-char -fshort-enums -Wl,--no-enum-size-warning" { target arm*-*-linux*eabi } } ++// { dg-options "-std=gnu++0x -funsigned-char -fshort-enums -Wl,--no-enum-size-warning" { target arm*-*-linux*eabi* } } + + // 2007-05-03 Benjamin Kosnik + // +Index: gcc-4_7-branch/libjava/configure.ac +=================================================================== +--- gcc-4_7-branch/libjava/configure.ac (revision 194579) ++++ gcc-4_7-branch/libjava/configure.ac (revision 194580) +@@ -931,7 +931,7 @@ + # on Darwin -single_module speeds up loading of the dynamic libraries. + extra_ldflags_libjava=-Wl,-single_module + ;; +-arm*linux*eabi) ++arm*-*-linux*eabi*) + # Some of the ARM unwinder code is actually in libstdc++. We + # could in principle replicate it in libgcj, but it's better to + # have a dependency on libstdc++. +Index: gcc-4_7-branch/libjava/configure +=================================================================== +--- gcc-4_7-branch/libjava/configure (revision 194579) ++++ gcc-4_7-branch/libjava/configure (revision 194580) +@@ -20542,7 +20542,7 @@ + # on Darwin -single_module speeds up loading of the dynamic libraries. + extra_ldflags_libjava=-Wl,-single_module + ;; +-arm*linux*eabi) ++arm*-*-linux*eabi*) + # Some of the ARM unwinder code is actually in libstdc++. We + # could in principle replicate it in libgcj, but it's better to + # have a dependency on libstdc++. +Index: gcc-4_7-branch/libgcc/config.host +=================================================================== +--- gcc-4_7-branch/libgcc/config.host (revision 194579) ++++ gcc-4_7-branch/libgcc/config.host (revision 194580) +@@ -327,7 +327,7 @@ + arm*-*-linux*) # ARM GNU/Linux with ELF + tmake_file="${tmake_file} arm/t-arm t-fixedpoint-gnu-prefix" + case ${host} in +- arm*-*-linux-*eabi) ++ arm*-*-linux-*eabi*) + tmake_file="${tmake_file} arm/t-elf arm/t-bpabi arm/t-linux-eabi t-slibgcc-libgcc" + tm_file="$tm_file arm/bpabi-lib.h" + unwind_header=config/arm/unwind-arm.h +Index: gcc-4_7-branch/gcc/doc/install.texi +=================================================================== +--- gcc-4_7-branch/gcc/doc/install.texi (revision 194579) ++++ gcc-4_7-branch/gcc/doc/install.texi (revision 194580) +@@ -3222,7 +3222,7 @@ + @heading @anchor{arm-x-eabi}arm-*-eabi + ARM-family processors. Subtargets that use the ELF object format + require GNU binutils 2.13 or newer. Such subtargets include: +-@code{arm-*-netbsdelf}, @code{arm-*-*linux-gnueabi} ++@code{arm-*-netbsdelf}, @code{arm-*-*linux-gnueabi*} + and @code{arm-*-rtemseabi}. + + @html +Index: gcc-4_7-branch/gcc/testsuite/gcc.target/arm/synchronize.c +=================================================================== +--- gcc-4_7-branch/gcc/testsuite/gcc.target/arm/synchronize.c (revision 194579) ++++ gcc-4_7-branch/gcc/testsuite/gcc.target/arm/synchronize.c (revision 194580) +@@ -1,4 +1,4 @@ +-/* { dg-final { scan-assembler "__sync_synchronize|dmb|mcr" { target arm*-*-linux-*eabi } } } */ ++/* { dg-final { scan-assembler "__sync_synchronize|dmb|mcr" { target arm*-*-linux-*eabi* } } } */ + + void *foo (void) + { +Index: gcc-4_7-branch/gcc/testsuite/g++.old-deja/g++.jason/enum6.C +=================================================================== +--- gcc-4_7-branch/gcc/testsuite/g++.old-deja/g++.jason/enum6.C (revision 194579) ++++ gcc-4_7-branch/gcc/testsuite/g++.old-deja/g++.jason/enum6.C (revision 194580) +@@ -7,10 +7,10 @@ + // enum-size attributes should only be emitted if there are values of + // enum type that can escape the compilation unit, gcc cannot currently + // detect this; if this facility is added then this linker option should +-// not be needed. arm-*-linux*eabi should be a good approximation to ++// not be needed. arm-*-linux*eabi* should be a good approximation to + // those platforms where the EABI supplement defines enum values to be + // 32 bits wide. +-// { dg-options "-fshort-enums -Wl,--no-enum-size-warning" { target arm*-*-linux*eabi } } ++// { dg-options "-fshort-enums -Wl,--no-enum-size-warning" { target arm*-*-linux*eabi* } } + + #include + +Index: gcc-4_7-branch/gcc/testsuite/g++.old-deja/g++.other/enum4.C +=================================================================== +--- gcc-4_7-branch/gcc/testsuite/g++.old-deja/g++.other/enum4.C (revision 194579) ++++ gcc-4_7-branch/gcc/testsuite/g++.old-deja/g++.other/enum4.C (revision 194580) +@@ -9,10 +9,10 @@ + // enum-size attributes should only be emitted if there are values of + // enum type that can escape the compilation unit, gcc cannot currently + // detect this; if this facility is added then this linker option should +-// not be needed. arm-*-linux*eabi should be a good approximation to ++// not be needed. arm-*-linux*eabi* should be a good approximation to + // those platforms where the EABI supplement defines enum values to be + // 32 bits wide. +-// { dg-options "-fshort-enums -Wl,--no-enum-size-warning" { target arm*-*-linux*eabi } } ++// { dg-options "-fshort-enums -Wl,--no-enum-size-warning" { target arm*-*-linux*eabi* } } + + enum E { + a = -312 +Index: gcc-4_7-branch/gcc/testsuite/g++.old-deja/g++.law/enum9.C +=================================================================== +--- gcc-4_7-branch/gcc/testsuite/g++.old-deja/g++.law/enum9.C (revision 194579) ++++ gcc-4_7-branch/gcc/testsuite/g++.old-deja/g++.law/enum9.C (revision 194580) +@@ -7,10 +7,10 @@ + // enum-size attributes should only be emitted if there are values of + // enum type that can escape the compilation unit, gcc cannot currently + // detect this; if this facility is added then this linker option should +-// not be needed. arm-*-linux*eabi should be a good approximation to ++// not be needed. arm-*-linux*eabi* should be a good approximation to + // those platforms where the EABI supplement defines enum values to be + // 32 bits wide. +-// { dg-options "-fshort-enums -Wl,--no-enum-size-warning" { target arm*-*-linux*eabi } } ++// { dg-options "-fshort-enums -Wl,--no-enum-size-warning" { target arm*-*-linux*eabi* } } + + // GROUPS passed enums + extern "C" int printf (const char *, ...); +Index: gcc-4_7-branch/gcc/testsuite/lib/target-supports.exp +=================================================================== +--- gcc-4_7-branch/gcc/testsuite/lib/target-supports.exp (revision 194579) ++++ gcc-4_7-branch/gcc/testsuite/lib/target-supports.exp (revision 194580) +@@ -3818,7 +3818,7 @@ + } + } "" + }] +- } elseif { [istarget arm*-*-linux-gnueabi] } { ++ } elseif { [istarget arm*-*-linux-gnueabi*] } { + return [check_runtime sync_longlong_runtime { + #include + int main () +@@ -3860,7 +3860,7 @@ + || [istarget i?86-*-*] + || [istarget x86_64-*-*] + || [istarget alpha*-*-*] +- || [istarget arm*-*-linux-gnueabi] ++ || [istarget arm*-*-linux-gnueabi*] + || [istarget bfin*-*linux*] + || [istarget hppa*-*linux*] + || [istarget s390*-*-*] +@@ -3890,7 +3890,7 @@ + || [istarget i?86-*-*] + || [istarget x86_64-*-*] + || [istarget alpha*-*-*] +- || [istarget arm*-*-linux-gnueabi] ++ || [istarget arm*-*-linux-gnueabi*] + || [istarget hppa*-*linux*] + || [istarget s390*-*-*] + || [istarget powerpc*-*-*] +Index: gcc-4_7-branch/gcc/testsuite/gfortran.dg/enum_9.f90 +=================================================================== +--- gcc-4_7-branch/gcc/testsuite/gfortran.dg/enum_9.f90 (revision 194579) ++++ gcc-4_7-branch/gcc/testsuite/gfortran.dg/enum_9.f90 (revision 194580) +@@ -1,6 +1,6 @@ + ! { dg-do run } + ! { dg-options "-fshort-enums" } +-! { dg-options "-fshort-enums -Wl,--no-enum-size-warning" { target arm*-*-linux*eabi } } ++! { dg-options "-fshort-enums -Wl,--no-enum-size-warning" { target arm*-*-linux*eabi* } } + ! Program to test enumerations when option -fshort-enums is given + + program main +Index: gcc-4_7-branch/gcc/testsuite/gfortran.dg/enum_10.f90 +=================================================================== +--- gcc-4_7-branch/gcc/testsuite/gfortran.dg/enum_10.f90 (revision 194579) ++++ gcc-4_7-branch/gcc/testsuite/gfortran.dg/enum_10.f90 (revision 194580) +@@ -1,7 +1,7 @@ + ! { dg-do run } + ! { dg-additional-sources enum_10.c } + ! { dg-options "-fshort-enums -w" } +-! { dg-options "-fshort-enums -w -Wl,--no-enum-size-warning" { target arm*-*-linux*eabi } } ++! { dg-options "-fshort-enums -w -Wl,--no-enum-size-warning" { target arm*-*-linux*eabi* } } + ! Make sure short enums are indeed interoperable with the + ! corresponding C type. + +Index: gcc-4_7-branch/gcc/ada/gcc-interface/Makefile.in +=================================================================== +--- gcc-4_7-branch/gcc/ada/gcc-interface/Makefile.in (revision 194579) ++++ gcc-4_7-branch/gcc/ada/gcc-interface/Makefile.in (revision 194580) +@@ -1866,7 +1866,7 @@ + LIBRARY_VERSION := $(LIB_VERSION) + endif + +-ifeq ($(strip $(filter-out arm% linux-gnueabi,$(arch) $(osys)-$(word 4,$(targ)))),) ++ifeq ($(strip $(filter-out arm%-linux,$(arch)-$(osys)) $(if $(findstring eabi,$(word 4,$(targ))),,$(word 4,$(targ)))),) + LIBGNAT_TARGET_PAIRS = \ + a-intnam.ads zip != null && unzip != null + && zlib != null && boehmgc != null + && perl != null; # for `--enable-java-home' +assert langAda -> gnatboot != null; +assert langVhdl -> gnat != null; + +# We enable the isl cloog backend. +assert cloog != null -> isl != null; + +# LTO needs libelf and zlib. +assert libelf != null -> zlib != null; + +# Make sure we get GNU sed. +assert stdenv.isDarwin -> gnused != null; + +# The go frontend is written in c++ +assert langGo -> langCC; + +with stdenv.lib; +with builtins; + +let version = "4.8.0"; + + # Whether building a cross-compiler for GNU/Hurd. + crossGNU = cross != null && cross.config == "i586-pc-gnu"; + + patches = [] + ++ optional stdenv.isArm [ ./arm-eabi.patch ] + ++ optional (cross != null) ./libstdc++-target.patch + # ++ 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 langFortran ./gfortran-driving.patch; + + 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; + + /* Platform flags */ + platformFlags = let + gccArch = stdenv.lib.attrByPath [ "platform" "gcc" "arch" ] null stdenv; + gccCpu = stdenv.lib.attrByPath [ "platform" "gcc" "cpu" ] null stdenv; + gccAbi = stdenv.lib.attrByPath [ "platform" "gcc" "abi" ] null stdenv; + gccFpu = stdenv.lib.attrByPath [ "platform" "gcc" "fpu" ] null stdenv; + gccFloat = stdenv.lib.attrByPath [ "platform" "gcc" "float" ] null stdenv; + gccMode = stdenv.lib.attrByPath [ "platform" "gcc" "mode" ] null stdenv; + 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 ""; + withFpu = if gccFpu != null then " --with-fpu=${gccFpu}" else ""; + withFloat = if gccFloat != null then " --with-float=${gccFloat}" else ""; + withMode = if gccMode != null then " --with-mode=${gccMode}" else ""; + in + (withArch + + withCpu + + withAbi + + withFpu + + withFloat + + withMode); + + /* Cross-gcc settings */ + crossMingw = (cross != null && cross.libc == "msvcrt"); + crossConfigureFlags = let + gccArch = stdenv.lib.attrByPath [ "gcc" "arch" ] null cross; + gccCpu = stdenv.lib.attrByPath [ "gcc" "cpu" ] null cross; + gccAbi = stdenv.lib.attrByPath [ "gcc" "abi" ] null cross; + gccFpu = stdenv.lib.attrByPath [ "gcc" "fpu" ] null cross; + gccFloat = stdenv.lib.attrByPath [ "gcc" "float" ] null cross; + gccMode = stdenv.lib.attrByPath [ "gcc" "mode" ] 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 ""; + withFpu = if gccFpu != null then " --with-fpu=${gccFpu}" else ""; + withFloat = if gccFloat != null then " --with-float=${gccFloat}" else ""; + withMode = if gccMode != null then " --with-mode=${gccMode}" else ""; + in + "--target=${cross.config}" + + withArch + + withCpu + + withAbi + + withFpu + + withFloat + + withMode + + (if crossMingw && crossStageStatic then + " --with-headers=${libcCross}/include" + + " --with-gcc" + + " --with-gnu-as" + + " --with-gnu-ld" + + " --with-gnu-ld" + + " --disable-shared" + + " --disable-nls" + + " --disable-debug" + + " --enable-sjlj-exceptions" + + " --enable-threads=win32" + + " --disable-win32-registry" + else if crossStageStatic then + " --disable-libssp --disable-nls" + + " --without-headers" + + " --disable-threads " + + " --disable-libmudflap " + + " --disable-libgomp " + + " --disable-libquadmath" + + " --disable-shared" + + " --disable-decimal-float" # libdecnumber requires libc + else + " --with-headers=${libcCross}/include" + + " --enable-__cxa_atexit" + + " --enable-long-long" + + (if crossMingw then + " --enable-threads=win32" + + " --enable-sjlj-exceptions" + + " --enable-hash-synchronization" + + " --disable-libssp" + + " --disable-nls" + + " --with-dwarf2" + + # I think noone uses shared gcc libs in mingw, so we better do the same. + # In any case, mingw32 g++ linking is broken by default with shared libs, + # unless adding "-lsupc++" to any linking command. I don't know why. + " --disable-shared" + + (if cross.config == "x86_64-w64-mingw32" then + # To keep ABI compatibility with upstream mingw-w64 + " --enable-fully-dynamic-string" + else "") + else (if cross.libc == "uclibc" then + # In uclibc cases, libgomp needs an additional '-ldl' + # and as I don't know how to pass it, I disable libgomp. + " --disable-libgomp" else "") + + " --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 ""; + + bootstrap = cross == null && !stdenv.isArm && !stdenv.isMips; + +in + +# We need all these X libraries when building AWT with GTK+. +assert gtk != null -> (filter (x: x == null) xlibs) == []; + +stdenv.mkDerivation ({ + name = "${name}${if stripped then "" else "-debug"}-${version}" + crossNameAddon; + + builder = ./builder.sh; + + src = fetchurl { + url = "mirror://gnu/gcc/gcc-${version}/gcc-${version}.tar.bz2"; + sha256 = "0b6cp9d1sas3vq6dj3zrgd134p9b569fqhbixb9cl7mp698zwdxh"; + }; + + inherit patches; + + postPatch = + if (stdenv.isGNU + || (libcCross != null # e.g., building `gcc.crossDrv' + && libcCross ? crossConfig + && libcCross.crossConfig == "i586-pc-gnu") + || (crossGNU && libcCross != null)) + then + # On GNU/Hurd glibc refers to Hurd & Mach headers and libpthread is not + # in glibc, so add the right `-I' flags to the default spec string. + assert libcCross != null -> libpthreadCross != null; + let + libc = if libcCross != null then libcCross else stdenv.glibc; + gnu_h = "gcc/config/gnu.h"; + extraCPPDeps = + libc.propagatedBuildInputs + ++ stdenv.lib.optional (libpthreadCross != null) libpthreadCross + ++ stdenv.lib.optional (libpthread != null) libpthread; + extraCPPSpec = + concatStrings (intersperse " " + (map (x: "-I${x}/include") extraCPPDeps)); + extraLibSpec = + if libpthreadCross != null + then "-L${libpthreadCross}/lib ${libpthreadCross.TARGET_LDFLAGS}" + else "-L${libpthread}/lib"; + in + '' echo "augmenting \`CPP_SPEC' in \`${gnu_h}' with \`${extraCPPSpec}'..." + sed -i "${gnu_h}" \ + -es'|CPP_SPEC *"\(.*\)$|CPP_SPEC "${extraCPPSpec} \1|g' + + echo "augmenting \`LIB_SPEC' in \`${gnu_h}' with \`${extraLibSpec}'..." + sed -i "${gnu_h}" \ + -es'|LIB_SPEC *"\(.*\)$|LIB_SPEC "${extraLibSpec} \1|g' + + echo "setting \`NATIVE_SYSTEM_HEADER_DIR' and \`STANDARD_INCLUDE_DIR' to \`${libc}/include'..." + sed -i "${gnu_h}" \ + -es'|#define STANDARD_INCLUDE_DIR.*$|#define STANDARD_INCLUDE_DIR "${libc}/include"|g' + '' + else if cross != null || stdenv.gcc.libc != null then + # On NixOS, use the right path to the dynamic linker instead of + # `/lib/ld*.so'. + let + libc = if libcCross != null then libcCross else stdenv.gcc.libc; + in + '' echo "fixing the \`GLIBC_DYNAMIC_LINKER' and \`UCLIBC_DYNAMIC_LINKER' macros..." + for header in "gcc/config/"*-gnu.h "gcc/config/"*"/"*.h + do + grep -q LIBC_DYNAMIC_LINKER "$header" || continue + echo " fixing \`$header'..." + sed -i "$header" \ + -e 's|define[[:blank:]]*\([UCG]\+\)LIBC_DYNAMIC_LINKER\([0-9]*\)[[:blank:]]"\([^\"]\+\)"$|define \1LIBC_DYNAMIC_LINKER\2 "${libc}\3"|g' + done + '' + else null; + + inherit noSysDirs staticCompiler langJava crossStageStatic + libcCross crossMingw; + + nativeBuildInputs = [ texinfo which gettext ] + ++ (optional (perl != null) perl) + ++ (optional javaAwtGtk pkgconfig); + + buildInputs = [ gmp mpfr mpc libelf ] + ++ (optional (ppl != null) ppl) + ++ (optional (cloog != null) cloog) + ++ (optional (isl != null) isl) + ++ (optional (zlib != null) zlib) + ++ (optionals langJava [ boehmgc zip unzip ]) + ++ (optionals javaAwtGtk ([ gtk libart_lgpl ] ++ xlibs)) + ++ (optionals (cross != null) [binutilsCross]) + ++ (optionals langAda [gnatboot]) + ++ (optionals langVhdl [gnat]) + + # The builder relies on GNU sed (for instance, Darwin's `sed' fails with + # "-i may not be used with stdin"), and `stdenvNative' doesn't provide it. + ++ (optional stdenv.isDarwin gnused) + ; + + NIX_LDFLAGS = stdenv.lib.optionalString stdenv.isSunOS "-lm -ldl"; + + preConfigure = '' + configureFlagsArray=( + ${stdenv.lib.optionalString (ppl != null && ppl ? dontDisableStatic && ppl.dontDisableStatic) + "'--with-host-libstdcxx=-lstdc++ -lgcc_s'"} + ${stdenv.lib.optionalString (ppl != null && stdenv.isSunOS) + "\"--with-host-libstdcxx=-Wl,-rpath,\$prefix/lib/amd64 -lstdc++\" + \"--with-boot-ldflags=-L../prev-x86_64-pc-solaris2.11/libstdc++-v3/src/.libs\""} + ); + ${stdenv.lib.optionalString (stdenv.isSunOS && stdenv.is64bit) + '' + export NIX_LDFLAGS=`echo $NIX_LDFLAGS | sed -e s~$prefix/lib~$prefix/lib/amd64~g` + export LDFLAGS_FOR_TARGET="-Wl,-rpath,$prefix/lib/amd64 $LDFLAGS_FOR_TARGET" + export CXXFLAGS_FOR_TARGET="-Wl,-rpath,$prefix/lib/amd64 $CXXFLAGS_FOR_TARGET" + export CFLAGS_FOR_TARGET="-Wl,-rpath,$prefix/lib/amd64 $CFLAGS_FOR_TARGET" + ''} + ''; + + # 'iant' at #go-nuts@freenode, gccgo maintainer, said that + # they have a bug in 4.7.1 if adding "--disable-static" + dontDisableStatic = langGo || staticCompiler; + + configureFlags = " + ${if stdenv.isSunOS then + " --enable-long-long --enable-libssp --enable-threads=posix --disable-nls --enable-__cxa_atexit " + + # On Illumos/Solaris GNU as is preferred + " --with-gnu-as --without-gnu-ld " + else ""} + --enable-lto + ${if enableMultilib then "" else "--disable-multilib"} + ${if enableShared then "" else "--disable-shared"} + ${if enablePlugin then "--enable-plugin" else "--disable-plugin"} + ${if ppl != null then "--with-ppl=${ppl} --disable-ppl-version-check" else ""} + ${optionalString (isl != null) "--with-isl=${isl}"} + ${optionalString (cloog != null) "--with-cloog=${cloog} --disable-cloog-version-check --enable-cloog-backend=isl"} + ${if langJava then + "--with-ecj-jar=${javaEcj} " + + + # Follow Sun's layout for the convenience of IcedTea/OpenJDK. See + # . + "--enable-java-home --with-java-home=\${prefix}/lib/jvm/jre " + 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 langAda "ada" + ++ optional langVhdl "vhdl" + ++ optional langGo "go" + ) + ) + } + ${if (stdenv ? glibc && cross == null) + then " --with-native-system-header-dir=${stdenv.glibc}/include" + else ""} + ${if langAda then " --enable-libada" else ""} + ${if cross == null && stdenv.isi686 then "--with-arch=i686" else ""} + ${if cross != null then crossConfigureFlags else ""} + ${if !bootstrap then "--disable-bootstrap" else ""} + ${if cross == null then platformFlags else ""} + "; + + targetConfig = if cross != null then cross.config else null; + + buildFlags = if bootstrap then + (if profiledCompiler then "profiledbootstrap" else "bootstrap") + else ""; + + installTargets = + if stripped + then "install-strip" + else "install"; + + crossAttrs = let + xgccArch = stdenv.lib.attrByPath [ "gcc" "arch" ] null stdenv.cross; + xgccCpu = stdenv.lib.attrByPath [ "gcc" "cpu" ] null stdenv.cross; + xgccAbi = stdenv.lib.attrByPath [ "gcc" "abi" ] null stdenv.cross; + xgccFpu = stdenv.lib.attrByPath [ "gcc" "fpu" ] null stdenv.cross; + xgccFloat = stdenv.lib.attrByPath [ "gcc" "float" ] null stdenv.cross; + xwithArch = if xgccArch != null then " --with-arch=${xgccArch}" else ""; + xwithCpu = if xgccCpu != null then " --with-cpu=${xgccCpu}" else ""; + xwithAbi = if xgccAbi != null then " --with-abi=${xgccAbi}" else ""; + xwithFpu = if xgccFpu != null then " --with-fpu=${xgccFpu}" else ""; + xwithFloat = if xgccFloat != null then " --with-float=${xgccFloat}" else ""; + in { + AR = "${stdenv.cross.config}-ar"; + LD = "${stdenv.cross.config}-ld"; + CC = "${stdenv.cross.config}-gcc"; + CXX = "${stdenv.cross.config}-gcc"; + AR_FOR_TARGET = "${stdenv.cross.config}-ar"; + LD_FOR_TARGET = "${stdenv.cross.config}-ld"; + CC_FOR_TARGET = "${stdenv.cross.config}-gcc"; + NM_FOR_TARGET = "${stdenv.cross.config}-nm"; + CXX_FOR_TARGET = "${stdenv.cross.config}-g++"; + # If we are making a cross compiler, cross != null + NIX_GCC_CROSS = if cross == null then "${stdenv.gccCross}" else ""; + dontStrip = true; + configureFlags = '' + ${if enableMultilib then "" else "--disable-multilib"} + ${if enableShared then "" else "--disable-shared"} + ${if ppl != null then "--with-ppl=${ppl.crossDrv}" else ""} + ${if cloog != null then "--with-cloog=${cloog.crossDrv} --enable-cloog-backend=isl" else ""} + ${if langJava then "--with-ecj-jar=${javaEcj.crossDrv}" else ""} + ${if javaAwtGtk then "--enable-java-awt=gtk" else ""} + ${if langJava && javaAntlr != null then "--with-antlr-jar=${javaAntlr.crossDrv}" else ""} + --with-gmp=${gmp.crossDrv} + --with-mpfr=${mpfr.crossDrv} + --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 langAda "ada" + ++ optional langVhdl "vhdl" + ++ optional langGo "go" + ) + ) + } + ${if langAda then " --enable-libada" else ""} + --target=${stdenv.cross.config} + ${xwithArch} + ${xwithCpu} + ${xwithAbi} + ${xwithFpu} + ${xwithFloat} + ''; + buildFlags = ""; + }; + + + # Needed for the cross compilation to work + AR = "ar"; + LD = "ld"; + # http://gcc.gnu.org/install/specific.html#x86-64-x-solaris210 + CC = if stdenv.system == "x86_64-solaris" then "gcc -m64" + else "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 ] + ++ optional (libpthread != null) libpthread + ++ optional (libpthreadCross != null) libpthreadCross + + # On GNU/Hurd glibc refers to Mach & Hurd + # headers. + ++ optionals (libcCross != null && + hasAttr "propagatedBuildInputs" libcCross) + libcCross.propagatedBuildInputs))); + + LIBRARY_PATH = concatStrings + (intersperse ":" (map (x: x + "/lib") + (optionals (zlib != null) [ zlib ] + ++ optionals langJava [ boehmgc ] + ++ optionals javaAwtGtk xlibs + ++ optionals javaAwtGtk [ gmp mpfr ] + ++ optional (libpthread != null) libpthread))); + + EXTRA_TARGET_CFLAGS = + if cross != null && libcCross != null + then "-idirafter ${libcCross}/include" + else null; + + EXTRA_TARGET_LDFLAGS = + if cross != null && libcCross != null + then "-B${libcCross}/lib -Wl,-L${libcCross}/lib" + + (optionalString (libpthreadCross != null) + " -L${libpthreadCross}/lib -Wl,${libpthreadCross.TARGET_LDFLAGS}") + else null; + + passthru = { inherit langC langCC langAda langFortran langVhdl + langGo enableMultilib version; }; + + /* From gccinstall.info: + "parallel make is currently not supported since collisions in profile + collecting may occur" + */ + enableParallelBuilding = !profiledCompiler; + + meta = { + homepage = http://gcc.gnu.org/; + license = "GPLv3+"; # runtime support libraries are typically LGPLv3+ + description = "GNU Compiler Collection, version ${version}" + + (if stripped then "" else " (with debugging info)"); + + 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 = with stdenv.lib.maintainers; [ ludo viric shlevy simons ]; + + # 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 && libelf == null) [ "i686-darwin" ]; + }; +} + +// optionalAttrs (cross != null && cross.libc == "msvcrt" && crossStageStatic) { + makeFlags = [ "all-gcc" "all-target-libgcc" ]; + installTargets = "install-gcc install-target-libgcc"; +} + + +# Strip kills static libs of other archs (hence cross != null) +// optionalAttrs (!stripped || cross != null) { dontStrip = true; NIX_STRIP_DEBUG = 0; } +) diff --git a/pkgs/development/compilers/gcc/4.8/gfortran-driving.patch b/pkgs/development/compilers/gcc/4.8/gfortran-driving.patch new file mode 100644 index 000000000000..70708886b405 --- /dev/null +++ b/pkgs/development/compilers/gcc/4.8/gfortran-driving.patch @@ -0,0 +1,20 @@ +This patch fixes interaction with Libtool. +See , for details. + +--- a/gcc/fortran/gfortranspec.c ++++ b/gcc/fortran/gfortranspec.c +@@ -461,8 +461,15 @@ For more information about these matters, see the file named COPYING\n\n")); + { + fprintf (stderr, _("Driving:")); + for (i = 0; i < g77_newargc; i++) ++ { ++ if (g77_new_decoded_options[i].opt_index == OPT_l) ++ /* Make sure no white space is inserted after `-l'. */ ++ fprintf (stderr, " -l%s", ++ g77_new_decoded_options[i].canonical_option[1]); ++ else + fprintf (stderr, " %s", + g77_new_decoded_options[i].orig_option_with_args_text); ++ } + fprintf (stderr, "\n"); + } diff --git a/pkgs/development/compilers/gcc/4.8/gnat-cflags.patch b/pkgs/development/compilers/gcc/4.8/gnat-cflags.patch new file mode 100644 index 000000000000..bf2acf065e9b --- /dev/null +++ b/pkgs/development/compilers/gcc/4.8/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. +@@ -193,7 +193,7 @@ RTSDIR = rts$(subst /,_,$(MULTISUBDIR)) + # Link flags used to build gnat tools. By default we prefer to statically + # link with libgcc to avoid a dependency on shared libgcc (which is tricky + # to deal with as it may conflict with the libgcc provided by the system). +-GCC_LINK_FLAGS=-static-libgcc ++GCC_LINK_FLAGS=-static-libgcc $(CFLAGS_FOR_TARGET) + + # End of variables for you to override. + diff --git a/pkgs/development/compilers/gcc/4.8/java-jvgenmain-link.patch b/pkgs/development/compilers/gcc/4.8/java-jvgenmain-link.patch new file mode 100644 index 000000000000..2612e8bfbbbc --- /dev/null +++ b/pkgs/development/compilers/gcc/4.8/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.8/libstdc++-target.patch b/pkgs/development/compilers/gcc/4.8/libstdc++-target.patch new file mode 100644 index 000000000000..fb622b395806 --- /dev/null +++ b/pkgs/development/compilers/gcc/4.8/libstdc++-target.patch @@ -0,0 +1,32 @@ +Patch to make the target libraries 'configure' scripts find the proper CPP. +I noticed that building the mingw32 cross compiler. +Looking at the build script for mingw in archlinux, I think that only nixos +needs this patch. I don't know why. +diff --git a/Makefile.in b/Makefile.in +index 93f66b6..d691917 100644 +--- a/Makefile.in ++++ b/Makefile.in +@@ -266,6 +266,7 @@ BASE_TARGET_EXPORTS = \ + AR="$(AR_FOR_TARGET)"; export AR; \ + AS="$(COMPILER_AS_FOR_TARGET)"; export AS; \ + CC="$(CC_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export CC; \ ++ CPP="$(CC_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS -E"; export CC; \ + CFLAGS="$(CFLAGS_FOR_TARGET)"; export CFLAGS; \ + CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ + CPPFLAGS="$(CPPFLAGS_FOR_TARGET)"; export CPPFLAGS; \ +@@ -291,11 +292,13 @@ BASE_TARGET_EXPORTS = \ + RAW_CXX_TARGET_EXPORTS = \ + $(BASE_TARGET_EXPORTS) \ + CXX_FOR_TARGET="$(RAW_CXX_FOR_TARGET)"; export CXX_FOR_TARGET; \ +- CXX="$(RAW_CXX_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export CXX; ++ CXX="$(RAW_CXX_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export CXX; \ ++ CXXCPP="$(RAW_CXX_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS -E"; export CXX; + + NORMAL_TARGET_EXPORTS = \ + $(BASE_TARGET_EXPORTS) \ +- CXX="$(CXX_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export CXX; ++ CXX="$(CXX_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export CXX; \ ++ CXXCPP="$(CXX_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS -E"; export CXX; + + # Where to find GMP + HOST_GMPLIBS = @gmplibs@ diff --git a/pkgs/development/compilers/gcc/4.8/no-sys-dirs.patch b/pkgs/development/compilers/gcc/4.8/no-sys-dirs.patch new file mode 100644 index 000000000000..79901703cb82 --- /dev/null +++ b/pkgs/development/compilers/gcc/4.8/no-sys-dirs.patch @@ -0,0 +1,41 @@ +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 +@@ -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/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index ba17cf99ae3e..c3af959ac48d 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -2237,6 +2237,32 @@ let binutilsCross = null; })); + gcc48_real = lowPrio (wrapGCC (callPackage ../development/compilers/gcc/4.8 { + inherit noSysDirs; + # I'm not sure if profiling with enableParallelBuilding helps a lot. + # We can enable it back some day. This makes the *gcc* builds faster now. + profiledCompiler = false; + + # When building `gcc.crossDrv' (a "Canadian cross", with host == target + # and host != build), `cross' must be null but the cross-libc must still + # be passed. + cross = null; + libcCross = if crossSystem != null then libcCross else null; + libpthreadCross = + if crossSystem != null && crossSystem.config == "i586-pc-gnu" + then gnu.libpthreadCross + else null; + })); + + gcc48_debug = lowPrio (wrapGCC (callPackage ../development/compilers/gcc/4.8 { + stripped = false; + + inherit noSysDirs; + cross = null; + libcCross = null; + binutilsCross = null; + })); + gccApple = assert stdenv.isDarwin; wrapGCC (makeOverridable (import ../development/compilers/gcc/4.2-apple64) {