summary refs log tree commit diff
path: root/pkgs/development/compilers/gcc
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/compilers/gcc')
-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/default.nix12
-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/parallel-bconfig.patch32
-rw-r--r--pkgs/development/compilers/gcc/5/builder.sh255
-rw-r--r--pkgs/development/compilers/gcc/5/default.nix10
-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
31 files changed, 22 insertions, 759 deletions
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/default.nix b/pkgs/development/compilers/gcc/4.9/default.nix
index e0c37c4390fb..16737ffc8963 100644
--- a/pkgs/development/compilers/gcc/4.9/default.nix
+++ b/pkgs/development/compilers/gcc/4.9/default.nix
@@ -64,13 +64,13 @@ let version = "4.9.2";
     enableParallelBuilding = true;
 
     patches = [ ]
-      ++ optional enableParallelBuilding ./parallel-bconfig.patch
-      ++ optional (cross != null) ./libstdc++-target.patch
-      ++ optional noSysDirs ../4.8/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
@@ -206,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 = ../4.8/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.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/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 5adecc47b873..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
@@ -206,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