commit:     8893df0d11de029e26b31bc3310e43ccb6b35dc3
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Sun Sep  1 16:47:47 2019 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Sun Sep  1 16:50:41 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8893df0d

sys-libs/glibc: revert CPPFLAGS fix for cross-compilers

In https://sourceware.org/PR24577 we discovered that riscv
can't really install libc headers as it needs a cross-compiler.

This revert reintroduces riscv bootstrap on crossdev.
To workaround it use the -without-headers option until
it's a crossdev's default.

Bug: https://sourceware.org/PR24577
Bug: https://bugs.gentoo.org/692052
Bug: https://bugs.gentoo.org/686248
Package-Manager: Portage-2.3.74, Repoman-2.3.17
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 sys-libs/glibc/Manifest                            |   4 +-
 .../{glibc-9999.ebuild => glibc-2.29-r5.ebuild}    | 122 +++++++++++----------
 .../{glibc-9999.ebuild => glibc-2.30-r1.ebuild}    |  81 ++++++++------
 sys-libs/glibc/glibc-9999.ebuild                   |   2 +-
 4 files changed, 114 insertions(+), 95 deletions(-)

diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
index b75203288d8..e8f7dda1268 100644
--- a/sys-libs/glibc/Manifest
+++ b/sys-libs/glibc/Manifest
@@ -14,7 +14,9 @@ DIST glibc-2.28-patches-9.tar.xz 98588 BLAKE2B 
4ab583be712994f949dee2512da6e12fd
 DIST glibc-2.28.tar.xz 16484344 BLAKE2B 
9aa8cbd5a145c2a6fde3a60b3d0a14b12b46ed79333ad1ca3e73464adcfe700277a17a9e7fd0ca36e355a0c5b0b27decfa091da320ba802741ad75cc955bbcc8
 SHA512 
521f820953ff07c69ece4c2186f59fc061a7f9747932cd70ef2995c2b2deee76eeb6de700d85071cdca5949179aa8ccee75eda7feca1394121ec7b821ad0a3f3
 DIST glibc-2.29-patches-3.tar.xz 35812 BLAKE2B 
90b8bc57b7a63f03617795c368b92e525eccfec462d638dbc25c581e5b7a2a72ffd5191842f5ac443a868cbc950838d7e5120e866d343a14b80c55dcbfa48f30
 SHA512 
4c9b78d9d1a8aa629418f2d758ef800857780b8a1fd8d3582b88348a513ca26ca7f6ac9110a8c6bae16949b360ba36840d184f42293cd4324760273592d1b438
 DIST glibc-2.29-patches-5.tar.xz 64032 BLAKE2B 
6c3104bd80aaba617201812a631b734ded4b02f8d4dadb5e353af48692f2a1509ddae1d34098de913ae5b3ac1a29111a44dfae71c3024fab4a805a22e9d66e33
 SHA512 
39add1388268ecf2029cb90b8312fb610b203f459a092dc1da8b46ce91ccfbbdff235592aa6174edf9efe71039d984ee121dc9adf7e18490cf92fe24561b1267
+DIST glibc-2.29-patches-6.tar.xz 64076 BLAKE2B 
04c1baf838eff9275e79145d4a5a642dcd6572aadcdfc6782769f2de107dcd1648b81d0690068db8c0d53229efe2130e279f4aafe8a91238e5dd6a8a7120a433
 SHA512 
6494dcd23441fe308de97706f7abbea1571e0015d1456e719268b8026e1fb23733c2efd5256840f4b9f0df4f02ac7827b1fad56905cbd8919bca9c25b0afe822
 DIST glibc-2.29.tar.xz 16515488 BLAKE2B 
b754e6825176538a2b8ca03fce014f0d87d333dc4d038bf0cda5ee8a2f484cd3ce93ad78ec126737e093ab64b55ceedf04cd08aecb4f8041daaa329e99717afa
 SHA512 
146bc0769fe853d9edbf93cea7f74c5b3d84d69cb7614c62588e7acdecd1ec789a9d8949f3e8b99f8f36f2ccac740a003bed94f32b07817baf780b06cfeb6ed0
 DIST glibc-2.30-patches-1.tar.xz 19364 BLAKE2B 
853ae651cf48a78796ac0a3c9c84098731d5a43b37644ee5029d2e2b06dab0d1d96b9dd7c3fd896c5513f5f712beca13845c1e24c698fe824ce0f529a2a827d4
 SHA512 
23065ec67b1a6302eece79da1ba731aa158a2abc0c65aed755cafea388c19aa1f545a6ea6d9db1fd128d06c6878b4c73aea07c6acc053b56bc416143e96e1c05
+DIST glibc-2.30-patches-2.tar.xz 19588 BLAKE2B 
672343ef8a44486304f03091844635febef9d1bc8000ab3382d702dcc1111a107b5e758355beaef8db5012f7e324e4c2365e10fc642b01c9f9a3a315de2dc7f6
 SHA512 
494155147b56e094a4427aed79e278b4a350928ddaff84330d6a40fad079131a4574f20c591dc95e572391b68ef72c49790571ee5323a2a541ec0757bcaeb161
 DIST glibc-2.30.tar.xz 16576920 BLAKE2B 
bd5aae4c9854f40785b91f83c3b632de6d48d811027ddfe61651cb1bc617db8017d7914c23a770cdd3feed06fcc316da841eea916cdba54179e7eace4ea45484
 SHA512 
37483990cd653685873e96c45dd1651b32b441b6d7919a68ebe3bae31a0c3f7ce183fc9b110f0b268b353f80312f18370559a1e7aecea0e5aa755c8f2aef1d6b
-DIST glibc-9999-patches-13.tar.xz 18316 BLAKE2B 
c55359dda094dabfec85f53e48fcd43985d41211f29c0c3ba0d07c4ce28994f96c334c9fcc2a6b78e64123363253c701ed6e9335f4e74274c984734ac8881731
 SHA512 
627799f65f79e60ed3a9ba1a499d21e771f1b109934967c9fbdf3300b0c1509ef5382834e63c8ead23ffbaee80becf541da5b25e4e2cfa8f6baa801c3838c69d
+DIST glibc-9999-patches-14.tar.xz 17908 BLAKE2B 
a6e1f22a4358111ff757431c5d42fd020f6095584c3517aa854ea266129d1a177a7c09b310643f1cea32ffaf253806ac08f3aed864fb477097aaa2c4010450f4
 SHA512 
ef28b409b26472ec1d868167345aecfee70b1edf1863374dc2f25892f40c10f0826620a8b22fbbc9f737c8f611569b3412e8e2ea041da1ad1ef7f6398b82cddc

diff --git a/sys-libs/glibc/glibc-9999.ebuild 
b/sys-libs/glibc/glibc-2.29-r5.ebuild
similarity index 94%
copy from sys-libs/glibc/glibc-9999.ebuild
copy to sys-libs/glibc/glibc-2.29-r5.ebuild
index 1075f02be79..d02d0fcb97d 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-2.29-r5.ebuild
@@ -1,16 +1,17 @@
 # Copyright 1999-2019 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
-EAPI=7
+EAPI=6
 
 PYTHON_COMPAT=( python3_{5,6,7} )
 
-inherit python-any-r1 prefix eutils toolchain-funcs flag-o-matic gnuconfig 
usr-ldscript \
+inherit python-any-r1 prefix eutils eapi7-ver toolchain-funcs flag-o-matic 
gnuconfig usr-ldscript \
        multilib systemd multiprocessing
 
 DESCRIPTION="GNU libc C library"
 HOMEPAGE="https://www.gnu.org/software/libc/";
 LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
+RESTRICT="strip" # Strip ourself #46186
 SLOT="2.2"
 
 EMULTILIB_PKG="true"
@@ -19,8 +20,7 @@ if [[ ${PV} == 9999* ]]; then
        EGIT_REPO_URI="https://sourceware.org/git/glibc.git";
        inherit git-r3
 else
-       #KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc 
~ppc64 ~s390 ~sh ~sparc ~x86"
-       KEYWORDS=""
+       KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 
~riscv ~s390 ~sh ~sparc ~x86"
        SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 fi
 
@@ -29,12 +29,12 @@ RELEASE_VER=${PV}
 GCC_BOOTSTRAP_VER=20180511
 
 # Gentoo patchset
-PATCH_VER=13
+PATCH_VER=6
 
 SRC_URI+=" 
https://dev.gentoo.org/~slyfox/distfiles/${P}-patches-${PATCH_VER}.tar.xz";
 SRC_URI+=" multilib? ( 
https://dev.gentoo.org/~dilfridge/distfiles/gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz
 )"
 
-IUSE="audit caps cet compile-locales custom-cflags doc gd headers-only 
+multiarch multilib nscd profile selinux +ssp +static-libs suid systemtap test 
vanilla"
+IUSE="audit caps cet compile-locales doc gd headers-only +multiarch multilib 
nscd profile selinux +ssp suid systemtap test vanilla"
 
 # Minimum kernel version that glibc requires
 MIN_KERN_VER="3.2.0"
@@ -64,16 +64,6 @@ fi
 # We need a new-enough binutils/gcc to match upstream baseline.
 # Also we need to make sure our binutils/gcc supports TLS,
 # and that gcc already contains the hardened patches.
-BDEPEND="
-       ${PYTHON_DEPS}
-       >=app-misc/pax-utils-0.1.10
-       sys-devel/bison
-       !<sys-apps/sandbox-1.6
-       !<sys-apps/portage-2.1.2
-       !<sys-devel/bison-2.7
-       !<sys-devel/make-4
-       doc? ( sys-apps/texinfo )
-"
 COMMON_DEPEND="
        nscd? ( selinux? (
                audit? ( sys-process/audit )
@@ -84,6 +74,14 @@ COMMON_DEPEND="
        systemtap? ( dev-util/systemtap )
 "
 DEPEND="${COMMON_DEPEND}
+       ${PYTHON_DEPS}
+       >=app-misc/pax-utils-0.1.10
+       sys-devel/bison
+       !<sys-apps/sandbox-1.6
+       !<sys-apps/portage-2.1.2
+       !<sys-devel/bison-2.7
+       !<sys-devel/make-4
+       doc? ( sys-apps/texinfo )
        test? ( >=net-dns/libidn2-2.0.5 )
 "
 RDEPEND="${COMMON_DEPEND}
@@ -93,17 +91,17 @@ RDEPEND="${COMMON_DEPEND}
 "
 
 if [[ ${CATEGORY} == cross-* ]] ; then
-       BDEPEND+=" !headers-only? (
+       DEPEND+=" !headers-only? (
                >=${CATEGORY}/binutils-2.24
                >=${CATEGORY}/gcc-6
        )"
        [[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
 else
-       BDEPEND+="
+       DEPEND+="
                >=sys-devel/binutils-2.24
                >=sys-devel/gcc-6
+               virtual/os-headers
        "
-       DEPEND+=" virtual/os-headers "
        RDEPEND+="
                >=net-dns/libidn2-2.0.5
                vanilla? ( !sys-libs/timezone-data )
@@ -358,18 +356,11 @@ setup_flags() {
        ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
        ASFLAGS=${ASFLAGS_BASE}
 
-       # Allow users to explicitly avoid flag sanitization via
-       # USE=custom-cflags.
-       if ! use custom-cflags; then
-               # Over-zealous CFLAGS can often cause problems.  What may work 
for one
-               # person may not work for another.  To avoid a large influx of 
bugs
-               # relating to failed builds, we strip most CFLAGS out to ensure 
as few
-               # problems as possible.
-               strip-flags
-               # Lock glibc at -O2; we want to be conservative here.
-               filter-flags '-O?'
-               append-flags -O2
-       fi
+       # Over-zealous CFLAGS can often cause problems.  What may work for one
+       # person may not work for another.  To avoid a large influx of bugs
+       # relating to failed builds, we strip most CFLAGS out to ensure as few
+       # problems as possible.
+       strip-flags
        strip-unsupported-flags
        filter-flags -m32 -m64 '-mabi=*'
 
@@ -391,9 +382,10 @@ setup_flags() {
                CBUILD_OPT=${CTARGET_OPT}
        fi
 
-       # glibc's headers disallow -O0 and fail at build time:
-       #  include/libc-symbols.h:75:3: #error "glibc cannot be compiled 
without optimization"
-       replace-flags -O0 -O1
+       # Lock glibc at -O2; we want to be conservative here.
+       # -fno-strict-aliasing is to work around #155906.
+       filter-flags '-O?'
+       append-flags -O2 -fno-strict-aliasing
 
        filter-flags '-fstack-protector*'
 }
@@ -523,7 +515,7 @@ check_devpts() {
        [[ ${MERGE_TYPE} == "buildonly" ]] && return
 
        # Only sanity check when installing the native glibc.
-       [[ -n ${ROOT} ]] && return
+       [[ ${ROOT} != "/" ]] && return
 
        # If they're opting in to the old suid code, then no need to check.
        use suid && return
@@ -611,7 +603,7 @@ sanity_prechecks() {
 
        # Prevent native builds from downgrading
        if [[ ${MERGE_TYPE} != "buildonly" ]] && \
-          [[ -z ${ROOT} ]] && \
+          [[ ${ROOT} == "/" ]] && \
           [[ ${CBUILD} == ${CHOST} ]] && \
           [[ ${CHOST} == ${CTARGET} ]] ; then
 
@@ -1103,7 +1095,7 @@ src_configure() {
 }
 
 do_src_compile() {
-       emake -C "$(builddir nptl)"
+       emake -C "$(builddir nptl)" || die "make nptl for ${ABI} failed"
 }
 
 src_compile() {
@@ -1151,7 +1143,7 @@ run_locale_gen() {
 
        local locale_list="${root}/etc/locale.gen"
 
-       pushd "${ED}"/$(get_libdir) >/dev/null
+       pushd "${ED}"/$(get_libdir)
 
        if [[ -z $(locale-gen --list --config "${locale_list}") ]] ; then
                [[ -z ${inplace} ]] && ewarn "Generating all locales; edit 
/etc/locale.gen to save time/space"
@@ -1161,14 +1153,14 @@ run_locale_gen() {
        locale-gen ${inplace} --jobs $(makeopts_jobs) --config "${locale_list}" 
\
                --destdir "${root}"
 
-       popd >/dev/null
+       popd
 }
 
 glibc_do_src_install() {
        local builddir=$(builddir nptl)
        cd "${builddir}"
 
-       emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
+       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
@@ -1181,18 +1173,13 @@ glibc_do_src_install() {
        # '#define VERSION "2.26.90"' -> '2.26.90'
        local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' 
"${S}"/version.h)
 
-       # gdb is lame and requires some debugging information to remain in
-       # libpthread.  libthread_db makes no sense stripped as it is only used 
when debugging.
-       dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
-       dostrip -x $(alt_libdir)/libthread_db-1.0.so
-
-       if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
+       if [[ -e ${ED}$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
                # Move versioned .a file out of libdir to evade portage QA 
checks
                # instead of using gen_usr_ldscript(). We fix ldscript as:
                # "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( 
/usr/lib64/glibc-<pv>/libm-<pv>.a ..."
-               sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" 
"${ED}"/$(alt_usrlibdir)/libm.a || die
+               sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" 
"${ED}"$(alt_usrlibdir)/libm.a || die
                dodir $(alt_usrlibdir)/${P}
-               mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a 
"${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
+               mv "${ED}"$(alt_usrlibdir)/libm-${upstream_pv}.a 
"${ED}"$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
        fi
 
        # We'll take care of the cache ourselves
@@ -1350,7 +1337,7 @@ glibc_do_src_install() {
 
        # Generate all locales if this is a native build as locale generation
        if use compile-locales && ! is_crosscompile ; then
-               run_locale_gen --inplace-glibc "${ED}/"
+               run_locale_gen --inplace-glibc "${ED}"
                sed -e 's:COMPILED_LOCALES="":COMPILED_LOCALES="1":' -i 
"${ED}"/usr/sbin/locale-gen || die
        fi
 }
@@ -1358,7 +1345,7 @@ glibc_do_src_install() {
 glibc_headers_install() {
        local builddir=$(builddir "headers")
        cd "${builddir}"
-       emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
+       emake install_root="${D}$(build_eprefix)$(alt_prefix)" install-headers
 
        insinto $(alt_headers)/gnu
        doins "${S}"/include/gnu/stubs.h
@@ -1369,6 +1356,23 @@ glibc_headers_install() {
        dosym usr/include $(alt_prefix)/sys-include
 }
 
+src_strip() {
+       # gdb is lame and requires some debugging information to remain in
+       # libpthread, so we need to strip it by hand.  libthread_db makes no
+       # sense stripped as it is only used when debugging.
+       local pthread=$(has splitdebug ${FEATURES} && echo "libthread_db" || 
echo "lib{pthread,thread_db}")
+       env \
+               -uRESTRICT \
+               CHOST=${CTARGET} \
+               STRIP_MASK="/*/{,tls/}${pthread}*" \
+               prepallstrip
+       # if user has stripping enabled and does not have split debug turned on,
+       # then leave the debugging sections in libpthread.
+       if ! has nostrip ${FEATURES} && ! has splitdebug ${FEATURES} ; then
+               ${STRIP:-${CTARGET}-strip} --strip-debug 
"${ED}"$(alt_prefix)/*/libpthread-*.so
+       fi
+}
+
 src_install() {
        if just_headers ; then
                export ABI=default
@@ -1377,11 +1381,7 @@ src_install() {
        fi
 
        foreach_abi glibc_do_src_install
-
-       if ! use static-libs ; then
-               elog "Not installing static glibc libraries"
-               find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
-       fi
+       src_strip
 }
 
 # Simple test to make sure our new glibc isn't completely broken.
@@ -1434,7 +1434,7 @@ pkg_preinst() {
                einfo "Defaulting /etc/host.conf:multi to on"
        fi
 
-       [[ -n ${ROOT} ]] && return 0
+       [[ ${ROOT} != "/" ]] && return 0
        [[ -d ${ED}/$(get_libdir) ]] || return 0
        [[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
 }
@@ -1445,11 +1445,15 @@ pkg_postinst() {
 
        if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; 
then
                # Generate fastloading iconv module configuration file.
-               "${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
+               "${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}"
        fi
 
-       if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
-               use compile-locales || run_locale_gen "${EROOT}/"
+       if ! is_crosscompile && [[ ${ROOT} == "/" ]] ; then
+               # Reload init ... if in a chroot or a diff init package, ignore
+               # errors from this step #253697
+               /sbin/telinit U 2>/dev/null
+
+               use compile-locales || run_locale_gen "${EROOT}"
        fi
 
        # Check for sanity of /etc/nsswitch.conf, take 2

diff --git a/sys-libs/glibc/glibc-9999.ebuild 
b/sys-libs/glibc/glibc-2.30-r1.ebuild
similarity index 96%
copy from sys-libs/glibc/glibc-9999.ebuild
copy to sys-libs/glibc/glibc-2.30-r1.ebuild
index 1075f02be79..2846ee6a61c 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-2.30-r1.ebuild
@@ -1,16 +1,17 @@
 # Copyright 1999-2019 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
-EAPI=7
+EAPI=6
 
 PYTHON_COMPAT=( python3_{5,6,7} )
 
-inherit python-any-r1 prefix eutils toolchain-funcs flag-o-matic gnuconfig 
usr-ldscript \
+inherit python-any-r1 prefix eutils eapi7-ver toolchain-funcs flag-o-matic 
gnuconfig usr-ldscript \
        multilib systemd multiprocessing
 
 DESCRIPTION="GNU libc C library"
 HOMEPAGE="https://www.gnu.org/software/libc/";
 LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
+RESTRICT="strip" # Strip ourself #46186
 SLOT="2.2"
 
 EMULTILIB_PKG="true"
@@ -29,7 +30,7 @@ RELEASE_VER=${PV}
 GCC_BOOTSTRAP_VER=20180511
 
 # Gentoo patchset
-PATCH_VER=13
+PATCH_VER=2
 
 SRC_URI+=" 
https://dev.gentoo.org/~slyfox/distfiles/${P}-patches-${PATCH_VER}.tar.xz";
 SRC_URI+=" multilib? ( 
https://dev.gentoo.org/~dilfridge/distfiles/gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz
 )"
@@ -64,16 +65,6 @@ fi
 # We need a new-enough binutils/gcc to match upstream baseline.
 # Also we need to make sure our binutils/gcc supports TLS,
 # and that gcc already contains the hardened patches.
-BDEPEND="
-       ${PYTHON_DEPS}
-       >=app-misc/pax-utils-0.1.10
-       sys-devel/bison
-       !<sys-apps/sandbox-1.6
-       !<sys-apps/portage-2.1.2
-       !<sys-devel/bison-2.7
-       !<sys-devel/make-4
-       doc? ( sys-apps/texinfo )
-"
 COMMON_DEPEND="
        nscd? ( selinux? (
                audit? ( sys-process/audit )
@@ -84,6 +75,14 @@ COMMON_DEPEND="
        systemtap? ( dev-util/systemtap )
 "
 DEPEND="${COMMON_DEPEND}
+       ${PYTHON_DEPS}
+       >=app-misc/pax-utils-0.1.10
+       sys-devel/bison
+       !<sys-apps/sandbox-1.6
+       !<sys-apps/portage-2.1.2
+       !<sys-devel/bison-2.7
+       !<sys-devel/make-4
+       doc? ( sys-apps/texinfo )
        test? ( >=net-dns/libidn2-2.0.5 )
 "
 RDEPEND="${COMMON_DEPEND}
@@ -93,17 +92,17 @@ RDEPEND="${COMMON_DEPEND}
 "
 
 if [[ ${CATEGORY} == cross-* ]] ; then
-       BDEPEND+=" !headers-only? (
+       DEPEND+=" !headers-only? (
                >=${CATEGORY}/binutils-2.24
                >=${CATEGORY}/gcc-6
        )"
        [[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
 else
-       BDEPEND+="
+       DEPEND+="
                >=sys-devel/binutils-2.24
                >=sys-devel/gcc-6
+               virtual/os-headers
        "
-       DEPEND+=" virtual/os-headers "
        RDEPEND+="
                >=net-dns/libidn2-2.0.5
                vanilla? ( !sys-libs/timezone-data )
@@ -523,7 +522,7 @@ check_devpts() {
        [[ ${MERGE_TYPE} == "buildonly" ]] && return
 
        # Only sanity check when installing the native glibc.
-       [[ -n ${ROOT} ]] && return
+       [[ ${ROOT} != "/" ]] && return
 
        # If they're opting in to the old suid code, then no need to check.
        use suid && return
@@ -611,7 +610,7 @@ sanity_prechecks() {
 
        # Prevent native builds from downgrading
        if [[ ${MERGE_TYPE} != "buildonly" ]] && \
-          [[ -z ${ROOT} ]] && \
+          [[ ${ROOT} == "/" ]] && \
           [[ ${CBUILD} == ${CHOST} ]] && \
           [[ ${CHOST} == ${CTARGET} ]] ; then
 
@@ -1103,7 +1102,7 @@ src_configure() {
 }
 
 do_src_compile() {
-       emake -C "$(builddir nptl)"
+       emake -C "$(builddir nptl)" || die "make nptl for ${ABI} failed"
 }
 
 src_compile() {
@@ -1168,7 +1167,7 @@ glibc_do_src_install() {
        local builddir=$(builddir nptl)
        cd "${builddir}"
 
-       emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
+       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
@@ -1181,18 +1180,13 @@ glibc_do_src_install() {
        # '#define VERSION "2.26.90"' -> '2.26.90'
        local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' 
"${S}"/version.h)
 
-       # gdb is lame and requires some debugging information to remain in
-       # libpthread.  libthread_db makes no sense stripped as it is only used 
when debugging.
-       dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
-       dostrip -x $(alt_libdir)/libthread_db-1.0.so
-
-       if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
+       if [[ -e ${ED}$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
                # Move versioned .a file out of libdir to evade portage QA 
checks
                # instead of using gen_usr_ldscript(). We fix ldscript as:
                # "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( 
/usr/lib64/glibc-<pv>/libm-<pv>.a ..."
-               sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" 
"${ED}"/$(alt_usrlibdir)/libm.a || die
+               sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" 
"${ED}"$(alt_usrlibdir)/libm.a || die
                dodir $(alt_usrlibdir)/${P}
-               mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a 
"${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
+               mv "${ED}"$(alt_usrlibdir)/libm-${upstream_pv}.a 
"${ED}"$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
        fi
 
        # We'll take care of the cache ourselves
@@ -1350,7 +1344,7 @@ glibc_do_src_install() {
 
        # Generate all locales if this is a native build as locale generation
        if use compile-locales && ! is_crosscompile ; then
-               run_locale_gen --inplace-glibc "${ED}/"
+               run_locale_gen --inplace-glibc "${ED}"
                sed -e 's:COMPILED_LOCALES="":COMPILED_LOCALES="1":' -i 
"${ED}"/usr/sbin/locale-gen || die
        fi
 }
@@ -1358,7 +1352,7 @@ glibc_do_src_install() {
 glibc_headers_install() {
        local builddir=$(builddir "headers")
        cd "${builddir}"
-       emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
+       emake install_root="${D}$(build_eprefix)$(alt_prefix)" install-headers
 
        insinto $(alt_headers)/gnu
        doins "${S}"/include/gnu/stubs.h
@@ -1369,6 +1363,23 @@ glibc_headers_install() {
        dosym usr/include $(alt_prefix)/sys-include
 }
 
+src_strip() {
+       # gdb is lame and requires some debugging information to remain in
+       # libpthread, so we need to strip it by hand.  libthread_db makes no
+       # sense stripped as it is only used when debugging.
+       local pthread=$(has splitdebug ${FEATURES} && echo "libthread_db" || 
echo "lib{pthread,thread_db}")
+       env \
+               -uRESTRICT \
+               CHOST=${CTARGET} \
+               STRIP_MASK="/*/{,tls/}${pthread}*" \
+               prepallstrip
+       # if user has stripping enabled and does not have split debug turned on,
+       # then leave the debugging sections in libpthread.
+       if ! has nostrip ${FEATURES} && ! has splitdebug ${FEATURES} ; then
+               ${STRIP:-${CTARGET}-strip} --strip-debug 
"${ED}"$(alt_prefix)/*/libpthread-*.so
+       fi
+}
+
 src_install() {
        if just_headers ; then
                export ABI=default
@@ -1382,6 +1393,8 @@ src_install() {
                elog "Not installing static glibc libraries"
                find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
        fi
+
+       src_strip
 }
 
 # Simple test to make sure our new glibc isn't completely broken.
@@ -1434,7 +1447,7 @@ pkg_preinst() {
                einfo "Defaulting /etc/host.conf:multi to on"
        fi
 
-       [[ -n ${ROOT} ]] && return 0
+       [[ ${ROOT} != "/" ]] && return 0
        [[ -d ${ED}/$(get_libdir) ]] || return 0
        [[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
 }
@@ -1445,11 +1458,11 @@ pkg_postinst() {
 
        if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; 
then
                # Generate fastloading iconv module configuration file.
-               "${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
+               "${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}"
        fi
 
-       if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
-               use compile-locales || run_locale_gen "${EROOT}/"
+       if ! is_crosscompile && [[ ${ROOT} == "/" ]] ; then
+               use compile-locales || run_locale_gen "${EROOT}"
        fi
 
        # Check for sanity of /etc/nsswitch.conf, take 2

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 1075f02be79..cd66539a922 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -29,7 +29,7 @@ RELEASE_VER=${PV}
 GCC_BOOTSTRAP_VER=20180511
 
 # Gentoo patchset
-PATCH_VER=13
+PATCH_VER=14
 
 SRC_URI+=" 
https://dev.gentoo.org/~slyfox/distfiles/${P}-patches-${PATCH_VER}.tar.xz";
 SRC_URI+=" multilib? ( 
https://dev.gentoo.org/~dilfridge/distfiles/gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz
 )"

Reply via email to