summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/gcc/gcc-configure-common.inc
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:37:18 +0100
commit934d38530c9a67562e53d4034aee5531f0f26750 (patch)
tree377b5b2aa3ffda4daf23d43ad88638d50eebfe31 /meta/recipes-devtools/gcc/gcc-configure-common.inc
parent49b994ccd752bc1bc3b0a3c2fe123d614fca584c (diff)
downloadopenembedded-core-934d38530c9a67562e53d4034aee5531f0f26750.tar.gz
openembedded-core-934d38530c9a67562e53d4034aee5531f0f26750.tar.bz2
openembedded-core-934d38530c9a67562e53d4034aee5531f0f26750.zip
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" Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
Diffstat (limited to 'meta/recipes-devtools/gcc/gcc-configure-common.inc')
-rw-r--r--meta/recipes-devtools/gcc/gcc-configure-common.inc48
1 files changed, 28 insertions, 20 deletions
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}"
SYSTEMLIBS = "${target_base_libdir}/"
SYSTEMLIBS1 = "${target_libdir}/"
+do_configure_prepend () {
+ # Change the default dynamic linker path, only useful for SDK, other's value
+ # are not changed according to the SYSTEMLIBS_DIR
+ sed -i ${S}/gcc/config/*/linux*.h -e \
+ 's#\(GLIBC_DYNAMIC_LINKER[^ ]*\)\( *"/lib.*\)#\1 SYSTEMLIBS_DIR\2#'
+
+ SYSTEMLIBS_DIR=`dirname ${SYSTEMLIBS}`
+ [ "$SYSTEMLIBS_DIR" = "/" ] && SYSTEMLIBS_DIR=""
+ # teach gcc to find correct target includedir when checking libc ssp support
+ mkdir -p ${B}/gcc
+ echo "NATIVE_SYSTEM_HEADER_DIR = ${SYSTEMHEADERS}" > ${B}/gcc/t-oe
+ cat ${S}/gcc/defaults.h | grep -v "\#endif.*GCC_DEFAULTS_H" > ${B}/gcc/defaults.h.new
+ cat >>${B}/gcc/defaults.h.new <<_EOF
+#ifndef STANDARD_INCLUDE_DIR
+#define STANDARD_INCLUDE_DIR "${SYSTEMHEADERS}"
+#endif
+#ifndef STANDARD_STARTFILE_PREFIX_1
+#define STANDARD_STARTFILE_PREFIX_1 "${SYSTEMLIBS}"
+#endif
+#ifndef STANDARD_STARTFILE_PREFIX_2
+#define STANDARD_STARTFILE_PREFIX_2 "${SYSTEMLIBS1}"
+#endif
+#define SYSTEMLIBS_DIR "$SYSTEMLIBS_DIR"
+#endif /* ! GCC_DEFAULTS_H */
+_EOF
+ mv ${B}/gcc/defaults.h.new ${B}/gcc/defaults.h
+}
+
do_configure () {
# Setup these vars for cross building only
# ... because foo_FOR_TARGET apparently gets misinterpreted inside the
@@ -86,27 +114,7 @@ do_configure () {
export LDFLAGS_FOR_BUILD="${BUILD_LDFLAGS}"
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
- 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
- # splice our idea of where the headers live into gcc's world
- echo "NATIVE_SYSTEM_HEADER_DIR = ${SYSTEMHEADERS}" > ${T}/t-oe
- sed 's%^tmake_file=.*$%& ${T}/t-oe%' < ${S}/gcc/Makefile.in >${S}/gcc/Makefile.in.new
- mv ${S}/gcc/Makefile.in.new ${S}/gcc/Makefile.in
- cat ${S}/gcc/defaults.h | grep -v "\#endif.*GCC_DEFAULTS_H" > ${S}/gcc/defaults.h.new
- echo "#ifndef STANDARD_INCLUDE_DIR" >> ${S}/gcc/defaults.h.new
- echo "#define STANDARD_INCLUDE_DIR \"${SYSTEMHEADERS}\"" >> ${S}/gcc/defaults.h.new
- echo "#endif" >> ${S}/gcc/defaults.h.new
- echo "#ifndef STANDARD_STARTFILE_PREFIX_1" >> ${S}/gcc/defaults.h.new
- echo "#define STANDARD_STARTFILE_PREFIX_1 \"${SYSTEMLIBS}\"" >> ${S}/gcc/defaults.h.new
- echo "#endif" >> ${S}/gcc/defaults.h.new
- echo "#ifndef STANDARD_STARTFILE_PREFIX_2" >> ${S}/gcc/defaults.h.new
- echo "#define STANDARD_STARTFILE_PREFIX_2 \"${SYSTEMLIBS1}\"" >> ${S}/gcc/defaults.h.new
- echo "#endif" >> ${S}/gcc/defaults.h.new
- echo "#endif /* ! GCC_DEFAULTS_H */" >> ${S}/gcc/defaults.h.new
- mv ${S}/gcc/defaults.h.new ${S}/gcc/defaults.h
oe_runconf
}