]> code.ossystems Code Review - openembedded-core.git/commitdiff
gcc: Split builddir saving into its own sstate task
authorRichard Purdie <richard.purdie@linuxfoundation.org>
Tue, 24 Jan 2017 13:18:12 +0000 (13:18 +0000)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Thu, 26 Jan 2017 10:41:08 +0000 (10:41 +0000)
When we stashed the gcc build directory for use in generating the various runtimes
we were being lazy and just used the staging directory. With recipe specific
sysroots this means we're copying a large chunk of data around with the cross
compiler which we don't really need in most cases.

Separate out the data into its own task and inject this into the configure
step. We have to do that here since autotools will wipe out ${B} if it thinks
we're rebuilding and we therefore have to time its recreation after that.

This also takes the opportunity to remove some pointless (as far as I can tell)
conditionals from the do_install code.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/recipes-devtools/gcc/gcc-common.inc
meta/recipes-devtools/gcc/gcc-cross-initial.inc
meta/recipes-devtools/gcc/gcc-cross.inc
meta/recipes-devtools/gcc/gcc-runtime.inc
meta/recipes-devtools/gcc/gcc-sanitizers.inc
meta/recipes-devtools/gcc/libgcc-common.inc
meta/recipes-devtools/gcc/libgcc-initial.inc
meta/recipes-devtools/gcc/libgcc.inc
meta/recipes-devtools/gcc/libgfortran.inc

index d17ba29d1d93f2d0c54d0968b695884534062f6c..44e7c2891c1ca856937dd25e88fa10006961e797 100644 (file)
@@ -8,6 +8,16 @@ NATIVEDEPS = ""
 inherit autotools gettext texinfo
 
 BPN = "gcc"
+COMPILERINITIAL = ""
+COMPILERDEP = "virtual/${MLPREFIX}${TARGET_PREFIX}gcc${COMPILERINITIAL}:do_gcc_stash_builddir"
+COMPILERDEP_class-nativesdk = "virtual/${TARGET_PREFIX}gcc${COMPILERINITIAL}-crosssdk:do_gcc_stash_builddir"
+
+python extract_stashed_builddir () {
+    src = d.expand("${STAGING_DIR}-components/${BUILD_ARCH}/gcc-stashed-builddir${COMPILERINITIAL}-${TARGET_SYS}")
+    dest = d.getVar("B")
+    oe.path.copyhardlinktree(src, dest)
+    staging_processfixme([src + "/fixmepath"], dest, dest, dest, d)
+}
 
 def get_gcc_float_setting(bb, d):
     if d.getVar('ARMPKGSFX_EABI') == "hf" and d.getVar('TRANSLATED_TARGET_ARCH') == "arm":
index d47f42e4c3f37f497db756c5300ea5247ce04944..dd35681c981fbdaaf0a4953fda1273013d5d3960 100644 (file)
@@ -75,14 +75,6 @@ do_install () {
        # so we overwirte the generated include-fixed/limits.h for gcc-cross-initial
        # to get rid references to real limits.h
        cp gcc/include-fixed/limits.h ${D}${gcclibdir}/${TARGET_SYS}/${BINV}/include/limits.h
-
-       # gcc-runtime installs libgcc into a special location in staging since it breaks doing a standalone build
-       case ${PN} in
-               *gcc-cross-initial-${TARGET_ARCH}|*gcc-crosssdk-initial-${SDK_SYS})
-                       dest=${D}/${includedir}/gcc-build-internal-initial-${TARGET_SYS}
-                       hardlinkdir . $dest
-               ;;
-       esac
 }
 #
 # Override the default sysroot staging copy since this won't look like a target system
@@ -99,3 +91,5 @@ do_populate_sysroot[sstate-inputdirs] = "${SYSROOT_DESTDIR}/${STAGING_DIR_HOST}/
 do_populate_sysroot[sstate-outputdirs] = "${STAGING_DIR}-components/${PACKAGE_ARCH}/${PN}"
 
 inherit nopackages
+
+COMPILERINITIAL = "-initial"
index c4f7084ba04476bc465a4fa02139eeba14e3edb7..f3ae4fe6b1bccf2751acd390f23f4c81a55c49cf 100644 (file)
@@ -185,21 +185,28 @@ do_install () {
        # We use libiberty from binutils
        find ${D}${exec_prefix}/lib -name libiberty.a | xargs rm -f
        find ${D}${exec_prefix}/lib -name libiberty.h | xargs rm -f
-
-       # gcc-runtime installs libgcc into a special location in staging since it breaks doing a standalone build
-       case ${PN} in
-               *gcc-cross-${TARGET_ARCH}|*gcc-crosssdk-${SDK_SYS})
-                       dest=${D}/${includedir}/gcc-build-internal-${TARGET_SYS}
-                       hardlinkdir . $dest
-               ;;
-       esac
 }
-# This is reflected in the recipe name and target gcc shouldn't depend 
-# on SDK settings either
-do_install[vardepsexclude] += "SDK_SYS"
 
 do_package[noexec] = "1"
 do_packagedata[noexec] = "1"
 do_package_write_ipk[noexec] = "1"
 do_package_write_rpm[noexec] = "1"
 do_package_write_deb[noexec] = "1"
+
+BUILDDIRSTASH = "${WORKDIR}/stashed-builddir"
+do_gcc_stash_builddir[dirs] = "${B}"
+do_gcc_stash_builddir[cleandirs] = "${BUILDDIRSTASH}"
+do_gcc_stash_builddir () {
+       dest=${BUILDDIRSTASH}
+       hardlinkdir . $dest
+}
+addtask do_gcc_stash_builddir after do_compile
+SSTATETASKS += "do_gcc_stash_builddir"
+do_gcc_stash_builddir[sstate-inputdirs] = "${BUILDDIRSTASH}"
+do_gcc_stash_builddir[sstate-outputdirs] = "${STAGING_DIR}-components/${BUILD_ARCH}/gcc-stashed-builddir${COMPILERINITIAL}-${TARGET_SYS}"
+do_gcc_stash_builddir[sstate-fixmedir] = "${STAGING_DIR}-components/${BUILD_ARCH}/gcc-stashed-builddir${COMPILERINITIAL}-${TARGET_SYS}"
+
+python do_gcc_stash_builddir_setscene () {
+    sstate_setscene(d)
+}
+addtask do_gcc_stash_builddir_setscene
index d56f82ac8d3a95a3c0fe185d2d37a666e966df1d..00856ad8bcf26b6c57b59250326f2173b80a1e36 100644 (file)
@@ -32,9 +32,8 @@ RUNTIMETARGET = "libssp libstdc++-v3 libgomp libatomic ${RUNTIMELIBITM} \
 
 do_configure () {
        export CXX="${CXX} -nostdinc++ -nostdlib++"
-       mtarget=`echo ${TARGET_SYS} | sed -e s#-${SDKPKGSUFFIX}##`
-       target=`echo ${TARGET_SYS} | sed -e s#-${SDKPKGSUFFIX}##`
-       hardlinkdir ${STAGING_INCDIR_NATIVE}/gcc-build-internal-$mtarget ${B}
+       target=${TARGET_SYS}
+
        for d in libgcc ${RUNTIMETARGET}; do
                echo "Configuring $d"
                rm -rf ${B}/$target/$d/
@@ -45,6 +44,8 @@ do_configure () {
                $relpath/configure ${CONFIGUREOPTS} ${EXTRA_OECONF}
        done
 }
+EXTRACONFFUNCS += "extract_stashed_builddir"
+do_configure[depends] += "${COMPILERDEP}"
 
 do_compile () {
        target=`echo ${TARGET_SYS} | sed -e s#-${SDKPKGSUFFIX}##`
index df4e297a4890703b530fdd645f4ac3202a81f2dd..ae3afe00b3d5c4d5ecebf4f287b75d01119fecf7 100644 (file)
@@ -12,11 +12,7 @@ EXTRA_OECONF_PATHS = "\
 "
 
 do_configure () {
-    mtarget=`echo ${TARGET_SYS} | sed -e s#-${SDKPKGSUFFIX}##`
     target=`echo ${TARGET_SYS} | sed -e s#-${SDKPKGSUFFIX}##`
-    if [ -d ${STAGING_INCDIR_NATIVE}/gcc-build-internal-$mtarget ]; then
-        hardlinkdir ${STAGING_INCDIR_NATIVE}/gcc-build-internal-$mtarget ${B}
-    fi
 
     echo "Configuring libsanitizer"
     rm -rf ${B}/$target/libsanitizer/
@@ -31,6 +27,8 @@ do_configure () {
     # Link to the sysroot's libstdc++ instead of one gcc thinks it just built
     sed -i -e '/LIBSTDCXX_RAW_CXX_\(CXXFLAGS\|LDFLAGS\)\s*=/d' ${B}/$target/libsanitizer/*/Makefile
 }
+EXTRACONFFUNCS += "extract_stashed_builddir"
+do_configure[depends] += "${COMPILERDEP}"
 
 do_compile () {
     target=`echo ${TARGET_SYS} | sed -e s#-${SDKPKGSUFFIX}##`
index 7a3b4106a8f6f95e4b8bbe2c434c1237ec05679a..c0efc29437637f9f181c18bbc2d10e94a0469100 100644 (file)
@@ -7,7 +7,6 @@ INHIBIT_DEFAULT_DEPS = "1"
 do_configure () {
        target=`echo ${TARGET_SYS} | sed -e s#-${SDKPKGSUFFIX}##`
        install -d ${D}${base_libdir} ${D}${libdir}
-       hardlinkdir ${STAGING_INCDIR_NATIVE}/${LIBGCCBUILDTREENAME}$target/ ${B}
        mkdir -p ${B}/${BPN}
        mkdir -p ${B}/$target/${BPN}/
        cd ${B}/${BPN}
@@ -15,6 +14,8 @@ do_configure () {
        relpath=${@os.path.relpath("${S}/${BPN}", "${B}/${BPN}")}
        $relpath/configure ${CONFIGUREOPTS} ${EXTRA_OECONF}
 }
+EXTRACONFFUNCS += "extract_stashed_builddir"
+do_configure[depends] += "${COMPILERDEP}"
 
 do_compile () {
        target=`echo ${TARGET_SYS} | sed -e s#-${SDKPKGSUFFIX}##`
index aa32185ec0d93192a11515600c4868d2cd33a4a6..5b4bc3b5a9f237e99a8f9d93151b7455819b74f0 100644 (file)
@@ -12,6 +12,6 @@ PACKAGES = ""
 
 EXTRA_OECONF += "--disable-shared"
 
-LIBGCCBUILDTREENAME = "gcc-build-internal-initial-"
+COMPILERINITIAL = "-initial"
 
 inherit nopackages
index 4770394c42cb88c679a69dd95015d25af81456d2..38d1643a9c557c21d2f1e3fc3b9acb800ec7d8c4 100644 (file)
@@ -33,8 +33,6 @@ FILES_${PN}-dev = "\
     ${libdir}/${TARGET_ARCH}${TARGET_VENDOR}* \
 "
 
-LIBGCCBUILDTREENAME = "gcc-build-internal-"
-
 do_package[depends] += "virtual/${MLPREFIX}libc:do_packagedata"
 do_package_write_ipk[depends] += "virtual/${MLPREFIX}libc:do_packagedata"
 do_package_write_deb[depends] += "virtual/${MLPREFIX}libc:do_packagedata"
index 194363543e1285bd8107ca538c6d38d056ee95e9..d3e2b411c808f67747463118105618f707f957bc 100644 (file)
@@ -6,9 +6,7 @@ EXTRA_OECONF_PATHS = "\
 "
 
 do_configure () {
-       mtarget=`echo ${TARGET_SYS} | sed -e s#-${SDKPKGSUFFIX}##`
        target=`echo ${TARGET_SYS} | sed -e s#-${SDKPKGSUFFIX}##`
-       hardlinkdir ${STAGING_INCDIR_NATIVE}/gcc-build-internal-$mtarget ${B}
 
        echo "Configuring libgfortran"
        rm -rf ${B}/$target/libgfortran/
@@ -21,6 +19,8 @@ do_configure () {
        # broken libtool here
        sed -i -e 's/hardcode_into_libs=yes/hardcode_into_libs=no/' ${B}/$target/libgfortran/libtool
 }
+EXTRACONFFUNCS += "extract_stashed_builddir"
+do_configure[depends] += "${COMPILERDEP}"
 
 do_compile () {
        target=`echo ${TARGET_SYS} | sed -e s#-${SDKPKGSUFFIX}##`