diff options
author | Mike Frysinger <vapier@gentoo.org> | 2014-09-10 18:45:21 +0000 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2014-09-10 18:45:21 +0000 |
commit | a4f9e7e22b42fd201b933f84e631b6d553ab0d40 (patch) | |
tree | dda2148383092034afc69a8880ffd9a35a0292f6 /sys-libs/glibc | |
parent | Combine ABI for loops into one helper. (diff) | |
download | gentoo-2-a4f9e7e22b42fd201b933f84e631b6d553ab0d40.tar.gz gentoo-2-a4f9e7e22b42fd201b933f84e631b6d553ab0d40.tar.bz2 gentoo-2-a4f9e7e22b42fd201b933f84e631b6d553ab0d40.zip |
Split src_configure out of src_compile #473728 by Benda Xu.
(Portage version: 2.2.10/cvs/Linux x86_64, signed Manifest commit with key D2E96200)
Diffstat (limited to 'sys-libs/glibc')
-rw-r--r-- | sys-libs/glibc/ChangeLog | 6 | ||||
-rw-r--r-- | sys-libs/glibc/files/eblits/src_compile.eblit | 248 | ||||
-rw-r--r-- | sys-libs/glibc/files/eblits/src_configure.eblit | 244 |
3 files changed, 258 insertions, 240 deletions
diff --git a/sys-libs/glibc/ChangeLog b/sys-libs/glibc/ChangeLog index e6afd5a13cef..4421c26d767f 100644 --- a/sys-libs/glibc/ChangeLog +++ b/sys-libs/glibc/ChangeLog @@ -1,6 +1,10 @@ # ChangeLog for sys-libs/glibc # Copyright 1999-2014 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/sys-libs/glibc/ChangeLog,v 1.1019 2014/09/10 18:15:55 vapier Exp $ +# $Header: /var/cvsroot/gentoo-x86/sys-libs/glibc/ChangeLog,v 1.1020 2014/09/10 18:45:21 vapier Exp $ + + 10 Sep 2014; Mike Frysinger <vapier@gentoo.org> + +files/eblits/src_configure.eblit, files/eblits/src_compile.eblit: + Split src_configure out of src_compile #473728 by Benda Xu. 10 Sep 2014; Mike Frysinger <vapier@gentoo.org> files/eblits/common.eblit, files/eblits/src_compile.eblit, files/eblits/src_install.eblit, diff --git a/sys-libs/glibc/files/eblits/src_compile.eblit b/sys-libs/glibc/files/eblits/src_compile.eblit index 83e526eba0be..7704d83fcf08 100644 --- a/sys-libs/glibc/files/eblits/src_compile.eblit +++ b/sys-libs/glibc/files/eblits/src_compile.eblit @@ -1,254 +1,24 @@ # 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.44 2014/09/10 18:15:55 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 $ -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() { - dump_toolchain_settings "Configuring glibc for $1" - - local myconf=() - - # 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+=",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 - - [[ $(tc-is-softfloat) == "yes" ]] && 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 ) - addons="linuxthreads${addons}" - myconf+=( --enable-kernel=${LT_KER_VER} ) - elif [[ $1 == "nptl" ]] ; then - # 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 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=/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) - --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=/$(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 #465816 - if ! version_is_at_least 2.17 ; then - export ac_cv_prog_MAKEINFO=: - fi - - local builddir=$(builddir "$1") - mkdir -p "${builddir}" - cd "${builddir}" - 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 - - # 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 -} +[[ ${EAPI:-0} == [01] ]] && source "${FILESDIR}/eblits/src_configure.eblit" toolchain-glibc_src_compile() { - 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 - glibc_do_configure nptl - emake || die "make for ${ABI} failed" - fi -} - -toolchain-glibc_headers_compile() { - 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 - # 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_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 - 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=/usr - ${EXTRA_ECONF} - ) - - # Nothing is compiled here which would affect the headers for the target. - # So forcing CC/CFLAGS is sane. - set -- "${S}"/configure "${myconf[@]}" - CC="$(tc-getBUILD_CC)" \ - CFLAGS="-O1 -pipe" \ - CPPFLAGS="-U_FORTIFY_SOURCE" \ - LDFLAGS="" \ - "$@" || die "failed to configure glibc" } eblit-glibc-src_compile() { if just_headers ; then - toolchain-glibc_headers_compile + [[ ${EAPI:-0} == [01] ]] && toolchain-glibc_headers_configure return fi - if is_crosscompile ; then - export \ - libc_cv_c_cleanup=yes \ - libc_cv_forced_unwind=yes - fi - foreach_abi toolchain-glibc_src_compile } diff --git a/sys-libs/glibc/files/eblits/src_configure.eblit b/sys-libs/glibc/files/eblits/src_configure.eblit new file mode 100644 index 000000000000..aab777ab10e9 --- /dev/null +++ b/sys-libs/glibc/files/eblits/src_configure.eblit @@ -0,0 +1,244 @@ +# 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_configure.eblit,v 1.1 2014/09/10 18:45:21 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() { + dump_toolchain_settings "Configuring glibc for $1" + + local myconf=() + + # 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+=",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 + + [[ $(tc-is-softfloat) == "yes" ]] && 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 ) + addons="linuxthreads${addons}" + myconf+=( --enable-kernel=${LT_KER_VER} ) + elif [[ $1 == "nptl" ]] ; then + # 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 is_final_abi ; then + myconf+=( --with-selinux ) + else + myconf+=( --without-selinux ) + fi + else + myconf+=( --with-selinux ) + fi + else + 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 + --build=${CBUILD_OPT:-${CBUILD}} + --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-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=/$(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 #465816 + if ! version_is_at_least 2.17 ; then + export ac_cv_prog_MAKEINFO=: + fi + + local builddir=$(builddir "$1") + mkdir -p "${builddir}" + cd "${builddir}" + 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 + + # 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_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 + # 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_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 + 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} + 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=/usr + ${EXTRA_ECONF} + ) + + # Nothing is compiled here which would affect the headers for the target. + # So forcing CC/CFLAGS is sane. + set -- "${S}"/configure "${myconf[@]}" + CC="$(tc-getBUILD_CC)" \ + CFLAGS="-O1 -pipe" \ + CPPFLAGS="-U_FORTIFY_SOURCE" \ + LDFLAGS="" \ + "$@" || die "failed to configure glibc" +} + +toolchain-glibc_src_configure() { + want_linuxthreads && glibc_do_configure linuxthreads + want_nptl && glibc_do_configure nptl +} + +eblit-glibc-src_configure() { + foreach_abi toolchain-glibc_src_configure +} |