Index: glibc/files/eblits/src_install.eblit =================================================================== --- glibc.orig/files/eblits/src_install.eblit +++ glibc/files/eblits/src_install.eblit @@ -10,7 +10,7 @@ toolchain-glibc_src_install() { GBUILDDIR=${WORKDIR}/build-${ABI}-${CTARGET}-nptl fi - local install_root="${D}$(alt_prefix)" + local install_root="${D}${EPREFIX%${TPREFIX}}/$(alt_prefix)" if want_linuxthreads ; then cd "${WORKDIR}"/build-${ABI}-${CTARGET}-linuxthreads einfo "Installing GLIBC ${ABI} with linuxthreads ..." @@ -190,7 +190,7 @@ toolchain-glibc_src_install() { toolchain-glibc_headers_install() { local GBUILDDIR=${WORKDIR}/build-${ABI}-${CTARGET}-headers cd "${GBUILDDIR}" - emake install_root="${D}$(alt_prefix)" install-headers || die + emake install_root="${D}${EPREFIX%${TPREFIX}}/$(alt_prefix)" install-headers || die if ! version_is_at_least 2.16 ; then insinto $(alt_headers)/bits doins bits/stdio_lim.h || die Index: glibc/files/eblits/src_compile.eblit =================================================================== --- glibc.orig/files/eblits/src_compile.eblit +++ glibc/files/eblits/src_compile.eblit @@ -74,12 +74,14 @@ glibc_do_configure() { --host=${CTARGET_OPT:-${CTARGET}} $(use_enable profile) $(use_with gd) - --with-headers=$(alt_build_headers) - --prefix=/usr - --libdir=/usr/$(get_libdir) - --mandir=/usr/share/man - --infodir=/usr/share/info - --libexecdir=/usr/$(get_libdir)/misc/glibc + --with-headers="${EPREFIX}$(alt_build_headers)" + --prefix="${TPREFIX}/usr" + --libdir="${TPREFIX}/usr/$(get_libdir)" + --mandir="${TPREFIX}/usr/share/man" + --infodir="${TPREFIX}/usr/share/info" + --libexecdir="${TPREFIX}/usr/$(get_libdir)/misc/glibc" + --sysconfdir="${TPREFIX}/etc" + --localstatedir="${TPREFIX}/var" --with-bugurl=http://bugs.gentoo.org/ --with-pkgversion="$(glibc_banner)" $(use_multiarch || echo --disable-multi-arch) @@ -91,7 +93,7 @@ glibc_do_configure() { # There is no configure option for this and we need to export it # since the glibc build will re-run configure on itself - export libc_cv_slibdir=/$(get_libdir) + export libc_cv_slibdir="${TPREFIX}/$(get_libdir)" # We take care of patching our binutils to use both hash styles, # and many people like to force gnu hash style only, so disable @@ -199,8 +201,8 @@ toolchain-glibc_headers_compile() { --enable-bind-now --build=${CBUILD_OPT:-${CBUILD}} --host=${CTARGET_OPT:-${CTARGET}} - --with-headers=$(alt_build_headers) - --prefix=/usr + --with-headers="${EPREFIX}$(alt_build_headers)" + --prefix="${TPREFIX}/usr" ${EXTRA_ECONF} ) Index: glibc/files/eblits/common.eblit =================================================================== --- glibc.orig/files/eblits/common.eblit +++ glibc/files/eblits/common.eblit @@ -2,10 +2,28 @@ # Distributed under the terms of the GNU General Public License v2 # $Header: /var/cvsroot/gentoo-x86/sys-libs/glibc/files/eblits/common.eblit,v 1.29 2012/12/28 19:00:51 vapier Exp $ +# There are many directory offsets here that can lead to confusion. We summarize the senarios in this table +# P:=Prefix X:=Cross-Triplet +# example of configure host: --with-headers +# example of configure target: --libdir +# +# variation phase PX X P solution +# -----------+-------------------+-----------------------+---------------+---------+---------------------------------------- +# host configure EPREFIX/usr/CTARGET /usr/CTARGET EPREFIX $EPREFIX/$(alt_prefix) +# target configure NULL NULL EPREFIX $TPREFIX +# -----------+-------------------+-----------------------+---------------+---------+---------------------------------------- +# host install_root D/EPREFIX/usr/CTARGET D/usr/CTARGET D ${D}/${EPREFIX%$TPREFIX}/$(alt_prefix) +# -----------+-------------------+-----------------------+---------------+---------+---------------------------------------- +# host ebuild helper ED/ /usr/CTARGET /usr/CTARGET NULL $(alt_prefix) +# +# alt_prefix and TPREFIX in the table are defined as followed + alt_prefix() { is_crosscompile && echo /usr/${CTARGET} } +TPREFIX=$(is_crosscompile || echo "${EPREFIX}") + : ${ED:=${D}} : ${EROOT:=${ROOT}} @@ -22,7 +40,7 @@ alt_build_headers() { ALT_BUILD_HEADERS=$(alt_headers) if tc-is-cross-compiler ; then ALT_BUILD_HEADERS=${ROOT}$(alt_headers) - if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then + if [[ ! -e ${EPREFIX}/${ALT_BUILD_HEADERS}/linux/version.h ]] ; then local header_path=$(echo '#include ' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h') ALT_BUILD_HEADERS=${header_path%/linux/version.h} fi