diff options
47 files changed, 4620 insertions, 877 deletions
diff --git a/sys-devel/binutils/Manifest b/sys-devel/binutils/Manifest new file mode 100644 index 00000000..340ef4ae --- /dev/null +++ b/sys-devel/binutils/Manifest @@ -0,0 +1,2 @@ +DIST binutils-2.31.1-patches-5.tar.xz 65896 BLAKE2B 7fb2c4c71336a77f3fef57a0430c511ef7326f8196d8f3a57a6d56aed464953172eeb0755f020387739cf27f709d0bc3de9c3c8b972a94f1480639465158e180 SHA512 c254f22b8ca662cf49cd5fc076d3e9b82d7f421420408c960c54310fc49462600325e7bc50f863cab7c8c49caebac3ac353dc24ab5947e8f01b98c11f43f57d2 +DIST binutils-2.31.1.tar.xz 20467996 BLAKE2B 6b914df1fbb7cf54f2159f71b2c2b09f3f6a569b7a3cb4cf9790d0a3733a7548bc0ea32334a178ed3b56e8b97656ae99c7abaf212601beeaeae9a0884c0f6051 SHA512 0fca326feb1d5f5fe505a827b20237fe3ec9c13eaf7ec7e35847fd71184f605ba1cefe1314b1b8f8a29c0aa9d88162849ee1c1a3e70c2f7407d88339b17edb30 diff --git a/sys-devel/binutils/binutils-2.31.1-r1337.ebuild b/sys-devel/binutils/binutils-2.31.1-r1337.ebuild new file mode 100644 index 00000000..0ba64dc3 --- /dev/null +++ b/sys-devel/binutils/binutils-2.31.1-r1337.ebuild @@ -0,0 +1,426 @@ +# Copyright 1999-2018 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=6 + +inherit eutils libtool flag-o-matic gnuconfig multilib versionator + +DESCRIPTION="Tools necessary to build programs" +HOMEPAGE="https://sourceware.org/binutils/" +LICENSE="GPL-3+" +IUSE="+cxx doc multitarget +nls static-libs test" + +# Variables that can be set here: +# PATCH_VER - the patchset version +# Default: empty, no patching +# PATCH_BINUTILS_VER - the binutils version in the patchset name +# - Default: PV +# PATCH_DEV - Use download URI https://dev.gentoo.org/~{PATCH_DEV}/distfiles/... +# for the patchsets +# Default: dilfridge :) + +PATCH_VER=5 +PATCH_DEV=dilfridge + +case ${PV} in + 9999) + EGIT_REPO_URI="https://sourceware.org/git/binutils-gdb.git" + inherit git-r3 + S=${WORKDIR}/binutils + EGIT_CHECKOUT_DIR=${S} + SLOT=${PV} + ;; + *.9999) + EGIT_REPO_URI="https://sourceware.org/git/binutils-gdb.git" + inherit git-r3 + S=${WORKDIR}/binutils + EGIT_CHECKOUT_DIR=${S} + EGIT_BRANCH=$(get_version_component_range 1-2) + EGIT_BRANCH="binutils-${EGIT_BRANCH/./_}-branch" + SLOT=$(get_version_component_range 1-2) + ;; + *) + SRC_URI="mirror://gnu/binutils/binutils-${PV}.tar.xz" + SLOT=$(get_version_component_range 1-2) + KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~x86-fbsd" + ;; +esac + +# +# The Gentoo patchset +# +PATCH_BINUTILS_VER=${PATCH_BINUTILS_VER:-${PV}} +PATCH_DEV=${PATCH_DEV:-slyfox} + +[[ -z ${PATCH_VER} ]] || SRC_URI="${SRC_URI} + https://dev.gentoo.org/~${PATCH_DEV}/distfiles/binutils-${PATCH_BINUTILS_VER}-patches-${PATCH_VER}.tar.xz" + +# +# The cross-compile logic +# +export CTARGET=${CTARGET:-${CHOST}} +if [[ ${CTARGET} == ${CHOST} ]] ; then + if [[ ${CATEGORY} == cross-* ]] ; then + export CTARGET=${CATEGORY#cross-} + fi +fi +is_cross() { [[ ${CHOST} != ${CTARGET} ]] ; } + +# +# The dependencies +# +RDEPEND=" + >=sys-devel/binutils-config-3 + sys-libs/zlib +" +DEPEND="${RDEPEND} + doc? ( sys-apps/texinfo ) + test? ( dev-util/dejagnu ) + nls? ( sys-devel/gettext ) + sys-devel/flex + virtual/yacc +" + +MY_BUILDDIR=${WORKDIR}/build + +src_unpack() { + case ${PV} in + *9999) + git-r3_src_unpack + ;; + *) + ;; + esac + default + mkdir -p "${MY_BUILDDIR}" +} + +src_prepare() { + if [[ ! -z ${PATCH_VER} ]] ; then + einfo "Applying binutils-${PATCH_BINUTILS_VER} patchset ${PATCH_VER}" + eapply "${WORKDIR}/patch"/*.patch + fi + + # This check should probably go somewhere else, like pkg_pretend. + if [[ ${CTARGET} == *-uclibc* ]] ; then + if grep -qs 'linux-gnu' "${S}"/ltconfig ; then + die "sorry, but this binutils doesn't yet support uClibc :(" + fi + fi + + # Make sure our explicit libdir paths don't get clobbered. #562460 + sed -i \ + -e 's:@bfdlibdir@:@libdir@:g' \ + -e 's:@bfdincludedir@:@includedir@:g' \ + {bfd,opcodes}/Makefile.in || die + + # Fix locale issues if possible #122216 + if [[ -e ${FILESDIR}/binutils-configure-LANG.patch ]] ; then + einfo "Fixing misc issues in configure files" + for f in $(find "${S}" -name configure -exec grep -l 'autoconf version 2.13' {} +) ; do + ebegin " Updating ${f/${S}\/}" + patch "${f}" "${FILESDIR}"/binutils-configure-LANG.patch >& "${T}"/configure-patch.log \ + || eerror "Please file a bug about this" + eend $? + done + fi + + # Fix conflicts with newer glibc #272594 + if [[ -e libiberty/testsuite/test-demangle.c ]] ; then + sed -i 's:\<getline\>:get_line:g' libiberty/testsuite/test-demangle.c + fi + + # Apply things from PATCHES and user dirs + default + + # Run misc portage update scripts + gnuconfig_update + elibtoolize --portage --no-uclibc +} + +toolchain-binutils_bugurl() { + printf "https://bugs.gentoo.org/" +} +toolchain-binutils_pkgversion() { + printf "Gentoo ${PV}" + [[ -n ${PATCH_VER} ]] && printf " p${PATCH_VER}" +} + +src_configure() { + # Setup some paths + LIBPATH=/usr/$(get_libdir)/binutils/${CTARGET}/${PV} + INCPATH=${LIBPATH}/include + DATAPATH=/usr/share/binutils-data/${CTARGET}/${PV} + if is_cross ; then + TOOLPATH=/usr/${CHOST}/${CTARGET} + else + TOOLPATH=/usr/${CTARGET} + fi + BINPATH=${TOOLPATH}/binutils-bin/${PV} + + # Make sure we filter $LINGUAS so that only ones that + # actually work make it through #42033 + strip-linguas -u */po + + # Keep things sane + strip-flags + + local x + echo + for x in CATEGORY CBUILD CHOST CTARGET CFLAGS LDFLAGS ; do + einfo "$(printf '%10s' ${x}:) ${!x}" + done + echo + + cd "${MY_BUILDDIR}" + local myconf=() + + # enable gold (installed as ld.gold) and ld's plugin architecture + if use cxx ; then + myconf+=( --enable-gold ) + myconf+=( --enable-plugins ) + fi + + if use nls ; then + myconf+=( --without-included-gettext ) + else + myconf+=( --disable-nls ) + fi + + myconf+=( --with-system-zlib ) + + # For bi-arch systems, enable a 64bit bfd. This matches + # the bi-arch logic in toolchain.eclass. #446946 + # We used to do it for everyone, but it's slow on 32bit arches. #438522 + case $(tc-arch) in + ppc|sparc|x86) myconf+=( --enable-64-bit-bfd ) ;; + esac + + use multitarget && myconf+=( --enable-targets=all --enable-64-bit-bfd ) + + [[ -n ${CBUILD} ]] && myconf+=( --build=${CBUILD} ) + + is_cross && myconf+=( + --with-sysroot="${EPREFIX}"/usr/${CTARGET} + --enable-poison-system-directories + ) + + # glibc-2.3.6 lacks support for this ... so rather than force glibc-2.5+ + # on everyone in alpha (for now), we'll just enable it when possible + has_version ">=${CATEGORY}/glibc-2.5" && myconf+=( --enable-secureplt ) + has_version ">=sys-libs/glibc-2.5" && myconf+=( --enable-secureplt ) + + # mips can't do hash-style=gnu ... + if [[ $(tc-arch) != mips ]] ; then + myconf+=( --enable-default-hash-style=gnu ) + fi + + myconf+=( + --prefix="${EPREFIX}"/usr + --host=${CHOST} + --target=${CTARGET} + --datadir="${EPREFIX}"${DATAPATH} + --datarootdir="${EPREFIX}"${DATAPATH} + --infodir="${EPREFIX}"${DATAPATH}/info + --mandir="${EPREFIX}"${DATAPATH}/man + --bindir="${EPREFIX}"${BINPATH} + --libdir="${EPREFIX}"${LIBPATH} + --libexecdir="${EPREFIX}"${LIBPATH} + --includedir="${EPREFIX}"${INCPATH} + --enable-obsolete + --enable-shared + --enable-threads + # Newer versions (>=2.27) offer a configure flag now. + --enable-relro + # Newer versions (>=2.24) make this an explicit option. #497268 + --enable-install-libiberty + --disable-werror + --with-bugurl="$(toolchain-binutils_bugurl)" + --with-pkgversion="$(toolchain-binutils_pkgversion)" + $(use_enable static-libs static) + ${EXTRA_ECONF} + # Disable modules that are in a combined binutils/gdb tree. #490566 + --disable-{gdb,libdecnumber,readline,sim} + # Strip out broken static link flags. + # https://gcc.gnu.org/PR56750 + --without-stage1-ldflags + # Change SONAME to avoid conflict across + # {native,cross}/binutils, binutils-libs. #666100 + --with-extra-soversion-suffix=gentoo-${CATEGORY}-${PN}-$(usex multitarget mt st) + ) + echo ./configure "${myconf[@]}" + "${S}"/configure "${myconf[@]}" || die + + # Prevent makeinfo from running if doc is unset. + if ! use doc ; then + sed -i \ + -e '/^MAKEINFO/s:=.*:= true:' \ + Makefile || die + fi +} + +src_compile() { + cd "${MY_BUILDDIR}" + # see Note [tooldir hack for ldscripts] + emake tooldir="${EPREFIX}${TOOLPATH}" all + + # only build info pages if the user wants them + if use doc ; then + emake info + fi + + # we nuke the manpages when we're left with junk + # (like when we bootstrap, no perl -> no manpages) + find . -name '*.1' -a -size 0 -delete +} + +src_test() { + cd "${MY_BUILDDIR}" + + # bug 637066 + filter-flags -Wall -Wreturn-type + + emake -k check +} + +src_install() { + local x d + + cd "${MY_BUILDDIR}" + # see Note [tooldir hack for ldscripts] + emake DESTDIR="${D}" tooldir="${EPREFIX}${LIBPATH}" install + rm -rf "${ED}"/${LIBPATH}/bin + use static-libs || find "${ED}" -name '*.la' -delete + + # Newer versions of binutils get fancy with ${LIBPATH} #171905 + cd "${ED}"/${LIBPATH} + for d in ../* ; do + [[ ${d} == ../${PV} ]] && continue + mv ${d}/* . || die + rmdir ${d} || die + done + + # Now we collect everything intp the proper SLOT-ed dirs + # When something is built to cross-compile, it installs into + # /usr/$CHOST/ by default ... we have to 'fix' that :) + if is_cross ; then + cd "${ED}"/${BINPATH} + for x in * ; do + mv ${x} ${x/${CTARGET}-} + done + + if [[ -d ${ED}/usr/${CHOST}/${CTARGET} ]] ; then + mv "${ED}"/usr/${CHOST}/${CTARGET}/include "${ED}"/${INCPATH} + mv "${ED}"/usr/${CHOST}/${CTARGET}/lib/* "${ED}"/${LIBPATH}/ + rm -r "${ED}"/usr/${CHOST}/{include,lib} + fi + fi + insinto ${INCPATH} + local libiberty_headers=( + # Not all the libiberty headers. See libiberty/Makefile.in:install_to_libdir. + demangle.h + dyn-string.h + fibheap.h + hashtab.h + libiberty.h + objalloc.h + splay-tree.h + ) + doins "${libiberty_headers[@]/#/${S}/include/}" || die + if [[ -d ${ED}/${LIBPATH}/lib ]] ; then + mv "${ED}"/${LIBPATH}/lib/* "${ED}"/${LIBPATH}/ + rm -r "${ED}"/${LIBPATH}/lib + fi + + # Generate an env.d entry for this binutils + insinto /etc/env.d/binutils + cat <<-EOF > "${T}"/env.d + TARGET="${CTARGET}" + VER="${PV}" + LIBPATH="${EPREFIX}${LIBPATH}" + EOF + newins "${T}"/env.d ${CTARGET}-${PV} + + # Handle documentation + if ! is_cross ; then + cd "${S}" + dodoc README + docinto bfd + dodoc bfd/ChangeLog* bfd/README bfd/PORTING bfd/TODO + docinto binutils + dodoc binutils/ChangeLog binutils/NEWS binutils/README + docinto gas + dodoc gas/ChangeLog* gas/CONTRIBUTORS gas/NEWS gas/README* + docinto gprof + dodoc gprof/ChangeLog* gprof/TEST gprof/TODO gprof/bbconv.pl + docinto ld + dodoc ld/ChangeLog* ld/README ld/NEWS ld/TODO + docinto libiberty + dodoc libiberty/ChangeLog* libiberty/README + docinto opcodes + dodoc opcodes/ChangeLog* + fi + + # Remove shared info pages + rm -f "${ED}"/${DATAPATH}/info/{dir,configure.info,standards.info} + + # Trim all empty dirs + find "${ED}" -depth -type d -exec rmdir {} + 2>/dev/null +} + +pkg_postinst() { + # Make sure this ${CTARGET} has a binutils version selected + [[ -e ${EROOT}/etc/env.d/binutils/config-${CTARGET} ]] && return 0 + binutils-config ${CTARGET}-${PV} +} + +pkg_postrm() { + local current_profile=$(binutils-config -c ${CTARGET}) + + # If no other versions exist, then uninstall for this + # target ... otherwise, switch to the newest version + # Note: only do this if this version is unmerged. We + # rerun binutils-config if this is a remerge, as + # we want the mtimes on the symlinks updated (if + # it is the same as the current selected profile) + if [[ ! -e ${EPREFIX}${BINPATH}/ld ]] && [[ ${current_profile} == ${CTARGET}-${PV} ]] ; then + local choice=$(binutils-config -l | grep ${CTARGET} | awk '{print $2}') + choice=${choice//$'\n'/ } + choice=${choice/* } + if [[ -z ${choice} ]] ; then + binutils-config -u ${CTARGET} + else + binutils-config ${choice} + fi + elif [[ $(CHOST=${CTARGET} binutils-config -c) == ${CTARGET}-${PV} ]] ; then + binutils-config ${CTARGET}-${PV} + fi +} + +# Note [slotting support] +# ----------------------- +# Gentoo's layout for binutils files is non-standard as Gentoo +# supports slotted installation for binutils. Many tools +# still expect binutils to reside in known locations. +# binutils-config package restores symlinks into known locations, +# like: +# /usr/bin/${CTARGET}-<tool> +# /usr/bin/${CHOST}/${CTARGET}/lib/ldscrips +# /usr/include/ +# +# Note [tooldir hack for ldscripts] +# --------------------------------- +# Build system does not allow ./configure to tweak every location +# we need for slotting binutils hence all the shuffling in +# src_install(). This note is about SCRIPTDIR define handling. +# +# SCRIPTDIR defines 'ldscripts/' directory location. SCRIPTDIR value +# is set at build-time in ld/Makefile.am as: 'scriptdir = $(tooldir)/lib' +# and hardcoded as -DSCRIPTDIR='"$(scriptdir)"' at compile time. +# Thus we can't just move files around after compilation finished. +# +# Our goal is the following: +# - at build-time set scriptdir to point to symlinked location: +# ${TOOLPATH}: /usr/${CHOST} (or /usr/${CHOST}/${CTARGET} for cross-case) +# - at install-time set scriptdir to point to slotted location: +# ${LIBPATH}: /usr/$(get_libdir)/binutils/${CTARGET}/${PV} diff --git a/sys-devel/binutils/files/binutils-2.29.1-nogoldtest.patch b/sys-devel/binutils/files/binutils-2.29.1-nogoldtest.patch new file mode 100644 index 00000000..8e066992 --- /dev/null +++ b/sys-devel/binutils/files/binutils-2.29.1-nogoldtest.patch @@ -0,0 +1,27 @@ +From 40f6e93e5078f16897f23856886566fe3b546206 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Andreas=20K=2E=20H=C3=BCttel?= <dilfridge@gentoo.org> +Date: Fri, 3 Nov 2017 21:51:35 +0100 +Subject: [PATCH] Gentoo: Disable gold testsuite for users since it fails + upstream + +https://bugs.gentoo.org/634348 +https://sourceware.org/bugzilla/show_bug.cgi?id=21090 +--- + Makefile.in | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/Makefile.in b/Makefile.in +index 3acb83b8de..49de829bfa 100644 +--- a/Makefile.in ++++ b/Makefile.in +@@ -2340,7 +2340,6 @@ check-host: \ + maybe-check-mpc \ + maybe-check-isl \ + maybe-check-libelf \ +- maybe-check-gold \ + maybe-check-gprof \ + maybe-check-intl \ + maybe-check-tcl \ +-- +2.15.0 + diff --git a/sys-devel/binutils/files/binutils-2.31-test-driver b/sys-devel/binutils/files/binutils-2.31-test-driver new file mode 100644 index 00000000..0218a01f --- /dev/null +++ b/sys-devel/binutils/files/binutils-2.31-test-driver @@ -0,0 +1,148 @@ +#! /bin/sh +# test-driver - basic testsuite driver script. + +scriptversion=2016-01-11.22; # UTC + +# Copyright (C) 2011-2017 Free Software Foundation, Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# This file is maintained in Automake, please report +# bugs to <bug-automake@gnu.org> or send patches to +# <automake-patches@gnu.org>. + +# Make unconditional expansion of undefined variables an error. This +# helps a lot in preventing typo-related bugs. +set -u + +usage_error () +{ + echo "$0: $*" >&2 + print_usage >&2 + exit 2 +} + +print_usage () +{ + cat <<END +Usage: + test-driver --test-name=NAME --log-file=PATH --trs-file=PATH + [--expect-failure={yes|no}] [--color-tests={yes|no}] + [--enable-hard-errors={yes|no}] [--] + TEST-SCRIPT [TEST-SCRIPT-ARGUMENTS] +The '--test-name', '--log-file' and '--trs-file' options are mandatory. +END +} + +test_name= # Used for reporting. +log_file= # Where to save the output of the test script. +trs_file= # Where to save the metadata of the test run. +expect_failure=no +color_tests=no +enable_hard_errors=yes +while test $# -gt 0; do + case $1 in + --help) print_usage; exit $?;; + --version) echo "test-driver $scriptversion"; exit $?;; + --test-name) test_name=$2; shift;; + --log-file) log_file=$2; shift;; + --trs-file) trs_file=$2; shift;; + --color-tests) color_tests=$2; shift;; + --expect-failure) expect_failure=$2; shift;; + --enable-hard-errors) enable_hard_errors=$2; shift;; + --) shift; break;; + -*) usage_error "invalid option: '$1'";; + *) break;; + esac + shift +done + +missing_opts= +test x"$test_name" = x && missing_opts="$missing_opts --test-name" +test x"$log_file" = x && missing_opts="$missing_opts --log-file" +test x"$trs_file" = x && missing_opts="$missing_opts --trs-file" +if test x"$missing_opts" != x; then + usage_error "the following mandatory options are missing:$missing_opts" +fi + +if test $# -eq 0; then + usage_error "missing argument" +fi + +if test $color_tests = yes; then + # Keep this in sync with 'lib/am/check.am:$(am__tty_colors)'. + red='[0;31m' # Red. + grn='[0;32m' # Green. + lgn='[1;32m' # Light green. + blu='[1;34m' # Blue. + mgn='[0;35m' # Magenta. + std='[m' # No color. +else + red= grn= lgn= blu= mgn= std= +fi + +do_exit='rm -f $log_file $trs_file; (exit $st); exit $st' +trap "st=129; $do_exit" 1 +trap "st=130; $do_exit" 2 +trap "st=141; $do_exit" 13 +trap "st=143; $do_exit" 15 + +# Test script is run here. +"$@" >$log_file 2>&1 +estatus=$? + +if test $enable_hard_errors = no && test $estatus -eq 99; then + tweaked_estatus=1 +else + tweaked_estatus=$estatus +fi + +case $tweaked_estatus:$expect_failure in + 0:yes) col=$red res=XPASS recheck=yes gcopy=yes;; + 0:*) col=$grn res=PASS recheck=no gcopy=no;; + 77:*) col=$blu res=SKIP recheck=no gcopy=yes;; + 99:*) col=$mgn res=ERROR recheck=yes gcopy=yes;; + *:yes) col=$lgn res=XFAIL recheck=no gcopy=yes;; + *:*) col=$red res=FAIL recheck=yes gcopy=yes;; +esac + +# Report the test outcome and exit status in the logs, so that one can +# know whether the test passed or failed simply by looking at the '.log' +# file, without the need of also peaking into the corresponding '.trs' +# file (automake bug#11814). +echo "$res $test_name (exit status: $estatus)" >>$log_file + +# Report outcome to console. +echo "${col}${res}${std}: $test_name" + +# Register the test result, and other relevant metadata. +echo ":test-result: $res" > $trs_file +echo ":global-test-result: $res" >> $trs_file +echo ":recheck: $recheck" >> $trs_file +echo ":copy-in-global-log: $gcopy" >> $trs_file + +# Local Variables: +# mode: shell-script +# sh-indentation: 2 +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-time-zone: "UTC0" +# time-stamp-end: "; # UTC" +# End: diff --git a/sys-devel/binutils/files/binutils-configure-LANG.patch b/sys-devel/binutils/files/binutils-configure-LANG.patch new file mode 100644 index 00000000..5521d196 --- /dev/null +++ b/sys-devel/binutils/files/binutils-configure-LANG.patch @@ -0,0 +1,65 @@ +The LANG vars aren't reset early enough so when sed tries to use [a-zA-Z] in +option parsing, it may break. + +http://bugs.gentoo.org/103483 +http://bugs.gentoo.org/122216 + +--- configure ++++ configure +@@ -54,6 +54,19 @@ + infodir='${prefix}/info' + mandir='${prefix}/man' + ++# NLS nuisances. ++for as_var in \ ++ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ ++ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ ++ LC_TELEPHONE LC_TIME ++do ++ if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then ++ eval $as_var=C; export $as_var ++ else ++ unset $as_var ++ fi ++done ++ + # Initialize some other variables. + subdirs= + MFLAGS= MAKEFLAGS= +@@ -452,16 +463,6 @@ + esac + done + +-# NLS nuisances. +-# Only set these to C if already set. These must not be set unconditionally +-# because not all systems understand e.g. LANG=C (notably SCO). +-# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'! +-# Non-C LC_CTYPE values break the ctype check. +-if test "${LANG+set}" = set; then LANG=C; export LANG; fi +-if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi +-if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi +-if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi +- + # confdefs.h avoids OS command line length limits that DEFS can exceed. + rm -rf conftest* confdefs.h + # AIX cpp loses on an empty file, so make sure it contains at least a newline. +@@ -1850,6 +1850,19 @@ + # Compiler output produced by configure, useful for debugging + # configure, is in ./config.log if it exists. + ++# NLS nuisances. ++for as_var in \ ++ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ ++ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ ++ LC_TELEPHONE LC_TIME ++do ++ if (set +x; test -z "`(eval \$as_var=C; export \$as_var) 2>&1`"); then ++ eval \$as_var=C; export \$as_var ++ else ++ unset \$as_var ++ fi ++done ++ + ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]" + for ac_option + do diff --git a/sys-devel/gcc/Manifest b/sys-devel/gcc/Manifest new file mode 100644 index 00000000..bfb413e8 --- /dev/null +++ b/sys-devel/gcc/Manifest @@ -0,0 +1,2 @@ +DIST gcc-8.2.0-patches-1.6.tar.bz2 17138 BLAKE2B edbeba9c41972836de072955c0db51406603aaf0dbb5f84ac1c5d8d2d61a8df6d725356655b69e3678950a0dc6dacc1bc2bf56f3620d685fe5c32045b3893f96 SHA512 32e7bddb5ec288def1e5c79d58023d90e29d77e83b70e3f21a22f4da78061cc49184d92c43807bdfd56a5067cbb9a8cfbfcb514016662aa1a24d791c7bd87b6b +DIST gcc-8.2.0.tar.xz 63460876 BLAKE2B c5372b0bdfcd2729577dca287b294623b78c583491998404eb307768c573618bdaaedb7d9ae0e39ba41a62a14b9525dff0e3083285754b7f5bb9987ecf635185 SHA512 64898a165f67e136d802a92e7633bf1b06c85266027e52127ea025bf5fc2291b5e858288aac0bdba246e6cdf7c6ec88bc8e0e7f3f6f1985f4297710cafde56ed diff --git a/sys-devel/gcc/files/3.3.4/libffi-without-libgcj.patch b/sys-devel/gcc/files/3.3.4/libffi-without-libgcj.patch new file mode 100644 index 00000000..507d42f0 --- /dev/null +++ b/sys-devel/gcc/files/3.3.4/libffi-without-libgcj.patch @@ -0,0 +1,22 @@ +--- configure.in.old 2004-06-26 07:01:06.000000000 +0200 ++++ configure.in 2004-06-26 07:02:55.000000000 +0200 +@@ -52,8 +52,7 @@ + host_tools="texinfo byacc flex bison binutils ld gas gcc sid sim gdb make patch prms send-pr gprof etc expect dejagnu ash bash bzip2 m4 autoconf automake libtool grep diff rcs fileutils shellutils time textutils wdiff find uudecode hello tar gzip indent recode release sed utils guile perl gawk findutils snavigator libtool gettext zip fastjar" + + # libgcj represents the runtime libraries only used by gcj. +-libgcj="target-libffi \ +- target-boehm-gc \ ++libgcj="target-boehm-gc \ + target-zlib \ + target-qthreads \ + target-libjava" +@@ -66,7 +65,8 @@ + target-newlib \ + ${libstdcxx_version} \ + target-libf2c \ +- ${libgcj} ++ ${libgcj} \ ++ target-libffi \ + target-libobjc" + + # these tools are built using the target libs, and are intended to run only diff --git a/sys-devel/gcc/files/3.4.3/libffi-nogcj-lib-path-fix.patch b/sys-devel/gcc/files/3.4.3/libffi-nogcj-lib-path-fix.patch new file mode 100644 index 00000000..b5195e4e --- /dev/null +++ b/sys-devel/gcc/files/3.4.3/libffi-nogcj-lib-path-fix.patch @@ -0,0 +1,40 @@ +diff -ur gcc-3.4.3/libffi/Makefile.in gcc-3.4.3-ffi-fixes/libffi/Makefile.in +--- gcc-3.4.3/libffi/Makefile.in 2003-11-22 08:41:32.000000000 -0500 ++++ gcc-3.4.3-ffi-fixes/libffi/Makefile.in 2004-11-28 17:31:50.000000000 -0500 +@@ -89,7 +89,7 @@ + libffi_basedir = @libffi_basedir@ + tool_include_dir = @tool_include_dir@ + toolexecdir = @toolexecdir@ +-toolexeclibdir = @toolexeclibdir@ ++toolexeclibdir = @toolexeclibdir@/@gcc_version@ + + AUTOMAKE_OPTIONS = cygnus + +diff -ur gcc-3.4.3/libffi/configure gcc-3.4.3-ffi-fixes/libffi/configure +--- gcc-3.4.3/libffi/configure 2004-05-18 05:08:39.000000000 -0400 ++++ gcc-3.4.3-ffi-fixes/libffi/configure 2004-11-28 17:48:19.000000000 -0500 +@@ -3800,8 +3800,8 @@ + toolexecdir='$(exec_prefix)/$(target_alias)' + toolexeclibdir='$(toolexecdir)/lib' + else +- toolexecdir='$(libdir)/gcc-lib/$(target_alias)' +- toolexeclibdir='$(libdir)' ++ toolexecdir='$(libdir)/gcc/$(target_alias)' ++ toolexeclibdir='$(libdir)/gcc/$(target_alias)/$(gcc-version)' + fi + multi_os_directory=`$CC -print-multi-os-directory` + case $multi_os_directory in +diff -ur gcc-3.4.3/libffi/configure.in gcc-3.4.3-ffi-fixes/libffi/configure.in +--- gcc-3.4.3/libffi/configure.in 2004-04-27 01:10:19.000000000 -0400 ++++ gcc-3.4.3-ffi-fixes/libffi/configure.in 2004-11-28 17:40:30.000000000 -0500 +@@ -225,8 +225,8 @@ + toolexecdir='$(exec_prefix)/$(target_alias)' + toolexeclibdir='$(toolexecdir)/lib' + else +- toolexecdir='$(libdir)/gcc-lib/$(target_alias)' +- toolexeclibdir='$(libdir)' ++ toolexecdir='$(libdir)/gcc/$(target_alias)' ++ toolexeclibdir='$(libdir)/gcc/$(target_alias)/$(gcc_version)' + fi + multi_os_directory=`$CC -print-multi-os-directory` + case $multi_os_directory in diff --git a/sys-devel/gcc/files/3.4.3/libffi-without-libgcj.patch b/sys-devel/gcc/files/3.4.3/libffi-without-libgcj.patch new file mode 100644 index 00000000..b270a06a --- /dev/null +++ b/sys-devel/gcc/files/3.4.3/libffi-without-libgcj.patch @@ -0,0 +1,40 @@ +--- configure.in.orig 2004-08-03 00:53:36.000000000 +0200 ++++ configure.in 2004-08-03 00:52:35.000000000 +0200 +@@ -136,8 +136,7 @@ + host_tools="texinfo byacc flex bison binutils gas ld gcc sid sim gdb make patch prms send-pr gprof etc expect dejagnu ash bash bzip2 m4 autoconf automake libtool diff rcs fileutils shellutils time textutils wdiff find uudecode hello tar gzip indent recode release sed utils guile perl gawk findutils gettext zip fastjar" + + # libgcj represents the runtime libraries only used by gcj. +-libgcj="target-libffi \ +- target-boehm-gc \ ++libgcj="target-boehm-gc \ + target-zlib \ + target-qthreads \ + target-libjava" +@@ -150,6 +150,7 @@ + target-libstdc++-v3 \ + target-libf2c \ + ${libgcj} \ ++ target-libffi \ + target-libobjc" + + # these tools are built using the target libraries, and are intended to +--- configure~ 2004-08-28 02:31:04.000000000 +0200 ++++ configure 2004-08-28 10:55:28.000000000 +0200 +@@ -876,8 +876,7 @@ + host_tools="texinfo byacc flex bison binutils gas ld gcc sid sim gdb make patch prms send-pr gprof etc expect dejagnu ash bash bzip2 m4 autoconf automake libtool diff rcs fileutils shellutils time textutils wdiff find uudecode hello tar gzip indent recode release sed utils guile perl gawk findutils gettext zip fastjar" + + # libgcj represents the runtime libraries only used by gcj. +-libgcj="target-libffi \ +- target-boehm-gc \ ++libgcj="target-boehm-gc \ + target-zlib \ + target-qthreads \ + target-libjava" +@@ -891,6 +890,7 @@ + target-libstdc++-v3 \ + target-libf2c \ + ${libgcj} \ ++ target-libffi \ + target-libobjc" + + # these tools are built using the target libraries, and are intended to diff --git a/sys-devel/gcc/files/3.4.4/gcc-3.4.4-cross-compile.patch b/sys-devel/gcc/files/3.4.4/gcc-3.4.4-cross-compile.patch new file mode 100644 index 00000000..03895434 --- /dev/null +++ b/sys-devel/gcc/files/3.4.4/gcc-3.4.4-cross-compile.patch @@ -0,0 +1,63 @@ +Some notes on the 'bootstrap with or without libc headers' debate: +http://linuxfromscratch.org/pipermail/lfs-dev/2005-July/052409.html +http://gcc.gnu.org/ml/gcc/2005-07/msg01195.html + +--- gcc/config/sh/linux.h ++++ gcc/config/sh/linux.h +@@ -145,6 +145,7 @@ + /* Do code reading to identify a signal frame, and set the frame + state data appropriately. See unwind-dw2.c for the structs. */ + ++#ifndef inhibit_libc + #ifdef IN_LIBGCC2 + #include <signal.h> + #include <sys/ucontext.h> +@@ -295,6 +296,7 @@ + + #endif /* defined (__SH5__) */ + #endif /* IN_LIBGCC2 */ ++#endif /* inhibit_libc */ + + /* For SH3 and SH4, we use a slot of the unwind frame which correspond + to a fake register number 16 as a placeholder for the return address +--- gcc/config/i386/linux.h ++++ gcc/config/i386/linux.h +@@ -208,6 +208,7 @@ + /* Do code reading to identify a signal frame, and set the frame + state data appropriately. See unwind-dw2.c for the structs. */ + ++#ifndef inhibit_libc + #ifdef IN_LIBGCC2 + /* There's no sys/ucontext.h for some (all?) libc1, so no + signal-turned-exceptions for them. There's also no configure-run for +@@ -272,3 +273,4 @@ + } while (0) + #endif /* not USE_GNULIBC_1 */ + #endif /* IN_LIBGCC2 */ ++#endif /* inhibit_libc */ +--- gcc/config/alpha/linux.h ++++ gcc/config/alpha/linux.h +@@ -73,6 +73,7 @@ + /* Do code reading to identify a signal frame, and set the frame + state data appropriately. See unwind-dw2.c for the structs. */ + ++#ifndef inhibit_libc + #ifdef IN_LIBGCC2 + #include <signal.h> + #include <sys/ucontext.h> +@@ -122,3 +123,4 @@ + (FS)->retaddr_column = 64; \ + goto SUCCESS; \ + } while (0) ++#endif /* inhibit_libc */ +--- gcc/config.gcc ++++ gcc/config.gcc +@@ -321,7 +321,7 @@ + need_64bit_hwint=yes + ;; + # Note the 'l'; we need to be able to match e.g. "shle" or "shl". +-sh[123456789l]*-*-*) ++sh[123456789lbe]*-*-*) + cpu_type=sh + need_64bit_hwint=yes + ;; diff --git a/sys-devel/gcc/files/4.1.0/gcc-4.1.0-cross-compile.patch b/sys-devel/gcc/files/4.1.0/gcc-4.1.0-cross-compile.patch new file mode 100644 index 00000000..523caa48 --- /dev/null +++ b/sys-devel/gcc/files/4.1.0/gcc-4.1.0-cross-compile.patch @@ -0,0 +1,40 @@ +Some notes on the 'bootstrap with or without libc headers' debate: +http://linuxfromscratch.org/pipermail/lfs-dev/2005-July/052409.html +http://gcc.gnu.org/ml/gcc/2005-07/msg01195.html + +--- gcc/unwind-dw2.c ++++ gcc/unwind-dw2.c +@@ -253,9 +253,11 @@ + } + #endif + ++#ifndef inhibit_libc + #ifdef MD_UNWIND_SUPPORT + #include MD_UNWIND_SUPPORT + #endif ++#endif + + /* Extract any interesting information from the CIE for the translation + unit F belongs to. Return a pointer to the byte after the augmentation, +--- gcc/configure ++++ gcc/configure +@@ -12857,7 +12857,7 @@ then + | powerpc*-*-*,powerpc64*-*-*) + CROSS="$CROSS -DNATIVE_CROSS" ;; + esac +-elif test "x$TARGET_SYSTEM_ROOT" != x; then ++elif test "x$TARGET_SYSTEM_ROOT" != x -o $build != $host; then + SYSTEM_HEADER_DIR=$build_system_header_dir + fi + +--- gcc/configure.ac ++++ gcc/configure.ac +@@ -1717,7 +1717,7 @@ then + | powerpc*-*-*,powerpc64*-*-*) + CROSS="$CROSS -DNATIVE_CROSS" ;; + esac +-elif test "x$TARGET_SYSTEM_ROOT" != x; then ++elif test "x$TARGET_SYSTEM_ROOT" != x -o $build != $host; then + SYSTEM_HEADER_DIR=$build_system_header_dir + fi + diff --git a/sys-devel/gcc/files/4.1.0/gcc-4.1.0-fast-math-i386-Os-workaround.patch b/sys-devel/gcc/files/4.1.0/gcc-4.1.0-fast-math-i386-Os-workaround.patch new file mode 100644 index 00000000..6090d66d --- /dev/null +++ b/sys-devel/gcc/files/4.1.0/gcc-4.1.0-fast-math-i386-Os-workaround.patch @@ -0,0 +1,64 @@ +workaround for lame stack packing on i386 ... + + - build gcc with -Os (crtfastmath.o to be specific) + - crtfastmath.o is installed into gcc libdir + - run gcc with -ffast-math and get crtfastmath.o linked in + - resulting compiled app segfaults due to init code in + crtfastmath.o that has mis-aligned structure on stack + +http://bugs.gentoo.org/147020 +http://gcc.gnu.org/PR28621 + +this is supposed to be fixed in current 4.1 branch, but i'm unable to get +the fix to work so until i can figure out what i'm doing wrong, we'll use +this workaround for now. + +--- gcc-4.1.1/gcc/config/i386/crtfastmath.c ++++ gcc-4.1.1/gcc/config/i386/crtfastmath.c +@@ -37,6 +37,23 @@ + #define FXSAVE (1 << 24) + #define SSE (1 << 25) + ++struct ++{ ++ unsigned short int cwd; ++ unsigned short int swd; ++ unsigned short int twd; ++ unsigned short int fop; ++ long int fip; ++ long int fcs; ++ long int foo; ++ long int fos; ++ long int mxcsr; ++ long int mxcsr_mask; ++ long int st_space[32]; ++ long int xmm_space[32]; ++ long int padding[56]; ++} __attribute__ ((aligned (16))) fxsave; ++ + static void __attribute__((constructor)) + set_fast_math (void) + { +@@ -75,22 +92,6 @@ + if (edx & FXSAVE) + { + /* Check if DAZ is available. */ +- struct +- { +- unsigned short int cwd; +- unsigned short int swd; +- unsigned short int twd; +- unsigned short int fop; +- long int fip; +- long int fcs; +- long int foo; +- long int fos; +- long int mxcsr; +- long int mxcsr_mask; +- long int st_space[32]; +- long int xmm_space[32]; +- long int padding[56]; +- } __attribute__ ((aligned (16))) fxsave; + + __builtin_memset (&fxsave, 0, sizeof (fxsave)); + diff --git a/sys-devel/gcc/files/awk/fixlafiles.awk b/sys-devel/gcc/files/awk/fixlafiles.awk new file mode 100644 index 00000000..aa2ecb60 --- /dev/null +++ b/sys-devel/gcc/files/awk/fixlafiles.awk @@ -0,0 +1,313 @@ +# Copyright 1999-2005 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +# +# Helper functions +# +function printn(string) { + printf("%s", string) +} +function einfo(string) { + printf(" \033[32;01m*\033[0m %s\n", string) +} +function einfon(string) { + printf(" \033[32;01m*\033[0m %s", string) +} +function ewarn(string) { + printf(" \033[33;01m*\033[0m %s\n", string) +} +function ewarnn(string) { + printf(" \033[33;01m*\033[0m %s", string) +} +function eerror(string) { + printf(" \033[31;01m*\033[0m %s\n", string) +} + +# +# assert(condition, errmsg) +# assert that a condition is true. Otherwise exit. +# +function assert(condition, string) { + if (! condition) { + printf("%s:%d: assertion failed: %s\n", + FILENAME, FNR, string) > "/dev/stderr" + _assert_exit = 1 + exit 1 + } +} + +# +# system(command, return) +# wrapper that normalizes return codes ... +# +function dosystem(command, ret) { + ret = 0 + ret = system(command) + if (ret == 0) + return 1 + else + return 0 +} + +BEGIN { + # + # Get our variables from environment + # + OLDVER = ENVIRON["OLDVER"] + OLDCHOST = ENVIRON["OLDCHOST"] + + if (OLDVER == "") { + eerror("Could not get OLDVER!"); + exit 1 + } + + # Setup some sane defaults + LIBCOUNT = 2 + HAVE_GCC34 = 0 + DIRLIST[1] = "/lib" + DIRLIST[2] = "/usr/lib" + + # + # Walk /etc/ld.so.conf to discover all our library paths + # + pipe = "cat /etc/ld.so.conf | sort 2>/dev/null" + while(((pipe) | getline ldsoconf_data) > 0) { + if (ldsoconf_data !~ /^[[:space:]]*#/) { + if (ldsoconf_data == "") continue + + # Remove any trailing comments + sub(/#.*$/, "", ldsoconf_data) + # Remove any trailing spaces + sub(/[[:space:]]+$/, "", ldsoconf_data) + + # If there's more than one path per line, split + # it up as if they were sep lines + split(ldsoconf_data, nodes, /[:,[:space:]]/) + + # Now add the rest from ld.so.conf + for (x in nodes) { + # wtf does this line do ? + sub(/=.*/, "", nodes[x]) + # Prune trailing / + sub(/\/$/, "", nodes[x]) + + if (nodes[x] == "") continue + + # + # Drop the directory if its a child directory of + # one that was already added ... + # For example, if we have: + # /usr/lib /usr/libexec /usr/lib/mozilla /usr/lib/nss + # We really just want to save /usr/lib /usr/libexec + # + CHILD = 0 + for (y in DIRLIST) { + if (nodes[x] ~ "^" DIRLIST[y] "(/|$)") { + CHILD = 1 + break + } + } + if (CHILD) continue + + DIRLIST[++LIBCOUNT] = nodes[x] + } + } + } + close(pipe) + + # + # Get line from gcc's output containing CHOST + # + pipe = "gcc -print-file-name=libgcc.a 2>/dev/null" + if ((!((pipe) | getline TMP_CHOST)) || (TMP_CHOST == "")) { + close(pipe) + + # If we fail to get the CHOST, see if we can get the CHOST + # portage thinks we are using ... + pipe = "/usr/bin/portageq envvar 'CHOST'" + assert(((pipe) | getline CHOST), "(" pipe ") | getline CHOST") + } else { + # Check pre gcc-3.4.x versions + CHOST = gensub("^.+lib/gcc-lib/([^/]+)/[0-9]+.+$", "\\1", 1, TMP_CHOST) + + if (CHOST == TMP_CHOST || CHOST == "") { + # Check gcc-3.4.x or later + CHOST = gensub("^.+lib/gcc/([^/]+)/[0-9]+.+$", "\\1", 1, TMP_CHOST); + + if (CHOST == TMP_CHOST || CHOST == "") + CHOST = "" + else + HAVE_GCC34 = 1 + } + } + close(pipe) + + if (CHOST == "") { + eerror("Could not get gcc's CHOST!") + exit 1 + } + + if (OLDCHOST != "") + if (OLDCHOST == CHOST) + OLDCHOST = "" + + GCCLIBPREFIX_OLD = "/usr/lib/gcc-lib/" + GCCLIBPREFIX_NEW = "/usr/lib/gcc/" + + if (HAVE_GCC34) + GCCLIBPREFIX = GCCLIBPREFIX_NEW + else + GCCLIBPREFIX = GCCLIBPREFIX_OLD + + GCCLIB = GCCLIBPREFIX CHOST + + if (OLDCHOST != "") { + OLDGCCLIB1 = GCCLIBPREFIX_OLD OLDCHOST + OLDGCCLIB2 = GCCLIBPREFIX_NEW OLDCHOST + } + + # Get current gcc's version + pipe = "gcc -dumpversion" + assert(((pipe) | getline NEWVER), "(" pipe ") | getline NEWVER)") + close(pipe) + + if (NEWVER == "") { + eerror("Could not get gcc's version!") + exit 1 + } + + # Nothing to do ? + if ((OLDVER == NEWVER) && (OLDCHOST == "")) + exit 0 + + # + # Ok, now let's scan for the .la files and actually fix them up + # + for (x = 1; x <= LIBCOUNT; x++) { + # Do nothing if the target dir is gcc's internal library path + if (DIRLIST[x] ~ GCCLIBPREFIX_OLD || + DIRLIST[x] ~ GCCLIBPREFIX_NEW) + continue + + einfo(" [" x "/" LIBCOUNT "] Scanning " DIRLIST[x] " ...") + + pipe = "find " DIRLIST[x] "/ -name '*.la' 2>/dev/null" + while (((pipe) | getline la_files) > 0) { + + # Do nothing if the .la file is located in gcc's internal lib path + if (la_files ~ GCCLIBPREFIX_OLD || + la_files ~ GCCLIBPREFIX_NEW) + continue + + CHANGED = 0 + CHOST_CHANGED = 0 + + # See if we need to fix the .la file + while ((getline la_data < (la_files)) > 0) { + if (OLDCHOST != "") { + if ((gsub(OLDGCCLIB1 "[/[:space:]]+", + GCCLIB, la_data) > 0) || + (gsub(OLDGCCLIB2 "[/[:space:]]+", + GCCLIB, la_data) > 0)) { + CHANGED = 1 + CHOST_CHANGED = 1 + } + } + if (OLDVER != NEWVER) { + if ((gsub(GCCLIBPREFIX_OLD CHOST "/" OLDVER "[/[:space:]]*", + GCCLIB "/" NEWVER, la_data) > 0) || + (gsub(GCCLIBPREFIX_NEW CHOST "/" OLDVER "[/[:space:]]*", + GCCLIB "/" NEWVER, la_data) > 0)) + CHANGED = 1 + } + } + close(la_files) + + # Do the actual changes in a second loop, as we can then + # verify that CHOST_CHANGED among things is correct ... + if (CHANGED) { + ewarnn(" FIXING: " la_files " ...") + + if (CHANGED) + printn("[") + + # Clear the temp file (removing rather than '>foo' is better + # out of a security point of view?) + dosystem("rm -f " la_files ".new") + + while ((getline la_data < (la_files)) > 0) { + if (OLDCHOST != "") { + tmpstr = gensub(OLDGCCLIB1 "([/[:space:]]+)", + GCCLIB "\\1", "g", la_data) + tmpstr = gensub(OLDGCCLIB2 "([/[:space:]]+)", + GCCLIB "\\1", "g", tmpstr) + + if (la_data != tmpstr) { + printn("c") + la_data = tmpstr + } + + if (CHOST_CHANGED > 0) { + # We try to be careful about CHOST changes outside + # the gcc library path (meaning we cannot match it + # via /GCCLIBPREFIX CHOST/) ... + + # Catch: + # + # dependency_libs=' -L/usr/CHOST/{bin,lib}' + # + gsub("-L/usr/" OLDCHOST "/", + "-L/usr/" CHOST "/", la_data) + # Catch: + # + # dependency_libs=' -L/usr/lib/gcc-lib/CHOST/VER/../../../../CHOST/lib' + # + la_data = gensub("(" GCCLIB "/[^[:space:]]+)/" OLDCHOST "/", + "\\1/" CHOST "/", "g", la_data) + } + } + + if (OLDVER != NEWVER) { + # Catch: + # + # dependency_libs=' -L/usr/lib/gcc/CHOST/VER' + # + tmpstr = gensub(GCCLIBPREFIX_OLD CHOST "/" OLDVER "([/[:space:]]+)", + GCCLIB "/" NEWVER "\\1", "g", la_data) + tmpstr = gensub(GCCLIBPREFIX_NEW CHOST "/" OLDVER "([/[:space:]]+)", + GCCLIB "/" NEWVER "\\1", "g", tmpstr) + + if (la_data != tmpstr) { + # Catch: + # + # dependency_libs=' -L/usr/lib/gcc-lib/../../CHOST/lib' + # + # in cases where we have gcc34 + tmpstr = gensub(GCCLIBPREFIX_OLD "(../../" CHOST "/lib)", + GCCLIBPREFIX "\\1", "g", tmpstr) + tmpstr = gensub(GCCLIBPREFIX_NEW "(../../" CHOST "/lib)", + GCCLIBPREFIX "\\1", "g", tmpstr) + printn("v") + la_data = tmpstr + } + } + + print la_data >> (la_files ".new") + } + + if (CHANGED) + print "]" + + close(la_files) + close(la_files ".new") + + assert(dosystem("mv -f " la_files ".new " la_files), + "dosystem(\"mv -f " la_files ".new " la_files "\")") + } + } + + close(pipe) + } +} + +# vim:ts=4 diff --git a/sys-devel/gcc/files/awk/fixlafiles.awk-no_gcc_la b/sys-devel/gcc/files/awk/fixlafiles.awk-no_gcc_la new file mode 100644 index 00000000..d95a3c06 --- /dev/null +++ b/sys-devel/gcc/files/awk/fixlafiles.awk-no_gcc_la @@ -0,0 +1,334 @@ +# Copyright 1999-2005 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +# +# Helper functions +# +function printn(string) { + printf("%s", string) +} +function einfo(string) { + printf(" \033[32;01m*\033[0m %s\n", string) +} +function einfon(string) { + printf(" \033[32;01m*\033[0m %s", string) +} +function ewarn(string) { + printf(" \033[33;01m*\033[0m %s\n", string) +} +function ewarnn(string) { + printf(" \033[33;01m*\033[0m %s", string) +} +function eerror(string) { + printf(" \033[31;01m*\033[0m %s\n", string) +} + +# +# assert(condition, errmsg) +# assert that a condition is true. Otherwise exit. +# +function assert(condition, string) { + if (! condition) { + printf("%s:%d: assertion failed: %s\n", + FILENAME, FNR, string) > "/dev/stderr" + _assert_exit = 1 + exit 1 + } +} + +# +# system(command, return) +# wrapper that normalizes return codes ... +# +function dosystem(command, ret) { + ret = 0 + ret = system(command) + if (ret == 0) + return 1 + else + return 0 +} + +# +# parse_ld_conf(config_file) +# +function parse_ld_conf(conf, pipe, ldsoconf_data, CHILD, y) { + pipe = "cd /etc; cat " conf " | sort 2>/dev/null" + while(((pipe) | getline ldsoconf_data) > 0) { + if (ldsoconf_data ~ /^[[:space:]]*#/) + continue + if (ldsoconf_data == "") + continue + + # Handle the "include" keyword + if (ldsoconf_data ~ /^include /) { + sub(/^include /, "", ldsoconf_data) + parse_ld_conf(ldsoconf_data) + continue + } + + # Remove any trailing comments + sub(/#.*$/, "", ldsoconf_data) + # Remove any trailing spaces + sub(/[[:space:]]+$/, "", ldsoconf_data) + # Eat duplicate slashes + sub(/\/\//, "/", ldsoconf_data) + # Prune trailing / + sub(/\/$/, "", ldsoconf_data) + + # + # Drop the directory if its a child directory of + # one that was already added ... + # For example, if we have: + # /usr/lib /usr/libexec /usr/lib/mozilla /usr/lib/nss + # We really just want to save /usr/lib /usr/libexec + # + CHILD = 0 + for (y in DIRLIST) { + if (ldsoconf_data ~ "^" DIRLIST[y] "(/|$)") { + CHILD = 1 + break + } + } + if (CHILD) continue + + DIRLIST[++LIBCOUNT] = ldsoconf_data + } + close(pipe) +} + +BEGIN { + # + # Get our variables from environment + # + OLDVER = ENVIRON["OLDVER"] + OLDCHOST = ENVIRON["OLDCHOST"] + + if (OLDVER == "") { + eerror("Could not get OLDVER!"); + exit 1 + } + + # Setup some sane defaults + LIBCOUNT = 2 + HAVE_GCC34 = 0 + DIRLIST[1] = "/lib" + DIRLIST[2] = "/usr/lib" + + # + # Walk /etc/ld.so.conf to discover all our library paths + # + parse_ld_conf("/etc/ld.so.conf") + + # + # Get line from gcc's output containing CHOST + # + pipe = "gcc -print-file-name=libgcc.a 2>/dev/null" + if ((!((pipe) | getline TMP_CHOST)) || (TMP_CHOST == "")) { + close(pipe) + + # If we fail to get the CHOST, see if we can get the CHOST + # portage thinks we are using ... + pipe = "/usr/bin/portageq envvar 'CHOST'" + assert(((pipe) | getline CHOST), "(" pipe ") | getline CHOST") + } else { + # Check pre gcc-3.4.x versions + CHOST = gensub("^.+lib/gcc-lib/([^/]+)/[0-9]+.+$", "\\1", 1, TMP_CHOST) + + if (CHOST == TMP_CHOST || CHOST == "") { + # Check gcc-3.4.x or later + CHOST = gensub("^.+lib/gcc/([^/]+)/[0-9]+.+$", "\\1", 1, TMP_CHOST); + + if (CHOST == TMP_CHOST || CHOST == "") + CHOST = "" + else + HAVE_GCC34 = 1 + } + } + close(pipe) + + if (CHOST == "") { + eerror("Could not get gcc's CHOST!") + exit 1 + } + + if (OLDCHOST != "") + if (OLDCHOST == CHOST) + OLDCHOST = "" + + GCCLIBPREFIX_OLD = "/usr/lib/gcc-lib/" + GCCLIBPREFIX_NEW = "/usr/lib/gcc/" + + if (HAVE_GCC34) + GCCLIBPREFIX = GCCLIBPREFIX_NEW + else + GCCLIBPREFIX = GCCLIBPREFIX_OLD + + GCCLIB = GCCLIBPREFIX CHOST + + if (OLDCHOST != "") { + OLDGCCLIB1 = GCCLIBPREFIX_OLD OLDCHOST + OLDGCCLIB2 = GCCLIBPREFIX_NEW OLDCHOST + } + + # Get current gcc's version + pipe = "gcc -dumpversion" + assert(((pipe) | getline NEWVER), "(" pipe ") | getline NEWVER)") + close(pipe) + + if (NEWVER == "") { + eerror("Could not get gcc's version!") + exit 1 + } + + # Nothing to do ? + # NB: Do not check for (OLDVER == NEWVER) anymore, as we might need to + # replace libstdc++.la .... + if ((OLDVER == "") && (OLDCHOST == "")) + exit 0 + + # + # Ok, now let's scan for the .la files and actually fix them up + # + for (x = 1; x <= LIBCOUNT; x++) { + # Do nothing if the target dir is gcc's internal library path + if (DIRLIST[x] ~ GCCLIBPREFIX_OLD || + DIRLIST[x] ~ GCCLIBPREFIX_NEW) + continue + + einfo(" [" x "/" LIBCOUNT "] Scanning " DIRLIST[x] " ...") + + pipe = "find " DIRLIST[x] "/ -name '*.la' 2>/dev/null" + while (((pipe) | getline la_files) > 0) { + + # Do nothing if the .la file is located in gcc's internal lib path + if (la_files ~ GCCLIBPREFIX_OLD || + la_files ~ GCCLIBPREFIX_NEW) + continue + + CHANGED = 0 + CHOST_CHANGED = 0 + + # See if we need to fix the .la file + while ((getline la_data < (la_files)) > 0) { + if (OLDCHOST != "") { + if ((gsub(OLDGCCLIB1 "[/[:space:]]+", + GCCLIB, la_data) > 0) || + (gsub(OLDGCCLIB2 "[/[:space:]]+", + GCCLIB, la_data) > 0)) { + CHANGED = 1 + CHOST_CHANGED = 1 + } + } + if (OLDVER != NEWVER) { + if ((gsub(GCCLIBPREFIX_OLD CHOST "/" OLDVER "[/[:space:]]*", + GCCLIB "/" NEWVER, la_data) > 0) || + (gsub(GCCLIBPREFIX_NEW CHOST "/" OLDVER "[/[:space:]]*", + GCCLIB "/" NEWVER, la_data) > 0)) + CHANGED = 1 + } + # We now check if we have libstdc++.la, as we remove the + # libtool linker scripts for gcc ... + # We do this last, as we only match the new paths + if (gsub(GCCLIB "/" NEWVER "/libstdc\\+\\+\\.la", + "-lstdc++", la_data) > 0) + CHANGED = 1 + } + close(la_files) + + # Do the actual changes in a second loop, as we can then + # verify that CHOST_CHANGED among things is correct ... + if (CHANGED) { + ewarnn(" FIXING: " la_files " ...[") + + # Clear the temp file (removing rather than '>foo' is better + # out of a security point of view?) + dosystem("rm -f " la_files ".new") + + while ((getline la_data < (la_files)) > 0) { + if (OLDCHOST != "") { + tmpstr = gensub(OLDGCCLIB1 "([/[:space:]]+)", + GCCLIB "\\1", "g", la_data) + tmpstr = gensub(OLDGCCLIB2 "([/[:space:]]+)", + GCCLIB "\\1", "g", tmpstr) + + if (la_data != tmpstr) { + printn("c") + la_data = tmpstr + } + + if (CHOST_CHANGED > 0) { + # We try to be careful about CHOST changes outside + # the gcc library path (meaning we cannot match it + # via /GCCLIBPREFIX CHOST/) ... + + # Catch: + # + # dependency_libs=' -L/usr/CHOST/{bin,lib}' + # + gsub("-L/usr/" OLDCHOST "/", + "-L/usr/" CHOST "/", la_data) + # Catch: + # + # dependency_libs=' -L/usr/lib/gcc-lib/CHOST/VER/../../../../CHOST/lib' + # + la_data = gensub("(" GCCLIB "/[^[:space:]]+)/" OLDCHOST "/", + "\\1/" CHOST "/", "g", la_data) + } + } + + if (OLDVER != NEWVER) { + # Catch: + # + # dependency_libs=' -L/usr/lib/gcc/CHOST/VER' + # + tmpstr = gensub(GCCLIBPREFIX_OLD CHOST "/" OLDVER "([/[:space:]]+)", + GCCLIB "/" NEWVER "\\1", "g", la_data) + tmpstr = gensub(GCCLIBPREFIX_NEW CHOST "/" OLDVER "([/[:space:]]+)", + GCCLIB "/" NEWVER "\\1", "g", tmpstr) + + if (la_data != tmpstr) { + # Catch: + # + # dependency_libs=' -L/usr/lib/gcc-lib/../../CHOST/lib' + # + # in cases where we have gcc34 + tmpstr = gensub(GCCLIBPREFIX_OLD "(../../" CHOST "/lib)", + GCCLIBPREFIX "\\1", "g", tmpstr) + tmpstr = gensub(GCCLIBPREFIX_NEW "(../../" CHOST "/lib)", + GCCLIBPREFIX "\\1", "g", tmpstr) + printn("v") + la_data = tmpstr + } + } + + # We now check if we have libstdc++.la, as we remove the + # libtool linker scripts for gcc and any referencese in any + # libtool linker scripts. + # We do this last, as we only match the new paths + tmpstr = gensub(GCCLIB "/" NEWVER "/libstdc\\+\\+\\.la", + "-lstdc++", "g", la_data); + if (la_data != tmpstr) { + printn("l") + la_data = tmpstr + } + + print la_data >> (la_files ".new") + } + + if (CHANGED) + print "]" + + close(la_files) + close(la_files ".new") + + assert(dosystem("mv -f " la_files ".new " la_files), + "dosystem(\"mv -f " la_files ".new " la_files "\")") + } + } + + close(pipe) + } +} + +# vim:ts=4 diff --git a/sys-devel/gcc/files/c89 b/sys-devel/gcc/files/c89 new file mode 100644 index 00000000..cee0325f --- /dev/null +++ b/sys-devel/gcc/files/c89 @@ -0,0 +1,20 @@ +#! /bin/sh + +# Call the appropriate C compiler with options to accept ANSI/ISO C +# The following options are the same (as of gcc-2.95): +# -ansi +# -std=c89 +# -std=iso9899:1990 + +for i; do + case "$i" in + -ansi|-std=c89|-std=iso9899:1990) + ;; + -std=*) + echo >&2 "`basename $0` called with non ANSI/ISO C90 option $i" + exit 1 + ;; + esac +done + +exec gcc -std=c89 -pedantic -U_FORTIFY_SOURCE "$@" diff --git a/sys-devel/gcc/files/c99 b/sys-devel/gcc/files/c99 new file mode 100644 index 00000000..c9542095 --- /dev/null +++ b/sys-devel/gcc/files/c99 @@ -0,0 +1,21 @@ +#! /bin/sh + +# Call the appropriate C compiler with options to accept ANSI/ISO C +# The following options are the same (as of gcc-3.3): +# -std=c99 +# -std=c9x +# -std=iso9899:1999 +# -std=iso9899:199x + +for i; do + case "$i" in + -std=c9[9x]|-std=iso9899:199[9x]) + ;; + -ansi|-std=*) + echo >&2 "`basename $0` called with non ANSI/ISO C99 option $i" + exit 1 + ;; + esac +done + +exec gcc -std=c99 -pedantic -U_FORTIFY_SOURCE ${1+"$@"} diff --git a/sys-devel/gcc/files/fix_libtool_files.sh b/sys-devel/gcc/files/fix_libtool_files.sh new file mode 100644 index 00000000..af085e1e --- /dev/null +++ b/sys-devel/gcc/files/fix_libtool_files.sh @@ -0,0 +1,66 @@ +#!/bin/sh +# Copyright 1999-2017 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +usage() { +cat << "USAGE_END" +Usage: fix_libtool_files.sh <old-gcc-version> [--oldarch <old-CHOST>] + + Where <old-gcc-version> is the version number of the + previous gcc version. For example, if you updated to + gcc-3.2.1, and you had gcc-3.2 installed, run: + + # fix_libtool_files.sh 3.2 + + If you updated to gcc-3.2.3, and the old CHOST was i586-pc-linux-gnu + but you now have CHOST as i686-pc-linux-gnu, run: + + # fix_libtool_files.sh 3.2 --oldarch i586-pc-linux-gnu + + Note that if only the CHOST and not the version changed, you can run + it with the current version and the '--oldarch <old-CHOST>' arguments, + and it will do the expected: + + # fix_libtool_files.sh `gcc -dumpversion` --oldarch i586-pc-linux-gnu + +USAGE_END + exit 1 +} + +case $2 in +--oldarch) [ $# -ne 3 ] && usage ;; +*) [ $# -ne 1 ] && usage ;; +esac + +ARGV1=$1 +ARGV2=$2 +ARGV3=$3 + +. /etc/profile || exit 1 + +if [ ${EUID:-0} -ne 0 -a "${EPREFIX}" = '' ] ; then + echo "${0##*/}: Must be root." + exit 1 +fi + +# make sure the files come out sane +umask 0022 + +OLDCHOST= +[ "${ARGV2}" = "--oldarch" ] && OLDCHOST=${ARGV3} + +AWKDIR="/usr/share/gcc-data" + +if [ ! -r "${AWKDIR}/fixlafiles.awk" ] ; then + echo "${0##*/}: ${AWKDIR}/fixlafiles.awk does not exist!" + exit 1 +fi + +OLDVER=${ARGV1} + +export OLDVER OLDCHOST + +echo "Scanning libtool files for hardcoded gcc library paths..." +exec gawk -f "${AWKDIR}/fixlafiles.awk" + +# vim:ts=4 diff --git a/sys-devel/gcc/files/gcc-4.9.4-bootstrap.patch b/sys-devel/gcc/files/gcc-4.9.4-bootstrap.patch new file mode 100644 index 00000000..aed1ad0e --- /dev/null +++ b/sys-devel/gcc/files/gcc-4.9.4-bootstrap.patch @@ -0,0 +1,66 @@ +From 41a4aa66eac45c8862a79351647ec06dd03bd1f5 Mon Sep 17 00:00:00 2001 +From: jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> +Date: Sat, 13 Dec 2014 11:24:37 +0000 +Subject: [PATCH] PR bootstrap/64023 * Makefile.tpl + (EXTRA_TARGET_FLAGS): Set STAGE1_LDFLAGS to POSTSTAGE1_LDFLAGS and + STAGE1_LIBS to POSTSTAGE1_LIBS. Add -B to libstdc++-v3/src/.libs and + libstdc++-v3/libsupc++/.libs to CXX. * Makefile.in: Regenerated. + +git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@218705 138bc75d-0d04-0410-961f-82ee72b054a4 +--- + ChangeLog | 9 +++++++++ + Makefile.in | 6 +++++- + Makefile.tpl | 6 +++++- + 3 files changed, 19 insertions(+), 2 deletions(-) + +diff --git a/Makefile.in b/Makefile.in +index ba5ae4c2ecb..8ffc313f157 100644 +--- a/Makefile.in ++++ b/Makefile.in +@@ -835,7 +835,9 @@ EXTRA_TARGET_FLAGS = \ + 'AS=$(COMPILER_AS_FOR_TARGET)' \ + 'CC=$$(CC_FOR_TARGET) $$(XGCC_FLAGS_FOR_TARGET) $$(TFLAGS)' \ + 'CFLAGS=$$(CFLAGS_FOR_TARGET)' \ +- 'CXX=$$(CXX_FOR_TARGET) $$(XGCC_FLAGS_FOR_TARGET) $$(TFLAGS)' \ ++ 'CXX=$$(CXX_FOR_TARGET) -B$$r/$$(TARGET_SUBDIR)/libstdc++-v3/src/.libs \ ++ -B$$r/$$(TARGET_SUBDIR)/libstdc++-v3/libsupc++/.libs \ ++ $$(XGCC_FLAGS_FOR_TARGET) $$(TFLAGS)' \ + 'CXXFLAGS=$$(CXXFLAGS_FOR_TARGET)' \ + 'DLLTOOL=$$(DLLTOOL_FOR_TARGET)' \ + 'GCJ=$$(GCJ_FOR_TARGET) $$(XGCC_FLAGS_FOR_TARGET) $$(TFLAGS)' \ +@@ -853,6 +855,8 @@ EXTRA_TARGET_FLAGS = \ + 'WINDRES=$$(WINDRES_FOR_TARGET)' \ + 'WINDMC=$$(WINDMC_FOR_TARGET)' \ + 'XGCC_FLAGS_FOR_TARGET=$(XGCC_FLAGS_FOR_TARGET)' \ ++ 'STAGE1_LDFLAGS=$$(POSTSTAGE1_LDFLAGS)' \ ++ 'STAGE1_LIBS=$$(POSTSTAGE1_LIBS)' \ + "TFLAGS=$$TFLAGS" + + TARGET_FLAGS_TO_PASS = $(BASE_FLAGS_TO_PASS) $(EXTRA_TARGET_FLAGS) +diff --git a/Makefile.tpl b/Makefile.tpl +index dcbc6b1b143..bb8227eaafa 100644 +--- a/Makefile.tpl ++++ b/Makefile.tpl +@@ -641,7 +641,9 @@ EXTRA_TARGET_FLAGS = \ + 'AS=$(COMPILER_AS_FOR_TARGET)' \ + 'CC=$$(CC_FOR_TARGET) $$(XGCC_FLAGS_FOR_TARGET) $$(TFLAGS)' \ + 'CFLAGS=$$(CFLAGS_FOR_TARGET)' \ +- 'CXX=$$(CXX_FOR_TARGET) $$(XGCC_FLAGS_FOR_TARGET) $$(TFLAGS)' \ ++ 'CXX=$$(CXX_FOR_TARGET) -B$$r/$$(TARGET_SUBDIR)/libstdc++-v3/src/.libs \ ++ -B$$r/$$(TARGET_SUBDIR)/libstdc++-v3/libsupc++/.libs \ ++ $$(XGCC_FLAGS_FOR_TARGET) $$(TFLAGS)' \ + 'CXXFLAGS=$$(CXXFLAGS_FOR_TARGET)' \ + 'DLLTOOL=$$(DLLTOOL_FOR_TARGET)' \ + 'GCJ=$$(GCJ_FOR_TARGET) $$(XGCC_FLAGS_FOR_TARGET) $$(TFLAGS)' \ +@@ -659,6 +661,8 @@ EXTRA_TARGET_FLAGS = \ + 'WINDRES=$$(WINDRES_FOR_TARGET)' \ + 'WINDMC=$$(WINDMC_FOR_TARGET)' \ + 'XGCC_FLAGS_FOR_TARGET=$(XGCC_FLAGS_FOR_TARGET)' \ ++ 'STAGE1_LDFLAGS=$$(POSTSTAGE1_LDFLAGS)' \ ++ 'STAGE1_LIBS=$$(POSTSTAGE1_LIBS)' \ + "TFLAGS=$$TFLAGS" + + TARGET_FLAGS_TO_PASS = $(BASE_FLAGS_TO_PASS) $(EXTRA_TARGET_FLAGS) +-- +2.15.0 + diff --git a/sys-devel/gcc/files/gcc-configure-LANG.patch b/sys-devel/gcc/files/gcc-configure-LANG.patch new file mode 100644 index 00000000..d1b1b035 --- /dev/null +++ b/sys-devel/gcc/files/gcc-configure-LANG.patch @@ -0,0 +1,64 @@ +The LANG vars aren't reset early enough so when sed tries to use [a-zA-Z] in +option parsing, it may break. + +http://bugs.gentoo.org/103483 + +--- configure ++++ configure +@@ -54,6 +54,19 @@ + infodir='${prefix}/info' + mandir='${prefix}/man' + ++# NLS nuisances. ++for as_var in \ ++ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ ++ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ ++ LC_TELEPHONE LC_TIME ++do ++ if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then ++ eval $as_var=C; export $as_var ++ else ++ unset $as_var ++ fi ++done ++ + # Initialize some other variables. + subdirs= + MFLAGS= MAKEFLAGS= +@@ -452,16 +463,6 @@ + esac + done + +-# NLS nuisances. +-# Only set these to C if already set. These must not be set unconditionally +-# because not all systems understand e.g. LANG=C (notably SCO). +-# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'! +-# Non-C LC_CTYPE values break the ctype check. +-if test "${LANG+set}" = set; then LANG=C; export LANG; fi +-if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi +-if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi +-if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi +- + # confdefs.h avoids OS command line length limits that DEFS can exceed. + rm -rf conftest* confdefs.h + # AIX cpp loses on an empty file, so make sure it contains at least a newline. +@@ -1850,6 +1850,19 @@ + # Compiler output produced by configure, useful for debugging + # configure, is in ./config.log if it exists. + ++# NLS nuisances. ++for as_var in \ ++ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ ++ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ ++ LC_TELEPHONE LC_TIME ++do ++ if (set +x; test -z "`(eval \$as_var=C; export \$as_var) 2>&1`"); then ++ eval \$as_var=C; export \$as_var ++ else ++ unset \$as_var ++ fi ++done ++ + ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]" + for ac_option + do diff --git a/sys-devel/gcc/files/gcc-configure-texinfo.patch b/sys-devel/gcc/files/gcc-configure-texinfo.patch new file mode 100644 index 00000000..ddc098dd --- /dev/null +++ b/sys-devel/gcc/files/gcc-configure-texinfo.patch @@ -0,0 +1,16 @@ +Chances are quite good that the installed makeinfo is sufficient. +So ignore false positives where the makeinfo installed is so new +that it violates the cheesy version grep. + +http://bugs.gentoo.org/198182 + +--- configure ++++ configure +@@ -3573,6 +3573,6 @@ + : + else +- MAKEINFO="$MISSING makeinfo" ++ : + fi + ;; + diff --git a/sys-devel/gcc/files/gcc-spec-env-r1.patch b/sys-devel/gcc/files/gcc-spec-env-r1.patch new file mode 100644 index 00000000..a5892683 --- /dev/null +++ b/sys-devel/gcc/files/gcc-spec-env-r1.patch @@ -0,0 +1,87 @@ +2013-08-22 Magnus Granberg <zorry@gentoo.org> + + * gcc/gcc.c (main): Add support for external spec file via the GCC_SPECS env var + and move the process of the user specifed specs. + + This allows us to easily control pie/ssp defaults with gcc-config profiles. + Original patch by Rob Holland + Extended to support multiple entries separated by ':' by Kevin F. Quinn + Modified to use getenv instead of poisoned GET_ENVIRONMENT by Ryan Hill + Modified to process the GCC_SPECS env var befor DRIVER_SELF_SPECS by Magnus Granberg + +--- gcc-4.8-20130210/gcc/gcc.c 2013-02-05 16:55:31.000000000 +0100 ++++ gcc-4.8-20130210-work/gcc/gcc.c 2013-07-26 02:32:14.625089864 +0200 +@@ -6427,6 +6428,48 @@ main (int argc, char **argv) + do_option_spec (option_default_specs[i].name, + option_default_specs[i].spec); + ++#if !(defined (__MSDOS__) || defined (OS2) || defined (VMS) || defined (WIN32)) ++ /* Add specs listed in GCC_SPECS. Note; in the process of separating ++ * each spec listed, the string is overwritten at token boundaries ++ * (':') with '\0', an effect of strtok_r(). ++ */ ++ specs_file = getenv ("GCC_SPECS"); ++ if (specs_file && (strlen(specs_file) > 0)) ++ { ++ char *spec, *saveptr; ++ for (spec=strtok_r(specs_file,":",&saveptr); ++ spec!=NULL; ++ spec=strtok_r(NULL,":",&saveptr)) ++ { ++ struct user_specs *user = (struct user_specs *) ++ xmalloc (sizeof (struct user_specs)); ++ user->next = (struct user_specs *) 0; ++ user->filename = spec; ++ if (user_specs_tail) ++ user_specs_tail->next = user; ++ else ++ user_specs_head = user; ++ user_specs_tail = user; ++ } ++ } ++#endif ++ /* Process any user specified specs in the order given on the command ++ * line. */ ++ for (uptr = user_specs_head; uptr; uptr = uptr->next) ++ { ++ char *filename = find_a_file (&startfile_prefixes, uptr->filename, ++ R_OK, true); ++ read_specs (filename ? filename : uptr->filename, false, true); ++ } ++ /* Process any user self specs. */ ++ { ++ struct spec_list *sl; ++ for (sl = specs; sl; sl = sl->next) ++ if (sl->name_len == sizeof "self_spec" - 1 ++ && !strcmp (sl->name, "self_spec")) ++ do_self_spec (*sl->ptr_spec); ++ } ++ + /* Process DRIVER_SELF_SPECS, adding any new options to the end + of the command line. */ + +@@ -6535,24 +6578,6 @@ main (int argc, char **argv) + PREFIX_PRIORITY_LAST, 0, 1); + } + +- /* Process any user specified specs in the order given on the command +- line. */ +- for (uptr = user_specs_head; uptr; uptr = uptr->next) +- { +- char *filename = find_a_file (&startfile_prefixes, uptr->filename, +- R_OK, true); +- read_specs (filename ? filename : uptr->filename, false, true); +- } +- +- /* Process any user self specs. */ +- { +- struct spec_list *sl; +- for (sl = specs; sl; sl = sl->next) +- if (sl->name_len == sizeof "self_spec" - 1 +- && !strcmp (sl->name, "self_spec")) +- do_self_spec (*sl->ptr_spec); +- } +- + if (compare_debug) + { + enum save_temps save; diff --git a/sys-devel/gcc/files/gcc-spec-env.patch b/sys-devel/gcc/files/gcc-spec-env.patch new file mode 100644 index 00000000..57e7567e --- /dev/null +++ b/sys-devel/gcc/files/gcc-spec-env.patch @@ -0,0 +1,42 @@ + Add support for external spec file via the GCC_SPECS env var. This + allows us to easily control pie/ssp defaults with gcc-config profiles. + + Original patch by Rob Holland + Extended to support multiple entries separated by ':' by Kevin F. Quinn + Modified to use getenv instead of poisoned GET_ENVIRONMENT by Ryan Hill + +--- gcc-4/gcc/gcc.c ++++ gcc-4/gcc/gcc.c +@@ -6482,6 +6482,32 @@ + + /* Process any user specified specs in the order given on the command + line. */ ++#if !(defined (__MSDOS__) || defined (OS2) || defined (VMS) || defined (WIN32)) ++ /* Add specs listed in GCC_SPECS. Note; in the process of separating ++ * each spec listed, the string is overwritten at token boundaries ++ * (':') with '\0', an effect of strtok_r(). ++ */ ++ specs_file = getenv ("GCC_SPECS"); ++ if (specs_file && (strlen(specs_file) > 0)) ++ { ++ char *spec, *saveptr; ++ for (spec=strtok_r(specs_file,":",&saveptr); ++ spec!=NULL; ++ spec=strtok_r(NULL,":",&saveptr)) ++ { ++ struct user_specs *user = (struct user_specs *) ++ xmalloc (sizeof (struct user_specs)); ++ ++ user->next = (struct user_specs *) 0; ++ user->filename = spec; ++ if (user_specs_tail) ++ user_specs_tail->next = user; ++ else ++ user_specs_head = user; ++ user_specs_tail = user; ++ } ++ } ++#endif + for (uptr = user_specs_head; uptr; uptr = uptr->next) + { + char *filename = find_a_file (&startfile_prefixes, uptr->filename, diff --git a/sys-devel/gcc/gcc-8.2.0-r1337.ebuild b/sys-devel/gcc/gcc-8.2.0-r1337.ebuild new file mode 100644 index 00000000..602acddf --- /dev/null +++ b/sys-devel/gcc/gcc-8.2.0-r1337.ebuild @@ -0,0 +1,20 @@ +# Copyright 1999-2018 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI="5" + +PATCH_VER="1.6" +#UCLIBC_VER="1.0" + +inherit toolchain + +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~x86-fbsd" + +RDEPEND="" +DEPEND="${RDEPEND} + elibc_glibc? ( >=sys-libs/glibc-2.13 ) + >=${CATEGORY}/binutils-2.20" + +if [[ ${CATEGORY} != cross-* ]] ; then + PDEPEND="${PDEPEND} elibc_glibc? ( >=sys-libs/glibc-2.13 )" +fi diff --git a/sys-devel/gede/Manifest b/sys-devel/gede/Manifest deleted file mode 100644 index 07f28d55..00000000 --- a/sys-devel/gede/Manifest +++ /dev/null @@ -1 +0,0 @@ -DIST gede-2.7.4.tar.xz 74772 BLAKE2B 0f45293ff2c0ff5a651a734db1428b36c5043dc7dd10181bce7daeb9d61c250809489d5bc7adf522f3299c1b69a8a03f970e75713464a450d8b6499f54fb6cd3 SHA512 bb023c2e2c434affd24e7b9d28e9213e77c2e2f22d4fb472e7b2906fd0193916d993df5ca00d7df4a33bda7e1e36318295d092f913b114bd9248ac73d178a818 diff --git a/sys-devel/gede/gede-2.7.4.ebuild b/sys-devel/gede/gede-2.7.4.ebuild deleted file mode 100644 index f8ff009a..00000000 --- a/sys-devel/gede/gede-2.7.4.ebuild +++ /dev/null @@ -1,37 +0,0 @@ -# Copyright 1999-2018 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 - -EAPI=6 -inherit eutils qmake-utils - -DESCRIPTION="A graphical frontend (GUI) to GDB written in C++ and using the Qt4 (or Qt5) toolkit" -HOMEPAGE="http://gede.acidron.com/" -SRC_URI="http://gede.acidron.com/uploads/source/${P}.tar.xz" - -LICENSE="BSD" -SLOT="0" -KEYWORDS="~amd64" -IUSE="" - -DEPEND=" - dev-qt/qtcore:5 - dev-qt/qtgui:5 - dev-qt/qtwidgets:5" -RDEPEND="${DEPEND} - sys-devel/gdb" - -S="${WORKDIR}"/"${P}"/src - -src_configure() { - eqmake5 PREFIX="${EPREFIX}/usr" gd.pro -} - -src_install() { - # install the binary - dodir usr/bin - exeinto usr/bin - doexe ${PN} - # TODO - # install icon - # install desktop file -} diff --git a/sys-devel/libtool/Manifest b/sys-devel/libtool/Manifest new file mode 100644 index 00000000..4f2d5bac --- /dev/null +++ b/sys-devel/libtool/Manifest @@ -0,0 +1 @@ +DIST libtool-2.4.6.tar.xz 973080 BLAKE2B 0865af9f8701ca9dc62eec8294a088d24f4a3ff541bc76acfe7b69f70637d7e8261a17d69f7d54a4177f974c429be68467883a1560edb539061966cbf7d4a356 SHA512 a6eef35f3cbccf2c9e2667f44a476ebc80ab888725eb768e91a3a6c33b8c931afc46eb23efaee76c8696d3e4eed74ab1c71157bcb924f38ee912c8a90a6521a4 diff --git a/sys-devel/libtool/files/libtool-2.2.10-eprefix.patch b/sys-devel/libtool/files/libtool-2.2.10-eprefix.patch new file mode 100644 index 00000000..c4693ee7 --- /dev/null +++ b/sys-devel/libtool/files/libtool-2.2.10-eprefix.patch @@ -0,0 +1,11 @@ +--- a/m4/libtool.m4 ++++ b/m4/libtool.m4 +@@ -2087,7 +2087,7 @@ + mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\ + $SED 's,/\([[A-Za-z]]:\),\1,g'` ;; + esac +- sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP` ++ sys_lib_search_path_spec=`$ECHO "@GENTOO_PORTAGE_EPREFIX@/lib @GENTOO_PORTAGE_EPREFIX@/usr/lib $lt_search_path_spec" | $lt_NL2SP` + else + sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" + fi]) diff --git a/sys-devel/libtool/files/libtool-2.2.6a-darwin-module-bundle.patch b/sys-devel/libtool/files/libtool-2.2.6a-darwin-module-bundle.patch new file mode 100644 index 00000000..c6b63ed3 --- /dev/null +++ b/sys-devel/libtool/files/libtool-2.2.6a-darwin-module-bundle.patch @@ -0,0 +1,24 @@ +In Gentoo Prefix we go by Apple's convention to give modules the .bundle +extension. +http://developer.apple.com/documentation/DeveloperTools/Conceptual/XcodeBuildSystem/500-Linking/bs_linking.html +(Above link was removed by Apple, the link below contains a copy: +http://disanji.net/iOS_Doc/#documentation/DeveloperTools/Conceptual/XcodeBuildSystem/500-Linking/bs_linking.html, +in case it disappears also, the relevant quote: + +Bundle. Bundles are executable files that can be loaded at runtime by +other products. Plug-ins are implemented using bundles. The term bundle +in this context refers to the binary itself, not to a structured +hierarchy. Bundles have the .bundle extension; for example, +MyBundle.bundle.) + +--- libltdl/m4/libtool.m4 ++++ libltdl/m4/libtool.m4 +@@ -2271,7 +2271,7 @@ + soname_spec='${libname}${release}${major}$shared_ext' + shlibpath_overrides_runpath=yes + shlibpath_var=DYLD_LIBRARY_PATH +- shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' ++ shrext_cmds='`test .$module = .yes && echo .bundle || echo .dylib`' + m4_if([$1], [],[ + sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib"]) + sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' diff --git a/sys-devel/libtool/files/libtool-2.4.3-use-linux-version-in-fbsd.patch b/sys-devel/libtool/files/libtool-2.4.3-use-linux-version-in-fbsd.patch new file mode 100644 index 00000000..8244eaa7 --- /dev/null +++ b/sys-devel/libtool/files/libtool-2.4.3-use-linux-version-in-fbsd.patch @@ -0,0 +1,38 @@ +Force linux-style versioning when generating shared libraries on +Gentoo/FreeBSD hosts only. + +Patch by Diego Elio Pettenò + +http://bugs.gentoo.org/109105 + +--- a/m4/libtool.m4 ++++ b/m4/libtool.m4 +@@ -1375,7 +1375,14 @@ + *) objformat=elf ;; + esac + fi +- version_type=freebsd-$objformat ++ # Handle Gentoo/FreeBSD as it was Linux ++ case $host_vendor in ++ gentoo) ++ version_type=linux ;; ++ *) ++ version_type=freebsd-$objformat ;; ++ esac ++ + case $version_type in + freebsd-elf*) + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' +@@ -1386,6 +1392,12 @@ + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' + need_version=yes + ;; ++ linux) ++ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' ++ soname_spec='${libname}${release}${shared_ext}$major' ++ need_lib_prefix=no ++ need_version=no ++ ;; + esac + shlibpath_var=LD_LIBRARY_PATH + case $host_os in diff --git a/sys-devel/libtool/files/libtool-2.4.6-darwin-use-linux-version.patch b/sys-devel/libtool/files/libtool-2.4.6-darwin-use-linux-version.patch new file mode 100644 index 00000000..b4409815 --- /dev/null +++ b/sys-devel/libtool/files/libtool-2.4.6-darwin-use-linux-version.patch @@ -0,0 +1,13 @@ +* revert old 1.5 behaviour + +--- libtool-2.4.6/m4/libtool.m4 ++++ libtool-2.4.6/m4/libtool.m4 +@@ -2272,7 +2272,7 @@ + version_type=darwin + need_lib_prefix=no + need_version=no +- library_names_spec='$libname$release$major$shared_ext $libname$shared_ext' ++ library_names_spec='$libname$release$versuffix$shared_ext $libname$release$major$shared_ext $libname$shared_ext' + soname_spec='$libname$release$major$shared_ext' + shlibpath_overrides_runpath=yes + shlibpath_var=DYLD_LIBRARY_PATH diff --git a/sys-devel/libtool/files/libtool-2.4.6-libtoolize-delay-help.patch b/sys-devel/libtool/files/libtool-2.4.6-libtoolize-delay-help.patch new file mode 100644 index 00000000..974cd44d --- /dev/null +++ b/sys-devel/libtool/files/libtool-2.4.6-libtoolize-delay-help.patch @@ -0,0 +1,53 @@ +https://lists.gnu.org/archive/html/libtool-patches/2016-02/msg00002.html + +From 53419307d5b44e5b0cff80d76f88ea02f237b747 Mon Sep 17 00:00:00 2001 +From: Mike Frysinger <vapier@gentoo.org> +Date: Sat, 13 Feb 2016 03:32:20 -0500 +Subject: [PATCH] libtoolize: don't execute automake and autoconf on every + invocation. + +Same fix as applied to libtool in commit 408cfb9c5fa8a666917167ffb806cb +to delay use of automake/autoconf to when the --help option is actually +specified. + +* libtoolize.in (func_help): Override func_help() from +gl/build-aux/options-parser to only run automake --version and +autoconf --version when libtool --help is executed on the command +line. +--- + libtoolize.in | 12 +++++++++--- + 1 file changed, 9 insertions(+), 3 deletions(-) + +diff --git a/libtoolize.in b/libtoolize.in +index 3fe61ce..0d4af3d 100644 +--- a/libtoolize.in ++++ b/libtoolize.in +@@ -94,7 +94,12 @@ usage_message="Options: + " + + # Additional text appended to 'usage_message' in response to '--help'. +-long_help_message=$long_help_message" ++func_help () ++{ ++ $debug_cmd ++ ++ func_usage_message ++ $ECHO "$long_help_message + 'environment' show warnings about LIBTOOLIZE_OPTIONS content + 'file' show warnings about file copying and linking + +@@ -120,8 +125,9 @@ include the following information: + + Report bugs to <@PACKAGE_BUGREPORT@>. + GNU @PACKAGE@ home page: <@PACKAGE_URL@>. +-General help using GNU software: <http://www.gnu.org/gethelp/>. +-" ++General help using GNU software: <http://www.gnu.org/gethelp/>." ++ exit 0 ++} + + warning_categories='environment file' + +-- +2.6.2 + diff --git a/sys-devel/libtool/files/libtool-2.4.6-libtoolize-slow.patch b/sys-devel/libtool/files/libtool-2.4.6-libtoolize-slow.patch new file mode 100644 index 00000000..d27f976c --- /dev/null +++ b/sys-devel/libtool/files/libtool-2.4.6-libtoolize-slow.patch @@ -0,0 +1,118 @@ +From 351a88feee66eda6ce33eb06acdebb8e9c6d6716 Mon Sep 17 00:00:00 2001 +From: Pavel Raiskup <praiskup@redhat.com> +Date: Fri, 18 Sep 2015 23:17:07 +0200 +Subject: [PATCH] libtoolize: fix infinite recursion in m4 + +Some projects use this construct in configure.ac: + + m4_define([version], m4_include([version])) + pkg_version=version + +When the m4_include builtin is undefined (as was done in +libtoolize and extract-trace scripts), the call to this 'version' +macro enters an infinite recursion (until ENOMEM). So rather +re-define all potentially dangerous macros by empty strings, +suggested by Eric Blake. + +While we are on it, merge the macro-"blacklist" with similar list +implemented in gettext, except for 'm4_esyscmd'. It's kept +defined because we already trace AC_INIT macro for package +version, while it is often specified by +m4_esyscmd(git-version-gen). Similarly to m4_include, m4_esyscmd +might be opt-in-blacklisted in future. + +References: +http://lists.gnu.org/archive/html/libtool/2015-09/msg00000.html +https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=764580 + +* gl/build-aux/extract-trace (_G_mini): Redefine trace-breaking +macros to empty strings rather than undefining those. Use 'dnl' +for comments. +* bootstrap: Likewise, sync with extract-trace. +* NEWS: Document. +* NO-THANKS: Mention Hiroyuki Sato. + +Signed-off-by: Pavel Raiskup <praiskup@redhat.com> +--- + NEWS | 4 ++++ + NO-THANKS | 1 + + bootstrap | 42 +++++++++++++++++++++++++++--------------- + build-aux/extract-trace | 42 +++++++++++++++++++++++++++--------------- + 4 files changed, 59 insertions(+), 30 deletions(-) + +diff --git a/gl/build-aux/extract-trace b/gl/build-aux/extract-trace +index 315a32a..c6abd21 100755 +--- a/build-aux/extract-trace ++++ b/build-aux/extract-trace +@@ -329,29 +329,41 @@ func_extract_trace () + # arguments to Autocof functions, but without following + # 'm4_s?include' files. + _G_mini=' +- # Initialisation. ++ dnl Initialisation. + m4_changequote([,]) + m4_define([m4_copy], [m4_define([$2], m4_defn([$1]))]) + m4_define([m4_rename], [m4_copy([$1], [$2])m4_undefine([$1])]) + +- # Disable these macros. +- m4_undefine([m4_dnl]) +- m4_undefine([m4_include]) +- m4_undefine([m4_m4exit]) +- m4_undefine([m4_m4wrap]) +- m4_undefine([m4_maketemp]) ++ dnl Replace macros which may abort m4 with a no-op variant. ++ m4_pushdef([m4_assert]) ++ m4_pushdef([m4_exit]) ++ m4_pushdef([m4_fatal]) ++ m4_pushdef([m4_m4exit]) + +- # Copy and rename macros not handled by "m4 --prefix". ++ dnl Replace macros that might break stderr of m4. ++ m4_pushdef([m4_errprint]) ++ m4_pushdef([m4_errprintn]) ++ m4_pushdef([m4_include]) ++ m4_pushdef([m4_warn]) ++ ++ dnl Avoid side-effects of tracing by extract-trace. ++ m4_pushdef([m4_maketemp]) ++ m4_pushdef([m4_mkstemp]) ++ ++ dnl TODO: reasons for this ++ m4_pushdef([m4_dnl]) ++ m4_pushdef([m4_m4wrap]) ++ ++ dnl Copy and rename macros not handled by "m4 --prefix". + m4_define([dnl], [m4_builtin([dnl])]) + m4_copy([m4_define], [m4_defun]) + m4_rename([m4_ifelse], [m4_if]) +- m4_ifdef([m4_mkstemp], [m4_undefine([m4_mkstemp])]) + m4_rename([m4_patsubst], [m4_bpatsubst]) + m4_rename([m4_regexp], [m4_bregexp]) + +- # "m4sugar.mini" - useful m4-time macros for dynamic arguments. +- # If we discover packages that need more m4 macros defined in +- # order to bootstrap correctly, add them here: ++ dnl "m4sugar.mini" - useful m4-time macros for dynamic arguments. ++ dnl If we discover packages that need more m4 macros defined in ++ dnl order to bootstrap correctly, add them here: + m4_define([m4_bmatch], + [m4_if([$#], 0, [], [$#], 1, [], [$#], 2, [$2], + [m4_if(m4_bregexp([$1], [$2]), -1, +@@ -362,11 +374,11 @@ func_extract_trace () + m4_define([m4_require], [$1]) + m4_define([m4_shift3], [m4_shift(m4shift(m4shift($@)))]) + +- # "autoconf.mini" - things from autoconf macros we care about. ++ dnl "autoconf.mini" - things from autoconf macros we care about. + m4_copy([m4_defun], [AC_DEFUN]) + +- # Dummy definitions for the macros we want to trace. +- # AM_INIT_AUTOMAKE at least produces no trace without this. ++ dnl Dummy definitions for the macros we want to trace. ++ dnl AM_INIT_AUTOMAKE at least produces no trace without this. + ' + + _G_save=$IFS +-- +2.6.2 + diff --git a/sys-devel/libtool/files/libtool-2.4.6-link-fsanitize.patch b/sys-devel/libtool/files/libtool-2.4.6-link-fsanitize.patch new file mode 100644 index 00000000..c1ea8a82 --- /dev/null +++ b/sys-devel/libtool/files/libtool-2.4.6-link-fsanitize.patch @@ -0,0 +1,58 @@ +https://bugs.gentoo.org/573744 + +From a5c6466528c060cc4660ad0319c00740db0e42ba Mon Sep 17 00:00:00 2001 +From: Jeremy Huddleston Sequoia <jeremyhu@macports.org> +Date: Sun, 18 Oct 2015 21:55:39 -0700 +Subject: [PATCH] libtool: fix GCC/clang linking with -fsanitize=* + +References: +https://lists.gnu.org/archive/html/libtool/2014-04/msg00026.html + +* build-aux/ltmain.in (func_mode_link): Pass -fsanitize=* to the +linker to allow trivial use of the clang address sanitizer. + +Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@macports.org> +Copyright-paperwork-exempt: Yes +--- + build-aux/ltmain.in | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/build-aux/ltmain.in b/build-aux/ltmain.in +index 1cbe875..2a5aaad 100644 +--- a/build-aux/ltmain.in ++++ b/build-aux/ltmain.in +@@ -5382,10 +5382,11 @@ func_mode_link () + # -O*, -g*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization + # -specs=* GCC specs files + # -stdlib=* select c++ std lib with clang ++ # -fsanitize=* Clang/GCC memory and address sanitizer + -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \ + -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \ + -O*|-g*|-flto*|-fwhopr*|-fuse-linker-plugin|-fstack-protector*|-stdlib=*| \ +- -specs=*) ++ -specs=*|-fsanitize=*) + func_quote_for_eval "$arg" + arg=$func_quote_for_eval_result + func_append compile_command " $arg" + +patch the generated file too to keep help2man from generating man pages +https://bugs.gentoo.org/556512 + +--- a/build-aux/ltmain.sh ++++ b/build-aux/ltmain.sh +@@ -5382,10 +5382,11 @@ func_mode_link () + # -O*, -g*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization + # -specs=* GCC specs files + # -stdlib=* select c++ std lib with clang ++ # -fsanitize=* Clang/GCC memory and address sanitizer + -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \ + -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \ + -O*|-g*|-flto*|-fwhopr*|-fuse-linker-plugin|-fstack-protector*|-stdlib=*| \ +- -specs=*) ++ -specs=*|-fsanitize=*) + func_quote_for_eval "$arg" + arg=$func_quote_for_eval_result + func_append compile_command " $arg" +-- +2.6.2 + diff --git a/sys-devel/libtool/files/libtool-2.4.6-link-fuse-ld.patch b/sys-devel/libtool/files/libtool-2.4.6-link-fuse-ld.patch new file mode 100644 index 00000000..55ec5ae9 --- /dev/null +++ b/sys-devel/libtool/files/libtool-2.4.6-link-fuse-ld.patch @@ -0,0 +1,54 @@ +https://lists.gnu.org/archive/html/libtool-patches/2015-03/msg00000.html +https://lists.gnu.org/archive/html/libtool-patches/2016-02/msg00001.html + +From 2f258b87ce4415edede1b2a84a3a7dbcf44555c2 Mon Sep 17 00:00:00 2001 +From: Mike Frysinger <vapier@gentoo.org> +Date: Mon, 16 Mar 2015 18:17:31 -0400 +Subject: [PATCH] libtool: pass through -fuse-ld flags + +Starting with gcc-4.8, there's a -fuse-ld flag that can be used to select +between bfd & gold. Make sure we pass it through to the linking stage. + +* build-aux/ltmain.in (func_mode_link): Pass -fuse-ld=* flags through. +--- + build-aux/ltmain.in | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/build-aux/ltmain.in b/build-aux/ltmain.in +index 2a5aaad..4c24d5d 100644 +--- a/build-aux/ltmain.in ++++ b/build-aux/ltmain.in +@@ -5383,10 +5383,11 @@ func_mode_link () + # -specs=* GCC specs files + # -stdlib=* select c++ std lib with clang + # -fsanitize=* Clang/GCC memory and address sanitizer ++ # -fuse-ld=* Linker select flags for GCC + -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \ + -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \ + -O*|-g*|-flto*|-fwhopr*|-fuse-linker-plugin|-fstack-protector*|-stdlib=*| \ +- -specs=*|-fsanitize=*) ++ -specs=*|-fsanitize=*|-fuse-ld=*) + func_quote_for_eval "$arg" + arg=$func_quote_for_eval_result + func_append compile_command " $arg" + +patch the generated file too to keep help2man from generating man pages +https://bugs.gentoo.org/556512 + +--- a/build-aux/ltmain.sh ++++ b/build-aux/ltmain.sh +@@ -5383,10 +5383,11 @@ func_mode_link () + # -specs=* GCC specs files + # -stdlib=* select c++ std lib with clang + # -fsanitize=* Clang/GCC memory and address sanitizer ++ # -fuse-ld=* Linker select flags for GCC + -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \ + -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \ + -O*|-g*|-flto*|-fwhopr*|-fuse-linker-plugin|-fstack-protector*|-stdlib=*| \ +- -specs=*|-fsanitize=*) ++ -specs=*|-fsanitize=*|-fuse-ld=*) + func_quote_for_eval "$arg" + arg=$func_quote_for_eval_result + func_append compile_command " $arg" +-- +2.3.2 diff --git a/sys-devel/libtool/files/libtool-2.4.6-link-specs.patch b/sys-devel/libtool/files/libtool-2.4.6-link-specs.patch new file mode 100644 index 00000000..a8fbf28f --- /dev/null +++ b/sys-devel/libtool/files/libtool-2.4.6-link-specs.patch @@ -0,0 +1,57 @@ +From 702a97fbb09bd7088a50f2b239016d1e32843c24 Mon Sep 17 00:00:00 2001 +From: Pavel Raiskup <praiskup@redhat.com> +Date: Fri, 18 Sep 2015 10:36:43 +0200 +Subject: [PATCH] libtool: fix GCC linking with -specs=* + +References: +https://bugzilla.redhat.com/show_bug.cgi?id=985592 + +* build-aux/ltmain.in (func_mode_link): Pass -specs=* +to the linker, Fedora uses this option for hardening. + +Signed-off-by: Pavel Raiskup <praiskup@redhat.com> +--- + build-aux/ltmain.in | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/build-aux/ltmain.in b/build-aux/ltmain.in +index d5cf07a..0c40da0 100644 +--- a/build-aux/ltmain.in ++++ b/build-aux/ltmain.in +@@ -5360,10 +5360,12 @@ func_mode_link () + # -tp=* Portland pgcc target processor selection + # --sysroot=* for sysroot support + # -O*, -g*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization ++ # -specs=* GCC specs files + # -stdlib=* select c++ std lib with clang + -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \ + -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \ +- -O*|-g*|-flto*|-fwhopr*|-fuse-linker-plugin|-fstack-protector*|-stdlib=*) ++ -O*|-g*|-flto*|-fwhopr*|-fuse-linker-plugin|-fstack-protector*|-stdlib=*| \ ++ -specs=*) + func_quote_for_eval "$arg" + arg=$func_quote_for_eval_result + func_append compile_command " $arg" + +patch the generated file too to keep help2man from generating man pages +https://bugs.gentoo.org/556512 + +--- a/build-aux/ltmain.sh ++++ b/build-aux/ltmain.sh +@@ -5360,10 +5360,12 @@ func_mode_link () + # -tp=* Portland pgcc target processor selection + # --sysroot=* for sysroot support + # -O*, -g*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization ++ # -specs=* GCC specs files + # -stdlib=* select c++ std lib with clang + -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \ + -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \ +- -O*|-g*|-flto*|-fwhopr*|-fuse-linker-plugin|-fstack-protector*|-stdlib=*) ++ -O*|-g*|-flto*|-fwhopr*|-fuse-linker-plugin|-fstack-protector*|-stdlib=*| \ ++ -specs=*) + func_quote_for_eval "$arg" + arg=$func_quote_for_eval_result + func_append compile_command " $arg" +-- +2.6.2 + diff --git a/sys-devel/libtool/files/libtool-2.4.6-mint.patch b/sys-devel/libtool/files/libtool-2.4.6-mint.patch new file mode 100644 index 00000000..341a0f02 --- /dev/null +++ b/sys-devel/libtool/files/libtool-2.4.6-mint.patch @@ -0,0 +1,49 @@ +Patch by Alan Hourihane + +http://bugs.gentoo.org/show_bug.cgi?id=266984 + +diff -ur libtool-2.2.6/configure libtool-2.2.6-mint/configure +--- libtool-2.2.6/configure 2008-09-07 17:52:50.000000000 +0000 ++++ libtool-2.2.6/configure 2009-04-21 08:49:27.000000000 +0000 +@@ -4986,6 +4986,11 @@ + lt_cv_sys_max_cmd_len=8192; + ;; + ++ mint*) ++ # On MiNT this can take a long time and run out of memory. ++ lt_cv_sys_max_cmd_len=8192; ++ ;; ++ + amigaos*) + # On AmigaOS with pdksh, this test takes hours, literally. + # So we just punt and use a minimum line length of 8192. +diff -ur libtool-2.2.6/libltdl/configure libtool-2.2.6-mint/libltdl/configure +--- libtool-2.2.6/libltdl/configure 2008-09-07 17:53:05.000000000 +0000 ++++ libtool-2.2.6/libltdl/configure 2009-04-21 08:50:08.000000000 +0000 +@@ -4422,6 +4422,11 @@ + lt_cv_sys_max_cmd_len=8192; + ;; + ++ mint*) ++ # On MiNT this can take a long time and run out of memory. ++ lt_cv_sys_max_cmd_len=8192; ++ ;; ++ + amigaos*) + # On AmigaOS with pdksh, this test takes hours, literally. + # So we just punt and use a minimum line length of 8192. +diff -ur libtool-2.2.6/libltdl/m4/libtool.m4 libtool-2.2.6-mint/libltdl/m4/libtool.m4 +--- libtool-2.2.6/m4/libtool.m4 2008-09-05 11:54:41.000000000 +0000 ++++ libtool-2.2.6/m4/libtool.m4 2009-04-21 08:50:26.000000000 +0000 +@@ -1527,6 +1527,11 @@ + lt_cv_sys_max_cmd_len=8192; + ;; + ++ mint*) ++ # On MiNT this can take a long time and run out of memory. ++ lt_cv_sys_max_cmd_len=8192; ++ ;; ++ + amigaos*) + # On AmigaOS with pdksh, this test takes hours, literally. + # So we just punt and use a minimum line length of 8192. diff --git a/sys-devel/libtool/files/libtool-2.4.6-ppc64le.patch b/sys-devel/libtool/files/libtool-2.4.6-ppc64le.patch new file mode 100644 index 00000000..78d86c72 --- /dev/null +++ b/sys-devel/libtool/files/libtool-2.4.6-ppc64le.patch @@ -0,0 +1,111 @@ +From 020afd7d6410f73bc205206abe1b88b4890b83b1 Mon Sep 17 00:00:00 2001 +From: Leno Hou <lenohou@gmail.com> +Date: Sun, 24 Apr 2016 00:46:53 +0800 +Subject: [PATCH] [m4/libtool.m4] linker error for powerpc64le-unknown-linux-gnu + +Hi all, + + 1) As we might know, Gentoo has powerpc64le-unknown-linux-gnu compiler + +leno@localhost ~ $ powerpc64le-unknown-linux-gnu-gcc -v + +Using built-in specs. + +COLLECT_GCC=/usr/powerpc64le-unknown-linux-gnu/gcc-bin/5.3.0/powerpc64le-unknown-linux-gnu-gcc + +COLLECT_LTO_WRAPPER=/usr/libexec/gcc/powerpc64le-unknown-linux-gnu/5.3.0/lto-wrapper + +Target: powerpc64le-unknown-linux-gnu + +Configured with: +/var/tmp/portage/sys-devel/gcc-5.3.0/work/gcc-5.3.0/configure +--host=powerpc64le-unknown-linux-gnu --build=powerpc64le-unknown-linux-gnu +--prefix=/usr --bindir=/usr/powerpc64le-unknown-linux-gnu/gcc-bin/5.3.0 +--includedir=/usr/lib/gcc/powerpc64le-unknown-linux-gnu/5.3.0/include +--datadir=/usr/share/gcc-data/powerpc64le-unknown-linux-gnu/5.3.0 +--mandir=/usr/share/gcc-data/powerpc64le-unknown-linux-gnu/5.3.0/man +--infodir=/usr/share/gcc-data/powerpc64le-unknown-linux-gnu/5.3.0/info +--with-gxx-include-dir=/usr/lib/gcc/powerpc64le-unknown-linux-gnu/5.3.0/include/g++-v5 +--with-python-dir=/share/gcc-data/powerpc64le-unknown-linux-gnu/5.3.0/python +--enable-languages=c,c++,fortran --enable-obsolete --enable-secureplt +--disable-werror --with-system-zlib --enable-nls --without-included-gettext +--enable-checking=release --with-bugurl=https://bugs.gentoo.org/ +--with-pkgversion='Gentoo 5.3.0 p1.0, pie-0.6.5' --enable-libstdcxx-time +--enable-shared --enable-threads=posix --enable-__cxa_atexit +--enable-clocale=gnu --disable-multilib --enable-altivec +--disable-fixed-point --enable-targets=all --disable-libgcj +--enable-libgomp --disable-libmudflap --disable-libssp --disable-libcilkrts +--enable-lto --without-isl --enable-libsanitizer + +Thread model: posix + +gcc version 5.3.0 (Gentoo 5.3.0 p1.0, pie-0.6.5) + + 2) And the supported emulations + +leno@localhost ~ $ powerpc64le-unknown-linux-gnu-ld -V +GNU ld (Gentoo 2.25.1 p1.1) 2.25.1 + Supported emulations: + elf64lppc + elf32lppc + elf32lppclinux + elf32lppcsim + + 3) But when I set CHOST="powerpc64le-unkown-linux-gnu" in Gentoo and +execute aclocal, automake, libtoolize --copy --force, autoconf. When I +glance in the latest m4/libtool.m4 : + +if AC_TRY_EVAL(ac_compile); then + case `/usr/bin/file conftest.o` in + *32-bit*) + case $host in +... + powerpc64le-*linux*) + LD="${LD-ld} -m elf32lppclinux" + ;; + powerpc64-*linux*) + LD="${LD-ld} -m elf32ppclinux" + ;; +... + *64-bit*) + case $host in +... + powerpcle-*linux*) + LD="${LD-ld} -m elf64lppc" + ;; + powerpc-*linux*) + LD="${LD-ld} -m elf64ppc" + ;; +... + +seems linked to $LD='$LD-ld -m elf64ppc' and failed to compile packages. + + 4) Below is my workaround patch and works fine for this case. If this is +OK for you, Could this to be merged in upstream? Thanks + +URL: https://debbugs.gnu.org/23348 +URL: https://bugs.gentoo.org/581314 +--- + m4/libtool.m4 | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/m4/libtool.m4 b/m4/libtool.m4 +index ee292aff5bca..758b6951ae07 100644 +--- a/m4/libtool.m4 ++++ b/m4/libtool.m4 +@@ -1417,10 +1417,10 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*) + x86_64-*linux*) + LD="${LD-ld} -m elf_x86_64" + ;; +- powerpcle-*linux*) ++ powerpcle-*linux*|powerpc64le-*linux*) + LD="${LD-ld} -m elf64lppc" + ;; +- powerpc-*linux*) ++ powerpc-*linux*|powerpc64-*linux*) + LD="${LD-ld} -m elf64ppc" + ;; + s390*-*linux*|s390*-*tpf*) +-- +2.11.1 + diff --git a/sys-devel/libtool/files/libtool-2.4.6-pthread.patch b/sys-devel/libtool/files/libtool-2.4.6-pthread.patch new file mode 100644 index 00000000..49b81c1d --- /dev/null +++ b/sys-devel/libtool/files/libtool-2.4.6-pthread.patch @@ -0,0 +1,43 @@ +http://permalink.gmane.org/gmane.comp.gnu.libtool.patches/11704 +https://bugs.gentoo.org/650876 + +From: Pavel Raiskup <praiskup <at> redhat.com> +Subject: [PATCH] libtool: handle the -pthread{,s} options for g++ +Newsgroups: gmane.comp.gnu.libtool.patches +Date: Thursday 28th November 2013 14:18:05 UTC (over 4 years ago) + +As we are forced to pass -nostdlib to g++ for linking, this option +expectedly disables the effectiveness of passed -pthread flag - so +add the -lpthread explicitly to $deplibs to link correctly. + +References: +http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25460 +https://bugzilla.redhat.com/show_bug.cgi?id=661333 +http://lists.gnu.org/archive/html/bug-libtool/2013-01/msg00018.htm + +* build-aux/ltmain.in (func_mode_link): Explicitly add -lpthread +flag into $deplibs when -pthread is passed (for g++ only). +--- + build-aux/ltmain.in | 10 ++++++++++ + 1 file changed, 10 insertions(+) + +diff --git a/build-aux/ltmain.in b/build-aux/ltmain.in +index fba05c1..f202b80 100644 +--- a/build-aux/ltmain.in ++++ b/build-aux/ltmain.in +@@ -5113,6 +5113,16 @@ func_mode_link () + *" $arg "*) ;; + * ) func_append new_inherited_linker_flags " $arg" ;; + esac ++ ++ # As we are forced to pass -nostdlib to g++ during linking, the option ++ # -pthread{,s} is not in effect; add the -lpthread to $deplist ++ # explicitly to link correctly. ++ if test "$tagname" = CXX -a x"$with_gcc" = xyes; then ++ case "$arg" in ++ -pthread*) func_append deplibs " -lpthread" ;; ++ esac ++ fi ++ + continue + ;; diff --git a/sys-devel/libtool/files/libtool-2.4.6-pthread_bootstrapped.patch b/sys-devel/libtool/files/libtool-2.4.6-pthread_bootstrapped.patch new file mode 100644 index 00000000..54461ccc --- /dev/null +++ b/sys-devel/libtool/files/libtool-2.4.6-pthread_bootstrapped.patch @@ -0,0 +1,21 @@ +https://bugs.gentoo.org/650876 + +--- libtool-2.4.6/build-aux/ltmain.sh ++++ libtool-2.4.6/build-aux/ltmain.sh +@@ -7079,6 +7079,16 @@ + *" $arg "*) ;; + * ) func_append new_inherited_linker_flags " $arg" ;; + esac ++ ++ # As we are forced to pass -nostdlib to g++ during linking, the option ++ # -pthread{,s} is not in effect; add the -lpthread to $deplist ++ # explicitly to link correctly. ++ if test "$tagname" = CXX -a x"$with_gcc" = xyes; then ++ case "$arg" in ++ -pthread*) func_append deplibs " -lpthread" ;; ++ esac ++ fi ++ + continue + ;; + diff --git a/sys-devel/libtool/files/libtool-2.4.6-sed-quote-speedup.patch b/sys-devel/libtool/files/libtool-2.4.6-sed-quote-speedup.patch new file mode 100644 index 00000000..0eeffac7 --- /dev/null +++ b/sys-devel/libtool/files/libtool-2.4.6-sed-quote-speedup.patch @@ -0,0 +1,268 @@ +https://bugs.gentoo.org/542252 + +From 32f0df9835ac15ac17e04be57c368172c3ad1d19 Mon Sep 17 00:00:00 2001 +From: Pavel Raiskup <praiskup@redhat.com> +Date: Sun, 4 Oct 2015 21:55:03 +0200 +Subject: [PATCH] libtool: mitigate the $sed_quote_subst slowdown + +When it is reasonably possible, use shell implementation for +quoting. + +References: +http://lists.gnu.org/archive/html/libtool/2015-03/msg00005.html +http://lists.gnu.org/archive/html/libtool/2015-02/msg00000.html +https://debbugs.gnu.org/cgi/bugreport.cgi?bug=20006 + +* gl/build-aux/funclib.sh (func_quote): New function that can be +used as substitution for '$SED $sed_quote_subst' call. +* build-aux/ltmain.in (func_emit_wrapper): Use func_quote instead +of '$SED $sed_quote_subst'. +(func_mode_link): Likewise. +* NEWS: Document. +* bootstrap: Sync with funclib.sh. +--- + NEWS | 3 +++ + bootstrap | 61 +++++++++++++++++++++++++++++++++++++++++++------ + build-aux/ltmain.in | 10 ++++---- + gl/build-aux/funclib.sh | 61 +++++++++++++++++++++++++++++++++++++++++++------ + 4 files changed, 117 insertions(+), 18 deletions(-) + +diff --git a/build-aux/ltmain.in b/build-aux/ltmain.in +index 0c40da0..24acefd 100644 +--- a/build-aux/ltmain.in ++++ b/build-aux/ltmain.in +@@ -3346,7 +3346,8 @@ else + if test \"\$libtool_execute_magic\" != \"$magic\"; then + file=\"\$0\"" + +- qECHO=`$ECHO "$ECHO" | $SED "$sed_quote_subst"` ++ func_quote "$ECHO" ++ qECHO=$func_quote_result + $ECHO "\ + + # A function that is used when there is no print builtin or printf. +@@ -8596,8 +8597,8 @@ EOF + relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" + fi + done +- relink_command="(cd `pwd`; $relink_command)" +- relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"` ++ func_quote "(cd `pwd`; $relink_command)" ++ relink_command=$func_quote_result + fi + + # Only actually do things if not in dry run mode. +@@ -8843,7 +8844,8 @@ EOF + done + # Quote the link command for shipping. + relink_command="(cd `pwd`; $SHELL \"$progpath\" $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" +- relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"` ++ func_quote "$relink_command" ++ relink_command=$func_quote_result + if test yes = "$hardcode_automatic"; then + relink_command= + fi +diff --git a/gl/build-aux/funclib.sh b/gl/build-aux/funclib.sh +index 39d972e..47d8b95 100644 +--- a/build-aux/funclib.sh ++++ b/build-aux/funclib.sh +@@ -1,5 +1,5 @@ + # Set a version string for this script. +-scriptversion=2015-01-20.17; # UTC ++scriptversion=2015-10-04.22; # UTC + + # General shell script boiler plate, and helper functions. + # Written by Gary V. Vaughan, 2004 +@@ -1026,6 +1026,57 @@ func_relative_path () + } + + ++# func_quote ARG ++# -------------- ++# Aesthetically quote one ARG, store the result into $func_quote_result. Note ++# that we keep attention to performance here (so far O(N) complexity as long as ++# func_append is O(1)). ++func_quote () ++{ ++ $debug_cmd ++ ++ func_quote_result=$1 ++ ++ case $func_quote_result in ++ *[\\\`\"\$]*) ++ case $func_quote_result in ++ *[\[\*\?]*) ++ func_quote_result=`$ECHO "$func_quote_result" | $SED "$sed_quote_subst"` ++ return 0 ++ ;; ++ esac ++ ++ func_quote_old_IFS=$IFS ++ for _G_char in '\' '`' '"' '$' ++ do ++ # STATE($1) PREV($2) SEPARATOR($3) ++ set start "" "" ++ func_quote_result=dummy"$_G_char$func_quote_result$_G_char"dummy ++ IFS=$_G_char ++ for _G_part in $func_quote_result ++ do ++ case $1 in ++ quote) ++ func_append func_quote_result "$3$2" ++ set quote "$_G_part" "\\$_G_char" ++ ;; ++ start) ++ set first "" "" ++ func_quote_result= ++ ;; ++ first) ++ set quote "$_G_part" "" ++ ;; ++ esac ++ done ++ IFS=$func_quote_old_IFS ++ done ++ ;; ++ *) ;; ++ esac ++} ++ ++ + # func_quote_for_eval ARG... + # -------------------------- + # Aesthetically quote ARGs to be evaled later. +@@ -1042,12 +1093,8 @@ func_quote_for_eval () + func_quote_for_eval_unquoted_result= + func_quote_for_eval_result= + while test 0 -lt $#; do +- case $1 in +- *[\\\`\"\$]*) +- _G_unquoted_arg=`printf '%s\n' "$1" |$SED "$sed_quote_subst"` ;; +- *) +- _G_unquoted_arg=$1 ;; +- esac ++ func_quote "$1" ++ _G_unquoted_arg=$func_quote_result + if test -n "$func_quote_for_eval_unquoted_result"; then + func_append func_quote_for_eval_unquoted_result " $_G_unquoted_arg" + else + +patch the generated file too to keep help2man from generating man pages +https://bugs.gentoo.org/556512 + +--- a/build-aux/ltmain.sh ++++ b/build-aux/ltmain.sh +@@ -1,5 +1,5 @@ + # Set a version string for this script. +-scriptversion=2015-01-20.17; # UTC ++scriptversion=2015-10-04.22; # UTC + + # General shell script boiler plate, and helper functions. + # Written by Gary V. Vaughan, 2004 +@@ -1026,6 +1026,57 @@ func_relative_path () + } + + ++# func_quote ARG ++# -------------- ++# Aesthetically quote one ARG, store the result into $func_quote_result. Note ++# that we keep attention to performance here (so far O(N) complexity as long as ++# func_append is O(1)). ++func_quote () ++{ ++ $debug_cmd ++ ++ func_quote_result=$1 ++ ++ case $func_quote_result in ++ *[\\\`\"\$]*) ++ case $func_quote_result in ++ *[\[\*\?]*) ++ func_quote_result=`$ECHO "$func_quote_result" | $SED "$sed_quote_subst"` ++ return 0 ++ ;; ++ esac ++ ++ func_quote_old_IFS=$IFS ++ for _G_char in '\' '`' '"' '$' ++ do ++ # STATE($1) PREV($2) SEPARATOR($3) ++ set start "" "" ++ func_quote_result=dummy"$_G_char$func_quote_result$_G_char"dummy ++ IFS=$_G_char ++ for _G_part in $func_quote_result ++ do ++ case $1 in ++ quote) ++ func_append func_quote_result "$3$2" ++ set quote "$_G_part" "\\$_G_char" ++ ;; ++ start) ++ set first "" "" ++ func_quote_result= ++ ;; ++ first) ++ set quote "$_G_part" "" ++ ;; ++ esac ++ done ++ IFS=$func_quote_old_IFS ++ done ++ ;; ++ *) ;; ++ esac ++} ++ ++ + # func_quote_for_eval ARG... + # -------------------------- + # Aesthetically quote ARGs to be evaled later. +@@ -1042,12 +1093,8 @@ func_quote_for_eval () + func_quote_for_eval_unquoted_result= + func_quote_for_eval_result= + while test 0 -lt $#; do +- case $1 in +- *[\\\`\"\$]*) +- _G_unquoted_arg=`printf '%s\n' "$1" |$SED "$sed_quote_subst"` ;; +- *) +- _G_unquoted_arg=$1 ;; +- esac ++ func_quote "$1" ++ _G_unquoted_arg=$func_quote_result + if test -n "$func_quote_for_eval_unquoted_result"; then + func_append func_quote_for_eval_unquoted_result " $_G_unquoted_arg" + else +@@ -3346,7 +3346,8 @@ else + if test \"\$libtool_execute_magic\" != \"$magic\"; then + file=\"\$0\"" + +- qECHO=`$ECHO "$ECHO" | $SED "$sed_quote_subst"` ++ func_quote "$ECHO" ++ qECHO=$func_quote_result + $ECHO "\ + + # A function that is used when there is no print builtin or printf. +@@ -8596,8 +8597,8 @@ EOF + relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" + fi + done +- relink_command="(cd `pwd`; $relink_command)" +- relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"` ++ func_quote "(cd `pwd`; $relink_command)" ++ relink_command=$func_quote_result + fi + + # Only actually do things if not in dry run mode. +@@ -8843,7 +8844,8 @@ EOF + done + # Quote the link command for shipping. + relink_command="(cd `pwd`; $SHELL \"$progpath\" $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" +- relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"` ++ func_quote "$relink_command" ++ relink_command=$func_quote_result + if test yes = "$hardcode_automatic"; then + relink_command= + fi +-- +2.6.2 + diff --git a/sys-devel/libtool/libtool-2.4.6-r1337.ebuild b/sys-devel/libtool/libtool-2.4.6-r1337.ebuild new file mode 100644 index 00000000..0146056f --- /dev/null +++ b/sys-devel/libtool/libtool-2.4.6-r1337.ebuild @@ -0,0 +1,127 @@ +# Copyright 1999-2018 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +EAPI=6 + +LIBTOOLIZE="true" #225559 +WANT_LIBTOOL="none" +inherit autotools epatch epunt-cxx multilib unpacker prefix + +if [[ ${PV} == "9999" ]] ; then + EGIT_REPO_URI="git://git.savannah.gnu.org/${PN}.git + http://git.savannah.gnu.org/r/${PN}.git" + inherit git-r3 +else + SRC_URI="mirror://gnu/${PN}/${P}.tar.xz" + KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~ppc-aix ~x64-cygwin ~amd64-fbsd ~x86-fbsd ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris ~x86-winnt" +fi + +DESCRIPTION="A shared library tool for developers" +HOMEPAGE="https://www.gnu.org/software/libtool/" + +LICENSE="GPL-2" +SLOT="2" +IUSE="vanilla" + +# Pull in libltdl directly until we convert packages to the new dep. +RDEPEND="sys-devel/gnuconfig + >=sys-devel/autoconf-2.69 + >=sys-devel/automake-1.13 + dev-libs/libltdl:0 + !<sys-apps/sandbox-2.10-r4" +DEPEND="${RDEPEND} + app-arch/xz-utils" +[[ ${PV} == "9999" ]] && DEPEND+=" sys-apps/help2man" + +PATCHES=( + "${FILESDIR}"/${PN}-2.4.3-use-linux-version-in-fbsd.patch #109105 + "${FILESDIR}"/${P}-link-specs.patch + "${FILESDIR}"/${P}-link-fsanitize.patch #573744 + "${FILESDIR}"/${P}-link-fuse-ld.patch + "${FILESDIR}"/${P}-libtoolize-slow.patch + "${FILESDIR}"/${P}-libtoolize-delay-help.patch + "${FILESDIR}"/${P}-sed-quote-speedup.patch #542252 + "${FILESDIR}"/${P}-ppc64le.patch #581314 + + "${FILESDIR}"/${PN}-2.4.6-mint.patch + "${FILESDIR}"/${PN}-2.2.6a-darwin-module-bundle.patch + "${FILESDIR}"/${PN}-2.4.6-darwin-use-linux-version.patch +) + +src_unpack() { + if [[ ${PV} == "9999" ]] ; then + git-r3_src_unpack + else + unpacker_src_unpack + fi +} + +src_prepare() { + if [[ "${PV}" = 9999 ]] ; then + eapply "${FILESDIR}"/${P}-pthread.patch #650876 + ./bootstrap || die + else + PATCHES+=( + "${FILESDIR}"/${P}-pthread_bootstrapped.patch #650876 + ) + fi + + if use vanilla ; then + eapply_user + return 0 + else + default + fi + + if use prefix ; then + # seems that libtool has to know about EPREFIX a little bit + # better, since it fails to find prefix paths to search libs + # from, resulting in some packages building static only, since + # libtool is fooled into thinking that libraries are unavailable + # (argh...). This could also be fixed by making the gcc wrapper + # return the correct result for -print-search-dirs (doesn't + # include prefix dirs ...). + eapply "${FILESDIR}"/${PN}-2.2.10-eprefix.patch + eprefixify m4/libtool.m4 + fi + + pushd libltdl >/dev/null + AT_NOELIBTOOLIZE=yes eautoreconf + popd >/dev/null + AT_NOELIBTOOLIZE=yes eautoreconf + epunt_cxx + + # Make sure timestamps don't trigger a rebuild of man pages. #556512 + if [[ ${PV} != "9999" ]] ; then + touch doc/*.1 + export HELP2MAN=false + fi +} + +src_configure() { + # the libtool script uses bash code in it and at configure time, tries + # to find a bash shell. if /bin/sh is bash, it uses that. this can + # cause problems for people who switch /bin/sh on the fly to other + # shells, so just force libtool to use /bin/bash all the time. + export CONFIG_SHELL="$(type -P bash)" + + # Do not bother hardcoding the full path to sed. Just rely on $PATH. #574550 + export ac_cv_path_SED="$(basename "$(type -P sed)")" + + local myconf + [[ ${CHOST} == *-darwin* ]] && myconf="--program-prefix=g" + ECONF_SOURCE=${S} econf ${myconf} --disable-ltdl-install +} + +src_test() { + emake check +} + +src_install() { + default + + local x + while read -d $'\0' -r x ; do + ln -sf "${EPREFIX}"/usr/share/gnuconfig/${x##*/} "${x}" || die + done < <(find "${ED}" '(' -name config.guess -o -name config.sub ')' -print0) +} diff --git a/sys-kernel/linux-headers/linux-headers-4.14-r1337.ebuild b/sys-kernel/linux-headers/linux-headers-4.14-r1337.ebuild new file mode 100644 index 00000000..12291f99 --- /dev/null +++ b/sys-kernel/linux-headers/linux-headers-4.14-r1337.ebuild @@ -0,0 +1,57 @@ +# Copyright 1999-2018 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=6 + +ETYPE="headers" +H_SUPPORTEDARCH="alpha amd64 arc arm arm64 avr32 bfin cris frv hexagon hppa ia64 m32r m68k metag microblaze mips mn10300 nios2 openrisc ppc ppc64 s390 score sh sparc tile x86 xtensa" +inherit kernel-2 +detect_version + +PATCH_VER="1" +SRC_URI="mirror://gentoo/gentoo-headers-base-${PV}.tar.xz + ${PATCH_VER:+mirror://gentoo/gentoo-headers-${PV}-${PATCH_VER}.tar.xz}" + +KEYWORDS="~alpha amd64 ~arm ~arm64 ~hppa ia64 ~m68k ~mips ppc ppc64 ~s390 ~sh sparc x86 ~amd64-linux ~x86-linux" + +DEPEND="app-arch/xz-utils + dev-lang/perl" +RDEPEND="!!media-sound/alsa-headers" + +S=${WORKDIR}/gentoo-headers-base-${PV} + +src_unpack() { + unpack ${A} +} + +src_prepare() { + default + + [[ -n ${PATCH_VER} ]] && eapply "${WORKDIR}/${PV}"/*.patch +} + +src_install() { + kernel-2_src_install + + # hrm, build system sucks + find "${ED}" '(' -name '.install' -o -name '*.cmd' ')' -delete + find "${ED}" -depth -type d -delete 2>/dev/null +} + +src_test() { + # Make sure no uapi/ include paths are used by accident. + egrep -r \ + -e '# *include.*["<]uapi/' \ + "${D}" && die "#include uapi/xxx detected" + + einfo "Possible unescaped attribute/type usage" + egrep -r \ + -e '(^|[[:space:](])(asm|volatile|inline)[[:space:](]' \ + -e '\<([us](8|16|32|64))\>' \ + . + + einfo "Missing linux/types.h include" + egrep -l -r -e '__[us](8|16|32|64)' "${ED}" | xargs grep -L linux/types.h + + emake ARCH=$(tc-arch-kernel) headers_check +} diff --git a/sys-libs/binutils-libs/Manifest b/sys-libs/binutils-libs/Manifest new file mode 100644 index 00000000..340ef4ae --- /dev/null +++ b/sys-libs/binutils-libs/Manifest @@ -0,0 +1,2 @@ +DIST binutils-2.31.1-patches-5.tar.xz 65896 BLAKE2B 7fb2c4c71336a77f3fef57a0430c511ef7326f8196d8f3a57a6d56aed464953172eeb0755f020387739cf27f709d0bc3de9c3c8b972a94f1480639465158e180 SHA512 c254f22b8ca662cf49cd5fc076d3e9b82d7f421420408c960c54310fc49462600325e7bc50f863cab7c8c49caebac3ac353dc24ab5947e8f01b98c11f43f57d2 +DIST binutils-2.31.1.tar.xz 20467996 BLAKE2B 6b914df1fbb7cf54f2159f71b2c2b09f3f6a569b7a3cb4cf9790d0a3733a7548bc0ea32334a178ed3b56e8b97656ae99c7abaf212601beeaeae9a0884c0f6051 SHA512 0fca326feb1d5f5fe505a827b20237fe3ec9c13eaf7ec7e35847fd71184f605ba1cefe1314b1b8f8a29c0aa9d88162849ee1c1a3e70c2f7407d88339b17edb30 diff --git a/sys-libs/binutils-libs/binutils-libs-2.31.1-r1337.ebuild b/sys-libs/binutils-libs/binutils-libs-2.31.1-r1337.ebuild new file mode 100644 index 00000000..17c9385a --- /dev/null +++ b/sys-libs/binutils-libs/binutils-libs-2.31.1-r1337.ebuild @@ -0,0 +1,113 @@ +# Copyright 1999-2018 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=6 + +PATCH_VER=5 +PATCH_DEV=dilfridge + +inherit eutils toolchain-funcs multilib-minimal + +MY_PN="binutils" +MY_P="${MY_PN}-${PV}" +PATCH_BINUTILS_VER=${PATCH_BINUTILS_VER:-${PV}} +PATCH_DEV=${PATCH_DEV:-slyfox} + +DESCRIPTION="Core binutils libraries (libbfd, libopcodes, libiberty) for external packages" +HOMEPAGE="https://sourceware.org/binutils/" +SRC_URI="mirror://gnu/binutils/${MY_P}.tar.xz + https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${MY_PN}-${PATCH_BINUTILS_VER}-patches-${PATCH_VER}.tar.xz" + +LICENSE="|| ( GPL-3 LGPL-3 )" +# The shared lib SONAMEs use the ${PV} in them. +# -r1 is a one-off subslot bump where SONAME changed for bug #666100 +SLOT="0/${PV}-r1" +IUSE="64-bit-bfd multitarget nls static-libs" +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~x86-fbsd" + +COMMON_DEPEND="sys-libs/zlib[${MULTILIB_USEDEP}]" +DEPEND="${COMMON_DEPEND} + >=sys-apps/texinfo-4.7 + nls? ( sys-devel/gettext )" +# Need a newer binutils-config that'll reset include/lib symlinks for us. +RDEPEND="${COMMON_DEPEND} + >=sys-devel/binutils-config-5 + nls? ( !<sys-devel/gdb-7.10-r1[nls] )" + +S="${WORKDIR}/${MY_P}" + +MULTILIB_WRAPPED_HEADERS=( + /usr/include/bfd.h +) + +src_prepare() { + if [[ ! -z ${PATCH_VER} ]] ; then + einfo "Applying binutils-${PATCH_BINUTILS_VER} patchset ${PATCH_VER}" + eapply "${WORKDIR}/patch"/*.patch + fi + default +} + +pkgversion() { + printf "Gentoo ${PVR}" + [[ -n ${PATCHVER} ]] && printf " p${PATCHVER}" +} + +multilib_src_configure() { + local myconf=( + --enable-obsolete + --enable-shared + --enable-threads + # Newer versions (>=2.24) make this an explicit option. #497268 + --enable-install-libiberty + --disable-werror + --with-bugurl="https://bugs.gentoo.org/" + --with-pkgversion="$(pkgversion)" + $(use_enable static-libs static) + # The binutils eclass enables this flag for all bi-arch builds, + # but other tools often don't care about that support. Put it + # beyond a flag if people really want it, but otherwise leave + # it disabled as it can slow things down on 32bit arches. #438522 + $(use_enable 64-bit-bfd) + # This only disables building in the zlib subdir. + # For binutils itself, it'll use the system version. #591516 + --without-zlib + --with-system-zlib + # We only care about the libs, so disable programs. #528088 + --disable-{binutils,etc,ld,gas,gold,gprof} + # Disable modules that are in a combined binutils/gdb tree. #490566 + --disable-{gdb,libdecnumber,readline,sim} + # Strip out broken static link flags. + # https://gcc.gnu.org/PR56750 + --without-stage1-ldflags + # We pull in all USE-flags that change ABI in an incompatible + # way. #666100 + # USE=multitarget change size of global arrays + # USE=64-bit-bfd changes data structures of exported API + --with-extra-soversion-suffix=gentoo-${CATEGORY}-${PN}-$(usex multitarget mt st)-$(usex 64-bit-bfd 64 def) + ) + + # mips can't do hash-style=gnu ... + if [[ $(tc-arch) != mips ]] ; then + myconf+=( --enable-default-hash-style=gnu ) + fi + + use multitarget && myconf+=( --enable-targets=all --enable-64-bit-bfd ) + + use nls \ + && myconf+=( --without-included-gettext ) \ + || myconf+=( --disable-nls ) + + ECONF_SOURCE=${S} \ + econf "${myconf[@]}" +} + +multilib_src_install() { + default + # Provide libiberty.h directly. + dosym libiberty/libiberty.h /usr/include/libiberty.h +} + +multilib_src_install_all() { + use static-libs || find "${ED}"/usr -name '*.la' -delete +} diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest index 246d3a54..03e7adf2 100644 --- a/sys-libs/glibc/Manifest +++ b/sys-libs/glibc/Manifest @@ -1,3 +1,3 @@ -DIST gcc-4.7.3-r1-multilib-bootstrap.tar.bz2 8064097 BLAKE2B 3cc5c82cd57d0fbd26d9a376ee8ca02f119fe9d653311cbe4d2b7b93aec2290adac3be271be19a7fdedae2e11e4b6e32360184e557204e100ad64357f5575d4b SHA512 40b93e194ad41a75d649d84d1c49070680f253a13f0617803243bc61c44fed1ca2d0a7572a97ebb79353f312b58b5f6360be916dd7435928cc53935082e15269 -DIST glibc-2.26-patches-7.tar.bz2 413976 BLAKE2B 18263201cf33abf911eb7b802ed539b217391156f897a8db50f65a69627d8f8cceded78414168986ee98eba038364a6b2f3599b23f95e7b0ad2643481c399718 SHA512 0c812a343fcc68c10d92117cb2a0cf1c255470e81f0a7a04d6db2fe35445e410ef37f15162f145c2eb772b08ab55af246f5b52f5e57c2e91038181f6f027abc3 -DIST glibc-2.26.tar.xz 14682748 BLAKE2B c1c9dbec110dd4e25b2f463a96d8afc43b8e3ebfe3c958107032beaa879710252be3bc4122bb62166408725d43785f233544df6159d29cce0fc5b2c08f45adbe SHA512 6ed368523bc55f00976f96c5177f114e3f714b27273d7bffc252812c8b98fb81970403c1f5b5f0a61da678811532fb446530745492d2b49bfefc0d5bd71ce8c0 +DIST gcc-multilib-bootstrap-20180511.tar.xz 2392908 BLAKE2B f3cf614399368acd8908f60d894c6344a2fa09383b30c1633a0682bc668367c8a2f8c6fec2d41b6e2178d709a2bd8db57e8b2ab56ba263c7d56f819c15acd061 SHA512 98c766e913693ab42ff790557acde2a36a8001e2648046a685b21964200df8d4d52d8452d499c0068c6648284d086ce062c2d36e2c6c2fd8aacd232d193f2853 +DIST glibc-2.28-patches-6.tar.xz 89724 BLAKE2B f846534dc912f11ed9b22badfd28ef0402451654390756d2f6332f52ce7c2d3491ed90bbdf2553d7bb38caea6373ad2d3c19e4a1f31f3669948f4e2cbaeb1577 SHA512 f687febde875bb8adb7a61408caea3db99bbbda703eb3486c7d5c09540515e657eda406bf14686498e2c093355c72395502a343201e02cfc97adf6483d8e7455 +DIST glibc-2.28.tar.xz 16484344 BLAKE2B 9aa8cbd5a145c2a6fde3a60b3d0a14b12b46ed79333ad1ca3e73464adcfe700277a17a9e7fd0ca36e355a0c5b0b27decfa091da320ba802741ad75cc955bbcc8 SHA512 521f820953ff07c69ece4c2186f59fc061a7f9747932cd70ef2995c2b2deee76eeb6de700d85071cdca5949179aa8ccee75eda7feca1394121ec7b821ad0a3f3 diff --git a/sys-libs/glibc/glibc-2.26-r1337.ebuild b/sys-libs/glibc/glibc-2.26-r1337.ebuild deleted file mode 100644 index e04e8dd3..00000000 --- a/sys-libs/glibc/glibc-2.26-r1337.ebuild +++ /dev/null @@ -1,836 +0,0 @@ -# Copyright 1999-2018 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 - -EAPI=6 - -inherit prefix toolchain-glibc - -DESCRIPTION="GNU libc C library" -HOMEPAGE="https://www.gnu.org/software/libc/" - -LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE" -RESTRICT="strip" # Strip ourself #46186 -EMULTILIB_PKG="true" - -# Configuration variables - -if [[ ${PV} == 9999* ]]; then - EGIT_REPO_URI="git://sourceware.org/git/glibc.git" - inherit git-r3 -else - KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86" - SRC_URI="mirror://gnu/glibc/${P}.tar.xz" -fi - -RELEASE_VER=${PV} - -GCC_BOOTSTRAP_VER="4.7.3-r1" - -# Gentoo patchset -PATCH_VER=7 - -SRC_URI+=" https://dev.gentoo.org/~dilfridge/distfiles/${P}-patches-${PATCH_VER}.tar.bz2" -SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-${GCC_BOOTSTRAP_VER}-multilib-bootstrap.tar.bz2 )" - -IUSE="audit caps debug doc gd hardened multilib nscd selinux systemtap profile suid vanilla headers-only" - -# Min kernel version glibc requires -: ${NPTL_KERN_VER:="3.2.0"} - -# Here's how the cross-compile logic breaks down ... -# CTARGET - machine that will target the binaries -# CHOST - machine that will host the binaries -# CBUILD - machine that will build the binaries -# If CTARGET != CHOST, it means you want a libc for cross-compiling. -# If CHOST != CBUILD, it means you want to cross-compile the libc. -# CBUILD = CHOST = CTARGET - native build/install -# CBUILD != (CHOST = CTARGET) - cross-compile a native build -# (CBUILD = CHOST) != CTARGET - libc for cross-compiler -# CBUILD != CHOST != CTARGET - cross-compile a libc for a cross-compiler -# For install paths: -# CHOST = CTARGET - install into / -# CHOST != CTARGET - install into /usr/CTARGET/ - -export CBUILD=${CBUILD:-${CHOST}} -export CTARGET=${CTARGET:-${CHOST}} -if [[ ${CTARGET} == ${CHOST} ]] ; then - if [[ ${CATEGORY} == cross-* ]] ; then - export CTARGET=${CATEGORY#cross-} - fi -fi - -is_crosscompile() { - [[ ${CHOST} != ${CTARGET} ]] -} - -SLOT="2.2" - -# General: We need a new-enough binutils/gcc to match upstream baseline. -# arch: we need to make sure our binutils/gcc supports TLS. -COMMON_DEPEND=" - nscd? ( selinux? ( - audit? ( sys-process/audit ) - caps? ( sys-libs/libcap ) - ) ) - suid? ( caps? ( sys-libs/libcap ) ) - selinux? ( sys-libs/libselinux ) - systemtap? ( dev-util/systemtap ) -" -DEPEND="${COMMON_DEPEND} - >=app-misc/pax-utils-0.1.10 - !<sys-apps/sandbox-1.6 - !<sys-apps/portage-2.1.2 - doc? ( sys-apps/texinfo ) -" -RDEPEND="${COMMON_DEPEND} - !sys-kernel/ps3-sources - sys-apps/gentoo-functions - !sys-libs/nss-db -" - -if [[ ${CATEGORY} == cross-* ]] ; then - DEPEND+=" !headers-only? ( - >=${CATEGORY}/binutils-2.24 - >=${CATEGORY}/gcc-4.9 - )" - [[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers" -else - DEPEND+=" - >=sys-devel/binutils-2.24 - >=sys-devel/gcc-4.9 - virtual/os-headers - " - RDEPEND+=" vanilla? ( !sys-libs/timezone-data )" - PDEPEND+=" !vanilla? ( sys-libs/timezone-data )" -fi - -# -# the phases -# - -pkg_pretend() { - # Make sure devpts is mounted correctly for use w/out setuid pt_chown - check_devpts - - # Prevent native builds from downgrading - if [[ ${MERGE_TYPE} != "buildonly" ]] && \ - [[ ${ROOT} == "/" ]] && \ - [[ ${CBUILD} == ${CHOST} ]] && \ - [[ ${CHOST} == ${CTARGET} ]] ; then - # The high rev # is to allow people to downgrade between -r# versions. - # We want to block 2.20->2.19, but 2.20-r3->2.20-r2 should be fine. - # Hopefully we never actually use a r# this high. - if has_version ">${CATEGORY}/${P}-r10000" ; then - eerror "Sanity check to keep you from breaking your system:" - eerror " Downgrading glibc is not supported and a sure way to destruction" - die "Aborting to save your system" - fi - - if ! glibc_run_test '#include <pwd.h>\nint main(){return getpwuid(0)==0;}\n' - then - eerror "Your patched vendor kernel is broken. You need to get an" - eerror "update from whoever is providing the kernel to you." - eerror "https://sourceware.org/bugzilla/show_bug.cgi?id=5227" - eerror "https://bugs.gentoo.org/262698" - die "Keeping your system alive, say thank you" - fi - - if ! glibc_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' - then - eerror "Your old kernel is broken. You need to update it to" - eerror "a newer version as syscall(<bignum>) will break." - eerror "https://bugs.gentoo.org/279260" - die "Keeping your system alive, say thank you" - fi - fi - - # Users have had a chance to phase themselves, time to give em the boot - 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 - - if [[ ${CTARGET} == i386-* ]] ; then - eerror "i386 CHOSTs are no longer supported." - eerror "Chances are you don't actually want/need i386." - eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml" - die "Please fix your CHOST" - fi - - if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then - ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS." - ewarn "This will result in a 50% performance penalty when running with a 32bit" - ewarn "hypervisor, which is probably not what you want." - fi - - use hardened && ! tc-enables-pie && \ - ewarn "PIE hardening not applied, as your compiler doesn't default to PIE" - - # Make sure host system is up to date #394453 - if has_version '<sys-libs/glibc-2.13' && \ - [[ -n $(scanelf -qys__guard -F'#s%F' "${EROOT}"/lib*/l*-*.so) ]] - then - ebegin "Scanning system for __guard to see if you need to rebuild first ..." - local files=$( - scanelf -qys__guard -F'#s%F' \ - "${EROOT}"/*bin/ \ - "${EROOT}"/lib* \ - "${EROOT}"/usr/*bin/ \ - "${EROOT}"/usr/lib* | \ - egrep -v \ - -e "^${EROOT}/lib.*/(libc|ld)-2.*.so$" \ - -e "^${EROOT}/sbin/(ldconfig|sln)$" - ) - [[ -z ${files} ]] - if ! eend $? ; then - eerror "Your system still has old SSP __guard symbols. You need to" - eerror "rebuild all the packages that provide these files first:" - eerror "${files}" - die "old __guard detected" - fi - fi - - # Check for sanity of /etc/nsswitch.conf - if [[ -e ${EROOT}/etc/nsswitch.conf ]] ; then - local entry - for entry in passwd group shadow; do - if ! egrep -q "^[ \t]*${entry}:.*files" "${EROOT}"/etc/nsswitch.conf; then - eerror "Your ${EROOT}/etc/nsswitch.conf is out of date." - eerror "Please make sure you have 'files' entries for" - eerror "'passwd:', 'group:' and 'shadow:' databases." - eerror "For more details see:" - eerror " https://wiki.gentoo.org/wiki/Project:Toolchain/nsswitch.conf_in_glibc-2.26" - die "nsswitch.conf has no 'files' provider in '${entry}'." - fi - done - fi -} - -src_unpack() { - use multilib && unpack gcc-${GCC_BOOTSTRAP_VER}-multilib-bootstrap.tar.bz2 - - setup_env - - # Check NPTL support _before_ we unpack things to save some time - check_nptl_support - - if [[ -n ${EGIT_REPO_URI} ]] ; then - git-r3_src_unpack - else - unpack ${P}.tar.xz - fi - - cd "${S}" - touch locale/C-translit.h #185476 #218003 - - cd "${WORKDIR}" - unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.tar.bz2 -} - -src_prepare() { - if ! use vanilla ; then - elog "Applying Gentoo Glibc Patchset ${RELEASE_VER}-${PATCH_VER}" - eapply "${WORKDIR}"/patches - einfo "Done." - 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 - - default - - gnuconfig_update - - cd "${WORKDIR}" - find . -name configure -exec touch {} + - - eprefixify extra/locale/locale-gen - - # Fix permissions on some of the scripts. - chmod u+x "${S}"/scripts/*.sh - - cd "${S}" - - if use hardened ; then - # We don't enable these for non-hardened as the output is very terse -- - # it only states that a crash happened. The default upstream behavior - # includes backtraces and symbols. - einfo "Installing Hardened Gentoo SSP and FORTIFY_SOURCE handler" - cp "${FILESDIR}"/2.20/glibc-2.20-gentoo-stack_chk_fail.c debug/stack_chk_fail.c || die - cp "${FILESDIR}"/2.25/glibc-2.25-gentoo-chk_fail.c debug/chk_fail.c || die - - if use debug ; then - # Allow SIGABRT to dump core on non-hardened systems, or when debug is requested. - sed -i \ - -e '/^CFLAGS-backtrace.c/ iCPPFLAGS-stack_chk_fail.c = -DSSP_SMASH_DUMPS_CORE' \ - -e '/^CFLAGS-backtrace.c/ iCPPFLAGS-chk_fail.c = -DSSP_SMASH_DUMPS_CORE' \ - debug/Makefile || die - fi - fi -} - -glibc_do_configure() { - # Glibc does not work with gold (for various reasons) #269274. - tc-ld-disable-gold - - # CXX isnt handled by the multilib system, so if we dont unset here - # we accumulate crap across abis - unset CXX - - einfo "Configuring glibc for $1" - - if use doc ; then - export MAKEINFO=makeinfo - else - export MAKEINFO=/dev/null - fi - - local v - for v in ABI CBUILD CHOST CTARGET CBUILD_OPT CTARGET_OPT CC CXX LD {AS,C,CPP,CXX,LD}FLAGS MAKEINFO ; do - einfo " $(printf '%15s' ${v}:) ${!v}" - done - - # The glibc configure script doesn't properly use LDFLAGS all the time. - export CC="$(tc-getCC ${CTARGET}) ${LDFLAGS}" - einfo " $(printf '%15s' 'Manual CC:') ${CC}" - - # Some of the tests are written in C++, so we need to force our multlib abis in, bug 623548 - export CXX="$(tc-getCXX ${CTARGET}) $(get_abi_CFLAGS)" - einfo " $(printf '%15s' 'Manual CXX:') ${CXX}" - - echo - - 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 - - case ${CTARGET} in - powerpc-*) - # Currently gcc on powerpc32 generates invalid code for - # __builtin_return_address(0) calls. Normally programs - # don't do that but malloc hooks in glibc do: - # https://gcc.gnu.org/PR81996 - # https://bugs.gentoo.org/629054 - myconf+=( --enable-stack-protector=no ) - ;; - *) - myconf+=( --enable-stack-protector=all ) - ;; - esac - myconf+=( --enable-stackguard-randomization ) - - # Keep a whitelist of targets supporing IFUNC. glibc's ./configure - # is not robust enough to detect proper support: - # https://bugs.gentoo.org/641216 - # https://sourceware.org/PR22634#c0 - case $(tc-arch ${CTARGET}) in - # Keep whitelist of targets where autodetection mostly works. - amd64|x86|sparc|ppc|ppc64|arm|arm64|s390) ;; - # Blacklist everywhere else - *) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;; - esac - - [[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp ) - - if [[ $1 == "nptl" ]] ; then - 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 ; 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 - --disable-werror - --enable-bind-now - --build=${CBUILD_OPT:-${CBUILD}} - --host=${CTARGET_OPT:-${CTARGET}} - $(use_enable profile) - $(use_with gd) - --with-headers=$(alt_build_headers) - --prefix="${EPREFIX}/usr" - --sysconfdir="${EPREFIX}/etc" - --localstatedir="${EPREFIX}/var" - --libdir='$(prefix)'/$(get_libdir) - --mandir='$(prefix)'/share/man - --infodir='$(prefix)'/share/info - --libexecdir='$(libdir)'/misc/glibc - --with-bugurl=https://bugs.gentoo.org/ - --with-pkgversion="$(glibc_banner)" - $(use_multiarch || echo --disable-multi-arch) - $(in_iuse systemtap && use_enable systemtap) - $(in_iuse nscd && use_enable nscd) - ${EXTRA_ECONF} - ) - - # We rely on sys-libs/timezone-data for timezone tools normally. - myconf+=( $(use_enable vanilla timezone-tools) ) - - # These libs don't have configure flags. - ac_cv_lib_audit_audit_log_user_avc_message=$(in_iuse audit && usex audit || echo no) - ac_cv_lib_cap_cap_init=$(in_iuse caps && usex caps || echo no) - - # There is no configure option for this and we need to export it - # since the glibc build will re-run configure on itself - export libc_cv_rootsbindir="${EPREFIX}/sbin" - export libc_cv_slibdir="${EPREFIX}/$(get_libdir)" - - # 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 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 - fi - fi -} - -glibc_headers_configure() { - export ABI=default - - local builddir=$(builddir "headers") - mkdir -p "${builddir}" - cd "${builddir}" - - # if we don't have a compiler yet, we can't really test it now ... - # hopefully they don't affect header generation, 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=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) - # These libs don't have configure flags. - ac_cv_lib_audit_audit_log_user_avc_message=no - ac_cv_lib_cap_cap_init=no - ) - - einfo "Forcing cached settings:" - for v in "${vars[@]}" ; do - einfo " ${v}" - export ${v} - done - - # Blow away some random CC settings that screw things up. #550192 - if [[ -d ${S}/sysdeps/mips ]]; then - pushd "${S}"/sysdeps/mips >/dev/null - sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die - sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die - - # Force the mips ABI to the default. This is OK because the set of - # installed headers in this phase is the same between the 3 ABIs. - # If this ever changes, this hack will break, but that's unlikely - # as glibc discourages that behavior. - # https://crbug.com/647033 - sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die - - popd >/dev/null - fi - - local myconf=() - myconf+=( - --disable-sanity-checks - --enable-hacker-mode - --without-cvs - --disable-werror - --enable-bind-now - --build=${CBUILD_OPT:-${CBUILD}} - --host=${CTARGET_OPT:-${CTARGET}} - --with-headers=$(alt_build_headers) - --prefix="${EPREFIX}/usr" - ${EXTRA_ECONF} - ) - - local addons - [[ -d ${S}/ports ]] && addons+=",ports" - myconf+=( --enable-add-ons="${addons#,}" ) - - # Nothing is compiled here which would affect the headers for the target. - # So forcing CC/CFLAGS is sane. - set -- "${S}"/configure "${myconf[@]}" - echo "$@" - CC="$(tc-getBUILD_CC)" \ - CFLAGS="-O1 -pipe" \ - CPPFLAGS="-U_FORTIFY_SOURCE" \ - LDFLAGS="" \ - "$@" || die "failed to configure glibc" -} - -do_src_configure() { - if just_headers ; then - glibc_headers_configure - else - glibc_do_configure nptl - fi -} - -src_configure() { - foreach_abi do_src_configure -} - -do_src_compile() { - emake -C "$(builddir nptl)" || die "make nptl for ${ABI} failed" -} - -src_compile() { - if just_headers ; then - return - fi - - foreach_abi do_src_compile -} - -glibc_src_test() { - cd "$(builddir $1)" - emake check -} - -do_src_test() { - local ret=0 - - glibc_src_test nptl - : $(( ret |= $? )) - - return ${ret} -} - -src_test() { - # Give tests more time to complete. - export TIMEOUTFACTOR=5 - - foreach_abi do_src_test || die "tests failed" -} - -glibc_do_src_install() { - local builddir=$(builddir nptl) - cd "${builddir}" - - emake install_root="${D}$(alt_prefix)" install || die - - # This version (2.26) provides some compatibility libraries for the NIS/NIS+ support - # which come without headers etc. Only needed for binary packages since the - # external net-libs/libnsl has increased soversion. Keep only versioned libraries. - find "${D}" -name "libnsl.a" -delete - find "${D}" -name "libnsl.so" -delete - - # Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need - # to infer upstream version: - # '#define VERSION "2.26.90"' -> '2.26.90' - local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h) - - if [[ -e ${ED}$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then - # Move versioned .a file out of libdir to evade portage QA checks - # instead of using gen_usr_ldscript(). We fix ldscript as: - # "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..." - sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"$(alt_usrlibdir)/libm.a || die - dodir $(alt_usrlibdir)/${P} - mv "${ED}"$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die - fi - - # We'll take care of the cache ourselves - 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 - ) - 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 - 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 ${ED}/${ldso_name} && ! -e ${ED}/${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 "${ED}" -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_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 - doman *.[0-8] - insinto /etc - doins locale.gen - - # 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 ../$(get_libdir)/locale /usr/$(get_abi_LIBDIR ${a})/locale - fi - done - - cd "${S}" - - # Install misc network config files - insinto /etc - doins nscd/nscd.conf posix/gai.conf nss/nsswitch.conf - doins "${WORKDIR}"/extra/etc/*.conf - - if use nscd ; then - doinitd "$(prefixify_ro "${WORKDIR}"/extra/etc/nscd)" - - local nscd_args=( - -e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):" - ) - - sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd - - systemd_dounit nscd/nscd.service - systemd_newtmpfilesd nscd/nscd.tmpfiles nscd.conf - 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 - - 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 -} - -glibc_headers_install() { - local builddir=$(builddir "headers") - cd "${builddir}" - emake install_root="${D}$(alt_prefix)" install-headers - - insinto $(alt_headers)/gnu - doins "${S}"/include/gnu/stubs.h - - # 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 $(alt_prefix)/sys-include -} - -src_install() { - if just_headers ; then - export ABI=default - glibc_headers_install - return - fi - - foreach_abi glibc_do_src_install - src_strip -} - -pkg_preinst() { - # nothing to do if just installing headers - just_headers && return - - # prepare /etc/ld.so.conf.d/ for files - mkdir -p "${EROOT}"/etc/ld.so.conf.d - - # 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 - einfo "Defaulting /etc/host.conf:multi to on" - fi - - [[ ${ROOT} != "/" ]] && return 0 - [[ -d ${ED}/$(get_libdir) ]] || return 0 - [[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check -} - -pkg_postinst() { - # nothing to do if just installing headers - just_headers && return - - if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then - # Generate fastloading iconv module configuration file. - "${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}" - fi - - if ! is_crosscompile && [[ ${ROOT} == "/" ]] ; then - # Reload init ... if in a chroot or a diff init package, ignore - # errors from this step #253697 - /sbin/telinit U 2>/dev/null - - # if the host locales.gen contains no entries, we'll install everything - local locale_list="${EROOT}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" - fi - locale-gen -j $(makeopts_jobs) --config "${locale_list}" - fi - - # Check for sanity of /etc/nsswitch.conf, take 2 - if [[ -e ${EROOT}/etc/nsswitch.conf ]] && ! has_version sys-auth/libnss-nis ; then - local entry - for entry in passwd group shadow; do - if egrep -q "^[ \t]*${entry}:.*nis" "${EROOT}"/etc/nsswitch.conf; then - ewarn "" - ewarn "Your ${EROOT}/etc/nsswitch.conf uses NIS. Support for that has been" - ewarn "removed from glibc and is now provided by the package" - ewarn " sys-auth/libnss-nis" - ewarn "Install it now to keep your NIS setup working." - ewarn "" - fi - done - fi -} diff --git a/sys-libs/glibc/glibc-2.28-r1337.ebuild b/sys-libs/glibc/glibc-2.28-r1337.ebuild new file mode 100644 index 00000000..bbe2505a --- /dev/null +++ b/sys-libs/glibc/glibc-2.28-r1337.ebuild @@ -0,0 +1,1411 @@ +# Copyright 1999-2018 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=6 + +inherit prefix eutils eapi7-ver toolchain-funcs flag-o-matic gnuconfig \ + multilib systemd multiprocessing + +DESCRIPTION="GNU libc C library" +HOMEPAGE="https://www.gnu.org/software/libc/" +LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE" +RESTRICT="strip" # Strip ourself #46186 +SLOT="2.2" + +EMULTILIB_PKG="true" + +if [[ ${PV} == 9999* ]]; then + EGIT_REPO_URI="https://sourceware.org/git/glibc.git" + inherit git-r3 +else + KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86" + SRC_URI="mirror://gnu/glibc/${P}.tar.xz" +fi + +RELEASE_VER=${PV} + +GCC_BOOTSTRAP_VER=20180511 + +# Gentoo patchset +PATCH_VER=6 + +SRC_URI+=" https://dev.gentoo.org/~dilfridge/distfiles/${P}-patches-${PATCH_VER}.tar.xz" +SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz )" + +IUSE="audit caps cet compile-locales doc gd headers-only +multiarch multilib nscd profile selinux suid systemtap test vanilla" + +# Minimum kernel version that glibc requires +MIN_KERN_VER="3.2.0" + +# Here's how the cross-compile logic breaks down ... +# CTARGET - machine that will target the binaries +# CHOST - machine that will host the binaries +# CBUILD - machine that will build the binaries +# If CTARGET != CHOST, it means you want a libc for cross-compiling. +# If CHOST != CBUILD, it means you want to cross-compile the libc. +# CBUILD = CHOST = CTARGET - native build/install +# CBUILD != (CHOST = CTARGET) - cross-compile a native build +# (CBUILD = CHOST) != CTARGET - libc for cross-compiler +# CBUILD != CHOST != CTARGET - cross-compile a libc for a cross-compiler +# For install paths: +# CHOST = CTARGET - install into / +# CHOST != CTARGET - install into /usr/CTARGET/ +# +export CBUILD=${CBUILD:-${CHOST}} +export CTARGET=${CTARGET:-${CHOST}} +if [[ ${CTARGET} == ${CHOST} ]] ; then + if [[ ${CATEGORY} == cross-* ]] ; then + export CTARGET=${CATEGORY#cross-} + fi +fi + +# We need a new-enough binutils/gcc to match upstream baseline. +# Also we need to make sure our binutils/gcc supports TLS, +# and that gcc already contains the hardened patches. +COMMON_DEPEND=" + nscd? ( selinux? ( + audit? ( sys-process/audit ) + caps? ( sys-libs/libcap ) + ) ) + suid? ( caps? ( sys-libs/libcap ) ) + selinux? ( sys-libs/libselinux ) + systemtap? ( dev-util/systemtap ) +" +DEPEND="${COMMON_DEPEND} + >=app-misc/pax-utils-0.1.10 + sys-devel/bison + !<sys-apps/sandbox-1.6 + !<sys-apps/portage-2.1.2 + !<sys-devel/bison-2.7 + !<sys-devel/make-4 + doc? ( sys-apps/texinfo ) + test? ( >=net-dns/libidn2-2.0.5 ) +" +RDEPEND="${COMMON_DEPEND} + >=net-dns/libidn2-2.0.5 + sys-apps/gentoo-functions + !sys-kernel/ps3-sources + !sys-libs/nss-db +" + +if [[ ${CATEGORY} == cross-* ]] ; then + DEPEND+=" !headers-only? ( + >=${CATEGORY}/binutils-2.24 + >=${CATEGORY}/gcc-6 + )" + [[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers" +else + DEPEND+=" + >=sys-devel/binutils-2.24 + >=sys-devel/gcc-6 + virtual/os-headers + " + RDEPEND+=" vanilla? ( !sys-libs/timezone-data )" + PDEPEND+=" !vanilla? ( sys-libs/timezone-data )" +fi + +# +# Small helper functions +# + +is_crosscompile() { + [[ ${CHOST} != ${CTARGET} ]] +} + +just_headers() { + is_crosscompile && use headers-only +} + +alt_prefix() { + is_crosscompile && echo /usr/${CTARGET} +} + +# We need to be able to set alternative headers for compiling for non-native +# platform. Will also become useful for testing kernel-headers without screwing +# up the whole system. +alt_headers() { + echo ${ALT_HEADERS:=$(alt_prefix)/usr/include} +} + +alt_build_headers() { + if [[ -z ${ALT_BUILD_HEADERS} ]] ; then + ALT_BUILD_HEADERS="${EPREFIX}$(alt_headers)" + if tc-is-cross-compiler ; then + 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} + fi + fi + fi + echo "${ALT_BUILD_HEADERS}" +} + +alt_libdir() { + echo $(alt_prefix)/$(get_libdir) +} +alt_usrlibdir() { + echo $(alt_prefix)/usr/$(get_libdir) +} + +builddir() { + echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1" +} + +do_compile_test() { + local ret save_cflags=${CFLAGS} + CFLAGS+=" $1" + shift + + pushd "${T}" >/dev/null + + rm -f glibc-test* + printf '%b' "$*" > glibc-test.c + + nonfatal emake -s glibc-test + ret=$? + + popd >/dev/null + + CFLAGS=${save_cflags} + return ${ret} +} + +do_run_test() { + local ret + + if [[ ${MERGE_TYPE} == "binary" ]] ; then + # ignore build failures when installing a binary package #324685 + do_compile_test "" "$@" 2>/dev/null || return 0 + else + if ! do_compile_test "" "$@" ; then + ewarn "Simple build failed ... assuming this is desired #324685" + return 0 + fi + fi + + pushd "${T}" >/dev/null + + ./glibc-test + ret=$? + rm -f glibc-test* + + popd >/dev/null + + return ${ret} +} + +setup_target_flags() { + # This largely mucks with compiler flags. None of which should matter + # when building up just the headers. + just_headers && return 0 + + case $(tc-arch) in + x86) + # -march needed for #185404 #199334 + # TODO: When creating the first glibc cross-compile, this test will + # always fail as it does a full link which in turn requires glibc. + # Probably also applies when changing multilib profile settings (e.g. + # enabling x86 when the profile was amd64-only previously). + # We could change main to _start and pass -nostdlib here so that we + # only test the gcc code compilation. Or we could do a compile and + # then look for the symbol via scanelf. + if ! do_compile_test "" 'void f(int i, void *p) {if (__sync_fetch_and_add(&i, 1)) f(i, p);}\nint main(){return 0;}\n' 2>/dev/null ; then + local t=${CTARGET_OPT:-${CTARGET}} + t=${t%%-*} + filter-flags '-march=*' + export CFLAGS="-march=${t} ${CFLAGS}" + einfo "Auto adding -march=${t} to CFLAGS #185404" + fi + ;; + amd64) + # -march needed for #185404 #199334 + # Note: This test only matters when the x86 ABI is enabled, so we could + # optimize a bit and elide it. + # TODO: See cross-compile issues listed above for x86. + if ! do_compile_test "${CFLAGS_x86}" 'void f(int i, void *p) {if (__sync_fetch_and_add(&i, 1)) f(i, p);}\nint main(){return 0;}\n' 2>/dev/null ; then + local t=${CTARGET_OPT:-${CTARGET}} + t=${t%%-*} + # Normally the target is x86_64-xxx, so turn that into the -march that + # gcc actually accepts. #528708 + [[ ${t} == "x86_64" ]] && t="x86-64" + filter-flags '-march=*' + # ugly, ugly, ugly. ugly. + CFLAGS_x86=$(CFLAGS=${CFLAGS_x86} filter-flags '-march=*'; echo "${CFLAGS}") + export CFLAGS_x86="${CFLAGS_x86} -march=${t}" + einfo "Auto adding -march=${t} to CFLAGS_x86 #185404" + fi + ;; + mips) + # The mips abi cannot support the GNU style hashes. #233233 + filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both + ;; + sparc) + # Both sparc and sparc64 can use -fcall-used-g6. -g7 is bad, though. + filter-flags "-fcall-used-g7" + append-flags "-fcall-used-g6" + + # If the CHOST is the basic one (e.g. not sparcv9-xxx already), + # try to pick a better one so glibc can use cpu-specific .S files. + # We key off the CFLAGS to get a good value. Also need to handle + # version skew. + # We can't force users to set their CHOST to their exact machine + # as many of these are not recognized by config.sub/gcc and such :(. + # Note: If the mcpu values don't scale, we might try probing CPP defines. + # Note: Should we factor in -Wa,-AvXXX flags too ? Or -mvis/etc... ? + + local cpu + case ${CTARGET} in + sparc64-*) + case $(get-flag mcpu) in + niagara[234]) + if ver_test -ge 2.8 ; then + cpu="sparc64v2" + elif ver_test -ge 2.4 ; then + cpu="sparc64v" + elif ver_test -ge 2.2.3 ; then + cpu="sparc64b" + fi + ;; + niagara) + if ver_test -ge 2.4 ; then + cpu="sparc64v" + elif ver_test -ge 2.2.3 ; then + cpu="sparc64b" + fi + ;; + ultrasparc3) + cpu="sparc64b" + ;; + *) + # We need to force at least v9a because the base build doesn't + # work with just v9. + # https://sourceware.org/bugzilla/show_bug.cgi?id=19477 + [[ -z ${cpu} ]] && append-flags "-Wa,-xarch=v9a" + ;; + esac + ;; + sparc-*) + case $(get-flag mcpu) in + niagara[234]) + if ver_test -ge 2.8 ; then + cpu="sparcv9v2" + elif ver_test -ge 2.4 ; then + cpu="sparcv9v" + elif ver_test -ge 2.2.3 ; then + cpu="sparcv9b" + else + cpu="sparcv9" + fi + ;; + niagara) + if ver_test -ge 2.4 ; then + cpu="sparcv9v" + elif ver_test -ge 2.2.3 ; then + cpu="sparcv9b" + else + cpu="sparcv9" + fi + ;; + ultrasparc3) + cpu="sparcv9b" + ;; + v9|ultrasparc) + cpu="sparcv9" + ;; + v8|supersparc|hypersparc|leon|leon3) + cpu="sparcv8" + ;; + esac + ;; + esac + [[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}" + ;; + esac +} + +setup_flags() { + # Make sure host make.conf doesn't pollute us + if is_crosscompile || tc-is-cross-compiler ; then + CHOST=${CTARGET} strip-unsupported-flags + fi + + # Store our CFLAGS because it's changed depending on which CTARGET + # we are building when pulling glibc on a multilib profile + CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}} + CFLAGS=${CFLAGS_BASE} + CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}} + CXXFLAGS=${CXXFLAGS_BASE} + ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}} + ASFLAGS=${ASFLAGS_BASE} + + # Over-zealous CFLAGS can often cause problems. What may work for one + # person may not work for another. To avoid a large influx of bugs + # relating to failed builds, we strip most CFLAGS out to ensure as few + # problems as possible. + strip-flags + strip-unsupported-flags + filter-flags -m32 -m64 '-mabi=*' + + # glibc aborts if rpath is set by LDFLAGS + filter-ldflags '-Wl,-rpath=*' + + # #492892 + filter-flags -frecord-gcc-switches + + unset CBUILD_OPT CTARGET_OPT + if use multilib ; then + CTARGET_OPT=$(get_abi_CTARGET) + [[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST) + fi + + setup_target_flags + + if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then + CBUILD_OPT=${CTARGET_OPT} + fi + + # Lock glibc at -O2; we want to be conservative here. + # -fno-strict-aliasing is to work around #155906. + filter-flags '-O?' + append-flags -O2 -fno-strict-aliasing + + filter-flags '-fstack-protector*' +} + +want_tls() { + # Archs that can use TLS (Thread Local Storage) + case $(tc-arch) in + x86) + # requires i486 or better #106556 + [[ ${CTARGET} == i[4567]86* ]] && return 0 + return 1 + ;; + esac + return 0 +} + +want__thread() { + want_tls || return 1 + + # For some reason --with-tls --with__thread is causing segfaults on sparc32. + [[ ${PROFILE_ARCH} == "sparc" ]] && return 1 + + [[ -n ${WANT__THREAD} ]] && return ${WANT__THREAD} + + # only test gcc -- can't test linking yet + tc-has-tls -c ${CTARGET} + WANT__THREAD=$? + + return ${WANT__THREAD} +} + +use_multiarch() { + # Allow user to disable runtime arch detection in multilib. + use multiarch || return 1 + # Make sure binutils is new enough to support indirect functions, + # #336792. 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" ;; + arm) nver="2.22" ;; + hppa) nver="2.23" ;; + ppc|ppc64) nver="2.20" ;; + # ifunc support 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 + ver_test ${bver} -ge ${nver} +} + +# Setup toolchain variables that had historically been defined in the +# profiles for these archs. +setup_env() { + # silly users + unset LD_RUN_PATH + unset LD_ASSUME_KERNEL + + if is_crosscompile || tc-is-cross-compiler ; then + multilib_env ${CTARGET_OPT:-${CTARGET}} + + if ! use multilib ; then + MULTILIB_ABIS=${DEFAULT_ABI} + else + MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}} + fi + + # If the user has CFLAGS_<CTARGET> in their make.conf, use that, + # and fall back on CFLAGS. + local VAR=CFLAGS_${CTARGET//[-.]/_} + CFLAGS=${!VAR-${CFLAGS}} + einfo " $(printf '%15s' 'Manual CFLAGS:') ${CFLAGS}" + fi + + setup_flags + + export ABI=${ABI:-${DEFAULT_ABI:-default}} + + if use headers-only ; then + # Avoid mixing host's CC and target's CFLAGS_${ABI}: + # At this bootstrap stage we have only binutils for + # target but not compiler yet. + einfo "Skip CC ABI injection. We can't use (cross-)compiler yet." + return 0 + fi + local VAR=CFLAGS_${ABI} + # We need to export CFLAGS with abi information in them because glibc's + # configure script checks CFLAGS for some targets (like mips). Keep + # around the original clean value to avoid appending multiple ABIs on + # top of each other. + : ${__GLIBC_CC:=$(tc-getCC ${CTARGET_OPT:-${CTARGET}})} + export __GLIBC_CC CC="${__GLIBC_CC} ${!VAR}" + einfo " $(printf '%15s' 'Manual CC:') ${CC}" +} + +foreach_abi() { + setup_env + + local ret=0 + local abilist="" + if use multilib ; then + abilist=$(get_install_abis) + else + abilist=${DEFAULT_ABI} + fi + local -x ABI + for ABI in ${abilist:-default} ; do + setup_env + einfo "Running $1 for ABI ${ABI}" + $1 + : $(( ret |= $? )) + done + return ${ret} +} + +glibc_banner() { + local b="Gentoo ${PVR}" + [[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" p${PATCH_VER}" + echo "${b}" +} + +check_devpts() { + # Make sure devpts is mounted correctly for use w/out setuid pt_chown. + + # If merely building the binary package, then there's nothing to verify. + [[ ${MERGE_TYPE} == "buildonly" ]] && return + + # Only sanity check when installing the native glibc. + [[ ${ROOT} != "/" ]] && return + + # If they're opting in to the old suid code, then no need to check. + use suid && return + + 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 +} + +# The following Kernel version handling functions are mostly copied from portage +# source. It's better not to use linux-info.eclass here since a) it adds too +# much magic, see bug 326693 for some of the arguments, and b) some of the +# functions are just not provided. + +g_get_running_KV() { + uname -r + return $? +} + +g_KV_major() { + [[ -z $1 ]] && return 1 + local KV=$@ + echo "${KV%%.*}" +} + +g_KV_minor() { + [[ -z $1 ]] && return 1 + local KV=$@ + KV=${KV#*.} + echo "${KV%%.*}" +} + +g_KV_micro() { + [[ -z $1 ]] && return 1 + local KV=$@ + KV=${KV#*.*.} + echo "${KV%%[^[:digit:]]*}" +} + +g_KV_to_int() { + [[ -z $1 ]] && return 1 + local KV_MAJOR=$(g_KV_major "$1") + local KV_MINOR=$(g_KV_minor "$1") + local KV_MICRO=$(g_KV_micro "$1") + local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO )) + + # We make version 2.2.0 the minimum version we will handle as + # a sanity check ... if its less, we fail ... + if [[ ${KV_int} -ge 131584 ]] ; then + echo "${KV_int}" + return 0 + fi + return 1 +} + +g_int_to_KV() { + local version=$1 major minor micro + major=$((version / 65536)) + minor=$(((version % 65536) / 256)) + micro=$((version % 256)) + echo ${major}.${minor}.${micro} +} + +eend_KV() { + [[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]] + eend $? +} + +get_kheader_version() { + printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \ + $(tc-getCPP ${CTARGET}) -I "${EPREFIX}/$(alt_build_headers)" - | \ + tail -n 1 +} + +# We collect all sanity checks here. Consistency is not guranteed between +# pkg_ and src_ phases, so we call this function both in pkg_pretend and in +# src_unpack. +sanity_prechecks() { + # Make sure devpts is mounted correctly for use w/out setuid pt_chown + check_devpts + + # Prevent native builds from downgrading + if [[ ${MERGE_TYPE} != "buildonly" ]] && \ + [[ ${ROOT} == "/" ]] && \ + [[ ${CBUILD} == ${CHOST} ]] && \ + [[ ${CHOST} == ${CTARGET} ]] ; then + + # The high rev # is to allow people to downgrade between -r# + # versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2 + # should be fine. Hopefully we never actually use a r# this + # high. + if has_version ">${CATEGORY}/${P}-r10000" ; then + eerror "Sanity check to keep you from breaking your system:" + eerror " Downgrading glibc is not supported and a sure way to destruction." + die "Aborting to save your system." + fi + + if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then + eerror "Your old kernel is broken. You need to update it to a newer" + eerror "version as syscall(<bignum>) will break. See bug 279260." + die "Old and broken kernel." + fi + fi + + # Users have had a chance to phase themselves, time to give em the boot + 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 + + if [[ ${CTARGET} == i386-* ]] ; then + eerror "i386 CHOSTs are no longer supported." + eerror "Chances are you don't actually want/need i386." + eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml" + die "Please fix your CHOST" + fi + + if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then + ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS." + ewarn "This will result in a 50% performance penalty when running with a 32bit" + ewarn "hypervisor, which is probably not what you want." + fi + + # Check for sanity of /etc/nsswitch.conf + if [[ -e ${EROOT}/etc/nsswitch.conf ]] ; then + local entry + for entry in passwd group shadow; do + if ! egrep -q "^[ \t]*${entry}:.*files" "${EROOT}"/etc/nsswitch.conf; then + eerror "Your ${EROOT}/etc/nsswitch.conf is out of date." + eerror "Please make sure you have 'files' entries for" + eerror "'passwd:', 'group:' and 'shadow:' databases." + eerror "For more details see:" + eerror " https://wiki.gentoo.org/wiki/Project:Toolchain/nsswitch.conf_in_glibc-2.26" + die "nsswitch.conf has no 'files' provider in '${entry}'." + fi + done + fi + + # ABI-specific checks follow here. Hey, we have a lot more specific conditions that + # we test for... + if ! is_crosscompile ; then + if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then + ebegin "Checking that IA32 emulation is enabled in the running kernel" + echo 'int main(){return 0;}' > "${T}/check-ia32-emulation.c" + local STAT + if "${CC-${CHOST}-gcc}" ${CFLAGS_x86} "${T}/check-ia32-emulation.c" -o "${T}/check-ia32-emulation.elf32"; then + "${T}/check-ia32-emulation.elf32" + STAT=$? + else + # Don't fail here to allow single->multi ABI switch + # or recover from breakage like bug #646424 + ewarn "Failed to compile the ABI test. Broken host glibc?" + STAT=0 + fi + rm -f "${T}/check-ia32-emulation.elf32" + eend $STAT + [[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc." + fi + + fi + + # When we actually have to compile something... + if ! just_headers ; then + ebegin "Checking gcc for __thread support" + if ! eend $(want__thread ; echo $?) ; then + echo + eerror "Could not find a gcc that supports the __thread directive!" + eerror "Please update your binutils/gcc and try again." + die "No __thread support in gcc!" + fi + + if [[ ${CTARGET} == *-linux* ]] ; then + local run_kv build_kv want_kv + + run_kv=$(g_get_running_KV) + build_kv=$(g_int_to_KV $(get_kheader_version)) + want_kv=${MIN_KERN_VER} + + if ! is_crosscompile && ! tc-is-cross-compiler ; then + # Building fails on an non-supporting kernel + ebegin "Checking running kernel version (${run_kv} >= ${want_kv})" + if ! eend_KV ${run_kv} ${want_kv} ; then + echo + eerror "You need a kernel of at least ${want_kv}!" + die "Kernel version too low!" + fi + fi + + ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})" + if ! eend_KV ${build_kv} ${want_kv} ; then + echo + eerror "You need linux-headers of at least ${want_kv}!" + die "linux-headers version too low!" + fi + fi + fi +} + +# +# the phases +# + +# pkg_pretend + +pkg_pretend() { + # All the checks... + einfo "Checking general environment sanity." + sanity_prechecks +} + +# src_unpack + +src_unpack() { + # Consistency is not guaranteed between pkg_ and src_ ... + sanity_prechecks + + use multilib && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz + + setup_env + + if [[ -n ${EGIT_REPO_URI} ]] ; then + git-r3_src_unpack + else + unpack ${P}.tar.xz + fi + + cd "${S}" || die + touch locale/C-translit.h || die #185476 #218003 + + cd "${WORKDIR}" || die + unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.tar.xz +} + +src_prepare() { + if ! use vanilla ; then + elog "Applying Gentoo Glibc Patchset ${RELEASE_VER}-${PATCH_VER}" + eapply "${WORKDIR}"/patches + einfo "Done." + fi + + default + + gnuconfig_update + + cd "${WORKDIR}" + find . -name configure -exec touch {} + + + eprefixify extra/locale/locale-gen + + # Fix permissions on some of the scripts. + chmod u+x "${S}"/scripts/*.sh + + cd "${S}" +} + +glibc_do_configure() { + # Glibc does not work with gold (for various reasons) #269274. + tc-ld-disable-gold + + # CXX isnt handled by the multilib system, so if we dont unset here + # we accumulate crap across abis + unset CXX + + einfo "Configuring glibc for nptl" + + if use doc ; then + export MAKEINFO=makeinfo + else + export MAKEINFO=/dev/null + fi + + local v + for v in ABI CBUILD CHOST CTARGET CBUILD_OPT CTARGET_OPT CC CXX LD {AS,C,CPP,CXX,LD}FLAGS MAKEINFO ; do + einfo " $(printf '%15s' ${v}:) ${!v}" + done + + # CFLAGS can contain ABI-specific flags like -mfpu=neon, see bug #657760 + # To build .S (assembly) files with the same ABI-specific flags + # upstream currently recommends adding CFLAGS to CC/CXX: + # https://sourceware.org/PR23273 + # Note: Passing CFLAGS via CPPFLAGS overrides glibc's arch-specific CFLAGS + # and breaks multiarch support. See 659030#c3 for an example. + # The glibc configure script doesn't properly use LDFLAGS all the time. + export CC="$(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS}" + einfo " $(printf '%15s' 'Manual CC:') ${CC}" + + # Some of the tests are written in C++, so we need to force our multlib abis in, bug 623548 + export CXX="$(tc-getCXX ${CTARGET}) $(get_abi_CFLAGS) ${CFLAGS}" + einfo " $(printf '%15s' 'Manual CXX:') ${CXX}" + + echo + + local myconf=() + + case ${CTARGET} in + powerpc-*) + # Currently gcc on powerpc32 generates invalid code for + # __builtin_return_address(0) calls. Normally programs + # don't do that but malloc hooks in glibc do: + # https://gcc.gnu.org/PR81996 + # https://bugs.gentoo.org/629054 + myconf+=( --enable-stack-protector=no ) + ;; + *) + myconf+=( --enable-stack-protector=all ) + ;; + esac + myconf+=( --enable-stackguard-randomization ) + + # Keep a whitelist of targets supporing IFUNC. glibc's ./configure + # is not robust enough to detect proper support: + # https://bugs.gentoo.org/641216 + # https://sourceware.org/PR22634#c0 + case $(tc-arch ${CTARGET}) in + # Keep whitelist of targets where autodetection mostly works. + amd64|x86|sparc|ppc|ppc64|arm|arm64|s390) ;; + # Blacklist everywhere else + *) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;; + esac + + # Enable Intel Control-flow Enforcement Technology on amd64 if requested + case ${CTARGET} in + x86_64-*) myconf+=( $(use_enable cet) ) ;; + *) ;; + esac + + [[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp ) + + myconf+=( --enable-kernel=${MIN_KERN_VER} ) + + # 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 ; 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 + --disable-werror + --enable-bind-now + --build=${CBUILD_OPT:-${CBUILD}} + --host=${CTARGET_OPT:-${CTARGET}} + $(use_enable profile) + $(use_with gd) + --with-headers=$(alt_build_headers) + --prefix="${EPREFIX}/usr" + --sysconfdir="${EPREFIX}/etc" + --localstatedir="${EPREFIX}/var" + --libdir='$(prefix)'/$(get_libdir) + --mandir='$(prefix)'/share/man + --infodir='$(prefix)'/share/info + --libexecdir='$(libdir)'/misc/glibc + --with-bugurl=https://bugs.gentoo.org/ + --with-pkgversion="$(glibc_banner)" + $(use_multiarch || echo --disable-multi-arch) + $(use_enable systemtap) + $(use_enable nscd) + ${EXTRA_ECONF} + ) + + # We rely on sys-libs/timezone-data for timezone tools normally. + myconf+=( $(use_enable vanilla timezone-tools) ) + + # These libs don't have configure flags. + ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no) + ac_cv_lib_cap_cap_init=$(usex caps || echo no) + + # There is no configure option for this and we need to export it + # since the glibc build will re-run configure on itself + export libc_cv_rootsbindir="${EPREFIX}/sbin" + export libc_cv_slibdir="${EPREFIX}/$(get_libdir)" + + # 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 builddir=$(builddir nptl) + 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-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die + fi + fi +} + +glibc_headers_configure() { + export ABI=default + + local builddir=$(builddir "headers") + mkdir -p "${builddir}" + cd "${builddir}" + + # if we don't have a compiler yet, we can't really test it now ... + # hopefully they don't affect header generation, 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_compiler_powerpc64le_binary128_ok=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=no + libc_cv_target_power8_ok=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 + libc_cv_z_relro=yes + libc_mips_abi=${ABI} + libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard) + # These libs don't have configure flags. + ac_cv_lib_audit_audit_log_user_avc_message=no + ac_cv_lib_cap_cap_init=no + ) + + einfo "Forcing cached settings:" + for v in "${vars[@]}" ; do + einfo " ${v}" + export ${v} + done + + local headers_only_arch_CPPFLAGS=() + + # Blow away some random CC settings that screw things up. #550192 + if [[ -d ${S}/sysdeps/mips ]]; then + pushd "${S}"/sysdeps/mips >/dev/null + sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die + sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die + + # Force the mips ABI to the default. This is OK because the set of + # installed headers in this phase is the same between the 3 ABIs. + # If this ever changes, this hack will break, but that's unlikely + # as glibc discourages that behavior. + # https://crbug.com/647033 + sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die + + popd >/dev/null + fi + + case ${CTARGET} in + riscv*) + # RISC-V interrogates the compiler to determine which target to + # build. If building the headers then we don't strictly need a + # RISC-V compiler, so the built-in definitions that are provided + # along with all RISC-V compiler might not exist. This causes + # glibc's RISC-V preconfigure script to blow up. Since we're just + # building the headers any value will actually work here, so just + # pick the standard one (rv64g/lp64d) to make the build scripts + # happy for now -- the headers are all the same anyway so it + # doesn't matter. + headers_only_arch_CPPFLAGS+=( + -D__riscv_xlen=64 + -D__riscv_flen=64 + -D__riscv_float_abi_double=1 + -D__riscv_atomic=1 + ) ;; + esac + + local myconf=() + myconf+=( + --disable-sanity-checks + --enable-hacker-mode + --without-cvs + --disable-werror + --enable-bind-now + --build=${CBUILD_OPT:-${CBUILD}} + --host=${CTARGET_OPT:-${CTARGET}} + --with-headers=$(alt_build_headers) + --prefix="${EPREFIX}/usr" + ${EXTRA_ECONF} + ) + + # Nothing is compiled here which would affect the headers for the target. + # So forcing CC/CFLAGS is sane. + local headers_only_CC=$(tc-getBUILD_CC) + local headers_only_CFLAGS="-O1 -pipe" + local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}" + local headers_only_LDFLAGS="" + set -- "${S}"/configure "${myconf[@]}" + echo \ + "CC=${headers_only_CC}" \ + "CFLAGS=${headers_only_CFLAGS}" \ + "CPPFLAGS=${headers_only_CPPFLAGS}" \ + "LDFLAGS=${headers_only_LDFLAGS}" \ + "$@" + CC=${headers_only_CC} \ + CFLAGS=${headers_only_CFLAGS} \ + CPPFLAGS=${headers_only_CPPFLAGS} \ + LDFLAGS="" \ + "$@" || die "failed to configure glibc" +} + +do_src_configure() { + if just_headers ; then + glibc_headers_configure + else + glibc_do_configure nptl + fi +} + +src_configure() { + foreach_abi do_src_configure +} + +do_src_compile() { + emake -C "$(builddir nptl)" || die "make nptl for ${ABI} failed" +} + +src_compile() { + if just_headers ; then + return + fi + + foreach_abi do_src_compile +} + +glibc_src_test() { + cd "$(builddir nptl)" + emake check +} + +do_src_test() { + local ret=0 + + glibc_src_test + : $(( ret |= $? )) + + return ${ret} +} + +src_test() { + if just_headers ; then + return + fi + + # Give tests more time to complete. + export TIMEOUTFACTOR=5 + + foreach_abi do_src_test || die "tests failed" +} + +run_locale_gen() { + # if the host locales.gen contains no entries, we'll install everything + local root="$1" + 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="${root}/usr/share/i18n/SUPPORTED" + fi + + locale-gen --jobs $(makeopts_jobs) --config "${locale_list}" \ + --destdir "${root}" +} + +glibc_do_src_install() { + local builddir=$(builddir nptl) + cd "${builddir}" + + emake install_root="${D}$(alt_prefix)" install || die + + # This version (2.26) provides some compatibility libraries for the NIS/NIS+ support + # which come without headers etc. Only needed for binary packages since the + # external net-libs/libnsl has increased soversion. Keep only versioned libraries. + find "${D}" -name "libnsl.a" -delete + find "${D}" -name "libnsl.so" -delete + + # Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need + # to infer upstream version: + # '#define VERSION "2.26.90"' -> '2.26.90' + local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h) + + if [[ -e ${ED}$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then + # Move versioned .a file out of libdir to evade portage QA checks + # instead of using gen_usr_ldscript(). We fix ldscript as: + # "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..." + sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"$(alt_usrlibdir)/libm.a || die + dodir $(alt_usrlibdir)/${P} + mv "${ED}"$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die + fi + + # We'll take care of the cache ourselves + 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 + ) + 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 + 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 ${ED}/${ldso_name} && ! -e ${ED}/${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 ! use suid ; then + find "${ED}" -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. + keepdir $(alt_prefix)/lib + keepdir $(alt_prefix)/usr/lib + + dosym usr/include $(alt_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 + doman *.[0-8] + insinto /etc + doins locale.gen + + # 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 ../$(get_libdir)/locale /usr/$(get_abi_LIBDIR ${a})/locale + fi + done + + cd "${S}" + + # Install misc network config files + insinto /etc + doins nscd/nscd.conf posix/gai.conf nss/nsswitch.conf + doins "${WORKDIR}"/extra/etc/*.conf + + if use nscd ; then + doinitd "$(prefixify_ro "${WORKDIR}"/extra/etc/nscd)" + + local nscd_args=( + -e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):" + ) + + sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd + + systemd_dounit nscd/nscd.service + systemd_newtmpfilesd nscd/nscd.tmpfiles nscd.conf + 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 + + for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do + [[ -s ${d} ]] && dodoc ${d} + done + dodoc -r ChangeLog.old + + # Prevent overwriting of the /etc/localtime symlink. We'll handle the + # creation of the "factory" symlink in pkg_postinst(). + rm -f "${ED}"/etc/localtime + + # Generate all locales if this is a native build as locale generation + if use compile-locales && ! is_crosscompile ; then + run_locale_gen "${ED}" + fi +} + +glibc_headers_install() { + local builddir=$(builddir "headers") + cd "${builddir}" + emake install_root="${D}$(alt_prefix)" install-headers + + insinto $(alt_headers)/gnu + doins "${S}"/include/gnu/stubs.h + + # 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 $(alt_prefix)/sys-include +} + +src_strip() { + # gdb is lame and requires some debugging information to remain in + # libpthread, so we need to strip it by hand. libthread_db makes no + # sense stripped as it is only used when debugging. + local pthread=$(has splitdebug ${FEATURES} && echo "libthread_db" || echo "lib{pthread,thread_db}") + env \ + -uRESTRICT \ + CHOST=${CTARGET} \ + STRIP_MASK="/*/{,tls/}${pthread}*" \ + prepallstrip + # if user has stripping enabled and does not have split debug turned on, + # then leave the debugging sections in libpthread. + if ! has nostrip ${FEATURES} && ! has splitdebug ${FEATURES} ; then + ${STRIP:-${CTARGET}-strip} --strip-debug "${ED}"$(alt_prefix)/*/libpthread-*.so + fi +} + +src_install() { + if just_headers ; then + export ABI=default + glibc_headers_install + return + fi + + foreach_abi glibc_do_src_install + src_strip +} + +# Simple test to make sure our new glibc isn't 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 + # 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 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 + case ${striptest} in + *"statically linked"*) continue;; + *"ASCII text"*) continue;; + esac + # We need to clear the locale settings as the upgrade might want + # incompatible locale data. This test is not for verifying that. + LC_ALL=C \ + ./ld-*.so --library-path . ${x} > /dev/null \ + || die "simple run test (${x}) failed" + done + + popd >/dev/null +} + +pkg_preinst() { + # nothing to do if just installing headers + just_headers && return + + # prepare /etc/ld.so.conf.d/ for files + mkdir -p "${EROOT}"/etc/ld.so.conf.d + + # 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 + einfo "Defaulting /etc/host.conf:multi to on" + fi + + [[ ${ROOT} != "/" ]] && return 0 + [[ -d ${ED}/$(get_libdir) ]] || return 0 + [[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check +} + +pkg_postinst() { + # nothing to do if just installing headers + just_headers && return + + if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then + # Generate fastloading iconv module configuration file. + "${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}" + fi + + if ! is_crosscompile && [[ ${ROOT} == "/" ]] ; then + # Reload init ... if in a chroot or a diff init package, ignore + # errors from this step #253697 + /sbin/telinit U 2>/dev/null + + use compile-locales || run_locale_gen "${EROOT}" + fi + + # Check for sanity of /etc/nsswitch.conf, take 2 + if [[ -e ${EROOT}/etc/nsswitch.conf ]] && ! has_version sys-auth/libnss-nis ; then + local entry + for entry in passwd group shadow; do + if egrep -q "^[ \t]*${entry}:.*nis" "${EROOT}"/etc/nsswitch.conf; then + ewarn "" + ewarn "Your ${EROOT}/etc/nsswitch.conf uses NIS. Support for that has been" + ewarn "removed from glibc and is now provided by the package" + ewarn " sys-auth/libnss-nis" + ewarn "Install it now to keep your NIS setup working." + ewarn "" + fi + done + fi +} |