summaryrefslogtreecommitdiff
path: root/sys-devel
diff options
context:
space:
mode:
authorV3n3RiX <venerix@redcorelinux.org>2018-12-24 15:36:46 +0000
committerV3n3RiX <venerix@redcorelinux.org>2018-12-24 15:36:46 +0000
commit2a15bb4c21792825ebc98028bbcfff4bb76230eb (patch)
tree78d658bfc8a6fa5463435afbe598bd3847a26be0 /sys-devel
parent7e363b923a5933e24521c24eafc75492fa4f5826 (diff)
import the toolchain from gentoo tree, increase revisions so they cannot beat us
Diffstat (limited to 'sys-devel')
-rw-r--r--sys-devel/binutils/Manifest2
-rw-r--r--sys-devel/binutils/binutils-2.31.1-r1337.ebuild426
-rw-r--r--sys-devel/binutils/files/binutils-2.29.1-nogoldtest.patch27
-rw-r--r--sys-devel/binutils/files/binutils-2.31-test-driver148
-rw-r--r--sys-devel/binutils/files/binutils-configure-LANG.patch65
-rw-r--r--sys-devel/gcc/Manifest2
-rw-r--r--sys-devel/gcc/files/3.3.4/libffi-without-libgcj.patch22
-rw-r--r--sys-devel/gcc/files/3.4.3/libffi-nogcj-lib-path-fix.patch40
-rw-r--r--sys-devel/gcc/files/3.4.3/libffi-without-libgcj.patch40
-rw-r--r--sys-devel/gcc/files/3.4.4/gcc-3.4.4-cross-compile.patch63
-rw-r--r--sys-devel/gcc/files/4.1.0/gcc-4.1.0-cross-compile.patch40
-rw-r--r--sys-devel/gcc/files/4.1.0/gcc-4.1.0-fast-math-i386-Os-workaround.patch64
-rw-r--r--sys-devel/gcc/files/awk/fixlafiles.awk313
-rw-r--r--sys-devel/gcc/files/awk/fixlafiles.awk-no_gcc_la334
-rw-r--r--sys-devel/gcc/files/c8920
-rw-r--r--sys-devel/gcc/files/c9921
-rw-r--r--sys-devel/gcc/files/fix_libtool_files.sh66
-rw-r--r--sys-devel/gcc/files/gcc-4.9.4-bootstrap.patch66
-rw-r--r--sys-devel/gcc/files/gcc-configure-LANG.patch64
-rw-r--r--sys-devel/gcc/files/gcc-configure-texinfo.patch16
-rw-r--r--sys-devel/gcc/files/gcc-spec-env-r1.patch87
-rw-r--r--sys-devel/gcc/files/gcc-spec-env.patch42
-rw-r--r--sys-devel/gcc/gcc-8.2.0-r1337.ebuild20
-rw-r--r--sys-devel/gede/Manifest1
-rw-r--r--sys-devel/gede/gede-2.7.4.ebuild37
-rw-r--r--sys-devel/libtool/Manifest1
-rw-r--r--sys-devel/libtool/files/libtool-2.2.10-eprefix.patch11
-rw-r--r--sys-devel/libtool/files/libtool-2.2.6a-darwin-module-bundle.patch24
-rw-r--r--sys-devel/libtool/files/libtool-2.4.3-use-linux-version-in-fbsd.patch38
-rw-r--r--sys-devel/libtool/files/libtool-2.4.6-darwin-use-linux-version.patch13
-rw-r--r--sys-devel/libtool/files/libtool-2.4.6-libtoolize-delay-help.patch53
-rw-r--r--sys-devel/libtool/files/libtool-2.4.6-libtoolize-slow.patch118
-rw-r--r--sys-devel/libtool/files/libtool-2.4.6-link-fsanitize.patch58
-rw-r--r--sys-devel/libtool/files/libtool-2.4.6-link-fuse-ld.patch54
-rw-r--r--sys-devel/libtool/files/libtool-2.4.6-link-specs.patch57
-rw-r--r--sys-devel/libtool/files/libtool-2.4.6-mint.patch49
-rw-r--r--sys-devel/libtool/files/libtool-2.4.6-ppc64le.patch111
-rw-r--r--sys-devel/libtool/files/libtool-2.4.6-pthread.patch43
-rw-r--r--sys-devel/libtool/files/libtool-2.4.6-pthread_bootstrapped.patch21
-rw-r--r--sys-devel/libtool/files/libtool-2.4.6-sed-quote-speedup.patch268
-rw-r--r--sys-devel/libtool/libtool-2.4.6-r1337.ebuild127
41 files changed, 3034 insertions, 38 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='' # Red.
+ grn='' # Green.
+ lgn='' # Light green.
+ blu='' # Blue.
+ mgn='' # Magenta.
+ std='' # 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)
+}