commit: ea4cbdc9159c0ebbd29d4062bbb314393a8cc32f
Author: James Le Cuirot <chewi <AT> gentoo <DOT> org>
AuthorDate: Fri Jul 12 21:13:47 2019 +0000
Commit: James Le Cuirot <chewi <AT> gentoo <DOT> org>
CommitDate: Sun Jul 21 13:30:54 2019 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ea4cbdc9
sys-libs/glibc: Fix handling of ${EPREFIX} when building cross-glibc
It was duplicating the prefix in the form
${EPREFIX}/usr/${CTARGET}/${EPREFIX}.
This also fixes the kernel header version check, which was broken for
native prefixed builds.
Bug: https://bugs.gentoo.org/642604
Closes: https://github.com/gentoo/gentoo/pull/12435
Package-Manager: Portage-2.3.69, Repoman-2.3.13
Signed-off-by: James Le Cuirot <chewi <AT> gentoo.org>
sys-libs/glibc/glibc-2.29-r2.ebuild | 32 ++++++++++++++++++++++----------
sys-libs/glibc/glibc-9999.ebuild | 32 ++++++++++++++++++++++----------
2 files changed, 44 insertions(+), 20 deletions(-)
diff --git a/sys-libs/glibc/glibc-2.29-r2.ebuild
b/sys-libs/glibc/glibc-2.29-r2.ebuild
index ad6fed1c166..da78a273d19 100644
--- a/sys-libs/glibc/glibc-2.29-r2.ebuild
+++ b/sys-libs/glibc/glibc-2.29-r2.ebuild
@@ -125,6 +125,18 @@ alt_prefix() {
is_crosscompile && echo /usr/${CTARGET}
}
+# This prefix is applicable to CHOST when building against this
+# glibc. It is baked into the library at configure time.
+host_eprefix() {
+ is_crosscompile || echo "${EPREFIX}"
+}
+
+# This prefix is applicable to CBUILD when building against this
+# glibc. It determines the destination path at install time.
+build_eprefix() {
+ is_crosscompile && echo "${EPREFIX}"
+}
+
# We need to be able to set alternative headers for compiling for non-native
# platform. Will also become useful for testing kernel-headers without screwing
# up the whole system.
@@ -134,7 +146,7 @@ alt_headers() {
alt_build_headers() {
if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
- ALT_BUILD_HEADERS="${EPREFIX}$(alt_headers)"
+ ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
if tc-is-cross-compiler ; then
ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ;
then
@@ -578,7 +590,7 @@ eend_KV() {
get_kheader_version() {
printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
- $(tc-getCPP ${CTARGET}) -I "${EPREFIX}/$(alt_build_headers)" - | \
+ $(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
tail -n 1
}
@@ -892,9 +904,9 @@ glibc_do_configure() {
$(use_enable profile)
$(use_with gd)
--with-headers=$(alt_build_headers)
- --prefix="${EPREFIX}/usr"
- --sysconfdir="${EPREFIX}/etc"
- --localstatedir="${EPREFIX}/var"
+ --prefix="$(host_eprefix)/usr"
+ --sysconfdir="$(host_eprefix)/etc"
+ --localstatedir="$(host_eprefix)/var"
--libdir='$(prefix)'/$(get_libdir)
--mandir='$(prefix)'/share/man
--infodir='$(prefix)'/share/info
@@ -916,8 +928,8 @@ 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_rootsbindir="${EPREFIX}/sbin"
- export libc_cv_slibdir="${EPREFIX}/$(get_libdir)"
+ export libc_cv_rootsbindir="$(host_eprefix)/sbin"
+ export libc_cv_slibdir="$(host_eprefix)/$(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
@@ -1046,7 +1058,7 @@ glibc_headers_configure() {
--build=${CBUILD_OPT:-${CBUILD}}
--host=${CTARGET_OPT:-${CTARGET}}
--with-headers=$(alt_build_headers)
- --prefix="${EPREFIX}/usr"
+ --prefix="$(host_eprefix)/usr"
${EXTRA_ECONF}
)
@@ -1136,7 +1148,7 @@ glibc_do_src_install() {
local builddir=$(builddir nptl)
cd "${builddir}"
- emake install_root="${D}$(alt_prefix)" install || die
+ emake install_root="${D}$(build_eprefix)$(alt_prefix)" install || die
# This version (2.26) provides some compatibility libraries for the
NIS/NIS+ support
# which come without headers etc. Only needed for binary packages since
the
@@ -1320,7 +1332,7 @@ glibc_do_src_install() {
glibc_headers_install() {
local builddir=$(builddir "headers")
cd "${builddir}"
- emake install_root="${D}$(alt_prefix)" install-headers
+ emake install_root="${D}$(build_eprefix)$(alt_prefix)" install-headers
insinto $(alt_headers)/gnu
doins "${S}"/include/gnu/stubs.h
diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 39209741d27..2b0697465d5 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -126,6 +126,18 @@ alt_prefix() {
is_crosscompile && echo /usr/${CTARGET}
}
+# This prefix is applicable to CHOST when building against this
+# glibc. It is baked into the library at configure time.
+host_eprefix() {
+ is_crosscompile || echo "${EPREFIX}"
+}
+
+# This prefix is applicable to CBUILD when building against this
+# glibc. It determines the destination path at install time.
+build_eprefix() {
+ is_crosscompile && echo "${EPREFIX}"
+}
+
# We need to be able to set alternative headers for compiling for non-native
# platform. Will also become useful for testing kernel-headers without screwing
# up the whole system.
@@ -135,7 +147,7 @@ alt_headers() {
alt_build_headers() {
if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
- ALT_BUILD_HEADERS="${EPREFIX}$(alt_headers)"
+ ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
if tc-is-cross-compiler ; then
ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ;
then
@@ -585,7 +597,7 @@ eend_KV() {
get_kheader_version() {
printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
- $(tc-getCPP ${CTARGET}) -I "${EPREFIX}/$(alt_build_headers)" - | \
+ $(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
tail -n 1
}
@@ -899,9 +911,9 @@ glibc_do_configure() {
$(use_enable profile)
$(use_with gd)
--with-headers=$(alt_build_headers)
- --prefix="${EPREFIX}/usr"
- --sysconfdir="${EPREFIX}/etc"
- --localstatedir="${EPREFIX}/var"
+ --prefix="$(host_eprefix)/usr"
+ --sysconfdir="$(host_eprefix)/etc"
+ --localstatedir="$(host_eprefix)/var"
--libdir='$(prefix)'/$(get_libdir)
--mandir='$(prefix)'/share/man
--infodir='$(prefix)'/share/info
@@ -923,8 +935,8 @@ 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_rootsbindir="${EPREFIX}/sbin"
- export libc_cv_slibdir="${EPREFIX}/$(get_libdir)"
+ export libc_cv_rootsbindir="$(host_eprefix)/sbin"
+ export libc_cv_slibdir="$(host_eprefix)/$(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
@@ -1053,7 +1065,7 @@ glibc_headers_configure() {
--build=${CBUILD_OPT:-${CBUILD}}
--host=${CTARGET_OPT:-${CTARGET}}
--with-headers=$(alt_build_headers)
- --prefix="${EPREFIX}/usr"
+ --prefix="$(host_eprefix)/usr"
${EXTRA_ECONF}
)
@@ -1143,7 +1155,7 @@ glibc_do_src_install() {
local builddir=$(builddir nptl)
cd "${builddir}"
- emake install_root="${D}$(alt_prefix)" install || die
+ emake install_root="${D}$(build_eprefix)$(alt_prefix)" install || die
# This version (2.26) provides some compatibility libraries for the
NIS/NIS+ support
# which come without headers etc. Only needed for binary packages since
the
@@ -1327,7 +1339,7 @@ glibc_do_src_install() {
glibc_headers_install() {
local builddir=$(builddir "headers")
cd "${builddir}"
- emake install_root="${D}$(alt_prefix)" install-headers
+ emake install_root="${D}$(build_eprefix)$(alt_prefix)" install-headers
insinto $(alt_headers)/gnu
doins "${S}"/include/gnu/stubs.h