[OE-core] [PATCH 2/2] Share gcc work directories
Robert Yang
liezhi.yang at windriver.com
Sat Jun 11 07:19:42 UTC 2011
This patched is derived from Richard, make gcc use the shared source
directory during the different building:
1) Make gcc-cross, gcc-cross-initial, gcc-cross-intermediate and
gcc-runtime share the same source directory.
2) The source directory is ${TMPDIR}/work-shared/gcc-${PV}, for example:
tmp/work-shared/gcc-4.6.0
3) gcc uses sed and creates config files against ${S} which means the
directory should not be shared. Change the way to make it work.
4) Fix do_clean to clean the shared source directory and stamps
Signed-off-by: Robert Yang <liezhi.yang at windriver.com>
---
meta/recipes-devtools/gcc/gcc-common.inc | 32 ++++++++++++++++++-
meta/recipes-devtools/gcc/gcc-configure-common.inc | 10 +++++-
2 files changed, 39 insertions(+), 3 deletions(-)
diff --git a/meta/recipes-devtools/gcc/gcc-common.inc b/meta/recipes-devtools/gcc/gcc-common.inc
index a3fa234..7bf036c 100644
--- a/meta/recipes-devtools/gcc/gcc-common.inc
+++ b/meta/recipes-devtools/gcc/gcc-common.inc
@@ -37,10 +37,38 @@ ${GNU_MIRROR}/gcc/ http://gcc.get-software.com/releases/ \n \
#
gcclibdir = "${libdir}/gcc"
BINV = "${PV}"
-S = "${WORKDIR}/gcc-${PV}"
-B = "${S}/build.${HOST_SYS}.${TARGET_SYS}"
+#S = "${WORKDIR}/gcc-${PV}"
+S = "${TMPDIR}/work-shared/gcc-${PV}/gcc-${PV}"
+B = "${WORKDIR}/gcc-${PV}/build.${HOST_SYS}.${TARGET_SYS}"
+
+# SS means Shared Stamps directory
+SS = "${TMPDIR}/stamps/work-shared/gcc-${PV}"
+do_fetch[stamp-base] = "${SS}"
+do_unpack[stamp-base] = "${SS}"
+do_patch[stamp-base] = "${SS}"
+
+# SW means Shared Work directory
+SW = "${TMPDIR}/work-shared/gcc-${PV}"
+WORKDIR_task-unpack = "${SW}"
+WORKDIR_task-patch = "${SW}"
target_includedir ?= "${includedir}"
target_libdir ?= "${libdir}"
target_base_libdir ?= "${base_libdir}"
target_prefix ?= "${prefix}"
+
+CLEANFUNCS += "workshared_clean"
+# The do_clean should be exclusive since share ${S}
+do_clean[lockfiles] = "${TMPDIR}/stamps/work-shared/gcc-${PV}.clean.lock"
+
+python workshared_clean () {
+ """clear the source directory"""
+ dir = bb.data.expand("${SW}", d)
+ bb.note("Removing " + dir)
+ oe.path.remove(dir)
+
+ """clear the the stamps in work-shared"""
+ dir = "%s.*" % bb.data.expand(d.getVarFlag('do_fetch', 'stamp-base', True), d)
+ bb.note("Removing " + dir)
+ oe.path.remove(dir)
+}
diff --git a/meta/recipes-devtools/gcc/gcc-configure-common.inc b/meta/recipes-devtools/gcc/gcc-configure-common.inc
index f7b5836..c32242d 100644
--- a/meta/recipes-devtools/gcc/gcc-configure-common.inc
+++ b/meta/recipes-devtools/gcc/gcc-configure-common.inc
@@ -87,7 +87,15 @@ do_configure () {
export ARCH_FLAGS_FOR_TARGET="${ARCH_FLAGS_FOR_TARGET}"
(cd ${S} && gnu-configize) || die "failure running gnu-configize"
- # teach gcc to find correct target includedir when checking libc ssp support
+ # teach gcc to find correct target includedir when checking libc ssp support,
+ # save the files before hack them, so that we can always hack the fresh one.
+ for i in configure.ac Makefile.in defaults.h configure; do
+ [ ! -f ${S}/gcc/$i.orig ] && cp ${S}/gcc/$i ${S}/gcc/$i.orig
+ cp ${S}/gcc/$i.orig ${S}/gcc/$i
+ done
+ # Make sure that ${S}/configure is newer than ${S}/gcc/configure to prevent
+ # auto run autoconf.
+ touch ${S}/configure
sed -i 's:^\([ ]*\)glibc_header_dir=\"${with_build_sysroot}/usr/include\":\1glibc_header_dir=\"${with_build_sysroot}${SYSTEMHEADERS}\":g' ${S}/gcc/configure.ac
sed -i 's:^\([ ]*\)glibc_header_dir=\"${with_build_sysroot}/usr/include\":\1glibc_header_dir=\"${with_build_sysroot}${SYSTEMHEADERS}\":g' ${S}/gcc/configure
--
1.7.1
More information about the Openembedded-core
mailing list