Hi,
Please help me review the patch attached.
This patch has 5 main kinds of modifications to the eclass,
* Define ED and EROOT for EAPI 0, 1 and 2.
* Add ${EPREFIX} to ${PREFIX} and quote the variables.
* Strip ${EPREFIX} if used with a ebuild helper.
* call fix_libtool_files.sh by name, because /usr/sbin is in PATH,
and no need to write as ${EPREFIX}/usr/sbin/fix_libtool_files.sh
* Preserve PATH when calling gcc-config.
Benda
diff --git a/eclass/toolchain.eclass b/eclass/toolchain.eclass
index 55249b0..ca64091 100644
--- a/eclass/toolchain.eclass
+++ b/eclass/toolchain.eclass
@@ -8,7 +8,7 @@ DESCRIPTION="The GNU Compiler Collection"
HOMEPAGE="https://gcc.gnu.org/;
RESTRICT="strip" # cross-compilers need controlled stripping
-inherit eutils fixheadtails flag-o-matic gnuconfig libtool multilib pax-utils toolchain-funcs versionator
+inherit eutils fixheadtails flag-o-matic gnuconfig libtool multilib pax-utils toolchain-funcs versionator prefix
if [[ ${PV} == *_pre* ]] ; then
EGIT_REPO_URI="git://gcc.gnu.org/git/gcc.git"
@@ -49,6 +49,11 @@ is_crosscompile() {
[[ ${CHOST} != ${CTARGET} ]]
}
+if [[ ${EAPI:-0} == [012] ]] ; then
+ : ${ED:=${D}}
+ : ${EROOT:=${ROOT}}
+fi
+
# 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}}"
@@ -93,7 +98,7 @@ fi
export GCC_FILESDIR=${GCC_FILESDIR:-${FILESDIR}}
-PREFIX=${TOOLCHAIN_PREFIX:-/usr}
+PREFIX=${TOOLCHAIN_PREFIX:-${EPREFIX}/usr}
if tc_version_is_at_least 3.4.0 ; then
LIBPATH=${TOOLCHAIN_LIBPATH:-${PREFIX}/lib/gcc/${CTARGET}/${GCC_CONFIG_VER}}
@@ -983,10 +988,10 @@ toolchain_src_configure() {
elif built_with_use --hidden --missing false ${CATEGORY}/${needed_libc} crosscompile_opts_headers-only ; then
confgcc+=(
"${confgcc_no_libc[@]}"
- --with-sysroot=${PREFIX}/${CTARGET}
+ --with-sysroot="${PREFIX}"/${CTARGET}
)
else
-confgcc+=( --with-sysroot=${PREFIX}/${CTARGET} )
+confgcc+=( --with-sysroot="${PREFIX}"/${CTARGET} )
fi
fi
@@ -1073,7 +1078,7 @@ toolchain_src_configure() {
[[ ${arm_arch} == armv7? ]] && arm_arch=${arm_arch/7/7-}
# See if this is a valid --with-arch flag
if (srcdir=${S}/gcc target=${CTARGET} with_arch=${arm_arch};
- . "${srcdir}"/config.gcc) &>/dev/null
+ . "${srcdir}"/config.gcc) &>/dev/null
then
confgcc+=( --with-arch=${arm_arch} )
fi
@@ -1267,7 +1272,7 @@ toolchain_src_configure() {
echo "${S}"/configure "${confgcc[@]}"
# Older gcc versions did not detect bash and re-exec itself, so force the
# use of bash. Newer ones will auto-detect, but this is not harmeful.
- CONFIG_SHELL="/bin/bash" \
+ CONFIG_SHELL="${EPREFIX}/bin/bash" \
bash "${S}"/configure "${confgcc[@]}" || die "failed to run configure"
# return to whatever directory we were in before
@@ -1703,11 +1708,11 @@ toolchain_src_install() {
if [[ -f ${CTARGET}-${x} ]] ; then
if ! is_crosscompile ; then
ln -sf ${CTARGET}-${x} ${x}
-dosym ${BINPATH}/${CTARGET}-${x} \
+dosym ${BINPATH#${EPREFIX}}/${CTARGET}-${x} \
/usr/bin/${x}-${GCC_CONFIG_VER}
fi
# Create versioned symlinks
- dosym ${BINPATH}/${CTARGET}-${x} \
+ dosym ${BINPATH#${EPREFIX}}/${CTARGET}-${x} \
/usr/bin/${CTARGET}-${x}-${GCC_CONFIG_VER}
fi
@@ -1727,7 +1732,7 @@ toolchain_src_install() {
# Now do the fun stripping stuff
env RESTRICT="" CHOST=${CHOST} prepstrip "${D}${BINPATH}"
is_crosscompile && \
- env RESTRICT="" CHOST=${CHOST} prepstrip "${D}/${HOSTLIBPATH}"
+ env RESTRICT="" CHOST=${CHOST} prepstrip "${D}${HOSTLIBPATH}"
env RESTRICT="" CHOST=${CTARGET} prepstrip "${D}${LIBPATH}"
# gcc used to install helper binaries in lib/ but then moved to libexec/
[[ -d ${D}${PREFIX}/libexec/gcc ]] && \
@@ -1735,7 +1740,7 @@ toolchain_src_install() {
cd "${S}"
if is_crosscompile; then
- rm -rf "${D}"/usr/share/{man,info}
+ rm -rf "${ED}"usr/share/{man,info}
rm -rf "${D}"${DATAPATH}/{man,info}
else
if tc_version_is_at_least 3.0 ; then
@@ -1745,11 +1750,11 @@ toolchain_src_install() {
fi
fi
has noinfo ${FEATURES} \
- && rm -r "${D}/${DATAPATH}"/info \
- || prepinfo "${DATAPATH}"
+ && rm -r "${D}${DATAPATH}"/info \
+ || prepinfo "${DATAPATH#${EPREFIX}}"
has noman ${FEATURES} \
- && rm -r "${D}/${DATAPATH}"/man \
- || prepman "${DATAPATH}"
+ && rm -r "${D}${DATAPATH}"/man \
+ || prepman "${DATAPATH#${EPREFIX}}"
fi
# prune empty dirs left behind
find "${D}" -depth -type d -delete 2>/dev/null
@@ -1764,10 +1769,10 @@ toolchain_src_install() {
# Rather install the script, else portage with changing $FILESDIR
# between binary and source package borks things
if ! is_crosscompile ; then
- insinto "${DATAPATH}"
- newins "${GCC_FILESDIR}"/awk/fixlafiles.awk-no_gcc_la fixlafiles.awk || die
- exeinto "${DATAPATH}"
- doexe "${GCC_FILESDIR}"/fix_libtool_files.sh || die
+ insinto