summaryrefslogtreecommitdiffstats
path: root/meta
diff options
context:
space:
mode:
authorRobert Yang <liezhi.yang@windriver.com>2011-06-28 14:31:04 -0600
committerRichard Purdie <richard.purdie@linuxfoundation.org>2011-06-30 20:56:33 +0100
commit3e08c1f0788a72299c288d79b06ec63055c77c89 (patch)
tree1996e13ebc03bf8a9d7bd27f0e52e141d56f3b6e /meta
parente485b88daacb062925ee8aa7e355711f55c75da5 (diff)
downloadpoky-3e08c1f0788a72299c288d79b06ec63055c77c89.tar.gz
Share gcc work directories
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.5.1 3) Fix do_clean to clean the shared source directory and stamps 4) gcc uses sed and creates config files against ${S} which means the directory should not be shared. Change the way to make it work: * The configure option --with-headers=${STAGING_DIR_TARGET}${SYSTEMHEADERS} can replace the sed command, see the code in configure: if test "x$with_headers" != x; then glibc_header_dir=$with_headers This has the same effect as the sed command: sed -i 's:^\([ ]*\)glibc_header_dir=\"${with_build_sysroot}/usr/include\": ... so add the --with-headers=${STAGING_DIR_TARGET}${SYSTEMHEADERS} to gcc-configure-cross.inc( not add to gcc-configure-common.inc, since not all the gcc building need this, the one which has its own do_configure doesn't need it). * Move t-oe from ${T} to ${B}/gcc, so that the patched Makefile.in can read it easily, please see the commit for gcc-4.5.1 and gcc-4.6.0. * Use the defaults.h in ${B}/gcc instead of ${S}/gcc, and the patched configure.ac(configure) can read it correctly, please see the commit for gcc-4.5.1 and gcc-4.6.0. * The gcc-crosssdk.inc used sed to edit ${S}/config/*/linux*.h to change the GLIBC_DYNAMIC_LINKER, which made the source incompatible. To make the source compatible: - Use: sed -i ${S}/gcc/config/*/linux*.h -e \ 's#\(GLIBC_DYNAMIC_LINKER[^ ]*\)\( *"/lib.*\)#\1 SYSTEMLIBS_DIR\2#' so entries in the files that look like: #define GLIBC_DYNAMIC_LINKER64 "/lib64/ld-linux-x86-64.so.2" would become #define GLIBC_DYNAMIC_LINKER64 SYSTEMLIBS_DIR"/ld-linux-x86-64.so.2" and we define SYSTEMLIBS_DIR in defaults.h. NOTE: #define GLIBC_DYNAMIC_LINKER64 (SYSTEMLIBS_DIR "/ld-linux-x86-64.so.2") doesn't work in in the following define: #define LINUX_DYNAMIC_LINKER \ CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER, UCLIBC_DYNAMIC_LINKER) so use #define GLIBC_DYNAMIC_LINKER64 SYSTEMLIBS_DIR"/ld-linux-x86-64.so.2" 5) Add do_configure_prepend to gcc-configure-common.inc and remove the one in gcc-crosssdk.inc, this makes it easy to share the source, otherwise we need do extra changes in gcc-configure-sdk.inc. 6) Use "cat > file <_EOF" to replace the "echo > file" (From OE-Core rev: 934d38530c9a67562e53d4034aee5531f0f26750) Signed-off-by: Robert Yang <liezhi.yang@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rw-r--r--meta/recipes-devtools/gcc/gcc-common.inc32
-rw-r--r--meta/recipes-devtools/gcc/gcc-configure-common.inc48
-rw-r--r--meta/recipes-devtools/gcc/gcc-configure-cross.inc4
-rw-r--r--meta/recipes-devtools/gcc/gcc-crosssdk.inc6
4 files changed, 61 insertions, 29 deletions
diff --git a/meta/recipes-devtools/gcc/gcc-common.inc b/meta/recipes-devtools/gcc/gcc-common.inc
index a3fa234422..7bf036cd86 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 \
37# 37#
38gcclibdir = "${libdir}/gcc" 38gcclibdir = "${libdir}/gcc"
39BINV = "${PV}" 39BINV = "${PV}"
40S = "${WORKDIR}/gcc-${PV}" 40#S = "${WORKDIR}/gcc-${PV}"
41B = "${S}/build.${HOST_SYS}.${TARGET_SYS}" 41S = "${TMPDIR}/work-shared/gcc-${PV}/gcc-${PV}"
42B = "${WORKDIR}/gcc-${PV}/build.${HOST_SYS}.${TARGET_SYS}"
43
44# SS means Shared Stamps directory
45SS = "${TMPDIR}/stamps/work-shared/gcc-${PV}"
46do_fetch[stamp-base] = "${SS}"
47do_unpack[stamp-base] = "${SS}"
48do_patch[stamp-base] = "${SS}"
49
50# SW means Shared Work directory
51SW = "${TMPDIR}/work-shared/gcc-${PV}"
52WORKDIR_task-unpack = "${SW}"
53WORKDIR_task-patch = "${SW}"
42 54
43target_includedir ?= "${includedir}" 55target_includedir ?= "${includedir}"
44target_libdir ?= "${libdir}" 56target_libdir ?= "${libdir}"
45target_base_libdir ?= "${base_libdir}" 57target_base_libdir ?= "${base_libdir}"
46target_prefix ?= "${prefix}" 58target_prefix ?= "${prefix}"
59
60CLEANFUNCS += "workshared_clean"
61# The do_clean should be exclusive since share ${S}
62do_clean[lockfiles] = "${TMPDIR}/stamps/work-shared/gcc-${PV}.clean.lock"
63
64python workshared_clean () {
65 """clear the source directory"""
66 dir = bb.data.expand("${SW}", d)
67 bb.note("Removing " + dir)
68 oe.path.remove(dir)
69
70 """clear the the stamps in work-shared"""
71 dir = "%s.*" % bb.data.expand(d.getVarFlag('do_fetch', 'stamp-base', True), d)
72 bb.note("Removing " + dir)
73 oe.path.remove(dir)
74}
diff --git a/meta/recipes-devtools/gcc/gcc-configure-common.inc b/meta/recipes-devtools/gcc/gcc-configure-common.inc
index f7b5836c4f..9f5ba335c0 100644
--- a/meta/recipes-devtools/gcc/gcc-configure-common.inc
+++ b/meta/recipes-devtools/gcc/gcc-configure-common.inc
@@ -61,6 +61,34 @@ SYSTEMHEADERS = "${target_includedir}"
61SYSTEMLIBS = "${target_base_libdir}/" 61SYSTEMLIBS = "${target_base_libdir}/"
62SYSTEMLIBS1 = "${target_libdir}/" 62SYSTEMLIBS1 = "${target_libdir}/"
63 63
64do_configure_prepend () {
65 # Change the default dynamic linker path, only useful for SDK, other's value
66 # are not changed according to the SYSTEMLIBS_DIR
67 sed -i ${S}/gcc/config/*/linux*.h -e \
68 's#\(GLIBC_DYNAMIC_LINKER[^ ]*\)\( *"/lib.*\)#\1 SYSTEMLIBS_DIR\2#'
69
70 SYSTEMLIBS_DIR=`dirname ${SYSTEMLIBS}`
71 [ "$SYSTEMLIBS_DIR" = "/" ] && SYSTEMLIBS_DIR=""
72 # teach gcc to find correct target includedir when checking libc ssp support
73 mkdir -p ${B}/gcc
74 echo "NATIVE_SYSTEM_HEADER_DIR = ${SYSTEMHEADERS}" > ${B}/gcc/t-oe
75 cat ${S}/gcc/defaults.h | grep -v "\#endif.*GCC_DEFAULTS_H" > ${B}/gcc/defaults.h.new
76 cat >>${B}/gcc/defaults.h.new <<_EOF
77#ifndef STANDARD_INCLUDE_DIR
78#define STANDARD_INCLUDE_DIR "${SYSTEMHEADERS}"
79#endif
80#ifndef STANDARD_STARTFILE_PREFIX_1
81#define STANDARD_STARTFILE_PREFIX_1 "${SYSTEMLIBS}"
82#endif
83#ifndef STANDARD_STARTFILE_PREFIX_2
84#define STANDARD_STARTFILE_PREFIX_2 "${SYSTEMLIBS1}"
85#endif
86#define SYSTEMLIBS_DIR "$SYSTEMLIBS_DIR"
87#endif /* ! GCC_DEFAULTS_H */
88_EOF
89 mv ${B}/gcc/defaults.h.new ${B}/gcc/defaults.h
90}
91
64do_configure () { 92do_configure () {
65 # Setup these vars for cross building only 93 # Setup these vars for cross building only
66 # ... because foo_FOR_TARGET apparently gets misinterpreted inside the 94 # ... because foo_FOR_TARGET apparently gets misinterpreted inside the
@@ -86,27 +114,7 @@ do_configure () {
86 export LDFLAGS_FOR_BUILD="${BUILD_LDFLAGS}" 114 export LDFLAGS_FOR_BUILD="${BUILD_LDFLAGS}"
87 export ARCH_FLAGS_FOR_TARGET="${ARCH_FLAGS_FOR_TARGET}" 115 export ARCH_FLAGS_FOR_TARGET="${ARCH_FLAGS_FOR_TARGET}"
88 (cd ${S} && gnu-configize) || die "failure running gnu-configize" 116 (cd ${S} && gnu-configize) || die "failure running gnu-configize"
89
90 # teach gcc to find correct target includedir when checking libc ssp support
91 sed -i 's:^\([ ]*\)glibc_header_dir=\"${with_build_sysroot}/usr/include\":\1glibc_header_dir=\"${with_build_sysroot}${SYSTEMHEADERS}\":g' ${S}/gcc/configure.ac
92 sed -i 's:^\([ ]*\)glibc_header_dir=\"${with_build_sysroot}/usr/include\":\1glibc_header_dir=\"${with_build_sysroot}${SYSTEMHEADERS}\":g' ${S}/gcc/configure
93 117
94 # splice our idea of where the headers live into gcc's world
95 echo "NATIVE_SYSTEM_HEADER_DIR = ${SYSTEMHEADERS}" > ${T}/t-oe
96 sed 's%^tmake_file=.*$%& ${T}/t-oe%' < ${S}/gcc/Makefile.in >${S}/gcc/Makefile.in.new
97 mv ${S}/gcc/Makefile.in.new ${S}/gcc/Makefile.in
98 cat ${S}/gcc/defaults.h | grep -v "\#endif.*GCC_DEFAULTS_H" > ${S}/gcc/defaults.h.new
99 echo "#ifndef STANDARD_INCLUDE_DIR" >> ${S}/gcc/defaults.h.new
100 echo "#define STANDARD_INCLUDE_DIR \"${SYSTEMHEADERS}\"" >> ${S}/gcc/defaults.h.new
101 echo "#endif" >> ${S}/gcc/defaults.h.new
102 echo "#ifndef STANDARD_STARTFILE_PREFIX_1" >> ${S}/gcc/defaults.h.new
103 echo "#define STANDARD_STARTFILE_PREFIX_1 \"${SYSTEMLIBS}\"" >> ${S}/gcc/defaults.h.new
104 echo "#endif" >> ${S}/gcc/defaults.h.new
105 echo "#ifndef STANDARD_STARTFILE_PREFIX_2" >> ${S}/gcc/defaults.h.new
106 echo "#define STANDARD_STARTFILE_PREFIX_2 \"${SYSTEMLIBS1}\"" >> ${S}/gcc/defaults.h.new
107 echo "#endif" >> ${S}/gcc/defaults.h.new
108 echo "#endif /* ! GCC_DEFAULTS_H */" >> ${S}/gcc/defaults.h.new
109 mv ${S}/gcc/defaults.h.new ${S}/gcc/defaults.h
110 oe_runconf 118 oe_runconf
111} 119}
112 120
diff --git a/meta/recipes-devtools/gcc/gcc-configure-cross.inc b/meta/recipes-devtools/gcc/gcc-configure-cross.inc
index 346d1640d1..36edb81e1c 100644
--- a/meta/recipes-devtools/gcc/gcc-configure-cross.inc
+++ b/meta/recipes-devtools/gcc/gcc-configure-cross.inc
@@ -2,7 +2,9 @@ require gcc-configure-common.inc
2 2
3USE_NLS = '${@base_conditional( "TARGET_OS", "linux-uclibc", "no", "", d )}' 3USE_NLS = '${@base_conditional( "TARGET_OS", "linux-uclibc", "no", "", d )}'
4 4
5EXTRA_OECONF += " --enable-poison-system-directories " 5EXTRA_OECONF += " --enable-poison-system-directories \
6 --with-headers=${STAGING_DIR_TARGET}${SYSTEMHEADERS} \
7 "
6 8
7EXTRA_OECONF_PATHS = "--with-local-prefix=${STAGING_DIR_TARGET}${target_exec_prefix} \ 9EXTRA_OECONF_PATHS = "--with-local-prefix=${STAGING_DIR_TARGET}${target_exec_prefix} \
8 --with-gxx-include-dir=${target_includedir}/c++ \ 10 --with-gxx-include-dir=${target_includedir}/c++ \
diff --git a/meta/recipes-devtools/gcc/gcc-crosssdk.inc b/meta/recipes-devtools/gcc/gcc-crosssdk.inc
index 6e7d5a73f9..0fd82a6fdf 100644
--- a/meta/recipes-devtools/gcc/gcc-crosssdk.inc
+++ b/meta/recipes-devtools/gcc/gcc-crosssdk.inc
@@ -8,9 +8,3 @@ GCCMULTILIB = "--disable-multilib"
8 8
9DEPENDS = "virtual/${TARGET_PREFIX}binutils-crosssdk virtual/${TARGET_PREFIX}libc-for-gcc-nativesdk gettext-native" 9DEPENDS = "virtual/${TARGET_PREFIX}binutils-crosssdk virtual/${TARGET_PREFIX}libc-for-gcc-nativesdk gettext-native"
10PROVIDES = "virtual/${TARGET_PREFIX}gcc-crosssdk virtual/${TARGET_PREFIX}g++-crosssdk" 10PROVIDES = "virtual/${TARGET_PREFIX}gcc-crosssdk virtual/${TARGET_PREFIX}g++-crosssdk"
11
12do_configure_prepend () {
13 # Change the default dynamic linker path to the one in the SDK
14 sed -i ${S}/gcc/config/*/linux*.h -e 's#\(GLIBC_DYNAMIC_LINKER.*\)/lib/#\1${SYSTEMLIBS}#'
15 sed -i ${S}/gcc/config/*/linux*.h -e 's#\(GLIBC_DYNAMIC_LINKER.*\)/lib64/#\1${SYSTEMLIBS}#'
16}