gcc-initial, gcc-intermediate, gcc-final: optimize extraction
authorThomas Petazzoni <thomas.petazzoni@free-electrons.com>
Sun, 30 Jun 2013 19:29:04 +0000 (21:29 +0200)
committerPeter Korsgaard <jacmet@sunsite.dk>
Wed, 3 Jul 2013 21:37:23 +0000 (23:37 +0200)
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>
package/gcc/4.3.6/100-uclibc-conf.patch
package/gcc/4.4.7/100-uclibc-conf.patch
package/gcc/4.5.4/100-uclibc-conf.patch
package/gcc/4.6.4/100-uclibc-conf.patch
package/gcc/4.7.3/100-uclibc-conf.patch
package/gcc/4.8.1/100-uclibc-conf.patch
package/gcc/gcc-final/gcc-final.mk
package/gcc/gcc-initial/gcc-initial.mk
package/gcc/gcc-intermediate/gcc-intermediate.mk
package/gcc/gcc.mk

index cca8c822922b4c1c0cfa038c38ecfef19a3f5c9c..6bad179e62bcd6057a52fea6209d7da178d17e4d 100644 (file)
  elif [ $H_REAL_TARGET = $H_REAL_HOST ] ; then
    make bootstrap || exit 1
    make install || exit 1
---- gcc/libjava/classpath/ltconfig
-+++ gcc/libjava/classpath/ltconfig
-@@ -603,7 +603,7 @@
- # Transform linux* to *-*-linux-gnu*, to support old configure scripts.
- case $host_os in
--linux-gnu*) ;;
-+linux-gnu*|linux-uclibc*) ;;
- linux*) host=`echo $host | sed 's/^\(.*-.*-linux\)\(.*\)$/\1-gnu\2/'`
- esac
-@@ -1251,7 +1251,7 @@
-   ;;
- # This must be Linux ELF.
--linux-gnu*)
-+linux*)
-   version_type=linux
-   need_lib_prefix=no
-   need_version=no
index cca8c822922b4c1c0cfa038c38ecfef19a3f5c9c..6bad179e62bcd6057a52fea6209d7da178d17e4d 100644 (file)
  elif [ $H_REAL_TARGET = $H_REAL_HOST ] ; then
    make bootstrap || exit 1
    make install || exit 1
---- gcc/libjava/classpath/ltconfig
-+++ gcc/libjava/classpath/ltconfig
-@@ -603,7 +603,7 @@
- # Transform linux* to *-*-linux-gnu*, to support old configure scripts.
- case $host_os in
--linux-gnu*) ;;
-+linux-gnu*|linux-uclibc*) ;;
- linux*) host=`echo $host | sed 's/^\(.*-.*-linux\)\(.*\)$/\1-gnu\2/'`
- esac
-@@ -1251,7 +1251,7 @@
-   ;;
- # This must be Linux ELF.
--linux-gnu*)
-+linux*)
-   version_type=linux
-   need_lib_prefix=no
-   need_version=no
index cca8c822922b4c1c0cfa038c38ecfef19a3f5c9c..6bad179e62bcd6057a52fea6209d7da178d17e4d 100644 (file)
  elif [ $H_REAL_TARGET = $H_REAL_HOST ] ; then
    make bootstrap || exit 1
    make install || exit 1
---- gcc/libjava/classpath/ltconfig
-+++ gcc/libjava/classpath/ltconfig
-@@ -603,7 +603,7 @@
- # Transform linux* to *-*-linux-gnu*, to support old configure scripts.
- case $host_os in
--linux-gnu*) ;;
-+linux-gnu*|linux-uclibc*) ;;
- linux*) host=`echo $host | sed 's/^\(.*-.*-linux\)\(.*\)$/\1-gnu\2/'`
- esac
-@@ -1251,7 +1251,7 @@
-   ;;
- # This must be Linux ELF.
--linux-gnu*)
-+linux*)
-   version_type=linux
-   need_lib_prefix=no
-   need_version=no
index cca8c822922b4c1c0cfa038c38ecfef19a3f5c9c..6bad179e62bcd6057a52fea6209d7da178d17e4d 100644 (file)
  elif [ $H_REAL_TARGET = $H_REAL_HOST ] ; then
    make bootstrap || exit 1
    make install || exit 1
---- gcc/libjava/classpath/ltconfig
-+++ gcc/libjava/classpath/ltconfig
-@@ -603,7 +603,7 @@
- # Transform linux* to *-*-linux-gnu*, to support old configure scripts.
- case $host_os in
--linux-gnu*) ;;
-+linux-gnu*|linux-uclibc*) ;;
- linux*) host=`echo $host | sed 's/^\(.*-.*-linux\)\(.*\)$/\1-gnu\2/'`
- esac
-@@ -1251,7 +1251,7 @@
-   ;;
- # This must be Linux ELF.
--linux-gnu*)
-+linux*)
-   version_type=linux
-   need_lib_prefix=no
-   need_version=no
index cca8c822922b4c1c0cfa038c38ecfef19a3f5c9c..6bad179e62bcd6057a52fea6209d7da178d17e4d 100644 (file)
  elif [ $H_REAL_TARGET = $H_REAL_HOST ] ; then
    make bootstrap || exit 1
    make install || exit 1
---- gcc/libjava/classpath/ltconfig
-+++ gcc/libjava/classpath/ltconfig
-@@ -603,7 +603,7 @@
- # Transform linux* to *-*-linux-gnu*, to support old configure scripts.
- case $host_os in
--linux-gnu*) ;;
-+linux-gnu*|linux-uclibc*) ;;
- linux*) host=`echo $host | sed 's/^\(.*-.*-linux\)\(.*\)$/\1-gnu\2/'`
- esac
-@@ -1251,7 +1251,7 @@
-   ;;
- # This must be Linux ELF.
--linux-gnu*)
-+linux*)
-   version_type=linux
-   need_lib_prefix=no
-   need_version=no
index d855b30ee8d538756b949ccc9c478c9d77f4944a..d56bf0a194b965c5aae37a6a14660d645390698d 100644 (file)
@@ -13,25 +13,3 @@ Index: gcc-4.8.0/contrib/regression/objs-gcc.sh
  elif [ $H_REAL_TARGET = $H_REAL_HOST ] ; then
    make bootstrap || exit 1
    make install || exit 1
-Index: gcc-4.8.0/libjava/classpath/ltconfig
-===================================================================
---- gcc-4.8.0.orig/libjava/classpath/ltconfig  2011-02-13 12:45:53.000000000 +0100
-+++ gcc-4.8.0/libjava/classpath/ltconfig       2013-03-23 17:39:04.000000000 +0100
-@@ -603,7 +603,7 @@
- # Transform linux* to *-*-linux-gnu*, to support old configure scripts.
- case $host_os in
--linux-gnu*) ;;
-+linux-gnu*|linux-uclibc*) ;;
- linux*) host=`echo $host | sed 's/^\(.*-.*-linux\)\(.*\)$/\1-gnu\2/'`
- esac
-@@ -1247,7 +1247,7 @@
-   ;;
- # This must be Linux ELF.
--linux-gnu*)
-+linux*)
-   version_type=linux
-   need_lib_prefix=no
-   need_version=no
index 1767bbbdf2a848ab35c350b3ecff94b48fa6c565..998c928f611802cef98c32e3191f8f26a505d6ae 100644 (file)
@@ -12,6 +12,8 @@ HOST_GCC_FINAL_DEPENDENCIES = \
        $(HOST_GCC_COMMON_DEPENDENCIES) \
        uclibc
 
+HOST_GCC_FINAL_EXTRACT_CMDS = $(HOST_GCC_EXTRACT_CMDS)
+
 ifneq ($(call qstrip, $(BR2_XTENSA_CORE_NAME)),)
 HOST_GCC_FINAL_POST_EXTRACT_CMDS += HOST_GCC_FINAL_XTENSA_OVERLAY_EXTRACT
 endif
index e07783e592ef6825c313450ac2b8d8365b440f51..05c956abcbf4a481d74d3f9c654257d4d8870abd 100644 (file)
@@ -10,6 +10,8 @@ GCC_INITIAL_SOURCE  = $(GCC_SOURCE)
 
 HOST_GCC_INITIAL_DEPENDENCIES = $(HOST_GCC_COMMON_DEPENDENCIES)
 
+HOST_GCC_INITIAL_EXTRACT_CMDS = $(HOST_GCC_EXTRACT_CMDS)
+
 ifneq ($(call qstrip, $(BR2_XTENSA_CORE_NAME)),)
 HOST_GCC_INITIAL_POST_EXTRACT_CMDS += HOST_GCC_XTENSA_OVERLAY_EXTRACT
 endif
index 0c062a756404bdb5ecce23d6c178886077985b6c..6b6b57e1f7ba567d6aa0e408c21be1105c1108d4 100644 (file)
@@ -12,6 +12,8 @@ HOST_GCC_INTERMEDIATE_DEPENDENCIES = \
        $(HOST_GCC_COMMON_DEPENDENCIES) \
        uclibc-configured
 
+HOST_GCC_INTERMEDIATE_EXTRACT_CMDS = $(HOST_GCC_EXTRACT_CMDS)
+
 ifneq ($(call qstrip, $(BR2_XTENSA_CORE_NAME)),)
 HOST_GCC_INTERMEDIATE_POST_EXTRACT_CMDS += HOST_GCC_XTENSA_OVERLAY_EXTRACT
 endif
index 3b61ffd4547bb2081fb05f6c7595c35b9c61c459..790762da725a5e815797b0a48d10fdb0fc2568bc 100644 (file)
@@ -42,6 +42,23 @@ define HOST_GCC_APPLY_PATCHES
        support/scripts/apply-patches.sh $(@D) package/gcc/$(GCC_VERSION) \*.patch
 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
 #