commit:     5cd787785e96926f58636b2af9e606b232b03c00
Author:     Benda Xu <heroxbd <AT> gentoo <DOT> org>
AuthorDate: Mon Nov 24 12:14:06 2014 +0000
Commit:     Benda XU <heroxbd <AT> gentoo <DOT> org>
CommitDate: Mon Nov 24 15:41:45 2014 +0000
URL:        
http://sources.gentoo.org/gitweb/?p=dev/heroxbd.git;a=commit;h=5cd78778

sys-libs/glibc: import eblits from gx86

---
 sys-libs/glibc/files/eblits/common.eblit           | 101 ++++----
 sys-libs/glibc/files/eblits/pkg_postinst.eblit     |   8 +-
 sys-libs/glibc/files/eblits/pkg_preinst.eblit      |  23 +-
 sys-libs/glibc/files/eblits/pkg_setup.eblit        |  11 +-
 sys-libs/glibc/files/eblits/src_compile.eblit      | 254 +--------------------
 .../{src_compile.eblit => src_configure.eblit}     | 180 +++++++--------
 sys-libs/glibc/files/eblits/src_install.eblit      |  83 +++----
 sys-libs/glibc/files/eblits/src_prepare.eblit      |  63 +++++
 sys-libs/glibc/files/eblits/src_test.eblit         |  62 ++---
 sys-libs/glibc/files/eblits/src_unpack.eblit       |  70 +-----
 10 files changed, 307 insertions(+), 548 deletions(-)

diff --git a/sys-libs/glibc/files/eblits/common.eblit 
b/sys-libs/glibc/files/eblits/common.eblit
index d3ef4a2..2f7471e 100644
--- a/sys-libs/glibc/files/eblits/common.eblit
+++ b/sys-libs/glibc/files/eblits/common.eblit
@@ -1,31 +1,21 @@
-# Copyright 1999-2012 Gentoo Foundation
+# Copyright 1999-2014 Gentoo Foundation
 # 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
+# $Header: /var/cvsroot/gentoo-x86/sys-libs/glibc/files/eblits/common.eblit,v 
1.45 2014/10/18 23:09:51 vapier Exp $
 
 alt_prefix() {
        is_crosscompile && echo /usr/${CTARGET}
 }
 
-TPREFIX=$(is_crosscompile || echo "${EPREFIX}")
-
-: ${ED:=${D}}
-: ${EROOT:=${ROOT}}
+if [[ ${EAPI:-0} == [012] ]] ; then
+       : ${ED:=${D}}
+       : ${EROOT:=${ROOT}}
+fi
+# This indirection is for binpkgs. #523332
+_nonfatal() { nonfatal "$@" ; }
+if [[ ${EAPI:-0} == [0123] ]] ; then
+       nonfatal() { "$@" ; }
+       _nonfatal() { "$@" ; }
+fi
 
 # We need to be able to set alternative headers for
 # compiling for non-native platform
@@ -37,9 +27,9 @@ alt_headers() {
 }
 alt_build_headers() {
        if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
-               ALT_BUILD_HEADERS=${EPREFIX}$(alt_headers)
+               ALT_BUILD_HEADERS=$(alt_headers)
                if tc-is-cross-compiler ; then
-                       ALT_BUILD_HEADERS=${EROOT}$(alt_headers)
+                       ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
                        if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; 
then
                                local header_path=$(echo '#include 
<linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o 
'[^"]*linux/version.h')
                                
ALT_BUILD_HEADERS=${header_path%/linux/version.h}
@@ -56,6 +46,10 @@ alt_usrlibdir() {
        echo $(alt_prefix)/usr/$(get_libdir)
 }
 
+builddir() {
+       echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
+}
+
 setup_target_flags() {
        # This largely mucks with compiler flags.  None of which should matter
        # when building up just the headers.
@@ -174,8 +168,11 @@ setup_flags() {
        strip-unsupported-flags
        filter-flags -m32 -m64 -mabi=*
 
+       # Bug 492892.
+       filter-flags -frecord-gcc-switches
+
        unset CBUILD_OPT CTARGET_OPT
-       if has_multilib_profile ; then
+       if use multilib ; then
                CTARGET_OPT=$(get_abi_CTARGET)
                [[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
        fi
@@ -198,7 +195,12 @@ setup_flags() {
        # building glibc with SSP is fraught with difficulty, especially
        # due to __stack_chk_fail_local which would mean significant changes
        # to the glibc build process. See bug #94325 #293721
-       use hardened && gcc-specs-ssp && append-cflags $(test-flags-CC 
-fno-stack-protector)
+       # Note we have to handle both user-given CFLAGS and gcc defaults via
+       # spec rules here.  We can't simply add -fno-stack-protector as it gets
+       # added before user flags, and we can't just filter-flags because
+       # _filter_hardened doesn't support globs.
+       filter-flags -fstack-protector*
+       gcc-specs-ssp && append-flags $(test-flags -fno-stack-protector)
 
        if use hardened && gcc-specs-pie ; then
                # Force PIC macro definition for all compilations since they're 
all
@@ -216,15 +218,8 @@ want_nptl() {
        want_tls || return 1
        use nptl || return 1
 
-       # Only list the arches that cannot do NPTL
-       case $(tc-arch) in
-               m68k) return 1;;
-               sparc)
-                       # >= v9 is needed for nptl.
-                       [[ ${PROFILE_ARCH} == "sparc" ]] && return 1
-               ;;
-       esac
-
+       # Older versions of glibc had incomplete arch support for nptl.
+       # But if you're building those now, you can handle USE=nptl yourself.
        return 0
 }
 
@@ -267,9 +262,14 @@ use_multiarch() {
        local bver nver
        bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r 
'1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
        case $(tc-arch ${CTARGET}) in
-               amd64|x86) nver="2.20" ;;
-               sparc)     nver="2.21" ;;
-               *)         return 1 ;;
+       amd64|x86) nver="2.20" ;;
+       arm)       nver="2.22" ;;
+       hppa)      nver="2.23" ;;
+       ppc|ppc64) nver="2.20" ;;
+       # ifunc was added in 2.23, but glibc also needs machinemode which is in 
2.24.
+       s390)      nver="2.24" ;;
+       sparc)     nver="2.21" ;;
+       *)         return 1 ;;
        esac
        version_is_at_least ${nver} ${bver}
 }
@@ -279,9 +279,10 @@ use_multiarch() {
 setup_env() {
        # silly users
        unset LD_RUN_PATH
+       unset LD_ASSUME_KERNEL
 
+       multilib_env ${CTARGET_OPT:-${CTARGET}}
        if is_crosscompile || tc-is-cross-compiler ; then
-               multilib_env ${CTARGET_OPT:-${CTARGET}}
                if ! use multilib ; then
                        MULTILIB_ABIS=${DEFAULT_ABI}
                else
@@ -307,6 +308,28 @@ setup_env() {
        export __GLIBC_CC CC="${__GLIBC_CC} ${!VAR}"
 }
 
+foreach_abi() {
+       setup_env
+
+       local ret=0
+       local abilist=""
+       if use multilib ; then
+               abilist=$(get_install_abis)
+       else
+               abilist=${DEFAULT_ABI}
+       fi
+       evar_push ABI
+       export ABI
+       for ABI in ${abilist:-default} ; do
+               setup_env
+               einfo "Running $1 for ABI ${ABI}"
+               $1
+               : $(( ret |= $? ))
+       done
+       evar_pop
+       return ${ret}
+}
+
 just_headers() {
        is_crosscompile && use crosscompile_opts_headers-only
 }

diff --git a/sys-libs/glibc/files/eblits/pkg_postinst.eblit 
b/sys-libs/glibc/files/eblits/pkg_postinst.eblit
index 10bed71..9e5447d 100644
--- a/sys-libs/glibc/files/eblits/pkg_postinst.eblit
+++ b/sys-libs/glibc/files/eblits/pkg_postinst.eblit
@@ -6,9 +6,9 @@ eblit-glibc-pkg_postinst() {
        # nothing to do if just installing headers
        just_headers && return
 
-       if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; 
then
+       if ! tc-is-cross-compiler && [[ -x ${ROOT}/usr/sbin/iconvconfig ]] ; 
then
                # Generate fastloading iconv module configuration file.
-               "${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}"
+               "${ROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}"
        fi
 
        if ! is_crosscompile && [[ ${ROOT} == "/" ]] ; then
@@ -17,10 +17,10 @@ eblit-glibc-pkg_postinst() {
                /sbin/telinit U 2>/dev/null
 
                # if the host locales.gen contains no entries, we'll install 
everything
-               local locale_list="${EROOT}etc/locale.gen"
+               local locale_list="${ROOT}etc/locale.gen"
                if [[ -z $(locale-gen --list --config "${locale_list}") ]] ; 
then
                        ewarn "Generating all locales; edit /etc/locale.gen to 
save time/space"
-                       locale_list="${EROOT}usr/share/i18n/SUPPORTED"
+                       locale_list="${ROOT}usr/share/i18n/SUPPORTED"
                fi
                locale-gen -j $(makeopts_jobs) --config "${locale_list}"
        fi

diff --git a/sys-libs/glibc/files/eblits/pkg_preinst.eblit 
b/sys-libs/glibc/files/eblits/pkg_preinst.eblit
index 404ff08..0fcb24a 100644
--- a/sys-libs/glibc/files/eblits/pkg_preinst.eblit
+++ b/sys-libs/glibc/files/eblits/pkg_preinst.eblit
@@ -1,14 +1,17 @@
-# Copyright 1999-2013 Gentoo Foundation
+# Copyright 1999-2014 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
-# $Header: 
/var/cvsroot/gentoo-x86/sys-libs/glibc/files/eblits/pkg_preinst.eblit,v 1.10 
2013/04/10 17:36:54 vapier Exp $
+# $Header: 
/var/cvsroot/gentoo-x86/sys-libs/glibc/files/eblits/pkg_preinst.eblit,v 1.13 
2014/08/10 03:35:56 vapier Exp $
 
 # Simple test to make sure our new glibc isnt completely broken.
 # Make sure we don't test with statically built binaries since
 # they will fail.  Also, skip if this glibc is a cross compiler.
+#
+# If coreutils is built with USE=multicall, some of these files
+# will just be wrapper scripts, not actual ELFs we can test.
 glibc_sanity_check() {
        cd / #228809
 
-       # We enter ${ED} so to avoid trouble if the path contains
+       # We enter ${D} so to avoid trouble if the path contains
        # special characters; for instance if the path contains the
        # colon character (:), then the linker will try to split it
        # and look for the libraries in an unexpected place. This can
@@ -18,11 +21,14 @@ glibc_sanity_check() {
        pushd "${ED}"/$(get_libdir) >/dev/null
 
        local x striptest
-       for x in date env ls true uname ; do
+       for x in cal date env free ls true uname uptime ; do
                x=$(type -p ${x})
                [[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
                striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
-               [[ ${striptest} == *"statically linked"* ]] && continue
+               case ${striptest} in
+               *"statically linked"*) continue;;
+               *"ASCII text"*) continue;;
+               esac
                ./ld-*.so --library-path . ${x} > /dev/null \
                        || die "simple run test (${x}) failed"
        done
@@ -44,7 +50,7 @@ eblit-glibc-pkg_preinst() {
        fi
 
        [[ ${ROOT} != "/" ]] && return 0
-       [[ -d ${ED}/$(get_libdir) ]] || return 0
+       [[ -d ${D}/$(get_libdir) ]] || return 0
        glibc_sanity_check
 
        # Make sure devpts is mounted correctly for use w/out setuid pt_chown.
@@ -54,7 +60,10 @@ eblit-glibc-pkg_preinst() {
                        eerror "you have devpts mounted at /dev/pts with the 
gid=5 option."
                        eerror "Openrc should do this for you, so you should 
check /etc/fstab"
                        eerror "and make sure you do not have any invalid 
settings there."
-                       die "mount & fix your /dev/pts settings"
+                       # Do not die on older kernels as devpts did not export 
these settings #489520.
+                       if version_is_at_least 2.6.25 $(uname -r) ; then
+                               die "mount & fix your /dev/pts settings"
+                       fi
                fi
        fi
 }

diff --git a/sys-libs/glibc/files/eblits/pkg_setup.eblit 
b/sys-libs/glibc/files/eblits/pkg_setup.eblit
index d9f36da..bd5b093 100644
--- a/sys-libs/glibc/files/eblits/pkg_setup.eblit
+++ b/sys-libs/glibc/files/eblits/pkg_setup.eblit
@@ -1,6 +1,6 @@
-# Copyright 1999-2011 Gentoo Foundation
+# Copyright 1999-2014 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
-# $Header: 
/var/cvsroot/gentoo-x86/sys-libs/glibc/files/eblits/pkg_setup.eblit,v 1.10 
2011/12/14 16:42:46 vapier Exp $
+# $Header: 
/var/cvsroot/gentoo-x86/sys-libs/glibc/files/eblits/pkg_setup.eblit,v 1.14 
2014/10/17 17:30:04 vapier Exp $
 
 glibc_compile_test() {
        local ret save_cflags=${CFLAGS}
@@ -12,7 +12,7 @@ glibc_compile_test() {
        rm -f glibc-test*
        printf '%b' "$*" > glibc-test.c
 
-       emake -s glibc-test
+       _nonfatal emake -s glibc-test
        ret=$?
 
        popd >/dev/null
@@ -48,7 +48,10 @@ glibc_run_test() {
 eblit-glibc-pkg_setup() {
        # prevent native builds from downgrading ... maybe update to allow 
people
        # to change between diff -r versions ? (2.3.6-r4 -> 2.3.6-r2)
-       if [[ ${ROOT} == "/" ]] && [[ ${CBUILD} == ${CHOST} ]] && [[ ${CHOST} 
== ${CTARGET} ]] ; then
+       if [[ ${MERGE_TYPE} != "buildonly" ]] && \
+          [[ ${ROOT} == "/" ]] && \
+          [[ ${CBUILD} == ${CHOST} ]] && \
+          [[ ${CHOST} == ${CTARGET} ]] ; then
                if has_version '>'${CATEGORY}/${PF} ; then
                        eerror "Sanity check to keep you from breaking your 
system:"
                        eerror " Downgrading glibc is not supported and a sure 
way to destruction"

diff --git a/sys-libs/glibc/files/eblits/src_compile.eblit 
b/sys-libs/glibc/files/eblits/src_compile.eblit
index 51792de..7704d83 100644
--- a/sys-libs/glibc/files/eblits/src_compile.eblit
+++ b/sys-libs/glibc/files/eblits/src_compile.eblit
@@ -1,256 +1,24 @@
-# Copyright 1999-2013 Gentoo Foundation
+# Copyright 1999-2014 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
-# $Header: 
/var/cvsroot/gentoo-x86/sys-libs/glibc/files/eblits/src_compile.eblit,v 1.35 
2013/04/05 18:25:21 vapier Exp $
+# $Header: 
/var/cvsroot/gentoo-x86/sys-libs/glibc/files/eblits/src_compile.eblit,v 1.45 
2014/09/10 18:45:21 vapier Exp $
 
-glibc_do_configure() {
-       local myconf=()
-
-       einfo "Configuring GLIBC for $1"
-
-       # set addons
-       pushd "${S}" > /dev/null
-       local ADDONS=$(echo */configure | sed \
-               -e 's:/configure::g' \
-               -e 's:\(linuxthreads\|nptl\|rtkaio\|glibc-compat\)\( \|$\)::g' \
-               -e 's: \+$::' \
-               -e 's! !,!g' \
-               -e 's!^!,!' \
-               -e '/^,\*$/d')
-       [[ -d ports ]] && ADDONS="${ADDONS},ports"
-       popd > /dev/null
-
-       myconf+=( $(use_enable hardened stackguard-randomization) )
-       if has_version '<sys-libs/glibc-2.13' ; then
-               myconf+=( --enable-old-ssp-compat )
-       fi
-
-       [[ ${CTARGET//_/-} == *-softfloat-* ]] && myconf+=( --without-fp )
-
-       if [[ $1 == "linuxthreads" ]] ; then
-               if want_tls ; then
-                       myconf+=( --with-tls )
-
-                       if ! want__thread || use glibc-compat20 || [[ 
${LT_KER_VER} == 2.[02].* ]] ; then
-                               myconf+=( --without-__thread )
-                       else
-                               myconf+=( --with-__thread )
-                       fi
-               else
-                       myconf+=( --without-tls --without-__thread )
-               fi
-
-               myconf+=( --disable-sanity-checks )
-               myconf+=( --enable-add-ons="linuxthreads${ADDONS}" )
-               myconf+=( --enable-kernel=${LT_KER_VER} )
-       elif [[ $1 == "nptl" ]] ; then
-               myconf+=( --enable-add-ons="nptl${ADDONS}" )
-               myconf+=( --enable-kernel=${NPTL_KERN_VER} )
-       else
-               die "invalid pthread option"
-       fi
-
-       # Since SELinux support is only required for nscd, only enable it if:
-       # 1. USE selinux
-       # 2. only for the primary ABI on multilib systems
-       # 3. Not a crosscompile
-       if ! is_crosscompile && use selinux ; then
-               if use multilib || has_multilib_profile ; then
-                       if is_final_abi ; then
-                               myconf+=( --with-selinux )
-                       else
-                               myconf+=( --without-selinux )
-                       fi
-               else
-                       myconf+=( --with-selinux )
-               fi
-       else
-               myconf+=( --without-selinux )
-       fi
-
-       myconf+=(
-               --without-cvs
-               --enable-bind-now
-               --build=${CBUILD_OPT:-${CBUILD}}
-               --host=${CTARGET_OPT:-${CTARGET}}
-               $(use_enable profile)
-               $(use_with gd)
-               --with-headers="$(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)
-               --enable-obsolete-rpc
-               $(in_iuse systemtap && use_enable systemtap)
-               $(in_iuse nscd && use_enable nscd)
-               ${EXTRA_ECONF}
-       )
-
-       # 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="${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
-       # this overriding check.  #347761
-       export libc_cv_hashstyle=no
-
-       # Overtime, generating info pages can be painful.  So disable this for
-       # versions older than the latest stable to avoid the issue (this ver
-       # should be updated from time to time).  #464394
-       if ! version_is_at_least 2.15 ; then
-               export ac_cv_prog_MAKEINFO=:
-       fi
-
-       local GBUILDDIR=${WORKDIR}/build-${ABI}-${CTARGET}-$1
-       mkdir -p "${GBUILDDIR}"
-       cd "${GBUILDDIR}"
-       set -- "${S}"/configure "${myconf[@]}"
-       echo "$@"
-       "$@" || die "failed to configure glibc"
-
-       # ia64 static cross-compilers are a pita in so much that they
-       # can't produce static ELFs (as the libgcc.a is broken).  so
-       # disable building of the programs for those targets if it
-       # doesn't work.
-       # XXX: We could turn this into a compiler test, but ia64 is
-       # the only one that matters, so this should be fine for now.
-       if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
-               sed -i '1i+link-static = touch $@' config.make
-       fi
-}
+[[ ${EAPI:-0} == [01] ]] && source "${FILESDIR}/eblits/src_configure.eblit"
 
 toolchain-glibc_src_compile() {
-       echo
-       local v
-       for v in ABI CBUILD CHOST CTARGET CBUILD_OPT CTARGET_OPT CC 
{AS,C,CPP,CXX,LD}FLAGS ; do
-               einfo " $(printf '%15s' ${v}:)   ${!v}"
-       done
-
-       export CC=$(tc-getCC ${CTARGET})
-       # Glibc does not work with gold (for various reasons) #269274.
-       if $(tc-getLD ${CTARGET}) --version | grep -q 'GNU gold' ; then
-               local d="${T}/bfd-linker"
-               mkdir -p "${d}"
-               ln -sf $(which ${CTARGET}-ld.bfd) "${d}"/ld
-               CC+=" -B${d}"
-       fi
-       einfo " $(printf '%15s' 'Manual CC:')   ${CC}"
-       echo
-
-       if want_linuxthreads ; then
-               glibc_do_configure linuxthreads
-               emake || die "make for ${ABI} failed"
-       fi
-       if want_nptl ; then
-               # ... and then do the optional nptl build
-               unset LD_ASSUME_KERNEL
-               glibc_do_configure nptl
-               emake || die "make for ${ABI} failed"
-       fi
-}
-
-toolchain-glibc_headers_compile() {
-       local GBUILDDIR=${WORKDIR}/build-${ABI}-${CTARGET}-headers
-       mkdir -p "${GBUILDDIR}"
-       cd "${GBUILDDIR}"
-
-       # if we don't have a compiler yet, we cant really test it now ...
-       # hopefully they don't affect header geneation, so let's hope for
-       # the best here ...
-       local v vars=(
-               ac_cv_header_cpuid_h=yes
-               
libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
-               libc_cv_asm_cfi_directives=yes
-               libc_cv_broken_visibility_attribute=no
-               libc_cv_gcc___thread=yes
-               libc_cv_mlong_double_128=yes
-               libc_cv_mlong_double_128ibm=yes
-               libc_cv_ppc_machine=yes
-               libc_cv_ppc_rel16=yes
-               libc_cv_predef_{fortify_source,stack_protector}=no
-               libc_cv_visibility_attribute=yes
-               libc_cv_z_combreloc=yes
-               libc_cv_z_execstack=yes
-               libc_cv_z_initfirst=yes
-               libc_cv_z_nodelete=yes
-               libc_cv_z_nodlopen=yes
-               libc_cv_z_relro=yes
-               libc_mips_abi=${ABI}
-               libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo 
soft || echo hard)
-       )
-       einfo "Forcing cached settings:"
-       for v in "${vars[@]}" ; do
-               einfo " ${v}"
-               export ${v}
+       local t
+       for t in linuxthreads nptl ; do
+               if want_${t} ; then
+                       [[ ${EAPI:-0} == [01] ]] && glibc_do_configure ${t}
+                       emake -C "$(builddir ${t})" || die "make ${t} for 
${ABI} failed"
+               fi
        done
-
-       # Pick out the correct location for build headers
-       local ports="" myconf=()
-       [[ -d ${S}/ports ]] && ports=",ports"
-       myconf+=(
-               --disable-sanity-checks
-               --enable-hacker-mode
-               --enable-add-ons=nptl${ports}
-               --without-cvs
-               --enable-bind-now
-               --build=${CBUILD_OPT:-${CBUILD}}
-               --host=${CTARGET_OPT:-${CTARGET}}
-               --with-headers="$(alt_build_headers)"
-               --prefix="${TPREFIX}/usr"
-               ${EXTRA_ECONF}
-       )
-
-       # Nothing is compiled here which would affect the headers for the 
target.
-       # so forcing CC/CFLAGS is sane.  unless you dont have `gcc`.  then i
-       # dont care :p.
-       set -- "${S}"/configure "${myconf[@]}"
-       CC=gcc \
-       CFLAGS="-O1 -pipe" \
-       CPPFLAGS="-U_FORTIFY_SOURCE" \
-       LDFLAGS="" \
-       "$@" || die "failed to configure glibc"
 }
 
 eblit-glibc-src_compile() {
-       if is_crosscompile ; then
-               export \
-                       libc_cv_c_cleanup=yes \
-                       libc_cv_forced_unwind=yes
-       fi
-
        if just_headers ; then
-               export ABI=default
-               toolchain-glibc_headers_compile
+               [[ ${EAPI:-0} == [01] ]] && toolchain-glibc_headers_configure
                return
        fi
 
-       setup_env
-
-       if [[ -z ${OABI} ]] ; then
-               local abilist=""
-               if has_multilib_profile ; then
-                       abilist=$(get_install_abis)
-               elif is_crosscompile || tc-is-cross-compiler ; then
-                       abilist=${DEFAULT_ABI}
-               fi
-               einfo "Building glibc for ABIs: ${abilist}"
-               if [[ -n ${abilist} ]] ; then
-                       OABI=${ABI}
-                       for ABI in ${abilist} ; do
-                               export ABI
-                               src_compile
-                       done
-                       ABI=${OABI}
-                       unset OABI
-                       return 0
-               fi
-       fi
-
-       toolchain-glibc_src_compile
+       foreach_abi toolchain-glibc_src_compile
 }

diff --git a/sys-libs/glibc/files/eblits/src_compile.eblit 
b/sys-libs/glibc/files/eblits/src_configure.eblit
similarity index 69%
copy from sys-libs/glibc/files/eblits/src_compile.eblit
copy to sys-libs/glibc/files/eblits/src_configure.eblit
index 51792de..e0fc185 100644
--- a/sys-libs/glibc/files/eblits/src_compile.eblit
+++ b/sys-libs/glibc/files/eblits/src_configure.eblit
@@ -1,22 +1,44 @@
-# Copyright 1999-2013 Gentoo Foundation
+# Copyright 1999-2014 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
-# $Header: 
/var/cvsroot/gentoo-x86/sys-libs/glibc/files/eblits/src_compile.eblit,v 1.35 
2013/04/05 18:25:21 vapier Exp $
+# $Header: 
/var/cvsroot/gentoo-x86/sys-libs/glibc/files/eblits/src_configure.eblit,v 1.2 
2014/09/18 16:48:15 vapier Exp $
+
+dump_toolchain_settings() {
+       echo
+
+       einfo "$*"
+
+       local v
+       for v in ABI CBUILD CHOST CTARGET CBUILD_OPT CTARGET_OPT CC 
{AS,C,CPP,CXX,LD}FLAGS ; do
+               einfo " $(printf '%15s' ${v}:)   ${!v}"
+       done
+
+       export CC=$(tc-getCC ${CTARGET})
+       # Glibc does not work with gold (for various reasons) #269274.
+       if $(tc-getLD ${CTARGET}) --version | grep -q 'GNU gold' ; then
+               local d="${T}/bfd-linker"
+               mkdir -p "${d}"
+               ln -sf $(which ${CTARGET}-ld.bfd) "${d}"/ld
+               CC+=" -B${d}"
+       fi
+       einfo " $(printf '%15s' 'Manual CC:')   ${CC}"
+       echo
+}
 
 glibc_do_configure() {
-       local myconf=()
+       dump_toolchain_settings "Configuring glibc for $1"
 
-       einfo "Configuring GLIBC for $1"
+       local myconf=()
 
        # set addons
        pushd "${S}" > /dev/null
-       local ADDONS=$(echo */configure | sed \
+       local addons=$(echo */configure | sed \
                -e 's:/configure::g' \
                -e 's:\(linuxthreads\|nptl\|rtkaio\|glibc-compat\)\( \|$\)::g' \
                -e 's: \+$::' \
                -e 's! !,!g' \
                -e 's!^!,!' \
                -e '/^,\*$/d')
-       [[ -d ports ]] && ADDONS="${ADDONS},ports"
+       [[ -d ports ]] && addons+=",ports"
        popd > /dev/null
 
        myconf+=( $(use_enable hardened stackguard-randomization) )
@@ -24,7 +46,7 @@ glibc_do_configure() {
                myconf+=( --enable-old-ssp-compat )
        fi
 
-       [[ ${CTARGET//_/-} == *-softfloat-* ]] && myconf+=( --without-fp )
+       [[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
 
        if [[ $1 == "linuxthreads" ]] ; then
                if want_tls ; then
@@ -40,21 +62,23 @@ glibc_do_configure() {
                fi
 
                myconf+=( --disable-sanity-checks )
-               myconf+=( --enable-add-ons="linuxthreads${ADDONS}" )
+               addons="linuxthreads${addons}"
                myconf+=( --enable-kernel=${LT_KER_VER} )
        elif [[ $1 == "nptl" ]] ; then
-               myconf+=( --enable-add-ons="nptl${ADDONS}" )
+               # Newer versions require nptl, so there is no addon for it.
+               version_is_at_least 2.20 || addons="nptl${addons}"
                myconf+=( --enable-kernel=${NPTL_KERN_VER} )
        else
                die "invalid pthread option"
        fi
+       myconf+=( --enable-add-ons="${addons#,}" )
 
        # Since SELinux support is only required for nscd, only enable it if:
        # 1. USE selinux
        # 2. only for the primary ABI on multilib systems
        # 3. Not a crosscompile
        if ! is_crosscompile && use selinux ; then
-               if use multilib || has_multilib_profile ; then
+               if use multilib ; then
                        if is_final_abi ; then
                                myconf+=( --with-selinux )
                        else
@@ -67,6 +91,14 @@ glibc_do_configure() {
                myconf+=( --without-selinux )
        fi
 
+       # Force a few tests where we always know the answer but
+       # configure is incapable of finding it.
+       if is_crosscompile ; then
+               export \
+                       libc_cv_c_cleanup=yes \
+                       libc_cv_forced_unwind=yes
+       fi
+
        myconf+=(
                --without-cvs
                --enable-bind-now
@@ -74,14 +106,12 @@ glibc_do_configure() {
                --host=${CTARGET_OPT:-${CTARGET}}
                $(use_enable profile)
                $(use_with gd)
-               --with-headers="$(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-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-bugurl=http://bugs.gentoo.org/
                --with-pkgversion="$(glibc_banner)"
                $(use_multiarch || echo --disable-multi-arch)
@@ -93,7 +123,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="${TPREFIX}/$(get_libdir)"
+       export libc_cv_slibdir=/$(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
@@ -102,14 +132,14 @@ glibc_do_configure() {
 
        # Overtime, generating info pages can be painful.  So disable this for
        # versions older than the latest stable to avoid the issue (this ver
-       # should be updated from time to time).  #464394
-       if ! version_is_at_least 2.15 ; then
+       # should be updated from time to time).  #464394 #465816
+       if ! version_is_at_least 2.17 ; then
                export ac_cv_prog_MAKEINFO=:
        fi
 
-       local GBUILDDIR=${WORKDIR}/build-${ABI}-${CTARGET}-$1
-       mkdir -p "${GBUILDDIR}"
-       cd "${GBUILDDIR}"
+       local builddir=$(builddir "$1")
+       mkdir -p "${builddir}"
+       cd "${builddir}"
        set -- "${S}"/configure "${myconf[@]}"
        echo "$@"
        "$@" || die "failed to configure glibc"
@@ -123,42 +153,28 @@ glibc_do_configure() {
        if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
                sed -i '1i+link-static = touch $@' config.make
        fi
-}
-
-toolchain-glibc_src_compile() {
-       echo
-       local v
-       for v in ABI CBUILD CHOST CTARGET CBUILD_OPT CTARGET_OPT CC 
{AS,C,CPP,CXX,LD}FLAGS ; do
-               einfo " $(printf '%15s' ${v}:)   ${!v}"
-       done
-
-       export CC=$(tc-getCC ${CTARGET})
-       # Glibc does not work with gold (for various reasons) #269274.
-       if $(tc-getLD ${CTARGET}) --version | grep -q 'GNU gold' ; then
-               local d="${T}/bfd-linker"
-               mkdir -p "${d}"
-               ln -sf $(which ${CTARGET}-ld.bfd) "${d}"/ld
-               CC+=" -B${d}"
-       fi
-       einfo " $(printf '%15s' 'Manual CC:')   ${CC}"
-       echo
 
-       if want_linuxthreads ; then
-               glibc_do_configure linuxthreads
-               emake || die "make for ${ABI} failed"
-       fi
-       if want_nptl ; then
-               # ... and then do the optional nptl build
-               unset LD_ASSUME_KERNEL
-               glibc_do_configure nptl
-               emake || die "make for ${ABI} failed"
+       # If we're trying to migrate between ABI sets, we need
+       # to lie and use a local copy of gcc.  Like if the system
+       # is built with MULTILIB_ABIS="amd64 x86" but we want to
+       # add x32 to it, gcc/glibc don't yet support x32.
+       if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib ; then
+               echo 'main(){}' > "${T}"/test.c
+               if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c 
-Wl,-emain -lgcc 2>/dev/null ; then
+                       sed -i -e '/^CC = /s:$: 
-B$(objdir)/../'"gcc-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
+                       mkdir -p sunrpc
+                       cp $(which rpcgen) sunrpc/cross-rpcgen || die
+                       touch -t 202001010101 sunrpc/cross-rpcgen || die
+               fi
        fi
 }
 
-toolchain-glibc_headers_compile() {
-       local GBUILDDIR=${WORKDIR}/build-${ABI}-${CTARGET}-headers
-       mkdir -p "${GBUILDDIR}"
-       cd "${GBUILDDIR}"
+toolchain-glibc_headers_configure() {
+       export ABI=default
+
+       local builddir=$(builddir "headers")
+       mkdir -p "${builddir}"
+       cd "${builddir}"
 
        # if we don't have a compiler yet, we cant really test it now ...
        # hopefully they don't affect header geneation, so let's hope for
@@ -168,6 +184,8 @@ toolchain-glibc_headers_compile() {
                
libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
                libc_cv_asm_cfi_directives=yes
                libc_cv_broken_visibility_attribute=no
+               libc_cv_c_cleanup=yes
+               libc_cv_forced_unwind=yes
                libc_cv_gcc___thread=yes
                libc_cv_mlong_double_128=yes
                libc_cv_mlong_double_128ibm=yes
@@ -201,56 +219,26 @@ toolchain-glibc_headers_compile() {
                --enable-bind-now
                --build=${CBUILD_OPT:-${CBUILD}}
                --host=${CTARGET_OPT:-${CTARGET}}
-               --with-headers="$(alt_build_headers)"
-               --prefix="${TPREFIX}/usr"
+               --with-headers=$(alt_build_headers)
+               --prefix=/usr
                ${EXTRA_ECONF}
        )
 
        # Nothing is compiled here which would affect the headers for the 
target.
-       # so forcing CC/CFLAGS is sane.  unless you dont have `gcc`.  then i
-       # dont care :p.
+       # So forcing CC/CFLAGS is sane.
        set -- "${S}"/configure "${myconf[@]}"
-       CC=gcc \
+       CC="$(tc-getBUILD_CC)" \
        CFLAGS="-O1 -pipe" \
        CPPFLAGS="-U_FORTIFY_SOURCE" \
        LDFLAGS="" \
        "$@" || die "failed to configure glibc"
 }
 
-eblit-glibc-src_compile() {
-       if is_crosscompile ; then
-               export \
-                       libc_cv_c_cleanup=yes \
-                       libc_cv_forced_unwind=yes
-       fi
-
-       if just_headers ; then
-               export ABI=default
-               toolchain-glibc_headers_compile
-               return
-       fi
-
-       setup_env
-
-       if [[ -z ${OABI} ]] ; then
-               local abilist=""
-               if has_multilib_profile ; then
-                       abilist=$(get_install_abis)
-               elif is_crosscompile || tc-is-cross-compiler ; then
-                       abilist=${DEFAULT_ABI}
-               fi
-               einfo "Building glibc for ABIs: ${abilist}"
-               if [[ -n ${abilist} ]] ; then
-                       OABI=${ABI}
-                       for ABI in ${abilist} ; do
-                               export ABI
-                               src_compile
-                       done
-                       ABI=${OABI}
-                       unset OABI
-                       return 0
-               fi
-       fi
+toolchain-glibc_src_configure() {
+       want_linuxthreads && glibc_do_configure linuxthreads
+       want_nptl && glibc_do_configure nptl
+}
 
-       toolchain-glibc_src_compile
+eblit-glibc-src_configure() {
+       foreach_abi toolchain-glibc_src_configure
 }

diff --git a/sys-libs/glibc/files/eblits/src_install.eblit 
b/sys-libs/glibc/files/eblits/src_install.eblit
index 2dca6f6..8030d93 100644
--- a/sys-libs/glibc/files/eblits/src_install.eblit
+++ b/sys-libs/glibc/files/eblits/src_install.eblit
@@ -1,28 +1,16 @@
-# Copyright 1999-2013 Gentoo Foundation
+# Copyright 1999-2014 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
-# $Header: 
/var/cvsroot/gentoo-x86/sys-libs/glibc/files/eblits/src_install.eblit,v 1.30 
2013/04/10 17:36:54 vapier Exp $
+# $Header: 
/var/cvsroot/gentoo-x86/sys-libs/glibc/files/eblits/src_install.eblit,v 1.38 
2014/09/10 18:15:55 vapier Exp $
 
 toolchain-glibc_src_install() {
-       local GBUILDDIR
-       if want_linuxthreads ; then
-               GBUILDDIR=${WORKDIR}/build-${ABI}-${CTARGET}-linuxthreads
-       else
-               GBUILDDIR=${WORKDIR}/build-${ABI}-${CTARGET}-nptl
-       fi
+       local builddir=$(builddir $(want_linuxthreads && echo linuxthreads || 
echo nptl))
+       cd "${builddir}"
 
-       local install_root="${D}${EPREFIX%${TPREFIX}}/$(alt_prefix)"
-       if want_linuxthreads ; then
-               cd "${WORKDIR}"/build-${ABI}-${CTARGET}-linuxthreads
-               einfo "Installing GLIBC ${ABI} with linuxthreads ..."
-       else
-               cd "${WORKDIR}"/build-${ABI}-${CTARGET}-nptl
-               einfo "Installing GLIBC ${ABI} with NPTL ..."
-       fi
-       emake install_root="${install_root}" install || die
+       emake install_root="${D}$(alt_prefix)" install || die
 
        if want_linuxthreads && want_nptl ; then
                einfo "Installing NPTL to $(alt_libdir)/tls/..."
-               cd "${WORKDIR}"/build-${ABI}-${CTARGET}-nptl
+               cd "$(builddir nptl)"
                dodir $(alt_libdir)/tls $(alt_usrlibdir)/nptl
 
                local l src_lib
@@ -92,6 +80,20 @@ toolchain-glibc_src_install() {
                sparc32 /lib/ld-linux.so.2
                sparc64 /lib64/ld-linux.so.2
        )
+       case $(tc-endian) in
+       little)
+               ldso_abi_list+=(
+                       # arm
+                       arm64   /lib/ld-linux-aarch64.so.1
+               )
+               ;;
+       big)
+               ldso_abi_list+=(
+                       # arm
+                       arm64   /lib/ld-linux-aarch64_be.so.1
+               )
+               ;;
+       esac
        if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] 
; then
                dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
        fi
@@ -100,7 +102,7 @@ toolchain-glibc_src_install() {
                has ${ldso_abi} $(get_install_abis) || continue
 
                ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
-               if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; 
then
+               if [[ ! -L ${D}/${ldso_name} && ! -e ${D}/${ldso_name} ]] ; then
                        dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} 
${ldso_name}
                fi
        done
@@ -170,6 +172,16 @@ toolchain-glibc_src_install() {
                )
                version_is_at_least 2.16 || nscd_args+=( -e 's: --foreground : 
:' )
                sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
+
+               # Newer versions of glibc include the nscd.service themselves.
+               # TODO: Drop the $FILESDIR copy once 2.19 goes stable.
+               if version_is_at_least 2.19 ; then
+                       systemd_dounit nscd/nscd.service || die
+                       systemd_newtmpfilesd nscd/nscd.tmpfiles nscd.conf || die
+               else
+                       systemd_dounit "${FILESDIR}"/nscd.service || die
+                       systemd_newtmpfilesd "${FILESDIR}"/nscd.tmpfilesd 
nscd.conf || die
+               fi
        else
                # Do this since extra/etc/*.conf above might have nscd.conf.
                rm -f "${ED}"/etc/nscd.conf
@@ -188,9 +200,9 @@ toolchain-glibc_src_install() {
 }
 
 toolchain-glibc_headers_install() {
-       local GBUILDDIR=${WORKDIR}/build-${ABI}-${CTARGET}-headers
-       cd "${GBUILDDIR}"
-       emake install_root="${D}${EPREFIX%${TPREFIX}}/$(alt_prefix)" 
install-headers || die
+       local builddir=$(builddir "headers")
+       cd "${builddir}"
+       emake install_root="${D}$(alt_prefix)" install-headers || die
        if ! version_is_at_least 2.16 ; then
                insinto $(alt_headers)/bits
                doins bits/stdio_lim.h || die
@@ -227,29 +239,6 @@ eblit-glibc-src_install() {
                return
        fi
 
-       setup_env
-
-       if [[ -z ${OABI} ]] ; then
-               local abilist=""
-               if has_multilib_profile ; then
-                       abilist=$(get_install_abis)
-                       einfo "Installing multilib glibc for ABIs: ${abilist}"
-               elif is_crosscompile || tc-is-cross-compiler ; then
-                       abilist=${DEFAULT_ABI}
-               fi
-               if [[ -n ${abilist} ]] ; then
-                       OABI=${ABI}
-                       for ABI in ${abilist} ; do
-                               export ABI
-                               eblit-glibc-src_install
-                       done
-                       ABI=${OABI}
-                       unset OABI
-                       src_strip
-                       return 0
-               fi
-       fi
-
-       toolchain-glibc_src_install
-       [[ -z ${OABI} ]] && src_strip
+       foreach_abi toolchain-glibc_src_install
+       src_strip
 }

diff --git a/sys-libs/glibc/files/eblits/src_prepare.eblit 
b/sys-libs/glibc/files/eblits/src_prepare.eblit
new file mode 100644
index 0000000..dc57fae
--- /dev/null
+++ b/sys-libs/glibc/files/eblits/src_prepare.eblit
@@ -0,0 +1,63 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: 
/var/cvsroot/gentoo-x86/sys-libs/glibc/files/eblits/src_prepare.eblit,v 1.1 
2014/09/10 05:59:03 vapier Exp $
+
+eblit-glibc-src_prepare() {
+       # XXX: We should do the branchupdate, before extracting the manpages and
+       # infopages else it does not help much (mtimes change if there is a 
change
+       # to them with branchupdate)
+       if [[ -n ${BRANCH_UPDATE} ]] ; then
+               epatch 
"${DISTDIR}"/glibc-${RELEASE_VER}-branch-update-${BRANCH_UPDATE}.patch.bz2
+
+               # Snapshot date patch
+               einfo "Patching version to display snapshot date ..."
+               sed -i -e "s:\(#define RELEASE\).*:\1 \"${BRANCH_UPDATE}\":" 
version.h
+       fi
+
+       # tag, glibc is it
+       if ! version_is_at_least 2.17 ; then
+               [[ -e csu/Banner ]] && die "need new banner location"
+               glibc_banner > csu/Banner
+       fi
+       if [[ -n ${PATCH_VER} ]] && ! use vanilla ; then
+               EPATCH_MULTI_MSG="Applying Gentoo Glibc Patchset 
${RELEASE_VER}-${PATCH_VER} ..." \
+               EPATCH_EXCLUDE=${GLIBC_PATCH_EXCLUDE} \
+               EPATCH_SUFFIX="patch" \
+               ARCH=$(tc-arch) \
+               epatch "${WORKDIR}"/patches
+       fi
+
+       if just_headers ; then
+               if [[ -e ports/sysdeps/mips/preconfigure ]] ; then
+                       # mips peeps like to screw with us.  if building 
headers,
+                       # we don't have a real compiler, so we can't let them
+                       # insert -mabi on us.
+                       sed -i '/CPPFLAGS=.*-mabi/s|.*|:|' 
ports/sysdeps/mips/preconfigure || die
+                       find ports/sysdeps/mips/ -name Makefile -exec sed -i 
'/^CC.*-mabi=/s:-mabi=.*:-D_MIPS_SZPTR=32:' {} +
+               fi
+       fi
+
+       epatch_user
+
+       gnuconfig_update
+
+       # Glibc is stupid sometimes, and doesn't realize that with a
+       # static C-Only gcc, -lgcc_eh doesn't exist.
+       # http://sourceware.org/ml/libc-alpha/2003-09/msg00100.html
+       # http://sourceware.org/ml/libc-alpha/2005-02/msg00042.html
+       # But! Finally fixed in recent versions:
+       # http://sourceware.org/ml/libc-alpha/2012-05/msg01865.html
+       if ! version_is_at_least 2.16 ; then
+               echo 'int main(){}' > "${T}"/gcc_eh_test.c
+               if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} 
"${T}"/gcc_eh_test.c -lgcc_eh 2>/dev/null ; then
+                       sed -i -e 's:-lgcc_eh::' Makeconfig || die "sed gcc_eh"
+               fi
+       fi
+
+       cd "${WORKDIR}"
+       find . -type f '(' -size 0 -o -name "*.orig" ')' -delete
+       find . -name configure -exec touch {} +
+
+       # Fix permissions on some of the scripts.
+       chmod u+x "${S}"/scripts/*.sh
+}

diff --git a/sys-libs/glibc/files/eblits/src_test.eblit 
b/sys-libs/glibc/files/eblits/src_test.eblit
index 532bc8c..210cca3 100644
--- a/sys-libs/glibc/files/eblits/src_test.eblit
+++ b/sys-libs/glibc/files/eblits/src_test.eblit
@@ -1,56 +1,30 @@
-# Copyright 1999-2013 Gentoo Foundation
+# Copyright 1999-2014 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
-# $Header: 
/var/cvsroot/gentoo-x86/sys-libs/glibc/files/eblits/src_test.eblit,v 1.5 
2013/04/11 20:42:56 vapier Exp $
+# $Header: 
/var/cvsroot/gentoo-x86/sys-libs/glibc/files/eblits/src_test.eblit,v 1.9 
2014/09/17 22:53:43 vapier Exp $
 
-toolchain-glibc_src_test() {
-       cd "${WORKDIR}"/build-${ABI}-${CTARGET}-$1 || die "cd 
build-${ABI}-${CTARGET}-$1"
-       unset LD_ASSUME_KERNEL
-       emake -j1 check && return 0
+glibc_src_test() {
+       cd "$(builddir $1)"
+       nonfatal emake -j1 check && return 0
        einfo "make check failed - re-running with --keep-going to get the rest 
of the results"
-       emake -j1 -k check
+       nonfatal emake -j1 -k check
        ewarn "make check failed for ${ABI}-${CTARGET}-$1"
        return 1
 }
 
-eblit-glibc-src_test() {
-       local ret=0
-
-       setup_env
-
-       _maybe_die() {
-               if [[ -n ${OABI} ]] ; then
-                       return ${ret}
-               elif [[ ${ret} -ne 0 ]] ; then
-                       die "tests failed"
-               fi
-       }
-
-       # give tests more time to complete
-       export TIMEOUTFACTOR=5
-
-       if [[ -z ${OABI} ]] && has_multilib_profile ; then
-               OABI=${ABI}
-               einfo "Testing multilib glibc for ABIs: $(get_install_abis)"
-               for ABI in $(get_install_abis) ; do
-                       export ABI
-                       einfo "   Testing ${ABI} glibc"
-                       eblit-glibc-src_test
-                       : $(( ret += $? ))
-               done
-               ABI=${OABI}
-               unset OABI
-
-               _maybe_die
-               return
-       fi
-
-       local t
+toolchain-glibc_src_test() {
+       local ret=0 t
        for t in linuxthreads nptl ; do
                if want_${t} ; then
-                       toolchain-glibc_src_test ${t}
-                       : $(( ret += $? ))
+                       glibc_src_test ${t}
+                       : $(( ret |= $? ))
                fi
        done
-       _maybe_die
-       return
+       return ${ret}
+}
+
+eblit-glibc-src_test() {
+       # Give tests more time to complete.
+       export TIMEOUTFACTOR=5
+
+       foreach_abi toolchain-glibc_src_test || die "tests failed"
 }

diff --git a/sys-libs/glibc/files/eblits/src_unpack.eblit 
b/sys-libs/glibc/files/eblits/src_unpack.eblit
index be2d76d..94f33b5 100644
--- a/sys-libs/glibc/files/eblits/src_unpack.eblit
+++ b/sys-libs/glibc/files/eblits/src_unpack.eblit
@@ -1,6 +1,8 @@
-# Copyright 1999-2013 Gentoo Foundation
+# Copyright 1999-2014 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
-# $Header: 
/var/cvsroot/gentoo-x86/sys-libs/glibc/files/eblits/src_unpack.eblit,v 1.22 
2013/04/05 00:25:16 vapier Exp $
+# $Header: 
/var/cvsroot/gentoo-x86/sys-libs/glibc/files/eblits/src_unpack.eblit,v 1.27 
2014/09/10 05:59:03 vapier Exp $
+
+[[ ${EAPI:-0} == [01] ]] && source "${FILESDIR}/eblits/src_prepare.eblit"
 
 int_to_KV() {
        local version=$1 major minor micro
@@ -17,7 +19,7 @@ eend_KV() {
 
 get_kheader_version() {
        printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
-       $(tc-getCPP ${CTARGET}) -I "$(alt_build_headers)" | \
+       $(tc-getCPP ${CTARGET}) -I "${EPREFIX}/$(alt_build_headers)" - | \
        tail -n 1
 }
 
@@ -109,71 +111,11 @@ toolchain-glibc_src_unpack() {
                        mv "${d}" "${S}" || die "moving ${d} failed"
                done
        fi
-
-       # XXX: We should do the branchupdate, before extracting the manpages and
-       # infopages else it does not help much (mtimes change if there is a 
change
-       # to them with branchupdate)
-       if [[ -n ${BRANCH_UPDATE} ]] ; then
-               cd "${S}"
-               epatch 
"${DISTDIR}"/glibc-${RELEASE_VER}-branch-update-${BRANCH_UPDATE}.patch.bz2
-
-               # Snapshot date patch
-               einfo "Patching version to display snapshot date ..."
-               sed -i -e "s:\(#define RELEASE\).*:\1 \"${BRANCH_UPDATE}\":" 
version.h
-       fi
-
-       # tag, glibc is it
-       cd "${S}"
-       if ! version_is_at_least 2.17 ; then
-               [[ -e csu/Banner ]] && die "need new banner location"
-               glibc_banner > csu/Banner
-       fi
-       if [[ -n ${PATCH_VER} ]] && ! use vanilla ; then
-               cd "${S}"
-               EPATCH_MULTI_MSG="Applying Gentoo Glibc Patchset 
${RELEASE_VER}-${PATCH_VER} ..." \
-               EPATCH_EXCLUDE=${GLIBC_PATCH_EXCLUDE} \
-               EPATCH_SUFFIX="patch" \
-               ARCH=$(tc-arch) \
-               epatch "${WORKDIR}"/patches
-       fi
-
-       if just_headers ; then
-               if [[ -e ports/sysdeps/mips/preconfigure ]] ; then
-                       # mips peeps like to screw with us.  if building 
headers,
-                       # we don't have a real compiler, so we can't let them
-                       # insert -mabi on us.
-                       sed -i '/CPPFLAGS=.*-mabi/s|.*|:|' 
ports/sysdeps/mips/preconfigure || die
-                       find ports/sysdeps/mips/ -name Makefile -exec sed -i 
'/^CC.*-mabi=/s:-mabi=.*:-D_MIPS_SZPTR=32:' {} +
-               fi
-       fi
-
-       epatch_user
-
-       gnuconfig_update
 }
 
 eblit-glibc-src_unpack() {
        setup_env
 
        toolchain-glibc_src_unpack
-
-       # Glibc is stupid sometimes, and doesn't realize that with a
-       # static C-Only gcc, -lgcc_eh doesn't exist.
-       # http://sourceware.org/ml/libc-alpha/2003-09/msg00100.html
-       # http://sourceware.org/ml/libc-alpha/2005-02/msg00042.html
-       # But! Finally fixed in recent versions:
-       # http://sourceware.org/ml/libc-alpha/2012-05/msg01865.html
-       if ! version_is_at_least 2.16 ; then
-               echo 'int main(){}' > "${T}"/gcc_eh_test.c
-               if ! $(tc-getCC ${CTARGET}) "${T}"/gcc_eh_test.c -lgcc_eh 
2>/dev/null ; then
-                       sed -i -e 's:-lgcc_eh::' Makeconfig || die "sed gcc_eh"
-               fi
-       fi
-
-       cd "${WORKDIR}"
-       find . -type f '(' -size 0 -o -name "*.orig" ')' -exec rm -f {} \;
-       find . -name configure -exec touch {} \;
-
-       # Fix permissions on some of the scripts
-       chmod u+x "${S}"/scripts/*.sh
+       [[ ${EAPI:-0} == [01] ]] && cd "${S}" && eblit-glibc-src_prepare
 }

Reply via email to