diff options
author | XU Benda <heroxbd@gmail.com> | 2013-06-19 22:46:50 +0900 |
---|---|---|
committer | XU Benda <heroxbd@gmail.com> | 2013-06-19 22:46:50 +0900 |
commit | 9cd40284e50b0f3f6afb0f54762dacd88c76f267 (patch) | |
tree | 5eaacd9ca7c53e2c4b7b9bc6ad302b8928973669 /sys-libs/glibc/files | |
parent | drop powerpc-softfloat-linux-gnu, glibc and wxPython updates (diff) | |
download | heroxbd-9cd40284e50b0f3f6afb0f54762dacd88c76f267.tar.gz heroxbd-9cd40284e50b0f3f6afb0f54762dacd88c76f267.tar.bz2 heroxbd-9cd40284e50b0f3f6afb0f54762dacd88c76f267.zip |
Prefix with-libc for wiki
http://wiki.gentoo.org/wiki/Prefix/libc
Diffstat (limited to 'sys-libs/glibc/files')
-rw-r--r-- | sys-libs/glibc/files/2.16/glibc-2.16-hardened-pie.patch | 39 | ||||
-rw-r--r-- | sys-libs/glibc/files/2.17/glibc-2.17-hardened-pie.patch | 42 | ||||
-rw-r--r-- | sys-libs/glibc/files/2.17/locale-gen_prefix.patch | 62 | ||||
-rw-r--r-- | sys-libs/glibc/files/eblits/common.eblit | 49 | ||||
-rw-r--r-- | sys-libs/glibc/files/eblits/common.eblit.rej | 13 | ||||
-rw-r--r-- | sys-libs/glibc/files/eblits/pkg_preinst.eblit | 115 | ||||
-rw-r--r-- | sys-libs/glibc/files/eblits/pkg_setup.eblit | 6 | ||||
-rw-r--r-- | sys-libs/glibc/files/eblits/src_compile.eblit | 154 | ||||
-rw-r--r-- | sys-libs/glibc/files/eblits/src_compile.eblit.orig | 249 | ||||
-rw-r--r-- | sys-libs/glibc/files/eblits/src_install.eblit | 103 | ||||
-rw-r--r-- | sys-libs/glibc/files/eblits/src_install.eblit.orig | 272 | ||||
-rw-r--r-- | sys-libs/glibc/files/eblits/src_test.eblit | 34 | ||||
-rw-r--r-- | sys-libs/glibc/files/eblits/src_unpack.eblit | 37 |
13 files changed, 975 insertions, 200 deletions
diff --git a/sys-libs/glibc/files/2.16/glibc-2.16-hardened-pie.patch b/sys-libs/glibc/files/2.16/glibc-2.16-hardened-pie.patch new file mode 100644 index 0000000..a850a61 --- /dev/null +++ b/sys-libs/glibc/files/2.16/glibc-2.16-hardened-pie.patch @@ -0,0 +1,39 @@ +2012-11-11 Magnus Granberg <zorry@gentoo.org> + + #442712 + * Makeconfig (+link): Set to +link-pie. + (+link-static-before-libc): Change $(static-start-installed-name) to + S$(static-start-installed-name). + (+prector): Set to +prectorS. + (+postctor): Set to +postctorS. + +--- libc/Makeconfig ++++ libc/Makeconfig +@@ -447,11 +447,12 @@ + $(common-objpfx)libc% $(+postinit),$^) \ + $(link-extra-libs) $(link-libc) $(+postctorS) $(+postinit) + endif +++link = $(+link-pie) + # Command for statically linking programs with the C library. + ifndef +link-static + +link-static-before-libc = $(CC) -nostdlib -nostartfiles -static -o $@ \ + $(sysdep-LDFLAGS) $(LDFLAGS) $(LDFLAGS-$(@F)) \ +- $(addprefix $(csu-objpfx),$(static-start-installed-name)) \ ++ $(addprefix $(csu-objpfx),S$(static-start-installed-name)) \ + $(+preinit) $(+prector) \ + $(filter-out $(addprefix $(csu-objpfx),start.o \ + $(start-installed-name))\ +@@ -549,11 +550,10 @@ + ifeq ($(elf),yes) + +preinit = $(addprefix $(csu-objpfx),crti.o) + +postinit = $(addprefix $(csu-objpfx),crtn.o) +-+prector = `$(CC) $(sysdep-LDFLAGS) --print-file-name=crtbegin.o` +-+postctor = `$(CC) $(sysdep-LDFLAGS) --print-file-name=crtend.o` +-# Variants of the two previous definitions for linking PIE programs. + +prectorS = `$(CC) $(sysdep-LDFLAGS) --print-file-name=crtbeginS.o` + +postctorS = `$(CC) $(sysdep-LDFLAGS) --print-file-name=crtendS.o` +++prector = $(+prectorS) +++postctor = $(+postctorS) + +interp = $(addprefix $(elf-objpfx),interp.os) + endif + csu-objpfx = $(common-objpfx)csu/ diff --git a/sys-libs/glibc/files/2.17/glibc-2.17-hardened-pie.patch b/sys-libs/glibc/files/2.17/glibc-2.17-hardened-pie.patch new file mode 100644 index 0000000..da4fb82 --- /dev/null +++ b/sys-libs/glibc/files/2.17/glibc-2.17-hardened-pie.patch @@ -0,0 +1,42 @@ +2012-11-11 Magnus Granberg <zorry@gentoo.org> + + #442712 + * Makeconfig (+link): Set to +link-pie. + (+link-static-before-libc): Change $(static-start-installed-name) to + S$(static-start-installed-name). + (+prector): Set to +prectorS. + (+postctor): Set to +postctorS. + +--- libc/Makeconfig ++++ libc/Makeconfig +@@ -447,11 +447,12 @@ + $(common-objpfx)libc% $(+postinit),$^) \ + $(link-extra-libs) $(link-libc) $(+postctorS) $(+postinit) + endif +++link = $(+link-pie) + # Command for statically linking programs with the C library. + ifndef +link-static + +link-static-before-libc = $(CC) -nostdlib -nostartfiles -static -o $@ \ + $(sysdep-LDFLAGS) $(LDFLAGS) $(LDFLAGS-$(@F)) \ +- $(addprefix $(csu-objpfx),$(static-start-installed-name)) \ ++ $(addprefix $(csu-objpfx),S$(static-start-installed-name)) \ + $(+preinit) $(+prectorT) \ + $(filter-out $(addprefix $(csu-objpfx),start.o \ + $(start-installed-name))\ +@@ -549,11 +550,10 @@ + ifeq ($(elf),yes) + +preinit = $(addprefix $(csu-objpfx),crti.o) + +postinit = $(addprefix $(csu-objpfx),crtn.o) +-+prector = `$(CC) $(sysdep-LDFLAGS) --print-file-name=crtbegin.o` +-+postctor = `$(CC) $(sysdep-LDFLAGS) --print-file-name=crtend.o` +-# Variants of the two previous definitions for linking PIE programs. + +prectorS = `$(CC) $(sysdep-LDFLAGS) --print-file-name=crtbeginS.o` + +postctorS = `$(CC) $(sysdep-LDFLAGS) --print-file-name=crtendS.o` +++prector = $(+prectorS) +++postctor = $(+postctorS) + # Variants of the two previous definitions for statically linking programs. + +prectorT = `$(CC) $(sysdep-LDFLAGS) --print-file-name=crtbeginT.o` + +postctorT = `$(CC) $(sysdep-LDFLAGS) --print-file-name=crtend.o` + +interp = $(addprefix $(elf-objpfx),interp.os) + endif + csu-objpfx = $(common-objpfx)csu/ diff --git a/sys-libs/glibc/files/2.17/locale-gen_prefix.patch b/sys-libs/glibc/files/2.17/locale-gen_prefix.patch new file mode 100644 index 0000000..6c17480 --- /dev/null +++ b/sys-libs/glibc/files/2.17/locale-gen_prefix.patch @@ -0,0 +1,62 @@ +bug #473484 +Index: work/extra/locale/locale-gen +=================================================================== +--- work.orig/extra/locale/locale-gen ++++ work/extra/locale/locale-gen +@@ -8,7 +8,7 @@ unset POSIXLY_CORRECT IFS + umask 0022 + + argv0=${0##*/} +-source /etc/init.d/functions.sh || { ++source "@GENTOO_PORTAGE_EPREFIX@"/etc/init.d/functions.sh || { + echo "${argv0}: Could not source /etc/init.d/functions.sh!" 1>&2 + exit 1 + } +@@ -97,13 +97,14 @@ if [[ -n ${DESTDIR} ]] && [[ ${ROOT} != + eerror "DESTDIR and ROOT are mutually exclusive options" + exit 1 + fi +-if [[ ${ROOT} != "/" ]] ; then +- einfo "Using locale.gen from ROOT ${ROOT}etc/" ++: ${EROOT:="${ROOT%/}@GENTOO_PORTAGE_EPREFIX@/"} ++if [[ ${EROOT} != "/" ]] ; then ++ einfo "Using locale.gen from EROOT ${EROOT}etc/" + fi + if [[ -n ${DESTDIR} ]] ; then + einfo "Building locales in DESTDIR '${DESTDIR}'" + else +- DESTDIR=${ROOT} ++ DESTDIR=${EROOT} + fi + + # XXX: should fix this ... +@@ -112,7 +113,7 @@ if [[ ${ROOT} != "/" ]] ; then + exit 0 + fi + +-: ${CONFIG:=${ROOT}etc/locale.gen} ++: ${CONFIG:=${EROOT}etc/locale.gen} + LOCALES=${DESTDIR}usr/share/i18n/locales + CHARMAPS=${DESTDIR}usr/share/i18n/charmaps + SUPPORTED=${DESTDIR}usr/share/i18n/SUPPORTED +@@ -150,7 +151,10 @@ fi + + # Extract the location of the locale dir on the fly as `localedef --help` has: + # locale path : /usr/lib64/locale:/usr/share/i18n +-LOCALEDIR=${DESTDIR}$(LC_ALL="C" "${DESTDIR}"usr/bin/localedef --help | sed -n -e '/locale path/{s|.* : ||;s|:.*||;p}') ++# For long paths, the line may get wrapped into two, in which case space (' ') is replaced ++# by newline (\n). ++LOCALEDIR=$(LC_ALL="C" "${DESTDIR}"usr/bin/localedef --help | sed -n -r '/locale path/{N;s|.*:[ \n](.*):/.*|\1|;p}') ++LOCALEDIR="${DESTDIR}${LOCALEDIR#@GENTOO_PORTAGE_EPREFIX@}" + if [[ $? -ne 0 ]] || [[ -z ${LOCALEDIR} ]] || [[ ${LOCALEDIR} != ${DESTDIR}/usr/lib*/locale ]] ; then + eerror "Unable to parse the output of your localedef utility." 1>&2 + eerror "File a bug about this issue and include the output of 'localedef --help'." 1>&2 +@@ -280,7 +284,7 @@ generate_locale() { + -i "${input}" \ + -f "${charmap}" \ + -A "${ALIAS}" \ +- --prefix "${DESTDIR}" \ ++ --prefix "${DESTDIR%@GENTOO_PORTAGE_EPREFIX@/}/" \ + "${locale}" 2>&1 + ret=$? + [[ -n ${output} ]] && eend ${ret} diff --git a/sys-libs/glibc/files/eblits/common.eblit b/sys-libs/glibc/files/eblits/common.eblit index e3a0abe..11ff68d 100644 --- a/sys-libs/glibc/files/eblits/common.eblit +++ b/sys-libs/glibc/files/eblits/common.eblit @@ -1,11 +1,34 @@ -# Copyright 1999-2011 Gentoo Foundation +# Copyright 1999-2012 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.25 2011/12/22 01:09:58 vapier Exp $ +# $Header: /var/cvsroot/gentoo-x86/sys-libs/glibc/files/eblits/common.eblit,v 1.29 2012/12/28 19:00:51 vapier Exp $ + +# There are many directory offsets here that can lead to confusion. We summarize the senarios in this table +# P:=Prefix X:=Cross-Triplet +# example of configure host: --with-headers +# example of configure target: --libdir +# +# variation phase PX X P solution +# -----------+-------------------+-----------------------+---------------+---------+---------------------------------------- +# host configure EPREFIX/usr/CTARGET /usr/CTARGET EPREFIX $EPREFIX/$(alt_prefix) +# target configure NULL NULL EPREFIX $TPREFIX +# -----------+-------------------+-----------------------+---------------+---------+---------------------------------------- +# host install_root D/EPREFIX/usr/CTARGET D/usr/CTARGET D ${D}/${EPREFIX%$TPREFIX}/$(alt_prefix) +# -----------+-------------------+-----------------------+---------------+---------+---------------------------------------- +# host ebuild helper ED/ /usr/CTARGET /usr/CTARGET NULL $(alt_prefix) +# +# alt_prefix and TPREFIX in the table are defined as followed alt_prefix() { is_crosscompile && echo /usr/${CTARGET} } +TPREFIX=$(is_crosscompile || echo "${EPREFIX}") + +eprefix_env() { + ED="${D%/}${EPREFIX}/" + EROOT="${ROOT%/}${EPREFIX}/" +} + # We need to be able to set alternative headers for # compiling for non-native platform # Will also become useful for testing kernel-headers without screwing up @@ -28,6 +51,9 @@ alt_build_headers() { echo "${ALT_BUILD_HEADERS}" } +alt_libdir() { + echo $(alt_prefix)/$(get_libdir) +} alt_usrlibdir() { echo $(alt_prefix)/usr/$(get_libdir) } @@ -167,8 +193,9 @@ setup_flags() { filter-flags -O? append-flags -O2 -fno-strict-aliasing - # Cant build glibc itself with fortify code - append-cppflags -U_FORTIFY_SOURCE + # Can't build glibc itself with fortify code. Newer versions add + # this flag for us, so no need to do it manually. + version_is_at_least 2.16 ${PV} || append-cppflags -U_FORTIFY_SOURCE # building glibc with SSP is fraught with difficulty, especially # due to __stack_chk_fail_local which would mean significant changes @@ -238,7 +265,9 @@ want__thread() { use_multiarch() { # Make sure binutils is new enough to support indirect functions #336792 - local bver=$($(tc-getLD ${CTARGET}) -v | awk '{print $NF}') nver + # This funky sed supports gold and bfd linkers. + 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" ;; @@ -253,8 +282,8 @@ setup_env() { # silly users unset LD_RUN_PATH - 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 @@ -283,3 +312,11 @@ setup_env() { just_headers() { is_crosscompile && use crosscompile_opts_headers-only } + +glibc_banner() { + local b="Gentoo ${PVR}" + [[ -n ${SNAP_VER} ]] && b+=" snapshot ${SNAP_VER}" + [[ -n ${BRANCH_UPDATE} ]] && b+=" branch ${BRANCH_UPDATE}" + [[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" p${PATCH_VER}" + echo "${b}" +} diff --git a/sys-libs/glibc/files/eblits/common.eblit.rej b/sys-libs/glibc/files/eblits/common.eblit.rej new file mode 100644 index 0000000..03ccf65 --- /dev/null +++ b/sys-libs/glibc/files/eblits/common.eblit.rej @@ -0,0 +1,13 @@ +--- files/eblits/common.eblit ++++ files/eblits/common.eblit +@@ -279,8 +279,9 @@ + # silly users + unset LD_RUN_PATH + +- 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 diff --git a/sys-libs/glibc/files/eblits/pkg_preinst.eblit b/sys-libs/glibc/files/eblits/pkg_preinst.eblit index a62499e..b572c20 100644 --- a/sys-libs/glibc/files/eblits/pkg_preinst.eblit +++ b/sys-libs/glibc/files/eblits/pkg_preinst.eblit @@ -1,83 +1,62 @@ -# Copyright 1999-2011 Gentoo Foundation +# Copyright 1999-2013 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.4 2011/11/16 16:07:46 vapier Exp $ +# $Header: /var/cvsroot/gentoo-x86/sys-libs/glibc/files/eblits/pkg_preinst.eblit,v 1.10 2013/04/10 17:36:54 vapier Exp $ -fix_lib64_symlinks() { - # the original Gentoo/AMD64 devs decided that since 64bit is the native - # bitdepth for AMD64, lib should be used for 64bit libraries. however, - # this ignores the FHS and breaks multilib horribly... especially - # since it wont even work without a lib64 symlink anyways. *rolls eyes* - # see bug 59710 for more information. - # Travis Tilley <lv@gentoo.org> (08 Aug 2004) - if [ -L ${EROOT}/lib64 ] ; then - ewarn "removing /lib64 symlink and moving lib to lib64..." - ewarn "dont hit ctrl-c until this is done" - rm ${EROOT}/lib64 - # now that lib64 is gone, nothing will run without calling ld.so - # directly. luckily the window of brokenness is almost non-existant - use amd64 && /lib/ld-linux-x86-64.so.2 /bin/mv ${EROOT}/lib ${EROOT}/lib64 - use ppc64 && /lib/ld64.so.1 /bin/mv ${EROOT}/lib ${EROOT}/lib64 - # all better :) - ldconfig - ln -s lib64 ${EROOT}/lib - einfo "done! :-)" - einfo "fixed broken lib64/lib symlink in ${EROOT}" - fi - if [ -L ${EROOT}/usr/lib64 ] ; then - rm ${EROOT}/usr/lib64 - mv ${EROOT}/usr/lib ${EROOT}/usr/lib64 - ln -s lib64 ${EROOT}/usr/lib - einfo "fixed broken lib64/lib symlink in ${EROOT}/usr" - fi - if [ -L ${EROOT}/usr/X11R6/lib64 ] ; then - rm ${EROOT}/usr/X11R6/lib64 - mv ${EROOT}/usr/X11R6/lib ${EROOT}/usr/X11R6/lib64 - ln -s lib64 ${EROOT}/usr/X11R6/lib - einfo "fixed broken lib64/lib symlink in ${EROOT}/usr/X11R6" - fi +# 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. +glibc_sanity_check() { + cd / #228809 + + # 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 + # lead to unsafe code execution if the generated prefix is + # within a world-writable directory. + # (e.g. /var/tmp/portage:${HOSTNAME}) + pushd "${ED}"/$(get_libdir) >/dev/null + + local x striptest + for x in date env ls true uname ; 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 + ./ld-*.so --library-path . ${x} > /dev/null \ + || die "simple run test (${x}) failed" + done + + popd >/dev/null } eblit-glibc-pkg_preinst() { # nothing to do if just installing headers just_headers && return - # PPC64+others may want to eventually be added to this logic if they - # decide to be multilib compatible and FHS compliant. note that this - # chunk of FHS compliance only applies to 64bit archs where 32bit - # compatibility is a major concern (not IA64, for example). - - # amd64's 2005.0 is the first amd64 profile to not need this code. - # 2005.0 is setup properly, and this is executed as part of the - # 2004.3 -> 2005.0 upgrade script. - # It can be removed after 2004.3 has been purged from portage. - { use amd64 || use ppc64; } && [ "$(get_libdir)" == "lib64" ] && ! has_multilib_profile && fix_lib64_symlinks + eprefix_env # prepare /etc/ld.so.conf.d/ for files mkdir -p "${EROOT}"/etc/ld.so.conf.d - # 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. + # Default /etc/hosts.conf:multi to on for systems with small dbs. + if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then + sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf + elog "Defaulting /etc/host.conf:multi to on" + fi + [[ ${ROOT} != "/" ]] && return 0 [[ -d ${D}/$(get_libdir) ]] || return 0 - cd / #228809 - local x striptest - for x in date env ls true uname ; do - x=$(type -p ${x}) - [[ -z ${x} ]] && continue - striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) - [[ -z ${striptest} ]] && continue - [[ ${striptest} == *"statically linked"* ]] && continue - # 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 - # lead to unsafe code execution if the generated prefix is - # within a world-writable directory - # (e.g. /var/tmp/portage:${HOSTNAME}) - pushd "${D}"/$(get_libdir) 2>/dev/null - ./ld-*.so --library-path . ${x} > /dev/null \ - || die "simple run test (${x}) failed" - popd 2>/dev/null - done + glibc_sanity_check + + # Make sure devpts is mounted correctly for use w/out setuid pt_chown. + if in_iuse suid && ! use suid ; then + if awk '$3 == "devpts" && $4 ~ /[, ]gid=5[, ]/ { exit 1 }' /proc/mounts ; then + eerror "In order to use glibc with USE=-suid, you must make sure that" + 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" + fi + fi } diff --git a/sys-libs/glibc/files/eblits/pkg_setup.eblit b/sys-libs/glibc/files/eblits/pkg_setup.eblit index 4e52695..d9f36da 100644 --- a/sys-libs/glibc/files/eblits/pkg_setup.eblit +++ b/sys-libs/glibc/files/eblits/pkg_setup.eblit @@ -74,9 +74,9 @@ eblit-glibc-pkg_setup() { fi # users have had a chance to phase themselves, time to give em the boot - if [[ -e ${ROOT}/etc/locale.gen ]] && [[ -e ${ROOT}/etc/locales.build ]] ; then - eerror "You still haven't deleted ${ROOT}/etc/locales.build." - eerror "Do so now after making sure ${ROOT}/etc/locale.gen is kosher." + if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then + eerror "You still haven't deleted ${EROOT}/etc/locales.build." + eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher." die "lazy upgrader detected" fi diff --git a/sys-libs/glibc/files/eblits/src_compile.eblit b/sys-libs/glibc/files/eblits/src_compile.eblit index 9aeb684..f1494e0 100644 --- a/sys-libs/glibc/files/eblits/src_compile.eblit +++ b/sys-libs/glibc/files/eblits/src_compile.eblit @@ -1,9 +1,9 @@ -# Copyright 1999-2012 Gentoo Foundation +# Copyright 1999-2013 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.23 2012/01/17 23:51:59 vapier Exp $ +# $Header: /var/cvsroot/gentoo-x86/sys-libs/glibc/files/eblits/src_compile.eblit,v 1.35 2013/04/05 18:25:21 vapier Exp $ glibc_do_configure() { - local myconf + local myconf=() einfo "Configuring GLIBC for $1" @@ -19,34 +19,32 @@ glibc_do_configure() { [[ -d ports ]] && ADDONS="${ADDONS},ports" popd > /dev/null - myconf="${myconf} $(use_enable hardened stackguard-randomization)" + myconf+=( $(use_enable hardened stackguard-randomization) ) if has_version '<sys-libs/glibc-2.13' ; then - myconf="${myconf} --enable-old-ssp-compat" + myconf+=( --enable-old-ssp-compat ) fi - use glibc-omitfp && myconf="${myconf} --enable-omitfp" - - [[ ${CTARGET//_/-} == *-softfloat-* ]] && myconf="${myconf} --without-fp" + [[ ${CTARGET//_/-} == *-softfloat-* ]] && myconf+=( --without-fp ) if [[ $1 == "linuxthreads" ]] ; then if want_tls ; then - myconf="${myconf} --with-tls" + myconf+=( --with-tls ) if ! want__thread || use glibc-compat20 || [[ ${LT_KER_VER} == 2.[02].* ]] ; then - myconf="${myconf} --without-__thread" + myconf+=( --without-__thread ) else - myconf="${myconf} --with-__thread" + myconf+=( --with-__thread ) fi else - myconf="${myconf} --without-tls --without-__thread" + myconf+=( --without-tls --without-__thread ) fi - myconf="${myconf} --disable-sanity-checks" - myconf="${myconf} --enable-add-ons=linuxthreads${ADDONS}" - myconf="${myconf} --enable-kernel=${LT_KER_VER}" + myconf+=( --disable-sanity-checks ) + myconf+=( --enable-add-ons="linuxthreads${ADDONS}" ) + myconf+=( --enable-kernel=${LT_KER_VER} ) elif [[ $1 == "nptl" ]] ; then - myconf="${myconf} --enable-add-ons=nptl${ADDONS}" - myconf="${myconf} --enable-kernel=${NPTL_KERN_VER}" + myconf+=( --enable-add-ons="nptl${ADDONS}" ) + myconf+=( --enable-kernel=${NPTL_KERN_VER} ) else die "invalid pthread option" fi @@ -58,47 +56,73 @@ glibc_do_configure() { if ! is_crosscompile && use selinux ; then if use multilib || has_multilib_profile ; then if is_final_abi ; then - myconf="${myconf} --with-selinux" + myconf+=( --with-selinux ) else - myconf="${myconf} --without-selinux" + myconf+=( --without-selinux ) fi else - myconf="${myconf} --with-selinux" + myconf+=( --with-selinux ) fi else - myconf="${myconf} --without-selinux" + myconf+=( --without-selinux ) fi - myconf="${myconf} + myconf+=( --without-cvs --enable-bind-now --build=${CBUILD_OPT:-${CBUILD}} --host=${CTARGET_OPT:-${CTARGET}} $(use_enable profile) $(use_with gd) - --with-headers=${EPREFIX}/$(alt_build_headers) - --prefix=/usr - --libdir=/usr/$(get_libdir) - --mandir=/usr/share/man - --infodir=/usr/share/info - --libexecdir=/usr/$(get_libdir)/misc/glibc + --with-headers="${EPREFIX}$(alt_build_headers)" + --prefix="${TPREFIX}/usr" + --libdir="${TPREFIX}/usr/$(get_libdir)" + --mandir="${TPREFIX}/usr/share/man" + --infodir="${TPREFIX}/usr/share/info" + --libexecdir="${TPREFIX}/usr/$(get_libdir)/misc/glibc" + --sysconfdir="${TPREFIX}/etc" + --localstatedir="${TPREFIX}/var" + --with-bugurl=http://bugs.gentoo.org/ + --with-pkgversion="$(glibc_banner)" $(use_multiarch || echo --disable-multi-arch) - ${EXTRA_ECONF}" + --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) + 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}" - echo "${S}"/configure ${myconf} - "${S}"/configure ${myconf} || die "failed to configure glibc" + 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 } toolchain-glibc_src_compile() { @@ -107,7 +131,15 @@ toolchain-glibc_src_compile() { 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 @@ -131,46 +163,58 @@ toolchain-glibc_headers_compile() { # 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 ... - export \ - ac_cv_header_cpuid_h=yes \ - libc_cv_386_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_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 \ + 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} + done # Pick out the correct location for build headers - local ports="" myconf="--disable-sanity-checks --enable-hacker-mode" + local ports="" myconf=() [[ -d ${S}/ports ]] && ports=",ports" - myconf="${myconf} + 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=${EPREFIX}/$(alt_build_headers) - --prefix=/usr - ${EXTRA_ECONF}" + --with-headers="${EPREFIX}$(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. - echo "${S}"/configure ${myconf} + set -- "${S}"/configure "${myconf[@]}" CC=gcc \ CFLAGS="-O1 -pipe" \ CPPFLAGS="-U_FORTIFY_SOURCE" \ LDFLAGS="" \ - "${S}"/configure ${myconf} || die "failed to configure glibc" + "$@" || die "failed to configure glibc" } eblit-glibc-src_compile() { diff --git a/sys-libs/glibc/files/eblits/src_compile.eblit.orig b/sys-libs/glibc/files/eblits/src_compile.eblit.orig new file mode 100644 index 0000000..8c07558 --- /dev/null +++ b/sys-libs/glibc/files/eblits/src_compile.eblit.orig @@ -0,0 +1,249 @@ +# Copyright 1999-2013 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 $ + +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_eprefix)"$(alt_build_headers) + --prefix="$(alt_eprefix)"/usr + --libdir="$(alt_eprefix)"/usr/$(get_libdir) + --mandir="$(alt_eprefix)"/usr/share/man + --infodir="$(alt_eprefix)"/usr/share/info + --libexecdir="$(alt_eprefix)"/usr/$(get_libdir)/misc/glibc + --sysconfdir="$(alt_eprefix)"/etc + --localstatedir="$(alt_eprefix)"/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="$(alt_eprefix)"/$(get_libdir) + + # We take care of patching our binutils to use both hash styles, + # and many people like to force gnu hash style only, so disable + # this overriding check. #347761 + export libc_cv_hashstyle=no + + 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 +} + +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} + 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_eprefix)$(alt_build_headers) + --prefix="$(alt_eprefix)"/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 + 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 +} diff --git a/sys-libs/glibc/files/eblits/src_install.eblit b/sys-libs/glibc/files/eblits/src_install.eblit index 1f551a6..1394da3 100644 --- a/sys-libs/glibc/files/eblits/src_install.eblit +++ b/sys-libs/glibc/files/eblits/src_install.eblit @@ -1,6 +1,6 @@ -# Copyright 1999-2011 Gentoo Foundation +# Copyright 1999-2013 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.20 2011/12/22 01:09:58 vapier Exp $ +# $Header: /var/cvsroot/gentoo-x86/sys-libs/glibc/files/eblits/src_install.eblit,v 1.30 2013/04/10 17:36:54 vapier Exp $ toolchain-glibc_src_install() { local GBUILDDIR @@ -10,7 +10,7 @@ toolchain-glibc_src_install() { GBUILDDIR=${WORKDIR}/build-${ABI}-${CTARGET}-nptl fi - local install_root="${ED}$(alt_prefix)" + local install_root="${D}${EPREFIX%${TPREFIX}}/$(alt_prefix)" if want_linuxthreads ; then cd "${WORKDIR}"/build-${ABI}-${CTARGET}-linuxthreads einfo "Installing GLIBC ${ABI} with linuxthreads ..." @@ -69,17 +69,47 @@ toolchain-glibc_src_install() { # Everything past this point just needs to be done once ... is_final_abi || return 0 - # Make sure the non-native interp can be found on multilib systems - if [[ ${SYMLINK_LIB} == "yes" ]] && has_multilib_profile ; then - local abi32 ldso - case $(tc-arch) in - amd64) abi32="x86" ldso="ld-linux.so.2" ;; - ppc64) abi32="ppc" ldso="ld.so.1" ;; - esac - if [[ -n ${ldso} ]] ; then - [[ ! -e ${ED}/lib ]] && dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib - dosym ../$(get_abi_LIBDIR ${abi32})/${ldso} $(alt_prefix)/lib/${ldso} + # Make sure the non-native interp can be found on multilib systems even + # if the main library set isn't installed into the right place. Maybe + # we should query the active gcc for info instead of hardcoding it ? + local i ldso_abi ldso_name + local ldso_abi_list=( + # x86 + amd64 /lib64/ld-linux-x86-64.so.2 + x32 /libx32/ld-linux-x32.so.2 + x86 /lib/ld-linux.so.2 + # mips + o32 /lib/ld.so.1 + n32 /lib32/ld.so.1 + n64 /lib64/ld.so.1 + # powerpc + ppc /lib/ld.so.1 + ppc64 /lib64/ld64.so.1 + # s390 + s390 /lib/ld.so.1 + s390x /lib/ld64.so.1 + # sparc + sparc32 /lib/ld-linux.so.2 + sparc64 /lib64/ld-linux.so.2 + ) + if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then + dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib + fi + for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do + ldso_abi=${ldso_abi_list[i]} + has ${ldso_abi} $(get_install_abis) || continue + + ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}" + if [[ ! -L ${D}/${ldso_name} && ! -e ${D}/${ldso_name} ]] ; then + dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name} fi + done + + # With devpts under Linux mounted properly, we do not need the pt_chown + # binary to be setuid. This is because the default owners/perms will be + # exactly what we want. + if in_iuse suid && ! use suid ; then + find "${D}" -name pt_chown -exec chmod -s {} + fi ################################################################# @@ -125,37 +155,32 @@ toolchain-glibc_src_install() { fi done - if ! has noinfo ${FEATURES} && [[ -n ${INFOPAGE_VER} ]] ; then - einfo "Installing info pages..." - - emake \ - -C "${GBUILDDIR}" \ - install_root="${install_root}" \ - info -i || die - fi - - if [[ -n ${MANPAGE_VER} ]] ; then - einfo "Installing man pages..." - - # Install linuxthreads man pages even if nptl is enabled - cd "${WORKDIR}"/man - doman *.3thr - fi - cd "${S}" # Install misc network config files insinto /etc doins nscd/nscd.conf posix/gai.conf nss/nsswitch.conf || die doins "${WORKDIR}"/extra/etc/*.conf || die - doinitd "${WORKDIR}"/extra/etc/nscd || die - sed -i -e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):" "${ED}"/etc/init.d/nscd + if ! in_iuse nscd || use nscd ; then + doinitd "${WORKDIR}"/extra/etc/nscd || die + + local nscd_args=( + -e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):" + ) + version_is_at_least 2.16 || nscd_args+=( -e 's: --foreground : :' ) + sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd + else + # Do this since extra/etc/*.conf above might have nscd.conf. + rm -f "${ED}"/etc/nscd.conf + fi echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc doenvd "${T}"/00glibc || die - dodoc BUGS ChangeLog* CONFORMANCE FAQ NEWS NOTES PROJECTS README* + for d in BUGS ChangeLog* CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do + [[ -s ${d} ]] && dodoc ${d} + done # Prevent overwriting of the /etc/localtime symlink. We'll handle the # creation of the "factory" symlink in pkg_postinst(). @@ -165,11 +190,11 @@ toolchain-glibc_src_install() { toolchain-glibc_headers_install() { local GBUILDDIR=${WORKDIR}/build-${ABI}-${CTARGET}-headers cd "${GBUILDDIR}" - emake install_root="${ED}/usr/${CTARGET}" install-headers || die "install-headers failed" - # Copy over headers that are not part of install-headers ... these - # are pretty much taken verbatim from crosstool, see it for more details - insinto $(alt_headers)/bits - doins misc/syscall-list.h bits/stdio_lim.h || die "doins include bits" + emake install_root="${D}${EPREFIX%${TPREFIX}}/$(alt_prefix)" install-headers || die + if ! version_is_at_least 2.16 ; then + insinto $(alt_headers)/bits + doins bits/stdio_lim.h || die + fi insinto $(alt_headers)/gnu doins "${S}"/include/gnu/stubs.h || die "doins include gnu" # Make sure we install the sys-include symlink so that when @@ -196,6 +221,8 @@ src_strip() { } eblit-glibc-src_install() { + eprefix_env + if just_headers ; then export ABI=default toolchain-glibc_headers_install diff --git a/sys-libs/glibc/files/eblits/src_install.eblit.orig b/sys-libs/glibc/files/eblits/src_install.eblit.orig new file mode 100644 index 0000000..a62ec60 --- /dev/null +++ b/sys-libs/glibc/files/eblits/src_install.eblit.orig @@ -0,0 +1,272 @@ +# Copyright 1999-2013 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 $ + +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 install_root="${D}$(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 + + if want_linuxthreads && want_nptl ; then + einfo "Installing NPTL to $(alt_libdir)/tls/..." + cd "${WORKDIR}"/build-${ABI}-${CTARGET}-nptl + dodir $(alt_libdir)/tls $(alt_usrlibdir)/nptl + + local l src_lib + for l in libc libm librt libpthread libthread_db ; do + # take care of shared lib first ... + l=${l}.so + if [[ -e ${l} ]] ; then + src_lib=${l} + else + src_lib=$(eval echo */${l}) + fi + cp -a ${src_lib} "${ED}"$(alt_libdir)/tls/${l} || die "copying nptl ${l}" + fperms a+rx $(alt_libdir)/tls/${l} + dosym ${l} $(alt_libdir)/tls/$(scanelf -qSF'%S#F' ${src_lib}) + + # then grab the linker script or the symlink ... + if [[ -L ${ED}$(alt_usrlibdir)/${l} ]] ; then + dosym $(alt_libdir)/tls/${l} $(alt_usrlibdir)/nptl/${l} + else + sed \ + -e "s:/${l}:/tls/${l}:g" \ + -e "s:/${l/%.so/_nonshared.a}:/nptl/${l/%.so/_nonshared.a}:g" \ + "${ED}"$(alt_usrlibdir)/${l} > "${ED}"$(alt_usrlibdir)/nptl/${l} + fi + + # then grab the static lib ... + src_lib=${src_lib/%.so/.a} + [[ ! -e ${src_lib} ]] && src_lib=${src_lib/%.a/_pic.a} + cp -a ${src_lib} "${ED}"$(alt_usrlibdir)/nptl/ || die "copying nptl ${src_lib}" + src_lib=${src_lib/%.a/_nonshared.a} + if [[ -e ${src_lib} ]] ; then + cp -a ${src_lib} "${ED}"$(alt_usrlibdir)/nptl/ || die "copying nptl ${src_lib}" + fi + done + + # use the nptl linker instead of the linuxthreads one as the linuxthreads + # one may lack TLS support and that can be really bad for business + cp -a elf/ld.so "${ED}"$(alt_libdir)/$(scanelf -qSF'%S#F' elf/ld.so) || die "copying nptl interp" + fi + + # We'll take care of the cache ourselves + rm -f "${ED}"/etc/ld.so.cache + + # Everything past this point just needs to be done once ... + is_final_abi || return 0 + + # Make sure the non-native interp can be found on multilib systems even + # if the main library set isn't installed into the right place. Maybe + # we should query the active gcc for info instead of hardcoding it ? + local i ldso_abi ldso_name + local ldso_abi_list=( + # x86 + amd64 /lib64/ld-linux-x86-64.so.2 + x32 /libx32/ld-linux-x32.so.2 + x86 /lib/ld-linux.so.2 + # mips + o32 /lib/ld.so.1 + n32 /lib32/ld.so.1 + n64 /lib64/ld.so.1 + # powerpc + ppc /lib/ld.so.1 + ppc64 /lib64/ld64.so.1 + # s390 + s390 /lib/ld.so.1 + s390x /lib/ld64.so.1 + # sparc + sparc32 /lib/ld-linux.so.2 + sparc64 /lib64/ld-linux.so.2 + ) + if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${D}$(alt_eprefix)/$(alt_prefix)/lib ]] ; then + dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_arch_prefix)/lib + fi + for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do + ldso_abi=${ldso_abi_list[i]} + has ${ldso_abi} $(get_install_abis) || continue + + ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}" + if [[ ! -L ${D}/${ldso_name} && ! -e ${D}/${ldso_name} ]] ; then + dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name} + fi + done + + # With devpts under Linux mounted properly, we do not need the pt_chown + # binary to be setuid. This is because the default owners/perms will be + # exactly what we want. + if in_iuse suid && ! use suid ; then + find "${D}" -name pt_chown -exec chmod -s {} + + fi + + ################################################################# + # EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY # + # Make sure we install some symlink hacks so that when we build + # a 2nd stage cross-compiler, gcc finds the target system + # headers correctly. See gcc/doc/gccinstall.info + if is_crosscompile ; then + # We need to make sure that /lib and /usr/lib always exists. + # gcc likes to use relative paths to get to its multilibs like + # /usr/lib/../lib64/. So while we don't install any files into + # /usr/lib/, we do need it to exist. + cd "${ED}"$(alt_libdir)/.. + [[ -e lib ]] || mkdir lib + cd "${ED}"$(alt_usrlibdir)/.. + [[ -e lib ]] || mkdir lib + + dosym usr/include $(alt_arch_prefix)/sys-include + return 0 + fi + + # Files for Debian-style locale updating + dodir /usr/share/i18n + sed \ + -e "/^#/d" \ + -e "/SUPPORTED-LOCALES=/d" \ + -e "s: \\\\::g" -e "s:/: :g" \ + "${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \ + || die "generating /usr/share/i18n/SUPPORTED failed" + cd "${WORKDIR}"/extra/locale + dosbin locale-gen || die + doman *.[0-8] + insinto /etc + doins locale.gen || die + + # Make sure all the ABI's can find the locales and so we only + # have to generate one set + local a + keepdir /usr/$(get_libdir)/locale + for a in $(get_install_abis) ; do + if [[ ! -e ${ED}/usr/$(get_abi_LIBDIR ${a})/locale ]] ; then + dosym /usr/$(get_libdir)/locale /usr/$(get_abi_LIBDIR ${a})/locale + fi + done + + if ! has noinfo ${FEATURES} && [[ -n ${INFOPAGE_VER} ]] ; then + einfo "Installing info pages..." + + emake \ + -C "${GBUILDDIR}" \ + install_root="${install_root}" \ + info -i || die + fi + + if [[ -n ${MANPAGE_VER} ]] ; then + einfo "Installing man pages..." + + # Install linuxthreads man pages even if nptl is enabled + cd "${WORKDIR}"/man + doman *.3thr + fi + + cd "${S}" + + # Install misc network config files + insinto /etc + doins nscd/nscd.conf posix/gai.conf nss/nsswitch.conf || die + doins "${WORKDIR}"/extra/etc/*.conf || die + + if ! in_iuse nscd || use nscd ; then + doinitd "${WORKDIR}"/extra/etc/nscd || die + + local nscd_args=( + -e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):" + ) + version_is_at_least 2.16 || nscd_args+=( -e 's: --foreground : :' ) + sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd + else + # Do this since extra/etc/*.conf above might have nscd.conf. + rm -f "${ED}"/etc/nscd.conf + fi + + echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc + doenvd "${T}"/00glibc || die + + for d in BUGS ChangeLog* CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do + [[ -s ${d} ]] && dodoc ${d} + done + + # Prevent overwriting of the /etc/localtime symlink. We'll handle the + # creation of the "factory" symlink in pkg_postinst(). + rm -f "${ED}"/etc/localtime +} + +toolchain-glibc_headers_install() { + local GBUILDDIR=${WORKDIR}/build-${ABI}-${CTARGET}-headers + cd "${GBUILDDIR}" + 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 + fi + insinto $(alt_headers)/gnu + doins "${S}"/include/gnu/stubs.h || die "doins include gnu" + # Make sure we install the sys-include symlink so that when + # we build a 2nd stage cross-compiler, gcc finds the target + # system headers correctly. See gcc/doc/gccinstall.info + dosym usr/include /usr/${CTARGET}/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}"/*/libpthread-*.so + fi +} + +eblit-glibc-src_install() { + if just_headers ; then + export ABI=default + toolchain-glibc_headers_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 +} diff --git a/sys-libs/glibc/files/eblits/src_test.eblit b/sys-libs/glibc/files/eblits/src_test.eblit index edcdac7..532bc8c 100644 --- a/sys-libs/glibc/files/eblits/src_test.eblit +++ b/sys-libs/glibc/files/eblits/src_test.eblit @@ -1,6 +1,6 @@ -# Copyright 1999-2010 Gentoo Foundation +# Copyright 1999-2013 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.4 2010/08/10 08:08:05 vapier Exp $ +# $Header: /var/cvsroot/gentoo-x86/sys-libs/glibc/files/eblits/src_test.eblit,v 1.5 2013/04/11 20:42:56 vapier Exp $ toolchain-glibc_src_test() { cd "${WORKDIR}"/build-${ABI}-${CTARGET}-$1 || die "cd build-${ABI}-${CTARGET}-$1" @@ -17,6 +17,14 @@ eblit-glibc-src_test() { 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 @@ -26,17 +34,23 @@ eblit-glibc-src_test() { for ABI in $(get_install_abis) ; do export ABI einfo " Testing ${ABI} glibc" - src_test - ((ret+=$?)) + eblit-glibc-src_test + : $(( ret += $? )) done ABI=${OABI} unset OABI - [[ ${ret} -ne 0 ]] \ - && die "tests failed" \ - || return 0 + + _maybe_die + return fi - want_linuxthreads && toolchain-glibc_src_test linuxthreads ; ((ret+=$?)) - want_nptl && toolchain-glibc_src_test nptl ; ((ret+=$?)) - return ${ret} + local t + for t in linuxthreads nptl ; do + if want_${t} ; then + toolchain-glibc_src_test ${t} + : $(( ret += $? )) + fi + done + _maybe_die + return } diff --git a/sys-libs/glibc/files/eblits/src_unpack.eblit b/sys-libs/glibc/files/eblits/src_unpack.eblit index eb56d54..352743c 100644 --- a/sys-libs/glibc/files/eblits/src_unpack.eblit +++ b/sys-libs/glibc/files/eblits/src_unpack.eblit @@ -1,6 +1,6 @@ -# Copyright 1999-2012 Gentoo Foundation +# Copyright 1999-2013 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.16 2012/02/16 00:27:08 vapier Exp $ +# $Header: /var/cvsroot/gentoo-x86/sys-libs/glibc/files/eblits/src_unpack.eblit,v 1.22 2013/04/05 00:25:16 vapier Exp $ int_to_KV() { local version=$1 major minor micro @@ -110,6 +110,9 @@ toolchain-glibc_src_unpack() { done fi + epatch "${FILESDIR}"/2.17/locale-gen_prefix.patch + eprefixify "${WORKDIR}"/extra/locale/locale-gen + # 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) @@ -122,21 +125,12 @@ toolchain-glibc_src_unpack() { sed -i -e "s:\(#define RELEASE\).*:\1 \"${BRANCH_UPDATE}\":" version.h fi - if [[ -n ${MANPAGE_VER} ]] ; then - cd "${WORKDIR}" - unpack glibc-manpages-${MANPAGE_VER}.tar.bz2 - fi - - if [[ -n ${INFOPAGE_VER} ]] ; then - cd "${S}" - unpack glibc-infopages-${INFOPAGE_VER}.tar.bz2 - fi - # tag, glibc is it cd "${S}" - [[ -e csu/Banner ]] && die "need new banner location" - [[ -n ${SNAP_VER} ]] && echo "Gentoo snapshot ${SNAP_VER}" >> csu/Banner - [[ -n ${BRANCH_UPDATE} ]] && echo "Gentoo branch ${BRANCH_UPDATE}" >> csu/Banner + 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} ..." \ @@ -144,7 +138,6 @@ toolchain-glibc_src_unpack() { EPATCH_SUFFIX="patch" \ ARCH=$(tc-arch) \ epatch "${WORKDIR}"/patches - echo "Gentoo patchset ${PATCH_VER}" >> csu/Banner fi if just_headers ; then @@ -169,11 +162,15 @@ eblit-glibc-src_unpack() { # Glibc is stupid sometimes, and doesn't realize that with a # static C-Only gcc, -lgcc_eh doesn't exist. - # http://sources.redhat.com/ml/libc-alpha/2003-09/msg00100.html + # http://sourceware.org/ml/libc-alpha/2003-09/msg00100.html # http://sourceware.org/ml/libc-alpha/2005-02/msg00042.html - 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" + # 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}" |