gcc-initial, gcc-intermediate, gcc-final: optimize extraction

Several sub-directories of the gcc code base are in fact not needed
for the Buildroot build: libjava/, libgo/ and gcc/testsuite/ being the
biggest ones. Avoiding their extraction saves quite a bit of disk
space, and compensates a bit the fact that we now extract three times
the gcc source code.

This requires changing the 100-uclibc-conf.patch to no longer patch
files from the libjava/ directory, since this directory is no longer
extracted.

[Peter: add comment about why this is done]
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
diff --git a/package/gcc/gcc.mk b/package/gcc/gcc.mk
index 3b61ffd..790762d 100644
--- a/package/gcc/gcc.mk
+++ b/package/gcc/gcc.mk
@@ -43,6 +43,23 @@
 endef
 
 #
+# Custom extract command to save disk space
+#
+
+define HOST_GCC_EXTRACT_CMDS
+	$(BZCAT) $(DL_DIR)/$(GCC_SOURCE) | \
+		$(TAR) $(TAR_STRIP_COMPONENTS)=1 -C $(@D) \
+		--exclude='libjava/*' \
+		--exclude='libgo/*' \
+		--exclude='gcc/testsuite/*' \
+		--exclude='libstdc++-v3/testsuite/*' \
+		$(TAR_OPTIONS) -
+	mkdir -p $(@D)/libstdc++-v3/testsuite/
+	echo "all:" > $(@D)/libstdc++-v3/testsuite/Makefile.in
+	echo "install:" >> $(@D)/libstdc++-v3/testsuite/Makefile.in
+endef
+
+#
 # Create 'build' directory and configure symlink
 #