summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRuud Koolen <redlizard@redlizard.nl>2016-06-15 04:58:21 +0200
committerRuud Koolen <redlizard@redlizard.nl>2016-06-15 06:59:38 +0200
commitdcc85d072940b9fe0b5457d7b8704a81bc2e336a (patch)
tree3c8c3af1b805e75d02bc303d3f9059413dc3b6ee
parentsys-kernel/linux-headers: HACK: Added version 3.18 (diff)
downloadandroid-dcc85d072940b9fe0b5457d7b8704a81bc2e336a.tar.gz
android-dcc85d072940b9fe0b5457d7b8704a81bc2e336a.tar.bz2
android-dcc85d072940b9fe0b5457d7b8704a81bc2e336a.zip
eclass: Added TPREFIX suppor to toolchain.eclass.
-rw-r--r--eclass/toolchain.eclass33
1 files changed, 33 insertions, 0 deletions
diff --git a/eclass/toolchain.eclass b/eclass/toolchain.eclass
index 81bc4fb..7249087 100644
--- a/eclass/toolchain.eclass
+++ b/eclass/toolchain.eclass
@@ -54,6 +54,9 @@ if [[ ${EAPI:-0} == [012] ]] ; then
: ${EROOT:=${ROOT}}
fi
+# The target prefix defaults to the host prefix, except for cross compilers, which targets the empty prefix by default.
+: ${TPREFIX:=$(is_crosscompile || echo "${EPREFIX}")}
+
# General purpose version check. Without a second arg matches up to minor version (x.x.x)
tc_version_is_at_least() {
version_is_at_least "$1" "${2:-${GCC_RELEASE_VER}}"
@@ -574,6 +577,25 @@ toolchain_src_prepare() {
sed -i -e 's/\(install-data-am:\).*/\1/' "${S}"/libffi/include/Makefile.in || die
fi
+ if use prefix && use !prefix-guest ; then
+ # Prefixify the dynamic linker location...
+ sed -i "s@-dynamic-linker @-dynamic-linker ${TPREFIX}@g" $(find gcc/config -name '*.h')
+ # ... and the startfile locations.
+ echo "
+#undef MD_EXEC_PREFIX
+#undef MD_STARTFILE_PREFIX
+#undef MD_STARTFILE_PREFIX_1
+#undef STANDARD_STARTFILE_PREFIX_1
+#undef STANDARD_STARTFILE_PREFIX_2
+#define MD_EXEC_PREFIX \"\"
+#define MD_STARTFILE_PREFIX \"\"
+#define MD_STARTFILE_PREFIX_1 \"\"
+#define STANDARD_STARTFILE_PREFIX_1 \"${TPREFIX}/lib/\"
+#define STANDARD_STARTFILE_PREFIX_2 \"${TPREFIX}/usr/lib/\"
+
+" >> gcc/gcc.h
+ fi
+
# Fixup libtool to correctly generate .la files with portage
elibtoolize --portage --shallow --no-uclibc
@@ -1028,6 +1050,13 @@ toolchain_src_configure() {
;;
esac
+ # In prefix-libc, prefixify the system include directories
+ if use prefix && ! use prefix-guest; then
+ # TODO: This is >=4.7 only. Add support for <4.7 at some point.
+ confgcc+=( --with-native-system-header-dir="${TPREFIX}"/usr/include )
+ confgcc+=( --with-local-prefix="${TPREFIX}"/usr/local )
+ fi
+
### arch options
gcc-multilib-configure
@@ -2030,6 +2059,8 @@ toolchain_pkg_postrm() {
}
do_gcc_config() {
+ export EPREFIX
+
if ! should_we_gcc_config ; then
env -i PATH="${PATH}" ROOT="${ROOT}" gcc-config --use-old --force
return 0
@@ -2058,6 +2089,8 @@ do_gcc_config() {
}
should_we_gcc_config() {
+ export EPREFIX
+
# if the current config is invalid, we definitely want a new one
# Note: due to bash quirkiness, the following must not be 1 line
local curr_config