about summary refs log tree commit diff
path: root/pkgs/development/compilers
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/compilers')
-rw-r--r--pkgs/development/compilers/aliceml/default.nix6
-rw-r--r--pkgs/development/compilers/ats2/default.nix4
-rw-r--r--pkgs/development/compilers/colm/default.nix28
-rw-r--r--pkgs/development/compilers/fsharp/default.nix4
-rw-r--r--pkgs/development/compilers/gcc/3.4/builder.sh63
-rw-r--r--pkgs/development/compilers/gcc/3.4/default.nix47
-rw-r--r--pkgs/development/compilers/gcc/3.4/no-sys-dirs.patch170
-rw-r--r--pkgs/development/compilers/gcc/4.4/java-jvgenmain-link.patch17
-rw-r--r--pkgs/development/compilers/gcc/4.5/default.nix4
-rw-r--r--pkgs/development/compilers/gcc/4.5/java-jvgenmain-link.patch17
-rw-r--r--pkgs/development/compilers/gcc/4.6/default.nix6
-rw-r--r--pkgs/development/compilers/gcc/4.6/gnat-cflags.patch33
-rw-r--r--pkgs/development/compilers/gcc/4.6/java-jvgenmain-link.patch17
-rw-r--r--pkgs/development/compilers/gcc/4.6/libstdc++-target.patch32
-rw-r--r--pkgs/development/compilers/gcc/4.8/default.nix12
-rw-r--r--pkgs/development/compilers/gcc/4.8/gfortran-driving.patch20
-rw-r--r--pkgs/development/compilers/gcc/4.8/gnat-cflags.patch33
-rw-r--r--pkgs/development/compilers/gcc/4.8/java-jvgenmain-link.patch17
-rw-r--r--pkgs/development/compilers/gcc/4.8/libstdc++-target.patch32
-rw-r--r--pkgs/development/compilers/gcc/4.9/builder.sh245
-rw-r--r--pkgs/development/compilers/gcc/4.9/default.nix59
-rw-r--r--pkgs/development/compilers/gcc/4.9/gfortran-driving.patch20
-rw-r--r--pkgs/development/compilers/gcc/4.9/gnat-cflags.patch33
-rw-r--r--pkgs/development/compilers/gcc/4.9/java-jvgenmain-link.patch17
-rw-r--r--pkgs/development/compilers/gcc/4.9/libstdc++-target.patch32
-rw-r--r--pkgs/development/compilers/gcc/4.9/no-sys-dirs.patch41
-rw-r--r--pkgs/development/compilers/gcc/4.9/parallel-bconfig.patch32
-rw-r--r--pkgs/development/compilers/gcc/5/builder.sh255
-rw-r--r--pkgs/development/compilers/gcc/5/default.nix11
-rw-r--r--pkgs/development/compilers/gcc/5/gfortran-driving.patch20
-rw-r--r--pkgs/development/compilers/gcc/5/gnat-cflags.patch33
-rw-r--r--pkgs/development/compilers/gcc/5/java-jvgenmain-link.patch17
-rw-r--r--pkgs/development/compilers/gcc/5/libstdc++-target.patch32
-rw-r--r--pkgs/development/compilers/gcc/5/no-sys-dirs.patch28
-rw-r--r--pkgs/development/compilers/gcc/builder.sh (renamed from pkgs/development/compilers/gcc/4.8/builder.sh)0
-rw-r--r--pkgs/development/compilers/gcc/gfortran-driving.patch (renamed from pkgs/development/compilers/gcc/4.6/gfortran-driving.patch)0
-rw-r--r--pkgs/development/compilers/gcc/gnat-cflags.patch (renamed from pkgs/development/compilers/gcc/4.5/gnat-cflags.patch)0
-rw-r--r--pkgs/development/compilers/gcc/libstdc++-target.patch (renamed from pkgs/development/compilers/gcc/4.5/libstdc++-target.patch)0
-rw-r--r--pkgs/development/compilers/gcc/no-sys-dirs.patch (renamed from pkgs/development/compilers/gcc/4.8/no-sys-dirs.patch)0
-rw-r--r--pkgs/development/compilers/gcc/parallel-bconfig.patch (renamed from pkgs/development/compilers/gcc/4.8/parallel-bconfig.patch)0
-rw-r--r--pkgs/development/compilers/gcl/default.nix2
-rw-r--r--pkgs/development/compilers/ghc/6.10.2-binary.nix10
-rw-r--r--pkgs/development/compilers/ghc/6.10.4.nix1
-rw-r--r--pkgs/development/compilers/ghc/6.12.3.nix1
-rw-r--r--pkgs/development/compilers/ghc/7.10.1.nix3
-rw-r--r--pkgs/development/compilers/ghc/7.8.4.nix7
-rw-r--r--pkgs/development/compilers/ghc/hpc-7.8.4.patch13
-rw-r--r--pkgs/development/compilers/ghc/osx-dylib-resolver.patch60
-rw-r--r--pkgs/development/compilers/ghcjs/default.nix8
-rw-r--r--pkgs/development/compilers/go/1.2.nix5
-rw-r--r--pkgs/development/compilers/go/1.4.nix42
-rw-r--r--pkgs/development/compilers/go/remove-tools.patch81
-rw-r--r--pkgs/development/compilers/hugs/default.nix53
-rw-r--r--pkgs/development/compilers/llvm/3.5/clang.nix2
-rw-r--r--pkgs/development/compilers/llvm/3.6/clang/default.nix2
-rw-r--r--pkgs/development/compilers/openjdk/fix-java-home-jdk8.patch15
-rw-r--r--pkgs/development/compilers/openjdk/openjdk8.nix34
-rw-r--r--pkgs/development/compilers/rustc/1.0.0.nix (renamed from pkgs/development/compilers/rustc/1.0.0-beta.nix)6
-rw-r--r--pkgs/development/compilers/rustc/head.nix18
-rw-r--r--pkgs/development/compilers/rustc/patches/head.patch20
-rw-r--r--pkgs/development/compilers/smlnj/default.nix6
61 files changed, 352 insertions, 1474 deletions
diff --git a/pkgs/development/compilers/aliceml/default.nix b/pkgs/development/compilers/aliceml/default.nix
index 5059cdf21587..6fbc1a350f5c 100644
--- a/pkgs/development/compilers/aliceml/default.nix
+++ b/pkgs/development/compilers/aliceml/default.nix
@@ -1,12 +1,12 @@
 {stdenv, gcc, glibc, fetchurl, fetchgit, libtool, autoconf, automake, file, gnumake, which, zsh, m4, pkgconfig, perl, gnome, pango, sqlite, libxml2, zlib, gmp, smlnj }:
 
 stdenv.mkDerivation {
-  name = "aliceml-1.4-493cd356";
+  name = "aliceml-1.4-7d44dc8e";
 
   src = fetchgit {
     url = "https://github.com/aliceml/aliceml";
-    rev = "493cd3565f0bc3b35790185ec358fb91b7b43037";
-    sha256 = "12fbaf0a474e53f40a71f16bf61c52b7ffe044f4d0993e208e69552df3054d45";
+    rev = "7d44dc8e4097c6f85888bbf4ff86d51fe05b0a08";
+    sha256 = "ab2d5bf05c40905b02cb1ec975d4980ae4437757856eeb1f587ede2c45a1917f";
     fetchSubmodules = true;
   };
 
diff --git a/pkgs/development/compilers/ats2/default.nix b/pkgs/development/compilers/ats2/default.nix
index 8345a353f3f9..08cae4d3e420 100644
--- a/pkgs/development/compilers/ats2/default.nix
+++ b/pkgs/development/compilers/ats2/default.nix
@@ -2,11 +2,11 @@
 
 stdenv.mkDerivation rec {
   name    = "ats2-${version}";
-  version = "0.1.11";
+  version = "0.1.12";
 
   src = fetchurl {
     url = "mirror://sourceforge/ats2-lang/ATS2-Postiats-${version}.tgz";
-    sha256 = "1dy2f7lxfwcmrk753midr75cy8xs6pqnmqmj9xj0ch479q4pkpsv";
+    sha256 = "1jiki88mzhki74xh5ffw3pali5zs74pa0nylcb8n4ypfvdpqvlhb";
   };
 
   buildInputs = [ gmp ];
diff --git a/pkgs/development/compilers/colm/default.nix b/pkgs/development/compilers/colm/default.nix
new file mode 100644
index 000000000000..ebfee6c4188e
--- /dev/null
+++ b/pkgs/development/compilers/colm/default.nix
@@ -0,0 +1,28 @@
+{ stdenv, fetchurl, makeWrapper, gcc }:
+
+stdenv.mkDerivation rec {
+  name = "colm-${version}";
+  version = "0.12.0";
+
+  src = fetchurl {
+    url = "http://www.colm.net/files/colm/${name}.tar.gz";
+    sha256 = "0kbfipxv3nvggd1a2nahk3jg22iifp2l7lkm55i5r7qkpms5sm3v";
+  };
+
+  buildInputs = [ makeWrapper ];
+
+  doCheck = true;
+  checkPhase = ''sh ./test/runtests.sh'';
+
+  postInstall = ''
+    wrapProgram $out/bin/colm \
+      --prefix PATH ":" ${gcc}/bin
+  '';
+
+  meta = with stdenv.lib; {
+    description = "A programming language for the analysis and transformation of computer languages";
+    homepage = http://www.colm.net/open-source/colm;
+    license = licenses.gpl2;
+    maintainers = with maintainers; [ pSub ];
+  };
+}
diff --git a/pkgs/development/compilers/fsharp/default.nix b/pkgs/development/compilers/fsharp/default.nix
index f1161dd4dd16..82742cf9af69 100644
--- a/pkgs/development/compilers/fsharp/default.nix
+++ b/pkgs/development/compilers/fsharp/default.nix
@@ -2,11 +2,11 @@
 
 stdenv.mkDerivation rec {
   name = "fsharp-${version}";
-  version = "3.1.1.31";
+  version = "3.1.1.32";
 
   src = fetchurl {
     url = "https://github.com/fsharp/fsharp/archive/${version}.tar.gz";
-    sha256 = "1c38jpisnh8slqaaw1bsccxgllpc6yivrpb86raw4xalcbsc6fcv";
+    sha256 = "16kqgdx0y0lmxv59mc4g7l5ll60nixg5b8bg07vxfnqrf7i6dffd";
   };
 
   buildInputs = [ mono pkgconfig autoconf automake which ];
diff --git a/pkgs/development/compilers/gcc/3.4/builder.sh b/pkgs/development/compilers/gcc/3.4/builder.sh
deleted file mode 100644
index 3909b605c208..000000000000
--- a/pkgs/development/compilers/gcc/3.4/builder.sh
+++ /dev/null
@@ -1,63 +0,0 @@
-source $stdenv/setup
-
-
-export NIX_FIXINC_DUMMY=$NIX_BUILD_TOP/dummy
-mkdir $NIX_FIXINC_DUMMY
-
-
-if test "$noSysDirs" = "1"; then
-
-    if test -e $NIX_CC/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_CC/nix-support/libc-cflags)"
-        extraLDFlags="$(cat $NIX_CC/nix-support/libc-ldflags) $(cat $NIX_CC/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_CC/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() {
-    # 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
-}
-
-
-if test -z "$profiledCompiler"; then
-    buildFlags="bootstrap $buildFlags"
-else    
-    buildFlags="profiledbootstrap $buildFlags"
-fi
-
-genericBuild
diff --git a/pkgs/development/compilers/gcc/3.4/default.nix b/pkgs/development/compilers/gcc/3.4/default.nix
deleted file mode 100644
index 1be771ac7054..000000000000
--- a/pkgs/development/compilers/gcc/3.4/default.nix
+++ /dev/null
@@ -1,47 +0,0 @@
-{ stdenv, fetchurl, noSysDirs
-, langC ? true, langCC ? true, langF77 ? false
-, profiledCompiler ? false
-}:
-
-assert langC;
-
-with stdenv.lib;
-
-stdenv.mkDerivation {
-  name = "gcc-3.4.6";
-  builder = ./builder.sh;
-  src = fetchurl {
-    url = mirror://gnu/gcc/gcc-3.4.6/gcc-3.4.6.tar.bz2;
-    md5 = "4a21ac777d4b5617283ce488b808da7b";
-  };
-
-  patches = stdenv.lib.optional noSysDirs ./no-sys-dirs.patch;
-
-  # inspiration: https://aur.archlinux.org/packages/g77/
-  postPatch = ''
-    substituteInPlace gcc/config/i386/linux.h --replace 'struct siginfo' siginfo_t
-  '';
-
-  inherit noSysDirs profiledCompiler;
-
-  configureFlags = "
-    --disable-multilib
-    --with-system-zlib
-    --enable-languages=${
-      concatStrings (intersperse ","
-        (  optional langC   "c"
-        ++ optional langCC  "c++"
-        ++ optional langF77 "f77"
-        )
-      )
-    }
-  ";
-
-  passthru = { inherit langC langCC langF77; isGNU = true; };
-
-  meta = {
-    homepage = "http://gcc.gnu.org/";
-    license = "GPL/LGPL";
-    description = "GNU Compiler Collection, 3.4.x";
-  };
-}
diff --git a/pkgs/development/compilers/gcc/3.4/no-sys-dirs.patch b/pkgs/development/compilers/gcc/3.4/no-sys-dirs.patch
deleted file mode 100644
index 2159893cde2b..000000000000
--- a/pkgs/development/compilers/gcc/3.4/no-sys-dirs.patch
+++ /dev/null
@@ -1,170 +0,0 @@
-diff -rc gcc-orig/gcc/cppdefault.c gcc-patched/gcc/cppdefault.c
-*** gcc-orig/gcc/cppdefault.c	2003-03-01 15:31:12.000000000 +0100
---- gcc-patched/gcc/cppdefault.c	2004-06-29 10:08:45.000000000 +0200
-***************
-*** 41,46 ****
---- 41,50 ----
-  # 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 -rc gcc-orig/gcc/Makefile.in gcc-patched/gcc/Makefile.in
-*** gcc-orig/gcc/Makefile.in	2004-04-01 18:47:54.000000000 +0200
---- gcc-patched/gcc/Makefile.in	2004-06-29 13:50:45.000000000 +0200
-***************
-*** 199,205 ****
-  CPPFLAGS = @CPPFLAGS@
-  
-  # These exists to be overridden by the x-* and t-* files, respectively.
-! X_CFLAGS =
-  T_CFLAGS =
-  
-  X_CPPFLAGS =
---- 199,205 ----
-  CPPFLAGS = @CPPFLAGS@
-  
-  # These exists to be overridden by the x-* and t-* files, respectively.
-! X_CFLAGS = $(NIX_EXTRA_CFLAGS) $(NIX_EXTRA_LDFLAGS)
-  T_CFLAGS =
-  
-  X_CPPFLAGS =
-***************
-*** 345,351 ****
-  PARTITION_H = $(srcdir)/../include/partition.h
-  
-  # Default native SYSTEM_HEADER_DIR, to be overridden by targets.
-! NATIVE_SYSTEM_HEADER_DIR = /usr/include
-  # Default cross SYSTEM_HEADER_DIR, to be overridden by targets.
-  CROSS_SYSTEM_HEADER_DIR = @CROSS_SYSTEM_HEADER_DIR@
-  
---- 345,355 ----
-  PARTITION_H = $(srcdir)/../include/partition.h
-  
-  # Default native SYSTEM_HEADER_DIR, to be overridden by targets.
-! # 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@
-  
-diff -rc gcc-orig/libstdc++-v3/include/Makefile.in gcc-patched/libstdc++-v3/include/Makefile.in
-*** gcc-orig/libstdc++-v3/include/Makefile.in	2004-03-18 18:36:43.000000000 +0100
---- gcc-patched/libstdc++-v3/include/Makefile.in	2004-06-29 19:01:33.000000000 +0200
-***************
-*** 896,903 ****
-  	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; \
-! 	$(CXX) $(PCHFLAGS) $(AM_CPPFLAGS) ${pch_source} -O2 -g -o ${pch_output_builddir}/O2g;
-  
-  # For robustness sake (in light of junk files or in-source
-  # configuration), copy from the build or source tree to the install
---- 896,903 ----
-  	if [ ! -d "${pch_output_builddir}" ]; then \
-  	  mkdir -p ${pch_output_builddir}; \
-  	fi; \
-! 	$(CXX) $(CFLAGS) $(PCHFLAGS) $(AM_CPPFLAGS) ${pch_source} -O0 -g -o ${pch_output_builddir}/O0g; \
-! 	$(CXX) $(CFLAGS) $(PCHFLAGS) $(AM_CPPFLAGS) ${pch_source} -O2 -g -o ${pch_output_builddir}/O2g;
-  
-  # For robustness sake (in light of junk files or in-source
-  # configuration), copy from the build or source tree to the install
-diff -rc gcc-orig/ltcf-cxx.sh gcc-patched/ltcf-cxx.sh
-*** gcc-orig/ltcf-cxx.sh	2003-11-19 06:29:32.000000000 +0100
---- gcc-patched/ltcf-cxx.sh	2004-06-29 15:26:01.000000000 +0200
-***************
-*** 985,991 ****
-    # the conftest object file.
-    pre_test_object_deps_done=no
-  
-!   for p in `eval $output_verbose_link_cmd`; do
-  
-      case $p in
-  
---- 985,991 ----
-    # the conftest object file.
-    pre_test_object_deps_done=no
-  
-!   for p in `true`; do
-  
-      case $p in
-  
-diff -rc gcc-orig/Makefile.in gcc-patched/Makefile.in
-*** gcc-orig/Makefile.in	2004-01-14 21:09:37.000000000 +0100
---- gcc-patched/Makefile.in	2004-06-29 16:21:36.000000000 +0200
-***************
-*** 228,234 ****
-  NM = @NM@
-  
-  LD = @LD@
-! LDFLAGS = 
-  
-  RANLIB = @RANLIB@
-  
---- 228,234 ----
-  NM = @NM@
-  
-  LD = @LD@
-! LDFLAGS = $(NIX_EXTRA_LDFLAGS)
-  
-  RANLIB = @RANLIB@
-  
-***************
-*** 277,283 ****
-  # 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)
-  # If GCC_FOR_TARGET is not overriden on the command line, then this
-  # variable is passed down to the gcc Makefile, where it is used to
-  # build libgcc2.a.  We define it here so that it can itself be
---- 277,283 ----
-  # 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) $(NIX_EXTRA_CFLAGS)
-  # If GCC_FOR_TARGET is not overriden on the command line, then this
-  # variable is passed down to the gcc Makefile, where it is used to
-  # build libgcc2.a.  We define it here so that it can itself be
-***************
-*** 290,296 ****
-  RAW_CXX_FOR_TARGET = @RAW_CXX_FOR_TARGET@
-  CXX_FOR_TARGET_FOR_RECURSIVE_MAKE = @CXX_FOR_TARGET_FOR_RECURSIVE_MAKE@
-  RAW_CXX_FOR_TARGET_FOR_RECURSIVE_MAKE = @RAW_CXX_FOR_TARGET_FOR_RECURSIVE_MAKE@
-! CXXFLAGS_FOR_TARGET = $(CXXFLAGS)
-  LIBCXXFLAGS_FOR_TARGET = $(CXXFLAGS_FOR_TARGET) -fno-implicit-templates
-  
-  DLLTOOL_FOR_TARGET=@DLLTOOL_FOR_TARGET@
---- 290,296 ----
-  RAW_CXX_FOR_TARGET = @RAW_CXX_FOR_TARGET@
-  CXX_FOR_TARGET_FOR_RECURSIVE_MAKE = @CXX_FOR_TARGET_FOR_RECURSIVE_MAKE@
-  RAW_CXX_FOR_TARGET_FOR_RECURSIVE_MAKE = @RAW_CXX_FOR_TARGET_FOR_RECURSIVE_MAKE@
-! CXXFLAGS_FOR_TARGET = $(CXXFLAGS) $(NIX_EXTRA_CFLAGS)
-  LIBCXXFLAGS_FOR_TARGET = $(CXXFLAGS_FOR_TARGET) -fno-implicit-templates
-  
-  DLLTOOL_FOR_TARGET=@DLLTOOL_FOR_TARGET@
-***************
-*** 321,327 ****
-      fi; \
-    fi`
-  
-! LDFLAGS_FOR_TARGET = 
-  
-  NM_FOR_TARGET=@NM_FOR_TARGET@
-  USUAL_NM_FOR_TARGET = ` \
---- 321,327 ----
-      fi; \
-    fi`
-  
-! LDFLAGS_FOR_TARGET = $(NIX_EXTRA_LDFLAGS)
-  
-  NM_FOR_TARGET=@NM_FOR_TARGET@
-  USUAL_NM_FOR_TARGET = ` \
diff --git a/pkgs/development/compilers/gcc/4.4/java-jvgenmain-link.patch b/pkgs/development/compilers/gcc/4.4/java-jvgenmain-link.patch
deleted file mode 100644
index 2612e8bfbbbc..000000000000
--- a/pkgs/development/compilers/gcc/4.4/java-jvgenmain-link.patch
+++ /dev/null
@@ -1,17 +0,0 @@
-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/default.nix b/pkgs/development/compilers/gcc/4.5/default.nix
index c4be4f266dd1..6cde7aba92a0 100644
--- a/pkgs/development/compilers/gcc/4.5/default.nix
+++ b/pkgs/development/compilers/gcc/4.5/default.nix
@@ -136,11 +136,11 @@ stdenv.mkDerivation ({
 
   patches =
     [ ]
-    ++ optional (cross != null) ./libstdc++-target.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 langAda ../gnat-cflags.patch
     ++ optional langVhdl ./ghdl-ortho-cflags.patch
     ;
 
diff --git a/pkgs/development/compilers/gcc/4.5/java-jvgenmain-link.patch b/pkgs/development/compilers/gcc/4.5/java-jvgenmain-link.patch
deleted file mode 100644
index 2612e8bfbbbc..000000000000
--- a/pkgs/development/compilers/gcc/4.5/java-jvgenmain-link.patch
+++ /dev/null
@@ -1,17 +0,0 @@
-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.6/default.nix b/pkgs/development/compilers/gcc/4.6/default.nix
index 0f65a89bd209..b3caad11b716 100644
--- a/pkgs/development/compilers/gcc/4.6/default.nix
+++ b/pkgs/development/compilers/gcc/4.6/default.nix
@@ -52,13 +52,13 @@ let version = "4.6.4";
     crossGNU = cross != null && cross.config == "i586-pc-gnu";
 
     patches = [ ]
-      ++ optional (cross != null) ./libstdc++-target.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 langAda ../gnat-cflags.patch
       ++ optional langVhdl ./ghdl-ortho-cflags.patch
-      ++ optional langFortran ./gfortran-driving.patch
+      ++ optional langFortran ../gfortran-driving.patch
       ++ optional (stdenv.isGNU || crossGNU) ./hurd-sigrtmin.patch;
 
     javaEcj = fetchurl {
diff --git a/pkgs/development/compilers/gcc/4.6/gnat-cflags.patch b/pkgs/development/compilers/gcc/4.6/gnat-cflags.patch
deleted file mode 100644
index bf2acf065e9b..000000000000
--- a/pkgs/development/compilers/gcc/4.6/gnat-cflags.patch
+++ /dev/null
@@ -1,33 +0,0 @@
-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.6/java-jvgenmain-link.patch b/pkgs/development/compilers/gcc/4.6/java-jvgenmain-link.patch
deleted file mode 100644
index 2612e8bfbbbc..000000000000
--- a/pkgs/development/compilers/gcc/4.6/java-jvgenmain-link.patch
+++ /dev/null
@@ -1,17 +0,0 @@
-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.6/libstdc++-target.patch b/pkgs/development/compilers/gcc/4.6/libstdc++-target.patch
deleted file mode 100644
index fb622b395806..000000000000
--- a/pkgs/development/compilers/gcc/4.6/libstdc++-target.patch
+++ /dev/null
@@ -1,32 +0,0 @@
-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/default.nix b/pkgs/development/compilers/gcc/4.8/default.nix
index 0958ce7b1c97..6d5627c34d68 100644
--- a/pkgs/development/compilers/gcc/4.8/default.nix
+++ b/pkgs/development/compilers/gcc/4.8/default.nix
@@ -64,13 +64,13 @@ let version = "4.8.4";
     enableParallelBuilding = true;
 
     patches = [ ]
-      ++ optional enableParallelBuilding ./parallel-bconfig.patch
-      ++ optional (cross != null) ./libstdc++-target.patch
-      ++ optional noSysDirs ./no-sys-dirs.patch
+      ++ optional enableParallelBuilding ../parallel-bconfig.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;
+      ++ optional langAda ../gnat-cflags.patch
+      ++ optional langFortran ../gfortran-driving.patch;
 
     javaEcj = fetchurl {
       # The `$(top_srcdir)/ecj.jar' file is automatically picked up at
@@ -207,7 +207,7 @@ assert x11Support -> (filter (x: x == null) ([ gtk libart_lgpl ] ++ xlibs)) == [
 stdenv.mkDerivation ({
   name = "${name}${if stripped then "" else "-debug"}-${version}" + crossNameAddon;
 
-  builder = ./builder.sh;
+  builder = ../builder.sh;
 
   src = fetchurl {
     url = "mirror://gnu/gcc/gcc-${version}/gcc-${version}.tar.bz2";
diff --git a/pkgs/development/compilers/gcc/4.8/gfortran-driving.patch b/pkgs/development/compilers/gcc/4.8/gfortran-driving.patch
deleted file mode 100644
index 70708886b405..000000000000
--- a/pkgs/development/compilers/gcc/4.8/gfortran-driving.patch
+++ /dev/null
@@ -1,20 +0,0 @@
-This patch fixes interaction with Libtool.
-See <http://thread.gmane.org/gmane.comp.gcc.patches/258777>, 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
deleted file mode 100644
index bf2acf065e9b..000000000000
--- a/pkgs/development/compilers/gcc/4.8/gnat-cflags.patch
+++ /dev/null
@@ -1,33 +0,0 @@
-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
deleted file mode 100644
index 2612e8bfbbbc..000000000000
--- a/pkgs/development/compilers/gcc/4.8/java-jvgenmain-link.patch
+++ /dev/null
@@ -1,17 +0,0 @@
-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
deleted file mode 100644
index fb622b395806..000000000000
--- a/pkgs/development/compilers/gcc/4.8/libstdc++-target.patch
+++ /dev/null
@@ -1,32 +0,0 @@
-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.9/builder.sh b/pkgs/development/compilers/gcc/4.9/builder.sh
deleted file mode 100644
index 96bbd025ba63..000000000000
--- a/pkgs/development/compilers/gcc/4.9/builder.sh
+++ /dev/null
@@ -1,245 +0,0 @@
-source $stdenv/setup
-
-
-export NIX_FIXINC_DUMMY=$NIX_BUILD_TOP/dummy
-mkdir $NIX_FIXINC_DUMMY
-
-
-if test "$staticCompiler" = "1"; then
-    EXTRA_LDFLAGS="-static"
-else
-    EXTRA_LDFLAGS=""
-fi
-
-# GCC interprets empty paths as ".", which we don't want.
-if test -z "$CPATH"; then unset CPATH; fi
-if test -z "$LIBRARY_PATH"; then unset LIBRARY_PATH; fi
-echo "\$CPATH is \`$CPATH'"
-echo "\$LIBRARY_PATH is \`$LIBRARY_PATH'"
-
-if test "$noSysDirs" = "1"; then
-
-    if test -e $NIX_CC/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_CC/nix-support/libc-cflags)"
-        extraLDFlags="$(cat $NIX_CC/nix-support/libc-ldflags) $(cat $NIX_CC/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_CC/nix-support/orig-libc)/include
-
-        # The path to the Glibc binaries such as `crti.o'.
-        glibc_libdir="$(cat $NIX_CC/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="-I$NIX_FIXINC_DUMMY $extraFlags"
-    extraLDFlags="-L$glibc_libdir -rpath $glibc_libdir $extraLDFlags"
-
-    # BOOT_CFLAGS defaults to `-g -O2'; since we override it below,
-    # make sure to explictly add them so that files compiled with the
-    # bootstrap compiler are optimized and (optionally) contain
-    # debugging information (info "(gccinstall) Building").
-    if test -n "$dontStrip"; then
-        extraFlags="-O2 -g $extraFlags"
-    else
-        # Don't pass `-g' at all; this saves space while building.
-        extraFlags="-O2 $extraFlags"
-    fi
-
-    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_TARGET_CFLAGS="-B${libcCross}/lib -idirafter ${libcCross}/include"
-            EXTRA_TARGET_LDFLAGS="-Wl,-L${libcCross}/lib -Wl,-rpath,${libcCross}/lib -Wl,-rpath-link,${libcCross}/lib"
-        fi
-    else
-        if test -z "$NIX_CC_CROSS"; then
-            EXTRA_TARGET_CFLAGS="$EXTRA_FLAGS"
-            EXTRA_TARGET_CXXFLAGS="$EXTRA_FLAGS"
-            EXTRA_TARGET_LDFLAGS="$EXTRA_LDFLAGS"
-        else
-            # This the case of cross-building the gcc.
-            # We need special flags for the target, different than those of the build
-            # Assertion:
-            test -e $NIX_CC_CROSS/nix-support/orig-libc
-
-            # Figure out what extra flags to pass to the gcc compilers
-            # being generated to make sure that they use our glibc.
-            extraFlags="$(cat $NIX_CC_CROSS/nix-support/libc-cflags)"
-            extraLDFlags="$(cat $NIX_CC_CROSS/nix-support/libc-ldflags) $(cat $NIX_CC_CROSS/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).
-            NIX_FIXINC_DUMMY_CROSS=$(cat $NIX_CC_CROSS/nix-support/orig-libc)/include
-
-            # The path to the Glibc binaries such as `crti.o'.
-            glibc_dir="$(cat $NIX_CC_CROSS/nix-support/orig-libc)"
-            glibc_libdir="$glibc_dir/lib"
-            configureFlags="$configureFlags --with-native-system-header-dir=$glibc_dir/include"
-
-            extraFlags="-I$NIX_FIXINC_DUMMY_CROSS $extraFlags"
-            extraLDFlags="-L$glibc_libdir -rpath $glibc_libdir $extraLDFlags"
-
-            EXTRA_TARGET_CFLAGS="$extraFlags"
-            for i in $extraLDFlags; do
-                EXTRA_TARGET_LDFLAGS="$EXTRA_TARGET_LDFLAGS -Wl,$i"
-            done
-        fi
-    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" \
-        CXXFLAGS_FOR_BUILD="$EXTRA_FLAGS $EXTRA_LDFLAGS" \
-        CFLAGS_FOR_TARGET="$EXTRA_TARGET_CFLAGS $EXTRA_TARGET_LDFLAGS" \
-        CXXFLAGS_FOR_TARGET="$EXTRA_TARGET_CFLAGS $EXTRA_TARGET_LDFLAGS" \
-        FLAGS_FOR_TARGET="$EXTRA_TARGET_CFLAGS $EXTRA_TARGET_LDFLAGS" \
-        LDFLAGS_FOR_BUILD="$EXTRA_FLAGS $EXTRA_LDFLAGS" \
-        LDFLAGS_FOR_TARGET="$EXTRA_TARGET_LDFLAGS $EXTRA_TARGET_LDFLAGS" \
-        )
-
-    if test -z "$targetConfig"; then
-        makeFlagsArray=( \
-            "${makeFlagsArray[@]}" \
-            BOOT_CFLAGS="$EXTRA_FLAGS $EXTRA_LDFLAGS" \
-            BOOT_LDFLAGS="$EXTRA_TARGET_CFLAGS $EXTRA_TARGET_LDFLAGS" \
-            )
-    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
-
-providedPreConfigure="$preConfigure";
-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
-
-    if test -f "$NIX_CC/nix-support/orig-libc"; then
-        # Patch the configure script so it finds glibc headers.  It's
-        # important for example in order not to get libssp built,
-        # because its functionality is in glibc already.
-        glibc_headers="$(cat $NIX_CC/nix-support/orig-libc)/include"
-        sed -i \
-            -e "s,glibc_header_dir=/usr/include,glibc_header_dir=$glibc_headers", \
-            gcc/configure
-    fi
-
-    if test -n "$crossMingw" -a -n "$crossStageStatic"; then
-        mkdir -p ../mingw
-        # --with-build-sysroot expects that:
-        cp -R $libcCross/include ../mingw
-        configureFlags="$configureFlags --with-build-sysroot=`pwd`/.."
-    fi
-
-    # Eval the preConfigure script from nix expression.
-    eval $providedPreConfigure;
-    env;
-    # Perform the build in a different directory.
-    mkdir ../build
-    cd ../build
-    configureScript=../$sourceRoot/configure
-}
-
-
-postConfigure() {
-    # Don't store the configure flags in the resulting executables.
-    sed -e '/TOPLEVEL_CONFIGURE_ARGUMENTS=/d' -i Makefile
-}
-
-
-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
-
-    # More dependencies with the previous gcc or some libs (gccbug stores the build command line)
-    rm -rf $out/bin/gccbug
-    # Take out the bootstrap-tools from the rpath, as it's not needed at all having $out
-    for i in $out/libexec/gcc/*/*/*; do
-        if PREV_RPATH=`patchelf --print-rpath $i`; then
-            patchelf --set-rpath `echo $PREV_RPATH | sed 's,:[^:]*bootstrap-tools/lib,,'` $i
-        fi
-    done
-
-    # 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/*-c++* $out/bin/*-g++*; do
-        if cmp -s $out/bin/g++ $i; then
-            ln -sfn g++ $i
-        fi
-    done
-
-    eval "$postInstallGhdl"
-}
-
-genericBuild
diff --git a/pkgs/development/compilers/gcc/4.9/default.nix b/pkgs/development/compilers/gcc/4.9/default.nix
index 7de8a140c0ab..16737ffc8963 100644
--- a/pkgs/development/compilers/gcc/4.9/default.nix
+++ b/pkgs/development/compilers/gcc/4.9/default.nix
@@ -1,5 +1,7 @@
 { stdenv, fetchurl, noSysDirs
 , langC ? true, langCC ? true, langFortran ? false
+, langObjC ? stdenv.isDarwin
+, langObjCpp ? stdenv.isDarwin
 , langJava ? false
 , langAda ? false
 , langVhdl ? false
@@ -13,10 +15,12 @@
 , libelf                      # optional, for link-time optimizations (LTO)
 , cloog ? null, isl ? null # optional, for the Graphite optimization framework.
 , zlib ? null, boehmgc ? null
-, zip ? null, unzip ? null, pkgconfig ? null, gtk ? null, libart_lgpl ? 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
+, x11Support ? langJava
 , gnatboot ? null
 , enableMultilib ? false
 , enablePlugin ? true             # whether to support user-supplied plug-ins
@@ -60,13 +64,13 @@ let version = "4.9.2";
     enableParallelBuilding = true;
 
     patches = [ ]
-      ++ optional enableParallelBuilding ./parallel-bconfig.patch
-      ++ optional (cross != null) ./libstdc++-target.patch
-      # ++ optional noSysDirs ./no-sys-dirs.patch
+      ++ optional enableParallelBuilding ../parallel-bconfig.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;
+      ++ optional langAda ../gnat-cflags.patch
+      ++ optional langFortran ../gfortran-driving.patch;
 
     javaEcj = fetchurl {
       # The `$(top_srcdir)/ecj.jar' file is automatically picked up at
@@ -80,8 +84,8 @@ let version = "4.9.2";
     # 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";
+      url = http://www.antlr.org/download/antlr-4.4-complete.jar;
+      sha256 = "02lda2imivsvsis8rnzmbrbp8rh1kb8vmq4i67pqhkwz7lf8y6dz";
     };
 
     xlibs = [
@@ -89,7 +93,7 @@ let version = "4.9.2";
       xproto renderproto xextproto inputproto randrproto
     ];
 
-    javaAwtGtk = langJava && gtk != null;
+    javaAwtGtk = langJava && x11Support;
 
     /* Platform flags */
     platformFlags = let
@@ -156,6 +160,7 @@ let version = "4.9.2";
           " --disable-libgomp " +
           " --disable-libquadmath" +
           " --disable-shared" +
+          " --disable-libatomic " +  # libatomic requires libc
           " --disable-decimal-float" # libdecnumber requires libc
           else
           (if crossDarwin then " --with-sysroot=${libcCross}/share/sysroot"
@@ -196,12 +201,12 @@ let version = "4.9.2";
 in
 
 # We need all these X libraries when building AWT with GTK+.
-assert gtk != null -> (filter (x: x == null) xlibs) == [];
+assert x11Support -> (filter (x: x == null) ([ gtk libart_lgpl ] ++ xlibs)) == [];
 
 stdenv.mkDerivation ({
   name = "${name}${if stripped then "" else "-debug"}-${version}" + crossNameAddon;
 
-  builder = ./builder.sh;
+  builder = ../builder.sh;
 
   src = fetchurl {
     url = "mirror://gnu/gcc/gcc-${version}/gcc-${version}.tar.bz2";
@@ -288,15 +293,21 @@ stdenv.mkDerivation ({
 
   NIX_LDFLAGS = stdenv.lib.optionalString  stdenv.isSunOS "-lm -ldl";
 
-  preConfigure = ''
-    ${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"
-      ''}
-    '';
+  preConfigure = 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"
+  '' + stdenv.lib.optionalString stdenv.isDarwin ''
+    if SDKROOT=$(/usr/bin/xcrun --show-sdk-path); then
+      configureFlagsArray+=(--with-native-system-header-dir=$SDKROOT/usr/include)
+      makeFlagsArray+=( \
+       CFLAGS_FOR_BUILD=-F$SDKROOT/System/Library/Frameworks \
+       CFLAGS_FOR_TARGET=-F$SDKROOT/System/Library/Frameworks \
+       FLAGS_FOR_TARGET=-F$SDKROOT/System/Library/Frameworks \
+      )
+    fi
+  '';
 
   dontDisableStatic = true;
 
@@ -338,6 +349,8 @@ stdenv.mkDerivation ({
         ++ optional langAda      "ada"
         ++ optional langVhdl     "vhdl"
         ++ optional langGo       "go"
+        ++ optional langObjC     "objc"
+        ++ optional langObjCpp   "obj-c++"
         ++ optionals crossDarwin [ "objc" "obj-c++" ]
         )
       )
@@ -475,9 +488,11 @@ stdenv.mkDerivation ({
     else null;
 
   passthru =
-    { inherit langC langCC langAda langFortran langVhdl langGo enableMultilib version; isGNU = true; };
+    { inherit langC langCC langObjC langObjCpp langAda langFortran langVhdl langGo version; isGNU = true; };
+
+  inherit enableParallelBuilding enableMultilib;
 
-  inherit enableParallelBuilding;
+  inherit (stdenv) is64bit;
 
   meta = {
     homepage = http://gcc.gnu.org/;
diff --git a/pkgs/development/compilers/gcc/4.9/gfortran-driving.patch b/pkgs/development/compilers/gcc/4.9/gfortran-driving.patch
deleted file mode 100644
index 70708886b405..000000000000
--- a/pkgs/development/compilers/gcc/4.9/gfortran-driving.patch
+++ /dev/null
@@ -1,20 +0,0 @@
-This patch fixes interaction with Libtool.
-See <http://thread.gmane.org/gmane.comp.gcc.patches/258777>, 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.9/gnat-cflags.patch b/pkgs/development/compilers/gcc/4.9/gnat-cflags.patch
deleted file mode 100644
index bf2acf065e9b..000000000000
--- a/pkgs/development/compilers/gcc/4.9/gnat-cflags.patch
+++ /dev/null
@@ -1,33 +0,0 @@
-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.9/java-jvgenmain-link.patch b/pkgs/development/compilers/gcc/4.9/java-jvgenmain-link.patch
deleted file mode 100644
index 2612e8bfbbbc..000000000000
--- a/pkgs/development/compilers/gcc/4.9/java-jvgenmain-link.patch
+++ /dev/null
@@ -1,17 +0,0 @@
-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.9/libstdc++-target.patch b/pkgs/development/compilers/gcc/4.9/libstdc++-target.patch
deleted file mode 100644
index fb622b395806..000000000000
--- a/pkgs/development/compilers/gcc/4.9/libstdc++-target.patch
+++ /dev/null
@@ -1,32 +0,0 @@
-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.9/no-sys-dirs.patch b/pkgs/development/compilers/gcc/4.9/no-sys-dirs.patch
deleted file mode 100644
index 79901703cb82..000000000000
--- a/pkgs/development/compilers/gcc/4.9/no-sys-dirs.patch
+++ /dev/null
@@ -1,41 +0,0 @@
-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/development/compilers/gcc/4.9/parallel-bconfig.patch b/pkgs/development/compilers/gcc/4.9/parallel-bconfig.patch
deleted file mode 100644
index bc56ac698f5a..000000000000
--- a/pkgs/development/compilers/gcc/4.9/parallel-bconfig.patch
+++ /dev/null
@@ -1,32 +0,0 @@
-Hacky work-around for highly parallel builds.
-http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57125
-
-diff --git a/gcc/Makefile.in b/gcc/Makefile.in
-index aad927c..182f666 100644
---- a/gcc/Makefile.in
-+++ b/gcc/Makefile.in
-@@ -3908,21 +3908,21 @@ build/gengtype-lex.o: $(BCONFIG_H)
- 
- gengtype-parse.o build/gengtype-parse.o : gengtype-parse.c gengtype.h \
-   $(SYSTEM_H)
--gengtype-parse.o: $(CONFIG_H)
-+gengtype-parse.o: $(CONFIG_H) $(BCONFIG_H)
- CFLAGS-gengtype-parse.o += -DGENERATOR_FILE
- build/gengtype-parse.o: $(BCONFIG_H)
- 
- gengtype-state.o build/gengtype-state.o: gengtype-state.c $(SYSTEM_H) \
-   gengtype.h errors.h double-int.h version.h $(HASHTAB_H) $(OBSTACK_H) \
-   $(XREGEX_H)
--gengtype-state.o: $(CONFIG_H)
-+gengtype-state.o: $(CONFIG_H) $(BCONFIG_H)
- CFLAGS-gengtype-state.o += -DGENERATOR_FILE
- build/gengtype-state.o: $(BCONFIG_H)
- 
- gengtype.o build/gengtype.o : gengtype.c $(SYSTEM_H) gengtype.h 	\
-   rtl.def insn-notes.def errors.h double-int.h version.h $(HASHTAB_H) \
-   $(OBSTACK_H) $(XREGEX_H)
--gengtype.o: $(CONFIG_H)
-+gengtype.o: $(CONFIG_H) $(BCONFIG_H)
- CFLAGS-gengtype.o += -DGENERATOR_FILE
- build/gengtype.o: $(BCONFIG_H)
- 
diff --git a/pkgs/development/compilers/gcc/5/builder.sh b/pkgs/development/compilers/gcc/5/builder.sh
deleted file mode 100644
index dd77c67a023e..000000000000
--- a/pkgs/development/compilers/gcc/5/builder.sh
+++ /dev/null
@@ -1,255 +0,0 @@
-source $stdenv/setup
-
-
-export NIX_FIXINC_DUMMY=$NIX_BUILD_TOP/dummy
-mkdir $NIX_FIXINC_DUMMY
-
-
-if test "$staticCompiler" = "1"; then
-    EXTRA_LDFLAGS="-static"
-else
-    EXTRA_LDFLAGS=""
-fi
-
-# GCC interprets empty paths as ".", which we don't want.
-if test -z "$CPATH"; then unset CPATH; fi
-if test -z "$LIBRARY_PATH"; then unset LIBRARY_PATH; fi
-echo "\$CPATH is \`$CPATH'"
-echo "\$LIBRARY_PATH is \`$LIBRARY_PATH'"
-
-if test "$noSysDirs" = "1"; then
-
-    if test -e $NIX_CC/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_CC/nix-support/libc-cflags)"
-        extraLDFlags="$(cat $NIX_CC/nix-support/libc-ldflags) $(cat $NIX_CC/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_CC/nix-support/orig-libc)/include
-
-        # The path to the Glibc binaries such as `crti.o'.
-        glibc_libdir="$(cat $NIX_CC/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="-I$NIX_FIXINC_DUMMY $extraFlags"
-    extraLDFlags="-L$glibc_libdir -rpath $glibc_libdir $extraLDFlags"
-
-    # BOOT_CFLAGS defaults to `-g -O2'; since we override it below,
-    # make sure to explictly add them so that files compiled with the
-    # bootstrap compiler are optimized and (optionally) contain
-    # debugging information (info "(gccinstall) Building").
-    if test -n "$dontStrip"; then
-        extraFlags="-O2 -g $extraFlags"
-    else
-        # Don't pass `-g' at all; this saves space while building.
-        extraFlags="-O2 $extraFlags"
-    fi
-
-    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_TARGET_CFLAGS="-B${libcCross}/lib -idirafter ${libcCross}/include"
-            EXTRA_TARGET_LDFLAGS="-Wl,-L${libcCross}/lib -Wl,-rpath,${libcCross}/lib -Wl,-rpath-link,${libcCross}/lib"
-        fi
-    else
-        if test -z "$NIX_CC_CROSS"; then
-            EXTRA_TARGET_CFLAGS="$EXTRA_FLAGS"
-            EXTRA_TARGET_CXXFLAGS="$EXTRA_FLAGS"
-            EXTRA_TARGET_LDFLAGS="$EXTRA_LDFLAGS"
-        else
-            # This the case of cross-building the gcc.
-            # We need special flags for the target, different than those of the build
-            # Assertion:
-            test -e $NIX_CC_CROSS/nix-support/orig-libc
-
-            # Figure out what extra flags to pass to the gcc compilers
-            # being generated to make sure that they use our glibc.
-            extraFlags="$(cat $NIX_CC_CROSS/nix-support/libc-cflags)"
-            extraLDFlags="$(cat $NIX_CC_CROSS/nix-support/libc-ldflags) $(cat $NIX_CC_CROSS/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).
-            NIX_FIXINC_DUMMY_CROSS=$(cat $NIX_CC_CROSS/nix-support/orig-libc)/include
-
-            # The path to the Glibc binaries such as `crti.o'.
-            glibc_dir="$(cat $NIX_CC_CROSS/nix-support/orig-libc)"
-            glibc_libdir="$glibc_dir/lib"
-            configureFlags="$configureFlags --with-native-system-header-dir=$glibc_dir/include"
-
-            extraFlags="-I$NIX_FIXINC_DUMMY_CROSS $extraFlags"
-            extraLDFlags="-L$glibc_libdir -rpath $glibc_libdir $extraLDFlags"
-
-            EXTRA_TARGET_CFLAGS="$extraFlags"
-            for i in $extraLDFlags; do
-                EXTRA_TARGET_LDFLAGS="$EXTRA_TARGET_LDFLAGS -Wl,$i"
-            done
-        fi
-    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+=( \
-        NATIVE_SYSTEM_HEADER_DIR="$NIX_FIXINC_DUMMY" \
-        SYSTEM_HEADER_DIR="$NIX_FIXINC_DUMMY" \
-        CFLAGS_FOR_BUILD="$EXTRA_FLAGS $EXTRA_LDFLAGS" \
-        CXXFLAGS_FOR_BUILD="$EXTRA_FLAGS $EXTRA_LDFLAGS" \
-        CFLAGS_FOR_TARGET="$EXTRA_TARGET_CFLAGS $EXTRA_TARGET_LDFLAGS" \
-        CXXFLAGS_FOR_TARGET="$EXTRA_TARGET_CFLAGS $EXTRA_TARGET_LDFLAGS" \
-        FLAGS_FOR_TARGET="$EXTRA_TARGET_CFLAGS $EXTRA_TARGET_LDFLAGS" \
-        LDFLAGS_FOR_BUILD="$EXTRA_FLAGS $EXTRA_LDFLAGS" \
-        LDFLAGS_FOR_TARGET="$EXTRA_TARGET_LDFLAGS $EXTRA_TARGET_LDFLAGS" \
-        )
-
-    if test -z "$targetConfig"; then
-        makeFlagsArray+=( \
-            BOOT_CFLAGS="$EXTRA_FLAGS $EXTRA_LDFLAGS" \
-            BOOT_LDFLAGS="$EXTRA_TARGET_CFLAGS $EXTRA_TARGET_LDFLAGS" \
-            )
-    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+=( \
-            LIMITS_H_TEST=false \
-            )
-    else
-        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
-
-providedPreConfigure="$preConfigure";
-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
-
-    if test -f "$NIX_CC/nix-support/orig-libc"; then
-        # Patch the configure script so it finds glibc headers.  It's
-        # important for example in order not to get libssp built,
-        # because its functionality is in glibc already.
-        glibc_headers="$(cat $NIX_CC/nix-support/orig-libc)/include"
-        sed -i \
-            -e "s,glibc_header_dir=/usr/include,glibc_header_dir=$glibc_headers", \
-            gcc/configure
-    fi
-
-    if test -n "$crossMingw" -a -n "$crossStageStatic"; then
-        mkdir -p ../mingw
-        # --with-build-sysroot expects that:
-        cp -R $libcCross/include ../mingw
-        configureFlags="$configureFlags --with-build-sysroot=`pwd`/.."
-    fi
-
-    # Eval the preConfigure script from nix expression.
-    eval "$providedPreConfigure"
-
-    # Perform the build in a different directory.
-    mkdir ../build
-    cd ../build
-    configureScript=../$sourceRoot/configure
-}
-
-
-postConfigure() {
-    # Don't store the configure flags in the resulting executables.
-    sed -e '/TOPLEVEL_CONFIGURE_ARGUMENTS=/d' -i Makefile
-}
-
-
-preInstall() {
-    # Make ‘lib64’ a symlink to ‘lib’.
-    if [ -n "$is64bit" -a -z "$enableMultilib" ]; then
-        mkdir -p $out/lib
-        ln -s lib $out/lib64
-    fi
-}
-
-
-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
-
-    # More dependencies with the previous gcc or some libs (gccbug stores the build command line)
-    rm -rf $out/bin/gccbug
-    # Take out the bootstrap-tools from the rpath, as it's not needed at all having $out
-    for i in $out/libexec/gcc/*/*/*; do
-        if PREV_RPATH=`patchelf --print-rpath $i`; then
-            patchelf --set-rpath `echo $PREV_RPATH | sed 's,:[^:]*bootstrap-tools/lib,,'` $i
-        fi
-    done
-
-    # 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/*-c++* $out/bin/*-g++*; do
-        if cmp -s $out/bin/g++ $i; then
-            ln -sfn g++ $i
-        fi
-    done
-
-    # Disable RANDMMAP on grsec, which causes segfaults when using
-    # precompiled headers.
-    # See https://bugs.gentoo.org/show_bug.cgi?id=301299#c31
-    paxmark r $out/libexec/gcc/*/*/{cc1,cc1plus}
-
-    eval "$postInstallGhdl"
-}
-
-genericBuild
diff --git a/pkgs/development/compilers/gcc/5/default.nix b/pkgs/development/compilers/gcc/5/default.nix
index 7096467854c7..95125d99893c 100644
--- a/pkgs/development/compilers/gcc/5/default.nix
+++ b/pkgs/development/compilers/gcc/5/default.nix
@@ -65,12 +65,12 @@ let version = "5.1.0";
     enableParallelBuilding = true;
 
     patches = [ ]
-      ++ optional (cross != null) ./libstdc++-target.patch
-      ++ optional noSysDirs ./no-sys-dirs.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;
+      ++ optional langAda ../gnat-cflags.patch
+      ++ optional langFortran ../gfortran-driving.patch;
 
     javaEcj = fetchurl {
       # The `$(top_srcdir)/ecj.jar' file is automatically picked up at
@@ -157,7 +157,6 @@ let version = "5.1.0";
           " --disable-libssp --disable-nls" +
           " --without-headers" +
           " --disable-threads " +
-          " --disable-libmudflap " +
           " --disable-libgomp " +
           " --disable-libquadmath" +
           " --disable-shared" +
@@ -207,7 +206,7 @@ assert x11Support -> (filter (x: x == null) ([ gtk libart_lgpl ] ++ xlibs)) == [
 stdenv.mkDerivation ({
   name = "${name}${if stripped then "" else "-debug"}-${version}" + crossNameAddon;
 
-  builder = ./builder.sh;
+  builder = ../builder.sh;
 
   src = fetchurl {
     url = "mirror://gnu/gcc/gcc-${version}/gcc-${version}.tar.bz2";
diff --git a/pkgs/development/compilers/gcc/5/gfortran-driving.patch b/pkgs/development/compilers/gcc/5/gfortran-driving.patch
deleted file mode 100644
index 70708886b405..000000000000
--- a/pkgs/development/compilers/gcc/5/gfortran-driving.patch
+++ /dev/null
@@ -1,20 +0,0 @@
-This patch fixes interaction with Libtool.
-See <http://thread.gmane.org/gmane.comp.gcc.patches/258777>, 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/5/gnat-cflags.patch b/pkgs/development/compilers/gcc/5/gnat-cflags.patch
deleted file mode 100644
index bf2acf065e9b..000000000000
--- a/pkgs/development/compilers/gcc/5/gnat-cflags.patch
+++ /dev/null
@@ -1,33 +0,0 @@
-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/5/java-jvgenmain-link.patch b/pkgs/development/compilers/gcc/5/java-jvgenmain-link.patch
deleted file mode 100644
index 2612e8bfbbbc..000000000000
--- a/pkgs/development/compilers/gcc/5/java-jvgenmain-link.patch
+++ /dev/null
@@ -1,17 +0,0 @@
-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/5/libstdc++-target.patch b/pkgs/development/compilers/gcc/5/libstdc++-target.patch
deleted file mode 100644
index fb622b395806..000000000000
--- a/pkgs/development/compilers/gcc/5/libstdc++-target.patch
+++ /dev/null
@@ -1,32 +0,0 @@
-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/5/no-sys-dirs.patch b/pkgs/development/compilers/gcc/5/no-sys-dirs.patch
deleted file mode 100644
index 36df51904acf..000000000000
--- a/pkgs/development/compilers/gcc/5/no-sys-dirs.patch
+++ /dev/null
@@ -1,28 +0,0 @@
-diff -ru -x '*~' gcc-4.8.3-orig/gcc/cppdefault.c gcc-4.8.3/gcc/cppdefault.c
---- gcc-4.8.3-orig/gcc/cppdefault.c	2013-01-10 21:38:27.000000000 +0100
-+++ gcc-4.8.3/gcc/cppdefault.c	2014-08-18 16:20:32.893944536 +0200
-@@ -35,6 +35,8 @@
- # undef CROSS_INCLUDE_DIR
- #endif
- 
-+#undef LOCAL_INCLUDE_DIR
-+
- const struct default_include cpp_include_defaults[]
- #ifdef INCLUDE_DEFAULTS
- = INCLUDE_DEFAULTS;
-diff -ru -x '*~' gcc-4.8.3-orig/gcc/gcc.c gcc-4.8.3/gcc/gcc.c
---- gcc-4.8.3-orig/gcc/gcc.c	2014-03-23 12:30:57.000000000 +0100
-+++ gcc-4.8.3/gcc/gcc.c	2014-08-18 13:19:32.689201690 +0200
-@@ -1162,10 +1162,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.  */
diff --git a/pkgs/development/compilers/gcc/4.8/builder.sh b/pkgs/development/compilers/gcc/builder.sh
index dd77c67a023e..dd77c67a023e 100644
--- a/pkgs/development/compilers/gcc/4.8/builder.sh
+++ b/pkgs/development/compilers/gcc/builder.sh
diff --git a/pkgs/development/compilers/gcc/4.6/gfortran-driving.patch b/pkgs/development/compilers/gcc/gfortran-driving.patch
index 70708886b405..70708886b405 100644
--- a/pkgs/development/compilers/gcc/4.6/gfortran-driving.patch
+++ b/pkgs/development/compilers/gcc/gfortran-driving.patch
diff --git a/pkgs/development/compilers/gcc/4.5/gnat-cflags.patch b/pkgs/development/compilers/gcc/gnat-cflags.patch
index bf2acf065e9b..bf2acf065e9b 100644
--- a/pkgs/development/compilers/gcc/4.5/gnat-cflags.patch
+++ b/pkgs/development/compilers/gcc/gnat-cflags.patch
diff --git a/pkgs/development/compilers/gcc/4.5/libstdc++-target.patch b/pkgs/development/compilers/gcc/libstdc++-target.patch
index fb622b395806..fb622b395806 100644
--- a/pkgs/development/compilers/gcc/4.5/libstdc++-target.patch
+++ b/pkgs/development/compilers/gcc/libstdc++-target.patch
diff --git a/pkgs/development/compilers/gcc/4.8/no-sys-dirs.patch b/pkgs/development/compilers/gcc/no-sys-dirs.patch
index 36df51904acf..36df51904acf 100644
--- a/pkgs/development/compilers/gcc/4.8/no-sys-dirs.patch
+++ b/pkgs/development/compilers/gcc/no-sys-dirs.patch
diff --git a/pkgs/development/compilers/gcc/4.8/parallel-bconfig.patch b/pkgs/development/compilers/gcc/parallel-bconfig.patch
index bc56ac698f5a..bc56ac698f5a 100644
--- a/pkgs/development/compilers/gcc/4.8/parallel-bconfig.patch
+++ b/pkgs/development/compilers/gcc/parallel-bconfig.patch
diff --git a/pkgs/development/compilers/gcl/default.nix b/pkgs/development/compilers/gcl/default.nix
index a31517afbeb1..f1844a1a632b 100644
--- a/pkgs/development/compilers/gcl/default.nix
+++ b/pkgs/development/compilers/gcl/default.nix
@@ -10,7 +10,7 @@ in
 
 (
 assert a.stdenv ? cc ;
-assert a.stdenv.cc.cc.isGNU or false ;
+assert a.stdenv.cc.isGNU ;
 assert a.stdenv.cc ? libc ;
 assert a.stdenv.cc.libc != null ;
 
diff --git a/pkgs/development/compilers/ghc/6.10.2-binary.nix b/pkgs/development/compilers/ghc/6.10.2-binary.nix
index 1e755ab6c0cc..3a649c2420a9 100644
--- a/pkgs/development/compilers/ghc/6.10.2-binary.nix
+++ b/pkgs/development/compilers/ghc/6.10.2-binary.nix
@@ -97,6 +97,12 @@ stdenv.mkDerivation rec {
         [ $(./main) == "yes" ]
       '';
 
-  meta.license = stdenv.lib.licenses.bsd3;
-  meta.platforms = ["x86_64-linux" "i686-linux"];
+  meta = {
+    homepage = "http://haskell.org/ghc";
+    description = "The Glasgow Haskell Compiler";
+    license = stdenv.lib.licenses.bsd3;
+    platforms = ["x86_64-linux" "i686-linux"];
+    broken = true;              # https://github.com/NixOS/nixpkgs/issues/7810
+  };
+
 }
diff --git a/pkgs/development/compilers/ghc/6.10.4.nix b/pkgs/development/compilers/ghc/6.10.4.nix
index d8157673fbc3..0df0ef27ca04 100644
--- a/pkgs/development/compilers/ghc/6.10.4.nix
+++ b/pkgs/development/compilers/ghc/6.10.4.nix
@@ -25,5 +25,6 @@ stdenv.mkDerivation rec {
     description = "The Glasgow Haskell Compiler";
     platforms = ["x86_64-linux" "i686-linux"];  # Darwin is unsupported.
     inherit (ghc.meta) license;
+    broken = true;              # https://github.com/NixOS/nixpkgs/issues/7810
   };
 }
diff --git a/pkgs/development/compilers/ghc/6.12.3.nix b/pkgs/development/compilers/ghc/6.12.3.nix
index f6beaf3a0067..499f1db79bac 100644
--- a/pkgs/development/compilers/ghc/6.12.3.nix
+++ b/pkgs/development/compilers/ghc/6.12.3.nix
@@ -39,5 +39,6 @@ stdenv.mkDerivation rec {
     maintainers = with stdenv.lib.maintainers; [ marcweber andres simons ];
     platforms = ["x86_64-linux" "i686-linux"];  # Darwin is unsupported.
     inherit (ghc.meta) license;
+    broken = true;              # https://github.com/NixOS/nixpkgs/issues/7810
   };
 }
diff --git a/pkgs/development/compilers/ghc/7.10.1.nix b/pkgs/development/compilers/ghc/7.10.1.nix
index 4eb4a501e4e3..34c2e3b36b0c 100644
--- a/pkgs/development/compilers/ghc/7.10.1.nix
+++ b/pkgs/development/compilers/ghc/7.10.1.nix
@@ -42,6 +42,9 @@ stdenv.mkDerivation rec {
       url = "https://git.haskell.org/ghc.git/patch/c46e4b184e0abc158ad8f1eff6b3f0421acaf984";
       sha256 = "0fkdyqd4bqp742rydwmqq8d2n7gf61bgdhaiw8xf7jy0ix7lr60w";
     })
+    # Fix TH + indirect symbol resolution on OSX (or any system using gold linker)
+    # https://phabricator.haskell.org/D852
+    ./osx-dylib-resolver.patch
   ];
 
   postPatch = ''
diff --git a/pkgs/development/compilers/ghc/7.8.4.nix b/pkgs/development/compilers/ghc/7.8.4.nix
index 5497b35ec1db..4323341dc4a4 100644
--- a/pkgs/development/compilers/ghc/7.8.4.nix
+++ b/pkgs/development/compilers/ghc/7.8.4.nix
@@ -1,6 +1,6 @@
 { stdenv, fetchurl, ghc, perl, gmp, ncurses, libiconv }:
 
-stdenv.mkDerivation rec {
+stdenv.mkDerivation (rec {
   version = "7.8.4";
   name = "ghc-${version}";
 
@@ -45,4 +45,7 @@ stdenv.mkDerivation rec {
     inherit (ghc.meta) license platforms;
   };
 
-}
+} // stdenv.lib.optionalAttrs stdenv.isDarwin {
+  # https://ghc.haskell.org/trac/ghc/ticket/9762
+  patches = [ ./hpc-7.8.4.patch ];
+})
diff --git a/pkgs/development/compilers/ghc/hpc-7.8.4.patch b/pkgs/development/compilers/ghc/hpc-7.8.4.patch
new file mode 100644
index 000000000000..212989200bc5
--- /dev/null
+++ b/pkgs/development/compilers/ghc/hpc-7.8.4.patch
@@ -0,0 +1,13 @@
+diff --git a/compiler/cmm/CLabel.hs b/compiler/cmm/CLabel.hs
+index 991fc57..0aad221 100644
+--- a/compiler/cmm/CLabel.hs
++++ b/compiler/cmm/CLabel.hs
+@@ -877,7 +877,7 @@ labelDynamic dflags this_pkg this_mod lbl =
+ 
+    PlainModuleInitLabel m -> not (gopt Opt_Static dflags) && this_pkg /= (modulePackageId m)
+ 
+-   HpcTicksLabel m        -> not (gopt Opt_Static dflags) && this_pkg /= (modulePackageId m)
++   HpcTicksLabel m        -> not (gopt Opt_Static dflags) && this_mod /= m
+ 
+    -- Note that DynamicLinkerLabels do NOT require dynamic linking themselves.
+    _                 -> False
diff --git a/pkgs/development/compilers/ghc/osx-dylib-resolver.patch b/pkgs/development/compilers/ghc/osx-dylib-resolver.patch
new file mode 100644
index 000000000000..50236026031e
--- /dev/null
+++ b/pkgs/development/compilers/ghc/osx-dylib-resolver.patch
@@ -0,0 +1,60 @@
+diff --git a/compiler/ghci/Linker.hs b/compiler/ghci/Linker.hs
+--- a/compiler/ghci/Linker.hs
++++ b/compiler/ghci/Linker.hs
+@@ -119,9 +119,9 @@
+         -- that is really important
+         pkgs_loaded :: ![PackageKey],
+ 
+-        -- we need to remember the name of the last temporary DLL/.so
+-        -- so we can link it
+-        last_temp_so :: !(Maybe (FilePath, String)) }
++        -- we need to remember the name of previous temporary DLL/.so
++        -- libraries so we can link them (see #10322)
++        temp_sos :: ![(FilePath, String)] }
+ 
+ 
+ emptyPLS :: DynFlags -> PersistentLinkerState
+@@ -131,7 +131,7 @@
+                         pkgs_loaded = init_pkgs,
+                         bcos_loaded = [],
+                         objs_loaded = [],
+-                        last_temp_so = Nothing }
++                        temp_sos = [] }
+ 
+   -- Packages that don't need loading, because the compiler
+   -- shares them with the interpreted program.
+@@ -841,19 +841,19 @@
+         dflags2 = dflags1 {
+                       -- We don't want the original ldInputs in
+                       -- (they're already linked in), but we do want
+-                      -- to link against the previous dynLoadObjs
+-                      -- library if there was one, so that the linker
++                      -- to link against previous dynLoadObjs
++                      -- libraries if there were any, so that the linker
+                       -- can resolve dependencies when it loads this
+                       -- library.
+                       ldInputs =
+-                        case last_temp_so pls of
+-                          Nothing -> []
+-                          Just (lp, l)  ->
++                        concatMap
++                            (\(lp, l) ->
+                                  [ Option ("-L" ++ lp)
+                                  , Option ("-Wl,-rpath")
+                                  , Option ("-Wl," ++ lp)
+                                  , Option ("-l" ++  l)
+-                                 ],
++                                 ])
++                            (temp_sos pls),
+                       -- Even if we're e.g. profiling, we still want
+                       -- the vanilla dynamic libraries, so we set the
+                       -- ways / build tag to be just WayDyn.
+@@ -868,7 +868,7 @@
+     consIORef (filesToNotIntermediateClean dflags) soFile
+     m <- loadDLL soFile
+     case m of
+-        Nothing -> return pls { last_temp_so = Just (libPath, libName) }
++        Nothing -> return pls { temp_sos = (libPath, libName) : temp_sos pls }
+         Just err -> panic ("Loading temp shared object failed: " ++ err)
+ 
+ rmDupLinkables :: [Linkable]    -- Already loaded
diff --git a/pkgs/development/compilers/ghcjs/default.nix b/pkgs/development/compilers/ghcjs/default.nix
index 24a361724aed..696415f4562d 100644
--- a/pkgs/development/compilers/ghcjs/default.nix
+++ b/pkgs/development/compilers/ghcjs/default.nix
@@ -41,8 +41,8 @@ let
   version = "0.1.0";
   ghcjsBoot = fetchgit {
     url = git://github.com/ghcjs/ghcjs-boot.git;
-    rev = "ab8765edcb507b8b810e3c324fd5bd5af2b69d8f"; # 7.10 branch
-    sha256 = "63b69a1d131cf3c7088e0f28d14750c81361dcc276fa113ad80dcccf73df5343";
+    rev = "5c3ca2db12bd3e92d3eeaead8bcb6b347174a30f"; # 7.10 branch
+    sha256 = "0rpfb73bd0maccg3bjf51l23byy0h2i47wph99wblmkdp8ywxkpf";
     fetchSubmodules = true;
   };
   shims = fetchgit {
@@ -55,8 +55,8 @@ in mkDerivation (rec {
   inherit version;
   src = fetchgit {
     url = git://github.com/ghcjs/ghcjs.git;
-    rev = "d4322c2ae4467420b28eca99f0c0abd00caf5d4a"; # master branch
-    sha256 = "12mvl4l1i993j86n9wkwcs567jm13javghbxapjjsc7493xpmya5";
+    rev = "15b7a34ddc11075a335e097f6109ad57ca03edab"; # master branch
+    sha256 = "0h6jdwd7lh3rkfsqpq3s6iavqkz1a88grzcxrcqj4rjilzdw288q";
   };
   isLibrary = true;
   isExecutable = true;
diff --git a/pkgs/development/compilers/go/1.2.nix b/pkgs/development/compilers/go/1.2.nix
index a00fe7346701..113e2118efb6 100644
--- a/pkgs/development/compilers/go/1.2.nix
+++ b/pkgs/development/compilers/go/1.2.nix
@@ -1,4 +1,5 @@
-{ stdenv, fetchurl, bison, glibc, bash, coreutils, makeWrapper, tzdata, iana_etc }:
+{ stdenv, fetchurl, bison, glibc, bash, coreutils, makeWrapper, tzdata, iana_etc
+, libgpgerror }:
 
 let
   loader386 = "${glibc}/lib/ld-linux.so.2";
@@ -14,7 +15,7 @@ stdenv.mkDerivation {
     sha1 = "3ce0ac4db434fc1546fec074841ff40dc48c1167";
   };
 
-  buildInputs = [ bison glibc bash makeWrapper ];
+  buildInputs = [ bison glibc bash makeWrapper libgpgerror ];
 
   NIX_CFLAGS_COMPILE = "-Wno-error=cpp";
 
diff --git a/pkgs/development/compilers/go/1.4.nix b/pkgs/development/compilers/go/1.4.nix
index 371496250056..1feaf68930ac 100644
--- a/pkgs/development/compilers/go/1.4.nix
+++ b/pkgs/development/compilers/go/1.4.nix
@@ -1,26 +1,19 @@
-{ stdenv, lib, fetchurl, fetchgit, bison, glibc, bash, coreutils, makeWrapper, tzdata, iana_etc, perl, Security }:
+{ stdenv, lib, fetchurl, bison, glibc, bash, coreutils, makeWrapper, tzdata, iana_etc, perl, Security, goPackages }:
 
 let
   loader386 = "${glibc}/lib/ld-linux.so.2";
   loaderAmd64 = "${glibc}/lib/ld-linux-x86-64.so.2";
   loaderArm = "${glibc}/lib/ld-linux.so.3";
-  srcs = {
-    golang = fetchurl {
-      url = https://github.com/golang/go/archive/go1.4.2.tar.gz;
-      sha256 = "3e5d07bc5214a1ffe187cf6406c5b5a80ee44f12f6bca97a5463db0afee2f6ac";
-    };
-    tools = fetchgit {
-      url = https://github.com/golang/tools.git;
-      rev = "c836fe615a448dbf9ff5448c1aa657479a0d0aeb";
-      sha256 = "0q9jnhmgmm3xzjss7ndsi6nyykmmb1y984n98118c2sipi183xp5";
-    };
-  };
 in
 
-stdenv.mkDerivation {
-  name = "go-1.4.2";
+stdenv.mkDerivation rec {
+  name = "go-${version}";
+  version = "1.4.2";
 
-  src = srcs.golang;
+  src = fetchurl {
+    url = "https://github.com/golang/go/archive/go${version}.tar.gz";
+    sha256 = "3e5d07bc5214a1ffe187cf6406c5b5a80ee44f12f6bca97a5463db0afee2f6ac";
+  };
 
   # perl is used for testing go vet
   buildInputs = [ bison bash makeWrapper perl ]
@@ -41,9 +34,6 @@ stdenv.mkDerivation {
       mv * go
     fi
 
-    mkdir -p $out/share/go/src/golang.org/x
-    cp -r --no-preserve=mode,ownership ${srcs.tools} $out/share/go/src/golang.org/x/tools
-
     cd go
     patchShebangs ./ # replace /bin/bash
 
@@ -68,13 +58,16 @@ stdenv.mkDerivation {
     sed -i 's,/lib/ld-linux.so.2,${loader386},' src/cmd/8l/asm.c
   '';
 
-  patches = [ ./cacert-1.4.patch ];
+  patches = [
+    ./cacert-1.4.patch
+    ./remove-tools.patch
+  ];
 
   GOOS = if stdenv.isDarwin then "darwin" else "linux";
   GOARCH = if stdenv.isDarwin then "amd64"
            else if stdenv.system == "i686-linux" then "386"
            else if stdenv.system == "x86_64-linux" then "amd64"
-           else if stdenv.system == "armv5tel-linux" then "arm"
+           else if stdenv.isArm then "arm"
            else throw "Unsupported system";
   GOARM = stdenv.lib.optionalString (stdenv.system == "armv5tel-linux") "5";
   GO386 = 387; # from Arch: don't assume sse2 on i686
@@ -91,13 +84,6 @@ stdenv.mkDerivation {
     export PATH="$GOBIN:$PATH"
     cd ./src
     ./all.bash
-    cd -
-
-    # Build extra tooling
-    # TODO: Fix godoc tests
-    TOOL_ROOT=golang.org/x/tools/cmd
-    go install -v $TOOL_ROOT/cover $TOOL_ROOT/vet $TOOL_ROOT/godoc
-    go test -v    $TOOL_ROOT/cover $TOOL_ROOT/vet # $TOOL_ROOT/godoc
   '';
 
   setupHook = ./setup-hook.sh;
@@ -107,7 +93,7 @@ stdenv.mkDerivation {
     homepage = http://golang.org/;
     description = "The Go Programming language";
     license = "BSD";
-    maintainers = with stdenv.lib.maintainers; [ cstrahan ];
+    maintainers = with stdenv.lib.maintainers; [ cstrahan wkennington ];
     platforms = stdenv.lib.platforms.linux ++ stdenv.lib.platforms.darwin;
   };
 }
diff --git a/pkgs/development/compilers/go/remove-tools.patch b/pkgs/development/compilers/go/remove-tools.patch
new file mode 100644
index 000000000000..807ab8e089c1
--- /dev/null
+++ b/pkgs/development/compilers/go/remove-tools.patch
@@ -0,0 +1,81 @@
+diff --git a/misc/makerelease/makerelease.go b/misc/makerelease/makerelease.go
+index 3b511b1..a46ebd8 100644
+--- a/misc/makerelease/makerelease.go
++++ b/misc/makerelease/makerelease.go
+@@ -65,9 +65,6 @@ const (
+ // These must be the command that cmd/go knows to install to $GOROOT/bin
+ // or $GOROOT/pkg/tool.
+ var toolPaths = []string{
+-	"golang.org/x/tools/cmd/cover",
+-	"golang.org/x/tools/cmd/godoc",
+-	"golang.org/x/tools/cmd/vet",
+ }
+ 
+ var preBuildCleanFiles = []string{
+diff --git a/src/cmd/dist/build.c b/src/cmd/dist/build.c
+index b6c61b4..2006bc2 100644
+--- a/src/cmd/dist/build.c
++++ b/src/cmd/dist/build.c
+@@ -210,7 +210,9 @@ init(void)
+ 	workdir = xworkdir();
+ 	xatexit(rmworkdir);
+ 
+-	bpathf(&b, "%s/pkg/tool/%s_%s", goroot, gohostos, gohostarch);
++	xgetenv(&b, "GOTOOLDIR");
++	if (b.len == 0)
++		bpathf(&b, "%s/pkg/tool/%s_%s", goroot, gohostos, gohostarch);
+ 	tooldir = btake(&b);
+ 
+ 	bfree(&b);
+diff --git a/src/cmd/go/pkg.go b/src/cmd/go/pkg.go
+index b71feb7..8468ea8 100644
+--- a/src/cmd/go/pkg.go
++++ b/src/cmd/go/pkg.go
+@@ -401,9 +401,9 @@ var goTools = map[string]targetDir{
+ 	"cmd/pack":                             toTool,
+ 	"cmd/pprof":                            toTool,
+ 	"cmd/yacc":                             toTool,
+-	"golang.org/x/tools/cmd/cover":         toTool,
+-	"golang.org/x/tools/cmd/godoc":         toBin,
+-	"golang.org/x/tools/cmd/vet":           toTool,
++	"nixos.org/x/tools/cmd/cover":          toTool,
++	"nixos.org/x/tools/cmd/godoc":          toBin,
++	"nixos.org/x/tools/cmd/vet":            toTool,
+ 	"code.google.com/p/go.tools/cmd/cover": stalePath,
+ 	"code.google.com/p/go.tools/cmd/godoc": stalePath,
+ 	"code.google.com/p/go.tools/cmd/vet":   stalePath,
+diff --git a/src/go/build/build.go b/src/go/build/build.go
+index 311ecb0..f151d8f 100644
+--- a/src/go/build/build.go
++++ b/src/go/build/build.go
+@@ -1367,7 +1367,7 @@ func init() {
+ }
+ 
+ // ToolDir is the directory containing build tools.
+-var ToolDir = filepath.Join(runtime.GOROOT(), "pkg/tool/"+runtime.GOOS+"_"+runtime.GOARCH)
++var ToolDir = runtime.GOTOOLDIR()
+ 
+ // IsLocalImport reports whether the import path is
+ // a local import path, like ".", "..", "./foo", or "../foo".
+diff --git a/src/runtime/extern.go b/src/runtime/extern.go
+index 6cc5df8..9a9a964 100644
+--- a/src/runtime/extern.go
++++ b/src/runtime/extern.go
+@@ -152,6 +152,17 @@ func GOROOT() string {
+ 	return defaultGoroot
+ }
+ 
++// GOTOOLDIR returns the root of the Go tree.
++// It uses the GOTOOLDIR environment variable, if set,
++// or else the root used during the Go build.
++func GOTOOLDIR() string {
++	s := gogetenv("GOTOOLDIR")
++	if s != "" {
++		return s
++	}
++	return GOROOT() + "/pkg/tool/" + GOOS + "_" + GOARCH
++}
++
+ // Version returns the Go tree's version string.
+ // It is either the commit hash and date at the time of the build or,
+ // when possible, a release tag like "go1.3".
diff --git a/pkgs/development/compilers/hugs/default.nix b/pkgs/development/compilers/hugs/default.nix
deleted file mode 100644
index 14751799795a..000000000000
--- a/pkgs/development/compilers/hugs/default.nix
+++ /dev/null
@@ -1,53 +0,0 @@
-{ composableDerivation, fetchurl }:
-
-let edf = composableDerivation.edf;
-    wwf = composableDerivation.wwf; in
-    
-composableDerivation.composableDerivation {} {
-  name = "hugs98-200609";
-
-  src = fetchurl {
-    url = http://cvs.haskell.org/Hugs/downloads/2006-09/hugs98-Sep2006.tar.gz;
-    sha256 = "3cf4d27673564cffe691bd14032369f646233f14daf2bc37c6c6df9f062b46b6";
-  };
-
-  #encode all character I/O using the byte encoding
-  #determined by the locale in effect at that time. To
-  #require that the UTF-8 encoding is always used, give
-  #the --enable-char-encoding=utf8 option.
-  #[default=autodetect]
-  postUnpack = ''
-    find -type f | xargs sed -i 's@/bin/cp@cp@';
-  '';
-  
-  configurePhase = "./configure --prefix=\$out --enable-char-encoding=utf8 $configureFlags";
-
-  flags =
-       edf { name = "pathCanonicalization"; feat="path-canonicalization"; }
-    // edf { name="timer"; }   # enable evaluation timing (for benchmarking Hugs)
-    // edf { name="profiling"; }# enable heap profiler
-    // edf { name="stackDumps"; feat="stack-dummps"; } # enable stack dump on stack overflow
-    // edf { name="largeBanner"; feat="large-banner"; } # disable multiline startup banner
-    // edf { name="internal-prims"; } # experimental primitives to access Hugs's innards
-    // edf { name="debug"; } # include C debugging information (for debugging Hugs)
-    // edf { name="tag"; } # runtime tag checking (for debugging Hugs)
-    // edf { name="lint"; } # enable "lint" flags (for debugging Hugs)
-    // edf { name="only98"; } # build Hugs to understand Haskell 98 only
-    // edf { name="ffi"; }
-      #--with-nmake            produce a Makefile compatible with nmake
-      #--with-gui              build Hugs for Windows GUI (Borland C++ only)
-    // wwf { name="pthreads"; } #   build Hugs using POSIX threads C library
-    ;
-
-  cfg = {
-    largeBannerSupport = true; # seems to be default
-    char = { cfgOption = "--enable-char-encoding"; blocks = "utf8"; };
-    utf8 = { cfgOption = "--enable-char-encoding=utf8"; blocks="char"; };
-  };
-
-  meta = {
-    license = "as-is"; # gentoo is calling it this way..
-    description = "Haskell interpreter";
-    homepage = http://www.haskell.org/hugs;
-  };
-}
diff --git a/pkgs/development/compilers/llvm/3.5/clang.nix b/pkgs/development/compilers/llvm/3.5/clang.nix
index 2398b0c59ac5..05ac4be01e5f 100644
--- a/pkgs/development/compilers/llvm/3.5/clang.nix
+++ b/pkgs/development/compilers/llvm/3.5/clang.nix
@@ -1,6 +1,6 @@
 { stdenv, fetch, cmake, libxml2, libedit, llvm, version, clang-tools-extra_src }:
 let
-  gcc = if stdenv.cc.cc.isGNU or false then stdenv.cc.cc else stdenv.cc.cc.gcc;
+  gcc = if stdenv.cc.isGNU then stdenv.cc.cc else stdenv.cc.cc.gcc;
 in stdenv.mkDerivation {
   name = "clang-${version}";
 
diff --git a/pkgs/development/compilers/llvm/3.6/clang/default.nix b/pkgs/development/compilers/llvm/3.6/clang/default.nix
index 7be535ada1e5..898ca37558e4 100644
--- a/pkgs/development/compilers/llvm/3.6/clang/default.nix
+++ b/pkgs/development/compilers/llvm/3.6/clang/default.nix
@@ -1,7 +1,7 @@
 { stdenv, fetch, cmake, libxml2, libedit, llvm, version, clang-tools-extra_src }:
 
 let
-  gcc = if stdenv.cc.cc.isGNU or false then stdenv.cc.cc else stdenv.cc.cc.gcc;
+  gcc = if stdenv.cc.isGNU then stdenv.cc.cc else stdenv.cc.cc.gcc;
 in stdenv.mkDerivation {
   name = "clang-${version}";
 
diff --git a/pkgs/development/compilers/openjdk/fix-java-home-jdk8.patch b/pkgs/development/compilers/openjdk/fix-java-home-jdk8.patch
new file mode 100644
index 000000000000..6189412c999c
--- /dev/null
+++ b/pkgs/development/compilers/openjdk/fix-java-home-jdk8.patch
@@ -0,0 +1,15 @@
+--- a/hotspot/src/os/linux/vm/os_linux.cpp  2015-02-04 21:14:39.000000000 +0100
++++ b/hotspot/src/os/linux/vm/os_linux.cpp  2015-05-19 16:17:29.960107613 +0200
+@@ -2304,10 +2304,8 @@
+   assert(ret, "cannot locate libjvm");
+   char *rp = NULL;
+   if (ret && dli_fname[0] != '\0') {
+-    rp = realpath(dli_fname, buf);
++    snprintf(buf, buflen, "%s", dli_fname);
+   }
+-  if (rp == NULL)
+-    return;
+
+   if (Arguments::created_by_gamma_launcher()) {
+     // Support for the gamma launcher.  Typical value for buf is
+
diff --git a/pkgs/development/compilers/openjdk/openjdk8.nix b/pkgs/development/compilers/openjdk/openjdk8.nix
index 44e934741635..63d42e6e3d64 100644
--- a/pkgs/development/compilers/openjdk/openjdk8.nix
+++ b/pkgs/development/compilers/openjdk/openjdk8.nix
@@ -1,41 +1,41 @@
 { stdenv, fetchurl, cpio, file, which, unzip, zip, xorg, cups, freetype, alsaLib, openjdk, cacert, perl, liberation_ttf, fontconfig } :
 let
   update = "40";
-  build = "25";
+  build = "27";
   baseurl = "http://hg.openjdk.java.net/jdk8u/jdk8u40";
   repover = "jdk8u${update}-b${build}";
   paxflags = if stdenv.isi686 then "msp" else "m";
   jdk8 = fetchurl {
              url = "${baseurl}/archive/${repover}.tar.gz";
-             sha256 = "05s5j0rq45n8piymv9c1n0hxr4bk3j8lz6fw2wbp0m8kam6zzpza";
+             sha256 = "0ra05jngvvy2g1da5b9anrp86m812g2wlkxpijc82kxv6c3h6g28";
           };
   langtools = fetchurl {
              url = "${baseurl}/langtools/archive/${repover}.tar.gz";
-             sha256 = "0p1z38szm63cf5f83697awbqwpf7b8q1ymrqc0v6r9hb5yf0p22r";
+             sha256 = "0r9zdq13kgqqm8rgr36qf03h23psxcwzvdqffsncd4jvbfap3n5f";
           };
   hotspot = fetchurl {
              url = "${baseurl}/hotspot/archive/${repover}.tar.gz";
-             sha256 = "0sl0ima3zlbd1ai7qrg4msy5ibg64qpwdrv7z4l8cpalwby26y6p";
+             sha256 = "07v3z38v5fdsx3g28c4pkdq76cdmnc4qflf1wb3lz46lhy230hkd";
           };
   corba = fetchurl {
              url = "${baseurl}/corba/archive/${repover}.tar.gz";
-             sha256 = "1ahvhap8av519813yf20v3hbvg82j9bq3gnqlayng1qggfivsb5s";
+             sha256 = "0y20468f2yi14lijbd732f2mlgrn718pyfji3279l2rm4ad7r7pl";
           };
   jdk = fetchurl {
              url = "${baseurl}/jdk/archive/${repover}.tar.gz";
-             sha256 = "0n86fcy1z4z22jcgfnn9agzfi949709hn2x6s8wyhwwa055rjd1a";
+             sha256 = "1sgfxmkq6z3vj9yq9kszr42b1ijvsknlss353jpcmyr1lljhyvfg";
           };
   jaxws = fetchurl {
              url = "${baseurl}/jaxws/archive/${repover}.tar.gz";
-             sha256 = "0hp19hq0dw3j8zz4mxd6bjk9zqlyr56fhwzgjwmm56b6pwkcmsn7";
+             sha256 = "08p3657d0871pz0g5fg157az9q38r5h2zs49dm7512sc9qrn5c06";
           };
   jaxp = fetchurl {
              url = "${baseurl}/jaxp/archive/${repover}.tar.gz";
-             sha256 = "037za0hjiwvzvbzsckfxnrrbak1vbd52pmrnd855vxkik08jxp8c";
+             sha256 = "1f1vlrvlvnjbyh8d168smizvmkcm076zc496sxk6njqamby16ip2";
           };
   nashorn = fetchurl {
              url = "${baseurl}/nashorn/archive/${repover}.tar.gz";
-             sha256 = "1np8hkg2fmj5s6ipd1vb8x0z6xy00kbi2ipqca9pxzib58caj6b2";
+             sha256 = "1llf3l4483kd8m1a77n7y9fgvm6fa63nim3qhp5z4gnw68ldbhra";
           };
   openjdk8 = stdenv.mkDerivation {
   name = "openjdk-8u${update}b${build}";
@@ -50,11 +50,19 @@ let
   '';
   prePatch = ''
     # despite --with-override-jdk the build still searchs here
-    ln -s "../jdk-${repover}" "jdk";
-    ln -s "../hotspot-${repover}" "hotspot";
+    # GNU Patch bug, --follow-symlinks only follow the last dir part symlink
+    mv "../jdk-${repover}" "jdk";
+    mv "../hotspot-${repover}" "hotspot";
+  '';
+  postPatch = ''
+    mv jdk "../jdk-${repover}";
+    mv hotspot "../hotspot-${repover}";
+    # Patching is over, lets re-add the links
+    ln -s "../jdk-${repover}" "jdk"
+    ln -s "../hotspot-${repover}" "hotspot"
   '';
   patches = [
-    ./fix-java-home.patch
+    ./fix-java-home-jdk8.patch
     ./read-truststore-from-env-jdk8.patch
     ./currency-date-range-jdk8.patch
   ];
@@ -78,7 +86,7 @@ let
     "--with-milestone=fcs"
   ];
   NIX_LDFLAGS= "-lfontconfig";
-  buildFlags = "DEBUG_BINARIES=true all";
+  buildFlags = "all";
   installPhase = ''
     mkdir -p $out/lib/openjdk $out/share $jre/lib/openjdk
 
diff --git a/pkgs/development/compilers/rustc/1.0.0-beta.nix b/pkgs/development/compilers/rustc/1.0.0.nix
index 93359fba9f7a..bd02397986be 100644
--- a/pkgs/development/compilers/rustc/1.0.0-beta.nix
+++ b/pkgs/development/compilers/rustc/1.0.0.nix
@@ -1,8 +1,8 @@
 { stdenv, callPackage }:
 callPackage ./makeRustcDerivation.nix {
-  shortVersion = "1.0.0-beta.2";
+  shortVersion = "1.0.0";
   isRelease = true;
-  srcSha = "0wcpp6fg7cc75bj5b6dcz5dhgps6xw09n75qiapmd12qxjzj17wn";
+  srcSha = "1fjyk5xhg9dx85d1kkjmb1jai7awvdmzcjf2fdmi2pdjyzacn163";
   snapshotHashLinux686 = "1ef82402ed16f5a6d2f87a9a62eaa83170e249ec";
   snapshotHashLinux64 = "ef2154372e97a3cb687897d027fd51c8f2c5f349";
   snapshotHashDarwin686 = "0310b1a970f2da7e61770fd14dbbbdca3b518234";
@@ -12,5 +12,5 @@ callPackage ./makeRustcDerivation.nix {
   patches = [
     ./patches/beta.patch
     ] ++ stdenv.lib.optional stdenv.needsPax ./patches/grsec.patch;
-  configureFlags = [ "--release-channel=beta" ];
+  configureFlags = [ "--release-channel=stable" ];
 }
diff --git a/pkgs/development/compilers/rustc/head.nix b/pkgs/development/compilers/rustc/head.nix
index 99012ba6d94d..c73a12c6f6e8 100644
--- a/pkgs/development/compilers/rustc/head.nix
+++ b/pkgs/development/compilers/rustc/head.nix
@@ -2,15 +2,15 @@
 callPackage ./makeRustcDerivation.nix {
   shortVersion = "1.0.0-dev";
   isRelease = false;
-  # src rev for master on 2015/04/13
-  srcRev = "0cf99c3e06e84d20d68da649c888d63c72f33971";
-  srcSha = "0brnzsbxmidjnmvi36sz582k3kw6wk813y2y837zpmyxg9fjah0l";
-  snapshotHashLinux686 = "1ef82402ed16f5a6d2f87a9a62eaa83170e249ec";
-  snapshotHashLinux64 = "ef2154372e97a3cb687897d027fd51c8f2c5f349";
-  snapshotHashDarwin686 = "0310b1a970f2da7e61770fd14dbbbdca3b518234";
-  snapshotHashDarwin64 = "5f35d9c920b8083a7420ef8cf5b00d5ef3085dfa";
-  snapshotDate = "2015-03-27";
-  snapshotRev = "5520801";
+  # src rev for master on 2015-05-13
+  srcRev = "67433c1a309d3c9457e49f15e80a2d927d165996";
+  srcSha = "0idc3nh0sfjlv7m9710azx7n6awzwj6mhw3aybsb9bbagzy2sdsg";
+  snapshotHashLinux686 = "0bc8cffdce611fb71fd7d3d8e7cdbfaf748a4f16";
+  snapshotHashLinux64 = "94089740e48167c5975c92c139ae9c286764012f";
+  snapshotHashDarwin686 = "54cc35e76497e6e94fddf38d6e40e9d168491ddb";
+  snapshotHashDarwin64 = "43a1c1fba0d1dfee4c2ca310d506f8f5f51b3f6f";
+  snapshotDate = "2015-04-27";
+  snapshotRev = "857ef6e";
   patches = [
     ./patches/head.patch
   ] ++ stdenv.lib.optional stdenv.needsPax ./patches/grsec.patch;
diff --git a/pkgs/development/compilers/rustc/patches/head.patch b/pkgs/development/compilers/rustc/patches/head.patch
index 3cbf8717cd1d..cd2320e84dfe 100644
--- a/pkgs/development/compilers/rustc/patches/head.patch
+++ b/pkgs/development/compilers/rustc/patches/head.patch
@@ -15,7 +15,7 @@ index ca59b1c..65ee7bf 100755
  # do not fail if one of the above fails, as all we need is a working rustc!
  exit 0
 diff --git a/src/librustc_back/archive.rs b/src/librustc_back/archive.rs
-index ed44bf8..2b84627 100644
+index 9f5751c..c98828f 100644
 --- a/src/librustc_back/archive.rs
 +++ b/src/librustc_back/archive.rs
 @@ -57,7 +57,7 @@ fn run_ar(handler: &ErrorHandler, maybe_ar_prog: &Option<String>,
@@ -28,10 +28,10 @@ index ed44bf8..2b84627 100644
      let mut cmd = Command::new(ar);
  
 diff --git a/src/librustc_trans/back/link.rs b/src/librustc_trans/back/link.rs
-index 3087a8e..578448f 100644
+index ad77735..1764f71 100644
 --- a/src/librustc_trans/back/link.rs
 +++ b/src/librustc_trans/back/link.rs
-@@ -352,8 +352,8 @@ pub fn mangle_internal_name_by_path_and_seq(path: PathElems, flav: &str) -> Stri
+@@ -360,8 +360,8 @@ pub fn mangle_internal_name_by_path_and_seq(path: PathElems, flav: &str) -> Stri
  
  pub fn get_cc_prog(sess: &Session) -> String {
      match sess.opts.cg.linker {
@@ -41,3 +41,17 @@ index 3087a8e..578448f 100644
 +        None => "@ccPath@".to_string(),
      }
  }
+ 
+diff --git a/src/test/run-pass/issue-20797.rs b/src/test/run-pass/issue-20797.rs
+index 8b5e6f8..480ad79 100644
+--- a/src/test/run-pass/issue-20797.rs
++++ b/src/test/run-pass/issue-20797.rs
+@@ -97,7 +97,7 @@ impl<S: Strategy> Iterator for Subpaths<S> {
+ }
+ 
+ fn _foo() {
+-    let _walker: Subpaths<Recursive> = Subpaths::walk(&PathBuf::from("/home")).unwrap();
++    let _walker: Subpaths<Recursive> = Subpaths::walk(&PathBuf::from("/tmp")).unwrap();
+ }
+ 
+ fn main() {}
diff --git a/pkgs/development/compilers/smlnj/default.nix b/pkgs/development/compilers/smlnj/default.nix
index aa8ea9012c11..a2b8d4f63b98 100644
--- a/pkgs/development/compilers/smlnj/default.nix
+++ b/pkgs/development/compilers/smlnj/default.nix
@@ -60,11 +60,11 @@ in stdenv.mkDerivation {
     done
   '';
 
-  meta = {
+  meta = with stdenv.lib; {
     description = "Standard ML of New Jersey, a compiler";
     homepage    = http://smlnj.org;
-    license     = stdenv.lib.licenses.bsd3;
+    license     = licenses.bsd3;
     platforms   = [ "i686-linux" ];
-    maintainers = stdenv.lib.maintainers.thoughtpolice;
+    maintainers = with maintainers; [ thoughtpolice ];
   };
 }