public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Benda XU" <heroxbd@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] dev/heroxbd:master commit in: sys-devel/gcc/, profiles/prefix/linux/arm/with-libc/, sys-devel/binutils/files/, ...
Date: Mon, 30 Sep 2013 14:02:17 +0000 (UTC)	[thread overview]
Message-ID: <1377986136.c98d2ea822845643bc10a40e349eaf16e7ed9291.heroxbd@gentoo> (raw)

commit:     c98d2ea822845643bc10a40e349eaf16e7ed9291
Author:     XU Benda <heroxbd <AT> gmail <DOT> com>
AuthorDate: Sat Aug 31 21:55:36 2013 +0000
Commit:     Benda XU <heroxbd <AT> gentoo <DOT> org>
CommitDate: Sat Aug 31 21:55:36 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=dev/heroxbd.git;a=commit;h=c98d2ea8

rap toolchain update

---
 eclass/toolchain-binutils.eclass                   |  476 +++++
 eclass/toolchain.eclass                            | 2128 ++++++++++++++++++++
 eclass/wxwidgets.eclass                            |  285 +++
 .../default/linux/amd64/13.0/rap/make.defaults     |    3 +
 profiles/default/linux/amd64/13.0/rap/parent       |    2 +
 .../linux/arm/13.0/armv7a/rap/make.defaults        |    3 +
 profiles/default/linux/arm/13.0/armv7a/rap/parent  |    2 +
 profiles/default/linux/x86/13.0/rap/make.defaults  |    3 +
 profiles/default/linux/x86/13.0/rap/parent         |    2 +
 profiles/features/rap/make.defaults                |    2 +
 profiles/features/rap/packages                     |   11 +
 profiles/features/rap/profile.bashrc               |    9 +
 profiles/features/rap/use.force                    |    5 +
 profiles/features/rap/use.mask                     |    8 +
 profiles/prefix/features/with-libc/packages        |    3 +
 ...ges.78a8f6ffc32b4d5af3a26b6758688d4f.unison.tmp |    2 +
 profiles/prefix/linux/arm/with-libc/parent         |    2 +
 profiles/prefix/linux/x86/with-libc/make.defaults  |    6 +
 profiles/prefix/linux/x86/with-libc/parent         |    2 +
 sys-devel/binutils/Manifest                        |    3 +-
 sys-devel/binutils/binutils-2.23.ebuild            |    5 +-
 .../files/binutils-2.23-runtime-sysroot.patch      |  116 ++
 sys-devel/gcc/Manifest                             |   16 +-
 sys-devel/gcc/files/gcc-4.2-rap.patch              |   28 +
 .../gcc/files/gcc-4.7.3-no-sysroot-to-ld.patch     |   13 -
 sys-devel/gcc/gcc-3.3.6-r1.ebuild                  |   41 -
 sys-devel/gcc/gcc-3.4.6-r2.ebuild                  |   90 -
 sys-devel/gcc/gcc-4.2.4-r1.ebuild                  |   38 +
 28 files changed, 3146 insertions(+), 158 deletions(-)

diff --git a/eclass/toolchain-binutils.eclass b/eclass/toolchain-binutils.eclass
new file mode 100644
index 0000000..d9197e0
--- /dev/null
+++ b/eclass/toolchain-binutils.eclass
@@ -0,0 +1,476 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/eclass/toolchain-binutils.eclass,v 1.123 2013/02/09 04:32:48 vapier Exp $
+#
+# Maintainer: Toolchain Ninjas <toolchain@gentoo.org>
+#
+# We install binutils into CTARGET-VERSION specific directories.  This lets
+# us easily merge multiple versions for multiple targets (if we wish) and
+# then switch the versions on the fly (with `binutils-config`).
+#
+# binutils-99999999       -> live cvs
+# binutils-9999           -> live git
+# binutils-9999_preYYMMDD -> nightly snapshot date YYMMDD
+# binutils-#              -> normal release
+
+extra_eclass=""
+if [[ -n ${BINUTILS_TYPE} ]] ; then
+	BTYPE=${BINUTILS_TYPE}
+else
+	case ${PV} in
+	99999999)  BTYPE="cvs";;
+	9999)      BTYPE="git";;
+	9999_pre*) BTYPE="snap";;
+	*.*.90)    BTYPE="snap";;
+	*.*.*.*.*) BTYPE="hjlu";;
+	*)         BTYPE="rel";;
+	esac
+fi
+
+case ${BTYPE} in
+cvs)
+	extra_eclass="cvs"
+	ECVS_SERVER="sourceware.org:/cvs/src"
+	ECVS_MODULE="binutils"
+	ECVS_USER="anoncvs"
+	ECVS_PASS="anoncvs"
+	BVER="cvs"
+	;;
+git)
+	extra_eclass="git-2"
+	BVER="git"
+	EGIT_REPO_URI="git://sourceware.org/git/binutils.git"
+	;;
+snap)
+	BVER=${PV/9999_pre}
+	;;
+*)
+	BVER=${BINUTILS_VER:-${PV}}
+	;;
+esac
+
+inherit eutils libtool flag-o-matic gnuconfig multilib versionator unpacker ${extra_eclass}
+EXPORT_FUNCTIONS src_unpack src_compile src_test src_install pkg_postinst pkg_postrm
+
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+	if [[ ${CATEGORY/cross-} != ${CATEGORY} ]] ; then
+		export CTARGET=${CATEGORY/cross-}
+	fi
+fi
+is_cross() { [[ ${CHOST} != ${CTARGET} ]] ; }
+
+DESCRIPTION="Tools necessary to build programs"
+HOMEPAGE="http://sourceware.org/binutils/"
+
+case ${BTYPE} in
+	cvs|git) SRC_URI="" ;;
+	snap)
+		SRC_URI="ftp://gcc.gnu.org/pub/binutils/snapshots/binutils-${BVER}.tar.bz2
+			ftp://sourceware.org/pub/binutils/snapshots/binutils-${BVER}.tar.bz2" ;;
+	hjlu)
+		SRC_URI="mirror://kernel/linux/devel/binutils/binutils-${BVER}.tar."
+		version_is_at_least 2.21.51.0.5 && SRC_URI+="xz" || SRC_URI+="bz2" ;;
+	rel) SRC_URI="mirror://gnu/binutils/binutils-${BVER}.tar.bz2" ;;
+esac
+add_src_uri() {
+	[[ -z $2 ]] && return
+	local a=$1
+	if version_is_at_least 2.22.52.0.2 ; then
+		a+=".xz"
+	else
+		a+=".bz2"
+	fi
+	set -- mirror://gentoo http://dev.gentoo.org/~vapier/dist
+	SRC_URI="${SRC_URI} ${@/%//${a}}"
+}
+add_src_uri binutils-${BVER}-patches-${PATCHVER}.tar ${PATCHVER}
+add_src_uri binutils-${BVER}-uclibc-patches-${UCLIBC_PATCHVER}.tar ${UCLIBC_PATCHVER}
+add_src_uri elf2flt-${ELF2FLT_VER}.tar ${ELF2FLT_VER}
+
+if version_is_at_least 2.18 ; then
+	LICENSE="|| ( GPL-3 LGPL-3 )"
+else
+	LICENSE="|| ( GPL-2 LGPL-2 )"
+fi
+IUSE="cxx nls multitarget multislot static-libs test vanilla"
+if version_is_at_least 2.19 ; then
+	IUSE+=" zlib"
+fi
+if use multislot ; then
+	SLOT="${BVER}"
+else
+	SLOT="0"
+fi
+
+RDEPEND=">=sys-devel/binutils-config-1.9"
+in_iuse zlib && RDEPEND+=" zlib? ( sys-libs/zlib )"
+DEPEND="${RDEPEND}
+	test? ( dev-util/dejagnu )
+	nls? ( sys-devel/gettext )
+	sys-devel/flex
+	virtual/yacc"
+
+S=${WORKDIR}/binutils
+case ${BVER} in
+cvs|git) ;;
+*) S=${S}-${BVER} ;;
+esac
+
+LIBPATH=/usr/$(get_libdir)/binutils/${CTARGET}/${BVER}
+INCPATH=${LIBPATH}/include
+DATAPATH=/usr/share/binutils-data/${CTARGET}/${BVER}
+MY_BUILDDIR=${WORKDIR}/build
+if is_cross ; then
+	BINPATH=/usr/${CHOST}/${CTARGET}/binutils-bin/${BVER}
+else
+	BINPATH=/usr/${CTARGET}/binutils-bin/${BVER}
+fi
+
+tc-binutils_unpack() {
+	case ${BTYPE} in
+	cvs) cvs_src_unpack ;;
+	git) git-2_src_unpack ;;
+	*)   unpacker ${A} ;;
+	esac
+	mkdir -p "${MY_BUILDDIR}"
+	[[ -d ${WORKDIR}/patch ]] && mkdir "${WORKDIR}"/patch/skip
+}
+
+# In case the ebuild wants to add a few of their own.
+PATCHES=()
+
+tc-binutils_apply_patches() {
+	cd "${S}"
+
+	if ! use vanilla ; then
+		if [[ -n ${PATCHVER} ]] ; then
+			EPATCH_SOURCE=${WORKDIR}/patch
+			if [[ ${CTARGET} == mips* ]] ; then
+				# remove gnu-hash for mips (bug #233233)
+				EPATCH_EXCLUDE+=" 77_all_generate-gnu-hash.patch"
+			fi
+			[[ -n $(ls "${EPATCH_SOURCE}"/*.bz2 2>/dev/null) ]] \
+				&& EPATCH_SUFFIX="patch.bz2" \
+				|| EPATCH_SUFFIX="patch"
+			epatch
+		fi
+		if [[ -n ${UCLIBC_PATCHVER} ]] ; then
+			EPATCH_SOURCE=${WORKDIR}/uclibc-patches
+			[[ -n $(ls "${EPATCH_SOURCE}"/*.bz2 2>/dev/null) ]] \
+				&& EPATCH_SUFFIX="patch.bz2" \
+				|| EPATCH_SUFFIX="patch"
+			EPATCH_MULTI_MSG="Applying uClibc fixes ..." \
+			epatch
+		elif [[ ${CTARGET} == *-uclibc* ]] ; then
+			# starting with binutils-2.17.50.0.17, we no longer need
+			# uClibc patchsets :D
+			if grep -qs 'linux-gnu' "${S}"/ltconfig ; then
+				die "sorry, but this binutils doesn't yet support uClibc :("
+			fi
+		fi
+		[[ ${#PATCHES[@]} -gt 0 ]] && epatch "${PATCHES[@]}"
+		epatch_user
+	fi
+
+	# fix locale issues if possible #122216
+	if [[ -e ${FILESDIR}/binutils-configure-LANG.patch ]] ; then
+		einfo "Fixing misc issues in configure files"
+		for f in $(grep -l 'autoconf version 2.13' $(find "${S}" -name configure)) ; 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
+
+	# Fix po Makefile generators
+	sed -i \
+		-e '/^datadir = /s:$(prefix)/@DATADIRNAME@:@datadir@:' \
+		-e '/^gnulocaledir = /s:$(prefix)/share:$(datadir):' \
+		*/po/Make-in || die "sed po's failed"
+
+	# Run misc portage update scripts
+	gnuconfig_update
+	elibtoolize --portage --no-uclibc
+}
+
+toolchain-binutils_src_unpack() {
+	tc-binutils_unpack
+	tc-binutils_apply_patches
+}
+
+toolchain-binutils_src_compile() {
+	# prevent makeinfo from running in releases.  it may not always be
+	# installed, and older binutils may fail with newer texinfo.
+	# besides, we never patch the doc files anyways, so regenerating
+	# in the first place is useless. #193364
+	find . '(' -name '*.info' -o -name '*.texi' ')' -print0 | xargs -0 touch -r .
+
+	# 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 if available (installed as ld.gold)
+	if use cxx ; then
+		if grep -q 'enable-gold=default' "${S}"/configure ; then
+			myconf+=( --enable-gold )
+		# old ways - remove when 2.21 is stable
+		elif grep -q 'enable-gold=both/ld' "${S}"/configure ; then
+			myconf+=( --enable-gold=both/ld )
+		elif grep -q 'enable-gold=both/bfd' "${S}"/configure ; then
+			myconf+=( --enable-gold=both/bfd )
+		fi
+		if grep -q -e '--enable-plugins' "${S}"/ld/configure ; then
+			myconf+=( --enable-plugins )
+		fi
+	fi
+
+	use nls \
+		&& myconf+=( --without-included-gettext ) \
+		|| myconf+=( --disable-nls )
+
+	if in_iuse zlib ; then
+		# older versions did not have an explicit configure flag
+		export ac_cv_search_zlibVersion=$(usex zlib -lz no)
+		myconf+=( $(use_with zlib) )
+	fi
+
+	# 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} )
+
+	# 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 )
+
+	myconf+=(
+		--prefix="${EPREFIX}"/usr
+		--host=${CHOST}
+		--target=${CTARGET}
+		--datadir="${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
+		--disable-werror
+		--with-bugurl=http://bugs.gentoo.org/
+		$(use_enable static-libs static)
+		${EXTRA_ECONF}
+	)
+	echo ./configure "${myconf[@]}"
+	"${S}"/configure "${myconf[@]}" || die
+
+	emake all || die "emake failed"
+
+	# only build info pages if we user wants them, and if
+	# we have makeinfo (may not exist when we bootstrap)
+	if type -p makeinfo > /dev/null ; then
+		emake info || die "make info failed"
+	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 | xargs rm -f
+
+	# elf2flt only works on some arches / targets
+	if [[ -n ${ELF2FLT_VER} ]] && [[ ${CTARGET} == *linux* || ${CTARGET} == *-elf* ]] ; then
+		cd "${WORKDIR}"/elf2flt-${ELF2FLT_VER}
+
+		local x supported_arches=$(sed -n '/defined(TARGET_/{s:^.*TARGET_::;s:)::;p}' elf2flt.c | sort -u)
+		for x in ${supported_arches} UNSUPPORTED ; do
+			[[ ${CTARGET} == ${x}* ]] && break
+		done
+
+		if [[ ${x} != "UNSUPPORTED" ]] ; then
+			append-flags -I"${S}"/include
+			myconf+=(
+				--with-bfd-include-dir=${MY_BUILDDIR}/bfd
+				--with-libbfd=${MY_BUILDDIR}/bfd/libbfd.a
+				--with-libiberty=${MY_BUILDDIR}/libiberty/libiberty.a
+				--with-binutils-ldscript-dir="${EPREFIX}"${LIBPATH}/ldscripts
+			)
+			echo ./configure "${myconf[@]}"
+			./configure "${myconf[@]}" || die
+			emake || die "make elf2flt failed"
+		fi
+	fi
+}
+
+toolchain-binutils_src_test() {
+	cd "${MY_BUILDDIR}"
+	emake -k check || die "check failed :("
+}
+
+toolchain-binutils_src_install() {
+	local x d
+
+	cd "${MY_BUILDDIR}"
+	emake DESTDIR="${D}" tooldir="${EPREFIX}/${LIBPATH}" install || die
+	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} == ../${BVER} ]] && 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
+
+	# Insert elf2flt where appropriate
+	if [[ -x ${WORKDIR}/elf2flt-${ELF2FLT_VER}/elf2flt ]] ; then
+		cd "${WORKDIR}"/elf2flt-${ELF2FLT_VER}
+		insinto ${LIBPATH}/ldscripts
+		doins elf2flt.ld || die "doins elf2flt.ld failed"
+		exeinto ${BINPATH}
+		doexe elf2flt flthdr || die "doexe elf2flt flthdr failed"
+		mv "${ED}"/${BINPATH}/{ld,ld.real} || die
+		newexe ld-elf2flt ld || die "doexe ld-elf2flt failed"
+		newdoc README README.elf2flt
+	fi
+
+	# Now, some binutils are tricky and actually provide
+	# for multiple TARGETS.  Really, we're talking just
+	# 32bit/64bit support (like mips/ppc/sparc).  Here
+	# we want to tell binutils-config that it's cool if
+	# it generates multiple sets of binutil symlinks.
+	# e.g. sparc gets {sparc,sparc64}-unknown-linux-gnu
+	local targ=${CTARGET/-*} src="" dst=""
+	local FAKE_TARGETS=${CTARGET}
+	case ${targ} in
+		mips*)    src="mips"    dst="mips64";;
+		powerpc*) src="powerpc" dst="powerpc64";;
+		s390*)    src="s390"    dst="s390x";;
+		sparc*)   src="sparc"   dst="sparc64";;
+	esac
+	case ${targ} in
+		mips64*|powerpc64*|s390x*|sparc64*) targ=${src} src=${dst} dst=${targ};;
+	esac
+	[[ -n ${src}${dst} ]] && FAKE_TARGETS="${FAKE_TARGETS} ${CTARGET/${src}/${dst}}"
+
+	# Generate an env.d entry for this binutils
+	cd "${S}"
+	insinto /etc/env.d/binutils
+	cat <<-EOF > env.d
+		TARGET="${CTARGET}"
+		VER="${BVER}"
+		LIBPATH="${EPREFIX}/${LIBPATH}"
+		FAKE_TARGETS="${FAKE_TARGETS}"
+	EOF
+	newins env.d ${CTARGET}-${BVER}
+
+	# 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}" -type d | xargs rmdir >& /dev/null
+}
+
+toolchain-binutils_pkg_postinst() {
+	# Make sure this ${CTARGET} has a binutils version selected
+	[[ -e ${EROOT}/etc/env.d/binutils/config-${CTARGET} ]] && return 0
+	binutils-config ${CTARGET}-${BVER}
+}
+
+toolchain-binutils_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}-${BVER} ]] ; then
+		local choice=$(binutils-config -l | grep ${CTARGET} | awk '{print $2}')
+		choice=${choice//$'\n'/ }
+		choice=${choice/* }
+		if [[ -z ${choice} ]] ; then
+			env -i ROOT="${ROOT}" binutils-config -u ${CTARGET}
+		else
+			binutils-config ${choice}
+		fi
+	elif [[ $(CHOST=${CTARGET} binutils-config -c) == ${CTARGET}-${BVER} ]] ; then
+		binutils-config ${CTARGET}-${BVER}
+	fi
+}

diff --git a/eclass/toolchain.eclass b/eclass/toolchain.eclass
new file mode 100644
index 0000000..76d92e6
--- /dev/null
+++ b/eclass/toolchain.eclass
@@ -0,0 +1,2128 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/eclass/toolchain.eclass,v 1.597 2013/07/24 01:34:38 dirtyepic Exp $
+
+# Maintainer: Toolchain Ninjas <toolchain@gentoo.org>
+
+#---->> eclass stuff <<----
+DESCRIPTION="The GNU Compiler Collection"
+HOMEPAGE="http://gcc.gnu.org/"
+LICENSE="GPL-2 LGPL-2.1"
+RESTRICT="strip" # cross-compilers need controlled stripping
+
+inherit eutils versionator libtool toolchain-funcs flag-o-matic gnuconfig multilib fixheadtails pax-utils prefix
+
+if [[ ${PV} == *_pre9999* ]] ; then
+	EGIT_REPO_URI="git://gcc.gnu.org/git/gcc.git"
+	# naming style:
+	# gcc-4.7.1_pre9999 -> gcc-4_7-branch
+	#  Note that the micro version is required or lots of stuff will break.
+	#  To checkout master set gcc_LIVE_BRANCH="master" in the ebuild before
+	#  inheriting this eclass.
+	EGIT_BRANCH="${PN}-${PV%.?_pre9999}-branch"
+	EGIT_BRANCH=${EGIT_BRANCH//./_}
+	inherit git-2
+fi
+
+FEATURES=${FEATURES/multilib-strict/}
+
+EXPORT_FUNCTIONS pkg_setup src_unpack src_compile src_test src_install pkg_postinst pkg_postrm
+#----<< eclass stuff >>----
+
+#---->> globals <<----
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} = ${CHOST} ]] ; then
+	if [[ ${CATEGORY/cross-} != ${CATEGORY} ]] ; then
+		export CTARGET=${CATEGORY/cross-}
+	fi
+fi
+: ${TARGET_ABI:=${ABI}}
+: ${TARGET_MULTILIB_ABIS:=${MULTILIB_ABIS}}
+: ${TARGET_DEFAULT_ABI:=${DEFAULT_ABI}}
+
+is_crosscompile() {
+	[[ ${CHOST} != ${CTARGET} ]]
+}
+
+# General purpose version check.  Without a second arg matches up to minor version (x.x.x)
+# (ie. 4.6.0_pre9999 matches 4 or 4.6 or 4.6.0 but not 4.6.1)
+tc_version_is_at_least() { 
+	version_is_at_least "$1" "${2:-${GCC_RELEASE_VER}}"
+}
+
+GCC_PV=${TOOLCHAIN_GCC_PV:-${PV}}
+GCC_PVR=${GCC_PV}
+[[ ${PR} != "r0" ]] && GCC_PVR=${GCC_PVR}-${PR}
+GCC_RELEASE_VER=$(get_version_component_range 1-3 ${GCC_PV})
+GCC_BRANCH_VER=$(get_version_component_range 1-2 ${GCC_PV})
+GCCMAJOR=$(get_version_component_range 1 ${GCC_PV})
+GCCMINOR=$(get_version_component_range 2 ${GCC_PV})
+GCCMICRO=$(get_version_component_range 3 ${GCC_PV})
+[[ ${BRANCH_UPDATE-notset} == "notset" ]] && \
+	BRANCH_UPDATE=$(get_version_component_range 4 ${GCC_PV})
+
+# According to gcc/c-cppbuiltin.c, GCC_CONFIG_VER MUST match this regex.
+# ([^0-9]*-)?[0-9]+[.][0-9]+([.][0-9]+)?([- ].*)?
+GCC_CONFIG_VER=${GCC_CONFIG_VER:-$(replace_version_separator 3 '-' ${GCC_PV})}
+
+# Pre-release support
+if [[ ${GCC_PV} != ${GCC_PV/_pre/-} ]] ; then
+	PRERELEASE=${GCC_PV/_pre/-}
+fi
+
+# make _alpha and _beta ebuilds automatically use a snapshot
+if [[ ${GCC_PV} == *_alpha* ]] ; then
+	SNAPSHOT=${GCC_BRANCH_VER}-${GCC_PV##*_alpha}
+elif [[ ${GCC_PV} == *_beta* ]] ; then
+	SNAPSHOT=${GCC_BRANCH_VER}-${GCC_PV##*_beta}
+elif [[ ${GCC_PV} == *_rc* ]] ; then
+	SNAPSHOT=${GCC_PV%_rc*}-RC-${GCC_PV##*_rc}
+fi
+
+export GCC_FILESDIR=${GCC_FILESDIR:-${FILESDIR}}
+PREFIX=${TOOLCHAIN_PREFIX:-/usr}
+
+if tc_version_is_at_least 3.4.0 ; then
+	LIBPATH=${TOOLCHAIN_LIBPATH:-${PREFIX}/lib/gcc/${CTARGET}/${GCC_CONFIG_VER}}
+else
+	LIBPATH=${TOOLCHAIN_LIBPATH:-${PREFIX}/lib/gcc-lib/${CTARGET}/${GCC_CONFIG_VER}}
+fi
+INCLUDEPATH=${TOOLCHAIN_INCLUDEPATH:-${LIBPATH}/include}
+
+if is_crosscompile ; then
+	BINPATH=${TOOLCHAIN_BINPATH:-${PREFIX}/${CHOST}/${CTARGET}/gcc-bin/${GCC_CONFIG_VER}}
+else
+	BINPATH=${TOOLCHAIN_BINPATH:-${PREFIX}/${CTARGET}/gcc-bin/${GCC_CONFIG_VER}}
+fi
+
+DATAPATH=${TOOLCHAIN_DATAPATH:-${PREFIX}/share/gcc-data/${CTARGET}/${GCC_CONFIG_VER}}
+
+# Dont install in /usr/include/g++-v3/, but in gcc internal directory.
+# We will handle /usr/include/g++-v3/ with gcc-config ...
+STDCXX_INCDIR=${TOOLCHAIN_STDCXX_INCDIR:-${LIBPATH}/include/g++-v${GCC_BRANCH_VER/\.*/}}
+#----<< globals >>----
+
+#---->> SLOT+IUSE logic <<----
+IUSE="multislot nls nptl regression-test vanilla"
+
+if [[ ${PN} != "kgcc64" && ${PN} != gcc-* ]] ; then
+	IUSE+=" altivec cxx fortran"
+	[[ -n ${PIE_VER} ]] && IUSE+=" nopie"
+	[[ -n ${HTB_VER} ]] && IUSE+=" boundschecking"
+	[[ -n ${D_VER}   ]] && IUSE+=" d"
+	[[ -n ${SPECS_VER} ]] && IUSE+=" nossp"
+	tc_version_is_at_least 3 && IUSE+=" doc gcj gtk hardened multilib objc"
+	tc_version_is_at_least 4.0 && IUSE+=" objc-gc mudflap"
+	tc_version_is_at_least 4.1 && IUSE+=" libssp objc++"
+	tc_version_is_at_least 4.2 && IUSE+=" openmp"
+	tc_version_is_at_least 4.3 && IUSE+=" fixed-point"
+	tc_version_is_at_least 4.6 && IUSE+=" graphite"
+	tc_version_is_at_least 4.6 && IUSE+=" lto"
+	tc_version_is_at_least 4.7 && IUSE+=" go"
+fi
+
+# Support upgrade paths here or people get pissed
+if use multislot ; then
+	SLOT="${GCC_CONFIG_VER}"
+else
+	SLOT="${GCC_BRANCH_VER}"
+fi
+#----<< SLOT+IUSE logic >>----
+
+#---->> DEPEND <<----
+RDEPEND="sys-libs/zlib
+	nls? ( sys-devel/gettext )"
+
+tc_version_is_at_least 3 && RDEPEND+=" virtual/libiconv"
+
+if tc_version_is_at_least 4 ; then
+	GMP_MPFR_DEPS=">=dev-libs/gmp-4.3.2 >=dev-libs/mpfr-2.4.2"
+	if tc_version_is_at_least 4.3 ; then
+		RDEPEND+=" ${GMP_MPFR_DEPS}"
+	elif in_iuse fortran ; then
+		RDEPEND+=" fortran? ( ${GMP_MPFR_DEPS} )"
+	fi
+fi
+
+tc_version_is_at_least 4.5 && RDEPEND+=" >=dev-libs/mpc-0.8.1"
+
+if in_iuse graphite ; then
+	if tc_version_is_at_least 4.8 ; then
+		RDEPEND+="
+			graphite? (
+				>=dev-libs/cloog-0.18.0
+				>=dev-libs/isl-0.11.1
+			)"
+	else
+		RDEPEND+="
+			graphite? (
+				>=dev-libs/cloog-ppl-0.15.10
+				>=dev-libs/ppl-0.11
+			)"
+	fi
+fi
+
+DEPEND="${RDEPEND}
+	>=sys-devel/bison-1.875
+	>=sys-devel/flex-2.5.4
+	regression-test? (
+		>=dev-util/dejagnu-1.4.4
+		>=sys-devel/autogen-5.5.4
+	)"
+
+if in_iuse gcj ; then
+	GCJ_DEPS=">=media-libs/libart_lgpl-2.1"
+	GCJ_GTK_DEPS="
+		x11-libs/libXt
+		x11-libs/libX11
+		x11-libs/libXtst
+		x11-proto/xproto
+		x11-proto/xextproto
+		=x11-libs/gtk+-2*
+		virtual/pkgconfig
+		amd64? ( multilib? (
+			app-emulation/emul-linux-x86-gtklibs
+			app-emulation/emul-linux-x86-xlibs
+		) )
+	"
+	tc_version_is_at_least 3.4 && GCJ_GTK_DEPS+=" x11-libs/pango"
+	tc_version_is_at_least 4.2 && GCJ_DEPS+=" app-arch/zip app-arch/unzip"
+	DEPEND+=" gcj? ( gtk? ( ${GCJ_GTK_DEPS} ) ${GCJ_DEPS} )"
+fi
+
+PDEPEND=">=sys-devel/gcc-config-1.7"
+#----<< DEPEND >>----
+
+#---->> S + SRC_URI essentials <<----
+
+# Set the source directory depending on whether we're using
+# a prerelease, snapshot, or release tarball.
+S=$(
+	if [[ -n ${PRERELEASE} ]] ; then
+		echo ${WORKDIR}/gcc-${PRERELEASE}
+	elif [[ -n ${SNAPSHOT} ]] ; then
+		echo ${WORKDIR}/gcc-${SNAPSHOT}
+	else
+		echo ${WORKDIR}/gcc-${GCC_RELEASE_VER}
+	fi
+)
+
+# This function handles the basics of setting the SRC_URI for a gcc ebuild.
+# To use, set SRC_URI with:
+#
+#	SRC_URI="$(get_gcc_src_uri)"
+#
+# Other than the variables normally set by portage, this function's behavior
+# can be altered by setting the following:
+#
+#	SNAPSHOT
+#			If set, this variable signals that we should be using a snapshot of
+#			gcc. It is expected to be in the format "YYYY-MM-DD". Note that if
+#			the ebuild has a _pre suffix, this variable is ignored and the
+#			prerelease tarball is used instead.
+#
+#	BRANCH_UPDATE
+#			If set, this variable signals that we should be using the main
+#			release tarball (determined by ebuild version) and applying a
+#			CVS branch update patch against it. The location of this branch
+#			update patch is assumed to be in ${GENTOO_TOOLCHAIN_BASE_URI}.
+#			Just like with SNAPSHOT, this variable is ignored if the ebuild
+#			has a _pre suffix.
+#
+#	PATCH_VER
+#	PATCH_GCC_VER
+#			This should be set to the version of the gentoo patch tarball.
+#			The resulting filename of this tarball will be:
+#			gcc-${PATCH_GCC_VER:-${GCC_RELEASE_VER}}-patches-${PATCH_VER}.tar.bz2
+#
+#	PIE_VER
+#	PIE_GCC_VER
+#			These variables control patching in various updates for the logic
+#			controlling Position Independant Executables. PIE_VER is expected
+#			to be the version of this patch, and PIE_GCC_VER the gcc version of
+#			the patch:
+#			An example:
+#					PIE_VER="8.7.6.5"
+#					PIE_GCC_VER="3.4.0"
+#			The resulting filename of this tarball will be:
+#			gcc-${PIE_GCC_VER:-${GCC_RELEASE_VER}}-piepatches-v${PIE_VER}.tar.bz2
+#
+#	SPECS_VER
+#	SPECS_GCC_VER
+#			This is for the minispecs files included in the hardened gcc-4.x
+#			The specs files for hardenedno*, vanilla and for building the "specs" file.
+#			SPECS_VER is expected to be the version of this patch, SPECS_GCC_VER
+#			the gcc version of the patch.
+#			An example:
+#					SPECS_VER="8.7.6.5"
+#					SPECS_GCC_VER="3.4.0"
+#			The resulting filename of this tarball will be:
+#			gcc-${SPECS_GCC_VER:-${GCC_RELEASE_VER}}-specs-${SPECS_VER}.tar.bz2
+#
+#	HTB_VER
+#	HTB_GCC_VER
+#			These variables control whether or not an ebuild supports Herman
+#			ten Brugge's bounds-checking patches. If you want to use a patch
+#			for an older gcc version with a new gcc, make sure you set
+#			HTB_GCC_VER to that version of gcc.
+#
+gentoo_urls() {
+	local devspace="HTTP~vapier/dist/URI HTTP~dirtyepic/dist/URI
+	HTTP~halcy0n/patches/URI HTTP~zorry/patches/gcc/URI"
+	devspace=${devspace//HTTP/http:\/\/dev.gentoo.org\/}
+	echo mirror://gentoo/$1 ${devspace//URI/$1}
+}
+
+get_gcc_src_uri() {
+	export PATCH_GCC_VER=${PATCH_GCC_VER:-${GCC_RELEASE_VER}}
+	export UCLIBC_GCC_VER=${UCLIBC_GCC_VER:-${PATCH_GCC_VER}}
+	export PIE_GCC_VER=${PIE_GCC_VER:-${GCC_RELEASE_VER}}
+	export HTB_GCC_VER=${HTB_GCC_VER:-${GCC_RELEASE_VER}}
+	export SPECS_GCC_VER=${SPECS_GCC_VER:-${GCC_RELEASE_VER}}
+
+	# Set where to download gcc itself depending on whether we're using a
+	# prerelease, snapshot, or release tarball.
+	if [[ -n ${PRERELEASE} ]] ; then
+		GCC_SRC_URI="ftp://gcc.gnu.org/pub/gcc/prerelease-${PRERELEASE}/gcc-${PRERELEASE}.tar.bz2"
+	elif [[ -n ${SNAPSHOT} ]] ; then
+		GCC_SRC_URI="ftp://gcc.gnu.org/pub/gcc/snapshots/${SNAPSHOT}/gcc-${SNAPSHOT}.tar.bz2"
+	elif [[ ${PV} != *9999* ]] ; then
+		GCC_SRC_URI="mirror://gnu/gcc/gcc-${GCC_PV}/gcc-${GCC_RELEASE_VER}.tar.bz2"
+		# we want all branch updates to be against the main release
+		[[ -n ${BRANCH_UPDATE} ]] && \
+			GCC_SRC_URI+=" $(gentoo_urls gcc-${GCC_RELEASE_VER}-branch-update-${BRANCH_UPDATE}.patch.bz2)"
+	fi
+
+	[[ -n ${UCLIBC_VER} ]] && \
+		GCC_SRC_URI+=" $(gentoo_urls gcc-${UCLIBC_GCC_VER}-uclibc-patches-${UCLIBC_VER}.tar.bz2)"
+	[[ -n ${PATCH_VER} ]] && \
+		GCC_SRC_URI+=" $(gentoo_urls gcc-${PATCH_GCC_VER}-patches-${PATCH_VER}.tar.bz2)"
+
+	# strawberry pie, Cappuccino and a Gauloises (it's a good thing)
+	[[ -n ${PIE_VER} ]] && \
+		PIE_CORE=${PIE_CORE:-gcc-${PIE_GCC_VER}-piepatches-v${PIE_VER}.tar.bz2} && \
+		GCC_SRC_URI+=" $(gentoo_urls ${PIE_CORE})"
+
+	# gcc minispec for the hardened gcc 4 compiler
+	[[ -n ${SPECS_VER} ]] && \
+		GCC_SRC_URI+=" $(gentoo_urls gcc-${SPECS_GCC_VER}-specs-${SPECS_VER}.tar.bz2)"
+
+	# gcc bounds checking patch
+	if [[ -n ${HTB_VER} ]] ; then
+		local HTBFILE="bounds-checking-gcc-${HTB_GCC_VER}-${HTB_VER}.patch.bz2"
+		GCC_SRC_URI+="
+			boundschecking? (
+				mirror://sourceforge/boundschecking/${HTBFILE}
+				$(gentoo_urls ${HTBFILE})
+			)"
+	fi
+
+	[[ -n ${D_VER} ]] && \
+		GCC_SRC_URI+=" d? ( mirror://sourceforge/dgcc/gdc-${D_VER}-src.tar.bz2 )"
+
+	if in_iuse gcj ; then
+		if tc_version_is_at_least 4.5 ; then
+			GCC_SRC_URI+=" gcj? ( ftp://sourceware.org/pub/java/ecj-4.5.jar )"
+		elif tc_version_is_at_least 4.3 ; then
+			GCC_SRC_URI+=" gcj? ( ftp://sourceware.org/pub/java/ecj-4.3.jar )"
+		fi
+	fi
+
+	echo "${GCC_SRC_URI}"
+}
+SRC_URI=$(get_gcc_src_uri)
+#---->> S + SRC_URI essentials >>----
+
+#---->> support checks <<----
+
+# Grab a variable from the build system (taken from linux-info.eclass)
+get_make_var() {
+	local var=$1 makefile=${2:-${WORKDIR}/build/Makefile}
+	echo -e "e:\\n\\t@echo \$(${var})\\ninclude ${makefile}" | \
+		r=${makefile%/*} emake --no-print-directory -s -f - 2>/dev/null
+}
+XGCC() { get_make_var GCC_FOR_TARGET ; }
+
+# The gentoo piessp patches allow for 3 configurations:
+# 1) PIE+SSP by default
+# 2) PIE by default
+# 3) SSP by default
+hardened_gcc_works() {
+	if [[ $1 == "pie" ]] ; then
+		# $gcc_cv_ld_pie is unreliable as it simply take the output of
+		# `ld --help | grep -- -pie`, that reports the option in all cases, also if
+		# the loader doesn't actually load the resulting executables.
+		# To avoid breakage, blacklist FreeBSD here at least
+		[[ ${CTARGET} == *-freebsd* ]] && return 1
+
+		want_pie || return 1
+		use_if_iuse nopie && return 1
+		hardened_gcc_is_stable pie
+		return $?
+	elif [[ $1 == "ssp" ]] ; then
+		[[ -n ${SPECS_VER} ]] || return 1
+		use_if_iuse nossp && return 1
+		hardened_gcc_is_stable ssp
+		return $?
+	else
+		# laziness ;)
+		hardened_gcc_works pie || return 1
+		hardened_gcc_works ssp || return 1
+		return 0
+	fi
+}
+
+hardened_gcc_is_stable() {
+	local tocheck
+	if [[ $1 == "pie" ]] ; then
+		if [[ ${CTARGET} == *-uclibc* ]] ; then
+			tocheck=${PIE_UCLIBC_STABLE}
+		else
+			tocheck=${PIE_GLIBC_STABLE}
+		fi
+	elif [[ $1 == "ssp" ]] ; then
+		if [[ ${CTARGET} == *-uclibc* ]] ; then
+			tocheck=${SSP_UCLIBC_STABLE}
+		else
+			tocheck=${SSP_STABLE}
+		fi
+	else
+		die "hardened_gcc_stable needs to be called with pie or ssp"
+	fi
+
+	has $(tc-arch) ${tocheck} && return 0
+	return 1
+}
+
+want_pie() {
+	! use hardened && [[ -n ${PIE_VER} ]] && use nopie && return 1
+	[[ -n ${PIE_VER} ]] && [[ -n ${SPECS_VER} ]] && return 0
+	tc_version_is_at_least 4.3.2 && return 1
+	[[ -z ${PIE_VER} ]] && return 1
+	use !nopie && return 0
+	return 1
+}
+
+want_minispecs() {
+	if tc_version_is_at_least 4.3.2 && use hardened ; then
+		if ! want_pie ; then
+			ewarn "PIE_VER or SPECS_VER is not defined in the GCC ebuild."
+		elif use vanilla ; then
+			ewarn "You will not get hardened features if you have the vanilla USE-flag."
+		elif use nopie && use nossp ; then
+			ewarn "You will not get hardened features if you have the nopie and nossp USE-flag."
+		elif ! hardened_gcc_works ; then
+			ewarn "Your $(tc-arch) arch is not supported."
+		else
+			return 0
+		fi
+		ewarn "Hope you know what you are doing. Hardened will not work."
+		return 0
+	fi
+	return 1
+}
+
+# This is to make sure we don't accidentally try to enable support for a
+# language that doesnt exist. GCC 3.4 supports f77, while 4.0 supports f95, etc.
+#
+# Also add a hook so special ebuilds (kgcc64) can control which languages
+# exactly get enabled
+gcc-lang-supported() {
+	grep ^language=\"${1}\" "${S}"/gcc/*/config-lang.in > /dev/null || return 1
+	[[ -z ${TOOLCHAIN_ALLOWED_LANGS} ]] && return 0
+	has $1 ${TOOLCHAIN_ALLOWED_LANGS}
+}
+#----<< support checks >>----
+
+#---->> specs + env.d logic <<----
+
+# configure to build with the hardened GCC specs as the default
+make_gcc_hard() {
+	# defaults to enable for all hardened toolchains
+	local gcc_hard_flags="-DEFAULT_RELRO -DEFAULT_BIND_NOW"
+
+	if hardened_gcc_works ; then
+		einfo "Updating gcc to use automatic PIE + SSP building ..."
+		gcc_hard_flags+=" -DEFAULT_PIE_SSP"
+	elif hardened_gcc_works pie ; then
+		einfo "Updating gcc to use automatic PIE building ..."
+		ewarn "SSP has not been enabled by default"
+		gcc_hard_flags+=" -DEFAULT_PIE"
+	elif hardened_gcc_works ssp ; then
+		einfo "Updating gcc to use automatic SSP building ..."
+		ewarn "PIE has not been enabled by default"
+		gcc_hard_flags+=" -DEFAULT_SSP"
+	else
+		# do nothing if hardened isnt supported, but dont die either
+		ewarn "hardened is not supported for this arch in this gcc version"
+		ebeep
+		return 0
+	fi
+
+	sed -i \
+		-e "/^HARD_CFLAGS = /s|=|= ${gcc_hard_flags} |" \
+		"${S}"/gcc/Makefile.in || die
+
+	# rebrand to make bug reports easier
+	BRANDING_GCC_PKGVERSION=${BRANDING_GCC_PKGVERSION/Gentoo/Gentoo Hardened}
+}
+
+create_gcc_env_entry() {
+	dodir /etc/env.d/gcc
+	local gcc_envd_base="/etc/env.d/gcc/${CTARGET}-${GCC_CONFIG_VER}"
+
+	local gcc_specs_file
+	local gcc_envd_file="${ED}${gcc_envd_base}"
+	if [[ -z $1 ]] ; then
+		# I'm leaving the following commented out to remind me that it
+		# was an insanely -bad- idea. Stuff broke. GCC_SPECS isnt unset
+		# on chroot or in non-toolchain.eclass gcc ebuilds!
+		#gcc_specs_file="${LIBPATH}/specs"
+		gcc_specs_file=""
+	else
+		gcc_envd_file+="-$1"
+		gcc_specs_file="${EPREFIX}${LIBPATH}/$1.specs"
+	fi
+
+	# We want to list the default ABI's LIBPATH first so libtool
+	# searches that directory first.  This is a temporary
+	# workaround for libtool being stupid and using .la's from
+	# conflicting ABIs by using the first one in the search path
+	local ldpaths mosdirs
+	if tc_version_is_at_least 3.2 ; then
+		local mdir mosdir abi ldpath
+		for abi in $(get_all_abis TARGET) ; do
+			mdir=$($(XGCC) $(get_abi_CFLAGS ${abi}) --print-multi-directory)
+			ldpath=${EPREFIX}${LIBPATH}
+			[[ ${mdir} != "." ]] && ldpath+="/${mdir}"
+			ldpaths="${ldpath}${ldpaths:+:${ldpaths}}"
+
+			mosdir=$($(XGCC) $(get_abi_CFLAGS ${abi}) -print-multi-os-directory)
+			mosdirs="${mosdir}${mosdirs:+:${mosdirs}}"
+		done
+	else
+		# Older gcc's didn't do multilib, so logic is simple.
+		ldpaths=${EPREFIX}${LIBPATH}
+	fi
+
+	cat <<-EOF > ${gcc_envd_file}
+	PATH="${EPREFIX}${BINPATH}"
+	ROOTPATH="${EPREFIX}${BINPATH}"
+	GCC_PATH="${EPREFIX}${BINPATH}"
+	LDPATH="${ldpaths}"
+	MANPATH="${EPREFIX}${DATAPATH}/man"
+	INFOPATH="${EPREFIX}${DATAPATH}/info"
+	STDCXX_INCDIR="${STDCXX_INCDIR##*/}"
+	CTARGET="${CTARGET}"
+	GCC_SPECS="${gcc_specs_file}"
+	MULTIOSDIRS="${mosdirs}"
+	EOF
+}
+
+setup_minispecs_gcc_build_specs() {
+	# Setup the "build.specs" file for gcc 4.3 to use when building.
+	if hardened_gcc_works pie ; then
+		cat "${WORKDIR}"/specs/pie.specs >> "${WORKDIR}"/build.specs
+	fi
+	if hardened_gcc_works ssp ; then
+		for s in ssp sspall ; do
+			cat "${WORKDIR}"/specs/${s}.specs >> "${WORKDIR}"/build.specs
+		done
+	fi
+	for s in nostrict znow ; do
+		cat "${WORKDIR}"/specs/${s}.specs >> "${WORKDIR}"/build.specs
+	done
+	export GCC_SPECS="${WORKDIR}"/build.specs
+}
+
+copy_minispecs_gcc_specs() {
+	# setup the hardenedno* specs files and the vanilla specs file.
+	if hardened_gcc_works ; then
+		create_gcc_env_entry hardenednopiessp
+	fi
+	if hardened_gcc_works pie ; then
+		create_gcc_env_entry hardenednopie
+	fi
+	if hardened_gcc_works ssp ; then
+		create_gcc_env_entry hardenednossp
+	fi
+	create_gcc_env_entry vanilla
+	insinto ${LIBPATH}
+	doins "${WORKDIR}"/specs/*.specs || die "failed to install specs"
+	# Build system specs file which, if it exists, must be a complete set of
+	# specs as it completely and unconditionally overrides the builtin specs.
+	if ! tc_version_is_at_least 4.4 ; then
+		$(XGCC) -dumpspecs > "${WORKDIR}"/specs/specs
+		cat "${WORKDIR}"/build.specs >> "${WORKDIR}"/specs/specs
+		doins "${WORKDIR}"/specs/specs || die "failed to install the specs file"
+	fi
+}
+
+#----<< specs + env.d logic >>----
+
+#---->> pkg_* <<----
+toolchain_pkg_setup() {
+	if [[ -n ${PRERELEASE}${SNAPSHOT} || ${PV} == *9999* ]] &&
+	   [[ -z ${I_PROMISE_TO_SUPPLY_PATCHES_WITH_BUGS} ]] ; 	then
+		die "Please \`export I_PROMISE_TO_SUPPLY_PATCHES_WITH_BUGS=1\` or define it" \
+			"in your make.conf if you want to use this version."
+	fi
+
+	local realEPREFIX=$(python -c 'import os; print(os.path.realpath("'"${EPREFIX}"'"))')
+	if [[ ${EPREFIX} != ${realEPREFIX} ]] ; then
+		ewarn "Your \${EPREFIX} contains one or more symlinks.  GCC has a"
+		ewarn "bug which prevents it from working properly when there are"
+		ewarn "symlinks in your \${EPREFIX}."
+		ewarn "See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29831"
+	fi
+
+	# we dont want to use the installed compiler's specs to build gcc!
+	unset GCC_SPECS
+
+	if ! use_if_iuse cxx ; then
+		use_if_iuse go && ewarn 'Go requires a C++ compiler, disabled due to USE="-cxx"'
+		use_if_iuse objc++ && ewarn 'Obj-C++ requires a C++ compiler, disabled due to USE="-cxx"'
+		use_if_iuse gcj && ewarn 'GCJ requires a C++ compiler, disabled due to USE="-cxx"'
+	fi
+
+	want_minispecs
+
+	unset LANGUAGES #265283
+}
+
+toolchain_pkg_postinst() {
+	do_gcc_config
+
+	if ! is_crosscompile ; then
+		echo
+		ewarn "If you have issues with packages unable to locate libstdc++.la,"
+		ewarn "then try running 'fix_libtool_files.sh' on the old gcc versions."
+		echo
+		ewarn "You might want to review the GCC upgrade guide when moving between"
+		ewarn "major versions (like 4.2 to 4.3):"
+		ewarn "http://www.gentoo.org/doc/en/gcc-upgrading.xml"
+		echo
+
+		# Clean up old paths
+		rm -f "${EROOT}"/*/rcscripts/awk/fixlafiles.awk "${EROOT}"/sbin/fix_libtool_files.sh
+		rmdir "${EROOT}"/*/rcscripts{/awk,} 2>/dev/null
+
+		mkdir -p "${EROOT}"/usr/{share/gcc-data,sbin,bin}
+		cp "${EROOT}/${DATAPATH}"/fixlafiles.awk "${EROOT}"/usr/share/gcc-data/ || die
+		cp "${EROOT}/${DATAPATH}"/fix_libtool_files.sh "${EROOT}"/usr/sbin/ || die
+
+		# Since these aren't critical files and portage sucks with
+		# handling of binpkgs, don't require these to be found
+		cp "${EROOT}/${DATAPATH}"/c{89,99} "${EROOT}"/usr/bin/ 2>/dev/null
+	fi
+
+	if use regression-test ; then
+		elog "Testsuite results have been installed into /usr/share/doc/${PF}/testsuite"
+		echo
+	fi
+}
+
+toolchain_pkg_postrm() {
+	# to make our lives easier (and saner), we do the fix_libtool stuff here.
+	# rather than checking SLOT's and trying in upgrade paths, we just see if
+	# the common libstdc++.la exists in the ${LIBPATH} of the gcc that we are
+	# unmerging.  if it does, that means this was a simple re-emerge.
+
+	# clean up the cruft left behind by cross-compilers
+	if is_crosscompile ; then
+		if [[ -z $(ls "${EROOT}"/etc/env.d/gcc/${CTARGET}* 2>/dev/null) ]] ; then
+			rm -f "${EROOT}"/etc/env.d/gcc/config-${CTARGET}
+			rm -f "${EROOT}"/etc/env.d/??gcc-${CTARGET}
+			rm -f "${EROOT}"/usr/bin/${CTARGET}-{gcc,{g,c}++}{,32,64}
+		fi
+		return 0
+	fi
+
+	# ROOT isnt handled by the script
+	[[ ${ROOT} != "/" ]] && return 0
+
+	if [[ ! -e ${EPREFIX}${LIBPATH}/libstdc++.so ]] ; then
+		# make sure the profile is sane during same-slot upgrade #289403
+		do_gcc_config
+
+		einfo "Running 'fix_libtool_files.sh ${GCC_RELEASE_VER}'"
+		"${EPREFIX}"/usr/sbin/fix_libtool_files.sh ${GCC_RELEASE_VER}
+		if [[ -n ${BRANCH_UPDATE} ]] ; then
+			einfo "Running 'fix_libtool_files.sh ${GCC_RELEASE_VER}-${BRANCH_UPDATE}'"
+			"${EPREFIX}"/usr/sbin/fix_libtool_files.sh ${GCC_RELEASE_VER}-${BRANCH_UPDATE}
+		fi
+	fi
+
+	return 0
+}
+
+#---->> pkg_* <<----
+
+#---->> src_* <<----
+
+guess_patch_type_in_dir() {
+	[[ -n $(ls "$1"/*.bz2 2>/dev/null) ]] \
+		&& EPATCH_SUFFIX="patch.bz2" \
+		|| EPATCH_SUFFIX="patch"
+}
+
+do_gcc_rename_java_bins() {
+	# bug #139918 - conflict between gcc and java-config-2 for ownership of
+	# /usr/bin/rmi{c,registry}.	 Done with mv & sed rather than a patch
+	# because patches would be large (thanks to the rename of man files),
+	# and it's clear from the sed invocations that all that changes is the
+	# rmi{c,registry} names to grmi{c,registry} names.
+	# Kevin F. Quinn 2006-07-12
+	einfo "Renaming jdk executables rmic and rmiregistry to grmic and grmiregistry."
+	# 1) Move the man files if present (missing prior to gcc-3.4)
+	for manfile in rmic rmiregistry ; do
+		[[ -f ${S}/gcc/doc/${manfile}.1 ]] || continue
+		mv "${S}"/gcc/doc/${manfile}.1 "${S}"/gcc/doc/g${manfile}.1
+	done
+	# 2) Fixup references in the docs if present (mission prior to gcc-3.4)
+	for jfile in gcc/doc/gcj.info gcc/doc/grmic.1 gcc/doc/grmiregistry.1 gcc/java/gcj.texi ; do
+		[[ -f ${S}/${jfile} ]] || continue
+		sed -i -e 's:rmiregistry:grmiregistry:g' "${S}"/${jfile} ||
+			die "Failed to fixup file ${jfile} for rename to grmiregistry"
+		sed -i -e 's:rmic:grmic:g' "${S}"/${jfile} ||
+			die "Failed to fixup file ${jfile} for rename to grmic"
+	done
+	# 3) Fixup Makefiles to build the changed executable names
+	#	 These are present in all 3.x versions, and are the important bit
+	#	 to get gcc to build with the new names.
+	for jfile in libjava/Makefile.am libjava/Makefile.in gcc/java/Make-lang.in ; do
+		sed -i -e 's:rmiregistry:grmiregistry:g' "${S}"/${jfile} ||
+			die "Failed to fixup file ${jfile} for rename to grmiregistry"
+		# Careful with rmic on these files; it's also the name of a directory
+		# which should be left unchanged.  Replace occurrences of 'rmic$',
+		# 'rmic_' and 'rmic '.
+		sed -i -e 's:rmic\([$_ ]\):grmic\1:g' "${S}"/${jfile} ||
+			die "Failed to fixup file ${jfile} for rename to grmic"
+	done
+}
+
+toolchain_src_unpack() {
+	[[ -z ${UCLIBC_VER} ]] && [[ ${CTARGET} == *-uclibc* ]] && \
+		die "Sorry, this version does not support uClibc"
+
+	if [[ ${PV} == *9999* ]]; then
+		git-2_src_unpack
+	else
+		gcc_quick_unpack
+	fi
+
+	export BRANDING_GCC_PKGVERSION="Gentoo ${GCC_PVR}"
+	cd "${S}"
+
+	if ! use vanilla ; then
+		if [[ -n ${PATCH_VER} ]] ; then
+			guess_patch_type_in_dir "${WORKDIR}"/patch
+			EPATCH_MULTI_MSG="Applying Gentoo patches ..." \
+			epatch "${WORKDIR}"/patch
+			BRANDING_GCC_PKGVERSION="${BRANDING_GCC_PKGVERSION} p${PATCH_VER}"
+		fi
+		if [[ -n ${UCLIBC_VER} ]] ; then
+			guess_patch_type_in_dir "${WORKDIR}"/uclibc
+			EPATCH_MULTI_MSG="Applying uClibc patches ..." \
+			epatch "${WORKDIR}"/uclibc
+		fi
+	fi
+	do_gcc_HTB_patches
+	do_gcc_PIE_patches
+	epatch_user
+
+	use hardened && make_gcc_hard
+
+	# install the libstdc++ python into the right location
+	# http://gcc.gnu.org/PR51368
+	if tc_version_is_at_least 4.5 && ! tc_version_is_at_least 4.7 ; then
+		sed -i \
+			'/^pythondir =/s:=.*:= $(datadir)/python:' \
+			"${S}"/libstdc++-v3/python/Makefile.in || die
+	fi
+
+	# make sure the pkg config files install into multilib dirs.
+	# since we configure with just one --libdir, we can't use that
+	# (as gcc itself takes care of building multilibs).  #435728
+	find "${S}" -name Makefile.in \
+		-exec sed -i '/^pkgconfigdir/s:=.*:=$(toolexeclibdir)/pkgconfig:' {} +
+
+	# No idea when this first started being fixed, but let's go with 4.3.x for now
+	if ! tc_version_is_at_least 4.3 ; then
+		fix_files=""
+		for x in contrib/test_summary libstdc++-v3/scripts/check_survey.in ; do
+			[[ -e ${x} ]] && fix_files="${fix_files} ${x}"
+		done
+		ht_fix_file ${fix_files} */configure *.sh */Makefile.in
+	fi
+
+	setup_multilib_osdirnames
+	gcc_version_patch
+
+	if tc_version_is_at_least 4.1 ; then
+		if [[ -n ${SNAPSHOT} || -n ${PRERELEASE} ]] ; then
+			# BASE-VER must be a three-digit version number
+			# followed by an optional -pre string
+			#   eg. 4.5.1, 4.6.2-pre20120213, 4.7.0-pre9999
+			# If BASE-VER differs from ${PV/_/-} then libraries get installed in
+			# the wrong directory.
+			echo ${PV/_/-} > "${S}"/gcc/BASE-VER
+		fi
+	fi
+
+	# >= gcc-4.3 doesn't bundle ecj.jar, so copy it
+	if tc_version_is_at_least 4.3 && use gcj ; then
+		if tc_version_is_at_least 4.5 ; then
+			einfo "Copying ecj-4.5.jar"
+			cp -pPR "${DISTDIR}/ecj-4.5.jar" "${S}/ecj.jar" || die
+		else
+			einfo "Copying ecj-4.3.jar"
+			cp -pPR "${DISTDIR}/ecj-4.3.jar" "${S}/ecj.jar" || die
+		fi
+	fi
+
+	# disable --as-needed from being compiled into gcc specs
+	# natively when using a gcc version < 3.4.4
+	# http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14992
+	if ! tc_version_is_at_least 3.4.4 ; then
+		sed -i -e s/HAVE_LD_AS_NEEDED/USE_LD_AS_NEEDED/g "${S}"/gcc/config.in
+	fi
+
+	# In gcc 3.3.x and 3.4.x, rename the java bins to gcc-specific names
+	# in line with gcc-4.
+	if tc_version_is_at_least 3.3 && ! tc_version_is_at_least 4.0 ; then
+		do_gcc_rename_java_bins
+	fi
+
+	# Prevent libffi from being installed
+	if tc_version_is_at_least 3.0 && ! tc_version_is_at_least 4.8 ; then
+		sed -i -e 's/\(install.*:\) install-.*recursive/\1/' "${S}"/libffi/Makefile.in || die
+		sed -i -e 's/\(install-data-am:\).*/\1/' "${S}"/libffi/include/Makefile.in || die
+	fi
+
+	# Fixup libtool to correctly generate .la files with portage
+	elibtoolize --portage --shallow --no-uclibc
+
+	gnuconfig_update
+
+	# update configure files
+	local f
+	einfo "Fixing misc issues in configure files"
+	# TODO - check if we can drop this now that we don't gen info files
+	tc_version_is_at_least 4.1 && epatch "${GCC_FILESDIR}"/gcc-configure-texinfo.patch
+	for f in $(grep -l 'autoconf version 2.13' $(find "${S}" -name configure)) ; do
+		ebegin "  Updating ${f/${S}\/} [LANG]"
+		patch "${f}" "${GCC_FILESDIR}"/gcc-configure-LANG.patch >& "${T}"/configure-patch.log \
+			|| eerror "Please file a bug about this"
+		eend $?
+	done
+	sed -i 's|A-Za-z0-9|[:alnum:]|g' "${S}"/gcc/*.awk #215828
+
+	if [[ -x contrib/gcc_update ]] ; then
+		einfo "Touching generated files"
+		./contrib/gcc_update --touch | \
+			while read f ; do
+				einfo "  ${f%%...}"
+			done
+	fi
+}
+
+gcc-abi-map() {
+	# Convert the ABI name we use in Gentoo to what gcc uses
+	local map=()
+	case ${CTARGET} in
+	mips*)   map=("o32 32" "n32 n32" "n64 64") ;;
+	x86_64*) map=("amd64 m64" "x86 m32" "x32 mx32") ;;
+	esac
+
+	local m
+	for m in "${map[@]}" ; do
+		l=( ${m} )
+		[[ $1 == ${l[0]} ]] && echo ${l[1]} && break
+	done
+}
+
+gcc-multilib-configure() {
+	if ! is_multilib ; then
+		confgcc+=( --disable-multilib )
+		# Fun times: if we are building for a target that has multiple
+		# possible ABI formats, and the user has told us to pick one
+		# that isn't the default, then not specifying it via the list
+		# below will break that on us.
+	else
+		confgcc+=( --enable-multilib )
+	fi
+
+	# translate our notion of multilibs into gcc's
+	local abi list
+	for abi in $(get_all_abis TARGET) ; do
+		local l=$(gcc-abi-map ${abi})
+		[[ -n ${l} ]] && list+=",${l}"
+	done
+	if [[ -n ${list} ]] ; then
+		case ${CTARGET} in
+		x86_64*)
+			tc_version_is_at_least 4.7 && confgcc+=( --with-multilib-list=${list:1} )
+			;;
+		esac
+	fi
+}
+
+gcc-compiler-configure() {
+	gcc-multilib-configure
+
+	if tc_version_is_at_least 4.0 ; then
+		if in_iuse mudflap ; then
+			confgcc+=( $(use_enable mudflap libmudflap) )
+		else
+			confgcc+=( --disable-libmudflap )
+		fi
+
+		if use_if_iuse libssp ; then
+			confgcc+=( --enable-libssp )
+		else
+			export gcc_cv_libc_provides_ssp=yes
+			confgcc+=( --disable-libssp )
+		fi
+
+		# If we want hardened support with the newer piepatchset for >=gcc 4.4
+		if tc_version_is_at_least 4.4 && want_minispecs ; then
+			confgcc+=( $(use_enable hardened esp) )
+		fi
+
+		if tc_version_is_at_least 4.2 ; then
+			if in_iuse openmp ; then
+				# Make sure target has pthreads support. #326757 #335883
+				# There shouldn't be a chicken&egg problem here as openmp won't
+				# build without a C library, and you can't build that w/out
+				# already having a compiler ...
+				if ! is_crosscompile || \
+				   $(tc-getCPP ${CTARGET}) -E - <<<"#include <pthread.h>" >& /dev/null
+				then
+					confgcc+=( $(use_enable openmp libgomp) )
+				else
+					# Force disable as the configure script can be dumb #359855
+					confgcc+=( --disable-libgomp )
+				fi
+			else
+				# For gcc variants where we don't want openmp (e.g. kgcc)
+				confgcc+=( --disable-libgomp )
+			fi
+		fi
+
+		# Stick the python scripts in their own slotted directory
+		# bug #279252
+		#
+		#  --with-python-dir=DIR
+		#  Specifies where to install the Python modules used for aot-compile. DIR
+		#  should not include the prefix used in installation. For example, if the
+		#  Python modules are to be installed in /usr/lib/python2.5/site-packages,
+		#  then --with-python-dir=/lib/python2.5/site-packages should be passed.
+		#
+		# This should translate into "/share/gcc-data/${CTARGET}/${GCC_CONFIG_VER}/python"
+		if tc_version_is_at_least 4.4 ; then
+			confgcc+=( --with-python-dir=${DATAPATH/$PREFIX/}/python )
+		fi
+	fi
+
+	# Enable build warnings by default with cross-compilers when system
+	# paths are included (e.g. via -I flags).
+	is_crosscompile && confgcc+=( --enable-poison-system-directories )
+
+	# For newer versions of gcc, use the default ("release"), because no
+	# one (even upstream apparently) tests with it disabled. #317217
+	if tc_version_is_at_least 4 || [[ -n ${GCC_CHECKS_LIST} ]] ; then
+		confgcc+=( --enable-checking=${GCC_CHECKS_LIST:-release} )
+	else
+		confgcc+=( --disable-checking )
+	fi
+
+	# GTK+ is preferred over xlib in 3.4.x (xlib is unmaintained
+	# right now). Much thanks to <csm@gnu.org> for the heads up.
+	# Travis Tilley <lv@gentoo.org>	 (11 Jul 2004)
+	if ! is_gcj ; then
+		confgcc+=( --disable-libgcj )
+	elif use gtk ; then
+		confgcc+=( --enable-java-awt=gtk )
+	fi
+
+	# allow gcc to search for clock funcs in the main C lib.
+	# if it can't find them, then tough cookies -- we aren't
+	# going to link in -lrt to all C++ apps.  #411681
+	if tc_version_is_at_least 4.4 && is_cxx ; then
+		confgcc+=( --enable-libstdcxx-time )
+	fi
+
+	# newer gcc versions like to bootstrap themselves with C++,
+	# so we need to manually disable it ourselves
+	if tc_version_is_at_least 4.7 && ! is_cxx ; then
+		confgcc+=( --disable-build-with-cxx --disable-build-poststage1-with-cxx )
+	fi
+
+	# newer gcc's come with libquadmath, but only fortran uses
+	# it, so auto punt it when we don't care
+	if tc_version_is_at_least 4.6 && ! is_fortran ; then
+		confgcc+=( --disable-libquadmath )
+	fi
+
+	local with_abi_map=()
+	case $(tc-arch) in
+	arm)	#264534 #414395
+		local a arm_arch=${CTARGET%%-*}
+		# Remove trailing endian variations first: eb el be bl b l
+		for a in e{b,l} {b,l}e b l ; do
+			if [[ ${arm_arch} == *${a} ]] ; then
+				arm_arch=${arm_arch%${a}}
+				break
+			fi
+		done
+		# Convert armv7{a,r,m} to armv7-{a,r,m}
+		[[ ${arm_arch} == armv7? ]] && arm_arch=${arm_arch/7/7-}
+		# See if this is a valid --with-arch flag
+		if (srcdir=${S}/gcc target=${CTARGET} with_arch=${arm_arch};
+		    . "${srcdir}"/config.gcc) &>/dev/null
+		then
+			confgcc+=( --with-arch=${arm_arch} )
+		fi
+
+		# Make default mode thumb for microcontroller classes #418209
+		[[ ${arm_arch} == *-m ]] && confgcc+=( --with-mode=thumb )
+
+		# Enable hardvfp
+		if [[ $(tc-is-softfloat) == "no" ]] && \
+		   [[ ${CTARGET} == armv[67]* ]] && \
+		   tc_version_is_at_least 4.5
+		then
+			# Follow the new arm hardfp distro standard by default
+			confgcc+=( --with-float=hard )
+			case ${CTARGET} in
+			armv6*) confgcc+=( --with-fpu=vfp ) ;;
+			armv7*) confgcc+=( --with-fpu=vfpv3-d16 ) ;;
+			esac
+		fi
+		;;
+	mips)
+		# Add --with-abi flags to set default ABI
+		confgcc+=( --with-abi=$(gcc-abi-map ${TARGET_DEFAULT_ABI}) )
+		;;
+	amd64)
+		# drop the older/ABI checks once this get's merged into some
+		# version of gcc upstream
+		if tc_version_is_at_least 4.7 && has x32 $(get_all_abis TARGET) ; then
+			confgcc+=( --with-abi=$(gcc-abi-map ${TARGET_DEFAULT_ABI}) )
+		fi
+		;;
+	x86)
+		# Default arch for x86 is normally i386, lets give it a bump
+		# since glibc will do so based on CTARGET anyways
+		confgcc+=( --with-arch=${CTARGET%%-*} )
+		;;
+	hppa)
+		# Enable sjlj exceptions for backward compatibility on hppa
+		[[ ${GCCMAJOR} == "3" ]] && confgcc+=( --enable-sjlj-exceptions )
+		;;
+	ppc)
+		# Set up defaults based on current CFLAGS
+		is-flagq -mfloat-gprs=double && confgcc+=( --enable-e500-double )
+		[[ ${CTARGET//_/-} == *-e500v2-* ]] && confgcc+=( --enable-e500-double )
+		;;
+	esac
+
+	local GCC_LANG="c"
+	is_cxx && GCC_LANG+=",c++"
+	is_d   && GCC_LANG+=",d"
+	is_gcj && GCC_LANG+=",java"
+	is_go  && GCC_LANG+=",go"
+	if is_objc || is_objcxx ; then
+		GCC_LANG+=",objc"
+		if tc_version_is_at_least 4 ; then
+			use objc-gc && confgcc+=( --enable-objc-gc )
+		fi
+		is_objcxx && GCC_LANG+=",obj-c++"
+	fi
+	is_treelang && GCC_LANG+=",treelang"
+
+	# fortran support just got sillier! the lang value can be f77 for
+	# fortran77, f95 for fortran95, or just plain old fortran for the
+	# currently supported standard depending on gcc version.
+	is_fortran && GCC_LANG+=",fortran"
+	is_f77 && GCC_LANG+=",f77"
+	is_f95 && GCC_LANG+=",f95"
+
+	# We do NOT want 'ADA support' in here!
+	# is_ada && GCC_LANG+=",ada"
+
+	einfo "configuring for GCC_LANG: ${GCC_LANG}"
+	confgcc+=( --enable-languages=${GCC_LANG} )
+}
+
+gcc_do_configure() {
+	local confgcc=(
+		--prefix="${EPREFIX}${PREFIX}"
+		--bindir="${EPREFIX}${BINPATH}"
+		--includedir="${EPREFIX}${INCLUDEPATH}"
+		--datadir="${EPREFIX}${DATAPATH}"
+		--mandir="${EPREFIX}${DATAPATH}/man"
+		--infodir="${EPREFIX}${DATAPATH}/info"
+		--with-gxx-include-dir="${EPREFIX}${STDCXX_INCDIR}"
+	)
+	# On Darwin we need libdir to be set in order to get correct install names
+	# for things like libobjc-gnu, libgcj and libfortran.  If we enable it on
+	# non-Darwin we screw up the behaviour this eclass relies on.  We in
+	# particular need this over --libdir for bug #255315.
+	[[ ${CTARGET} == *-darwin* ]] && \
+		confgcc+=( --enable-version-specific-runtime-libs )
+
+	# All our cross-compile logic goes here !  woo !
+	confgcc+=( --host=${CHOST} )
+	if is_crosscompile || tc-is-cross-compiler ; then
+		# Straight from the GCC install doc:
+		# "GCC has code to correctly determine the correct value for target
+		# for nearly all native systems. Therefore, we highly recommend you
+		# not provide a configure target when configuring a native compiler."
+		confgcc+=( --target=${CTARGET} )
+	fi
+	[[ -n ${CBUILD} ]] && confgcc+=( --build=${CBUILD} )
+
+	# ppc altivec support
+	confgcc+=( $(use_enable altivec) )
+
+	# gcc has fixed-point arithmetic support in 4.3 for mips targets that can
+	# significantly increase compile time by several hours.  This will allow
+	# users to control this feature in the event they need the support.
+	tc_version_is_at_least 4.3 && confgcc+=( $(use_enable fixed-point) )
+
+	# graphite was added in 4.4 but we only support it in 4.6+ due to external
+	# library issues.  4.6/4.7 uses cloog-ppl which is a fork of CLooG with a
+	# PPL backend.  4.8+ uses upstream CLooG with the ISL backend.  We install
+	# cloog-ppl into a non-standard location to prevent collisions.
+	if tc_version_is_at_least 4.8 ; then
+		confgcc+=( $(use_with graphite cloog) )
+		use graphite && confgcc+=( --disable-isl-version-check )
+	elif tc_version_is_at_least 4.6 ; then
+		confgcc+=( $(use_with graphite cloog) )
+		confgcc+=( $(use_with graphite ppl) )
+		use graphite && confgcc+=( --with-cloog-include="${EPREFIX}"/usr/include/cloog-ppl )
+		use graphite && confgcc+=( --disable-ppl-version-check )
+	elif tc_version_is_at_least 4.4 ; then
+		confgcc+=( --without-cloog )
+		confgcc+=( --without-ppl )
+	fi
+
+	if tc_version_is_at_least 4.6 ; then
+		confgcc+=( $(use_enable lto) )
+	elif tc_version_is_at_least 4.5 ; then
+		confgcc+=( --disable-lto )
+	fi
+
+	case $(tc-is-softfloat) in
+	yes)    confgcc+=( --with-float=soft ) ;;
+	softfp) confgcc+=( --with-float=softfp ) ;;
+	*)
+		# If they've explicitly opt-ed in, do hardfloat,
+		# otherwise let the gcc default kick in.
+		[[ ${CTARGET//_/-} == *-hardfloat-* ]] \
+			&& confgcc+=( --with-float=hard )
+		;;
+	esac
+
+	# Native Language Support
+	if use nls ; then
+		confgcc+=( --enable-nls --without-included-gettext )
+	else
+		confgcc+=( --disable-nls )
+	fi
+
+	# reasonably sane globals (hopefully)
+	confgcc+=(
+		--with-system-zlib
+		--enable-obsolete
+		--disable-werror
+		--enable-secureplt
+	)
+
+	gcc-compiler-configure || die
+
+	if is_crosscompile ; then
+		# When building a stage1 cross-compiler (just C compiler), we have to
+		# disable a bunch of features or gcc goes boom
+		local needed_libc=""
+		case ${CTARGET} in
+		*-linux)		 needed_libc=no-fucking-clue;;
+		*-dietlibc)		 needed_libc=dietlibc;;
+		*-elf|*-eabi)	 needed_libc=newlib;;
+		*-freebsd*)		 needed_libc=freebsd-lib;;
+		*-gnu*)			 needed_libc=glibc;;
+		*-klibc)		 needed_libc=klibc;;
+		*-musl*)		 needed_libc=musl;;
+		*-uclibc*)
+			if ! echo '#include <features.h>' | \
+			   $(tc-getCPP ${CTARGET}) -E -dD - 2>/dev/null | \
+			   grep -q __HAVE_SHARED__
+			then #291870
+				confgcc+=( --disable-shared )
+			fi
+			needed_libc=uclibc
+			;;
+		*-cygwin)		 needed_libc=cygwin;;
+		x86_64-*-mingw*|\
+		*-w64-mingw*)	 needed_libc=mingw64-runtime;;
+		mingw*|*-mingw*) needed_libc=mingw-runtime;;
+		avr)			 confgcc+=( --enable-shared --disable-threads );;
+		*-apple-darwin*) confgcc+=( --with-sysroot="${EPREFIX}"${PREFIX}/${CTARGET} );;
+		*-solaris*)      confgcc+=( --with-sysroot="${EPREFIX}"${PREFIX}/${CTARGET} );;
+		*-freebsd*)      confgcc+=( --with-sysroot="${EPREFIX}"${PREFIX}/${CTARGET} );;
+		esac
+		if [[ -n ${needed_libc} ]] ; then
+			local confgcc_no_libc=( --disable-shared )
+			tc_version_is_at_least 4.8 && confgcc_no_libc+=( --disable-libatomic )
+			if ! has_version ${CATEGORY}/${needed_libc} ; then
+				confgcc+=(
+					"${confgcc_no_libc[@]}"
+					--disable-threads
+					--without-headers
+				)
+			elif built_with_use --hidden --missing false ${CATEGORY}/${needed_libc} crosscompile_opts_headers-only ; then
+				confgcc+=(
+					"${confgcc_no_libc[@]}"
+					--with-sysroot="${EPREFIX}"${PREFIX}/${CTARGET}
+				)
+			else
+				confgcc+=( --with-sysroot="${EPREFIX}"${PREFIX}/${CTARGET} )
+			fi
+		fi
+
+		tc_version_is_at_least 4.2 && confgcc+=( --disable-bootstrap )
+	else
+		if tc-is-static-only ; then
+			confgcc+=( --disable-shared )
+		else
+			confgcc+=( --enable-shared )
+		fi
+		case ${CHOST} in
+		mingw*|*-mingw*|*-cygwin)
+			confgcc+=( --enable-threads=win32 ) ;;
+		*)
+			confgcc+=( --enable-threads=posix ) ;;
+		esac
+
+		if use prefix ; then
+			# should be /usr, because it's the path to search includes for,
+			# which is unrelated to TOOLCHAIN_PREFIX, a.k.a. PREFIX
+			confgcc+=( --with-local-prefix="${TPREFIX}"/usr )
+		fi
+	fi
+	# __cxa_atexit is "essential for fully standards-compliant handling of
+	# destructors", but apparently requires glibc.
+	case ${CTARGET} in
+	*-uclibc*)
+		confgcc+=(
+			--disable-__cxa_atexit
+			$(use_enable nptl tls)
+		)
+		[[ ${GCCMAJOR}.${GCCMINOR} == 3.3 ]] && confgcc+=( --enable-sjlj-exceptions )
+		if tc_version_is_at_least 3.4 && ! tc_version_is_at_least 4.3 ; then
+			confgcc+=( --enable-clocale=uclibc )
+		fi
+		;;
+	*-elf|*-eabi)
+		confgcc+=( --with-newlib )
+		;;
+	*-gnu*)
+		confgcc+=(
+			--enable-__cxa_atexit
+			--enable-clocale=gnu
+		)
+		;;
+	*-freebsd*)
+		confgcc+=( --enable-__cxa_atexit )
+		;;
+	*-solaris*)
+		confgcc+=( --enable-__cxa_atexit )
+		;;
+	esac
+
+	tc_version_is_at_least 3.4 || confgcc+=( --disable-libunwind-exceptions )
+
+	# if the target can do biarch (-m32/-m64), enable it.  overhead should
+	# be small, and should simplify building of 64bit kernels in a 32bit
+	# userland by not needing sys-devel/kgcc64.  #349405
+	if ! use prefix ; then
+	case $(tc-arch) in
+	ppc|ppc64) tc_version_is_at_least 3.4 && confgcc+=( --enable-targets=all ) ;;
+	sparc)     tc_version_is_at_least 4.4 && confgcc+=( --enable-targets=all ) ;;
+	amd64|x86) tc_version_is_at_least 4.3 && confgcc+=( --enable-targets=all ) ;;
+	esac
+	fi
+
+	tc_version_is_at_least 4.3 && confgcc+=(
+		--with-bugurl=http://bugs.gentoo.org/
+		--with-pkgversion="${BRANDING_GCC_PKGVERSION}"
+	)
+
+	confgcc+=(
+		"$@"
+		${EXTRA_ECONF}
+	)
+
+	# Disable gcc info regeneration -- it ships with generated info pages
+	# already.  Our custom version/urls/etc... trigger it.  #464008
+	export gcc_cv_prog_makeinfo_modern=no
+
+	# Do not let the X detection get in our way.  We know things can be found
+	# via system paths, so no need to hardcode things that'll break multilib.
+	# Older gcc versions will detect ac_x_libraries=/usr/lib64 which ends up
+	# killing the 32bit builds which want /usr/lib.
+	export ac_cv_have_x='have_x=yes ac_x_includes= ac_x_libraries='
+
+	# Nothing wrong with a good dose of verbosity
+	echo
+	einfo "EPREFIX:			${EPREFIX}"
+	einfo "PREFIX:			${PREFIX}"
+	einfo "BINPATH:			${BINPATH}"
+	einfo "LIBPATH:			${LIBPATH}"
+	einfo "DATAPATH:		${DATAPATH}"
+	einfo "STDCXX_INCDIR:	${STDCXX_INCDIR}"
+	echo
+	einfo "Configuring GCC with: ${confgcc[@]//--/\n\t--}"
+	echo
+
+	# Build in a separate build tree
+	mkdir -p "${WORKDIR}"/build
+	pushd "${WORKDIR}"/build > /dev/null
+
+	# and now to do the actual configuration
+	addwrite /dev/zero
+	echo "${S}"/configure "${confgcc[@]}"
+	"${S}"/configure "${confgcc[@]}" || die "failed to run configure"
+
+	# return to whatever directory we were in before
+	popd > /dev/null
+}
+
+has toolchain_death_notice ${EBUILD_DEATH_HOOKS} || EBUILD_DEATH_HOOKS+=" toolchain_death_notice"
+toolchain_death_notice() {
+	pushd "${WORKDIR}"/build >/dev/null
+	tar jcf gcc-build-logs.tar.bz2 $(find -name config.log)
+	eerror
+	eerror "Please include ${PWD}/gcc-build-logs.tar.bz2 in your bug report"
+	eerror
+	popd >/dev/null
+}
+
+# This function accepts one optional argument, the make target to be used.
+# If ommitted, gcc_do_make will try to guess whether it should use all,
+# profiledbootstrap, or bootstrap-lean depending on CTARGET and arch. An
+# example of how to use this function:
+#
+#	gcc_do_make all-target-libstdc++-v3
+#
+# In addition to the target to be used, the following variables alter the
+# behavior of this function:
+#
+#	LDFLAGS
+#			Flags to pass to ld
+#
+#	STAGE1_CFLAGS
+#			CFLAGS to use during stage1 of a gcc bootstrap
+#
+#	BOOT_CFLAGS
+#			CFLAGS to use during stages 2+3 of a gcc bootstrap.
+#
+# Travis Tilley <lv@gentoo.org> (04 Sep 2004)
+#
+gcc_do_make() {
+	# Set make target to $1 if passed
+	[[ -n $1 ]] && GCC_MAKE_TARGET=$1
+	# default target
+	if is_crosscompile || tc-is-cross-compiler ; then
+		# 3 stage bootstrapping doesnt quite work when you cant run the
+		# resulting binaries natively ^^;
+		GCC_MAKE_TARGET=${GCC_MAKE_TARGET-all}
+	else
+		GCC_MAKE_TARGET=${GCC_MAKE_TARGET-bootstrap-lean}
+	fi
+
+	# the gcc docs state that parallel make isnt supported for the
+	# profiledbootstrap target, as collisions in profile collecting may occur.
+	# boundschecking also seems to introduce parallel build issues.
+	if [[ ${GCC_MAKE_TARGET} == "profiledbootstrap" ]] ||
+	   use_if_iuse boundschecking
+	then
+		export MAKEOPTS="${MAKEOPTS} -j1"
+	fi
+
+	if [[ ${GCC_MAKE_TARGET} == "all" ]] ; then
+		STAGE1_CFLAGS=${STAGE1_CFLAGS-"${CFLAGS}"}
+	elif [[ $(gcc-version) == "3.4" && ${GCC_BRANCH_VER} == "3.4" ]] && gcc-specs-ssp ; then
+		# See bug #79852
+		STAGE1_CFLAGS=${STAGE1_CFLAGS-"-O2"}
+	fi
+
+	if is_crosscompile; then
+		# In 3.4, BOOT_CFLAGS is never used on a crosscompile...
+		# but I'll leave this in anyways as someone might have had
+		# some reason for putting it in here... --eradicator
+		BOOT_CFLAGS=${BOOT_CFLAGS-"-O2"}
+	else
+		# we only want to use the system's CFLAGS if not building a
+		# cross-compiler.
+		BOOT_CFLAGS=${BOOT_CFLAGS-"$(get_abi_CFLAGS ${TARGET_DEFAULT_ABI}) ${CFLAGS}"}
+	fi
+
+	pushd "${WORKDIR}"/build >/dev/null
+
+	# we "undef" T because the GCC makefiles use this variable, and if it's set
+	# in the environment (like Portage does) the build fails, bug #286494
+	emake \
+		T= \
+		LDFLAGS="${LDFLAGS}" \
+		STAGE1_CFLAGS="${STAGE1_CFLAGS}" \
+		LIBPATH="${EPREFIX}${LIBPATH}" \
+		BOOT_CFLAGS="${BOOT_CFLAGS}" \
+		${GCC_MAKE_TARGET} \
+		|| die "emake failed with ${GCC_MAKE_TARGET}"
+
+	if ! is_crosscompile && use cxx && use_if_iuse doc ; then
+		if type -p doxygen > /dev/null ; then
+			if tc_version_is_at_least 4.3 ; then
+				cd "${CTARGET}"/libstdc++-v3/doc
+				emake doc-man-doxygen || ewarn "failed to make docs"
+			elif tc_version_is_at_least 3.0 ; then
+				cd "${CTARGET}"/libstdc++-v3
+				emake doxygen-man || ewarn "failed to make docs"
+			fi
+		else
+			ewarn "Skipping libstdc++ manpage generation since you don't have doxygen installed"
+		fi
+	fi
+
+	popd >/dev/null
+}
+
+gcc_do_filter_flags() {
+
+	strip-flags
+
+	# In general gcc does not like optimization, and add -O2 where
+	# it is safe.  This is especially true for gcc 3.3 + 3.4
+	replace-flags -O? -O2
+
+	# ... sure, why not?
+	strip-unsupported-flags
+
+	# dont want to funk ourselves
+	filter-flags '-mabi*' -m31 -m32 -m64
+
+	case ${GCC_BRANCH_VER} in
+	3.2|3.3)
+		replace-cpu-flags k8 athlon64 opteron i686 x86-64
+		replace-cpu-flags pentium-m pentium3m pentium3
+		case $(tc-arch) in
+			amd64|x86) filter-flags '-mtune=*' ;;
+			# in gcc 3.3 there is a bug on ppc64 where if -mcpu is used,
+			# the compiler wrongly assumes a 32bit target
+			ppc64) filter-flags "-mcpu=*";;
+		esac
+		case $(tc-arch) in
+			amd64) replace-cpu-flags core2 nocona;;
+			x86)   replace-cpu-flags core2 prescott;;
+		esac
+
+		replace-cpu-flags G3 750
+		replace-cpu-flags G4 7400
+		replace-cpu-flags G5 7400
+
+		# XXX: should add a sed or something to query all supported flags
+		#      from the gcc source and trim everything else ...
+		filter-flags -f{no-,}unit-at-a-time -f{no-,}web -mno-tls-direct-seg-refs
+		filter-flags -f{no-,}stack-protector{,-all}
+		filter-flags -fvisibility-inlines-hidden -fvisibility=hidden
+		;;
+	3.4|4.*)
+		case $(tc-arch) in
+			x86|amd64) filter-flags '-mcpu=*';;
+			*-macos)
+				# http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25127
+				[[ ${GCC_BRANCH_VER} == 4.0 || ${GCC_BRANCH_VER}  == 4.1 ]] && \
+					filter-flags '-mcpu=*' '-march=*' '-mtune=*'
+			;;
+		esac
+		;;
+	esac
+
+	case ${GCC_BRANCH_VER} in
+	4.6)
+		# https://bugs.gentoo.org/411333
+		# https://bugs.gentoo.org/466454
+		replace-cpu-flags c3-2 pentium2 pentium3 pentium3m pentium-m i686
+		;;
+	esac
+
+	# TODO: Move to gcc_do_make()
+
+	# CFLAGS logic (verified with 3.4.3):
+	# CFLAGS:
+	#	This conflicts when creating a crosscompiler, so set to a sane
+	#	  default in this case:
+	#	used in ./configure and elsewhere for the native compiler
+	#	used by gcc when creating libiberty.a
+	#	used by xgcc when creating libstdc++ (and probably others)!
+	#	  this behavior should be removed...
+	#
+	# CXXFLAGS:
+	#	used by xgcc when creating libstdc++
+	#
+	# STAGE1_CFLAGS (not used in creating a crosscompile gcc):
+	#	used by ${CHOST}-gcc for building stage1 compiler
+	#
+	# BOOT_CFLAGS (not used in creating a crosscompile gcc):
+	#	used by xgcc for building stage2/3 compiler
+
+	if is_crosscompile ; then
+		# Set this to something sane for both native and target
+		CFLAGS="-O2 -pipe"
+		FFLAGS=${CFLAGS}
+		FCFLAGS=${CFLAGS}
+
+		local VAR="CFLAGS_"${CTARGET//-/_}
+		CXXFLAGS=${!VAR}
+	fi
+
+	export GCJFLAGS=${GCJFLAGS:-${CFLAGS}}
+}
+
+toolchain_src_compile() {
+	gcc_do_filter_flags
+	einfo "CFLAGS=\"${CFLAGS}\""
+	einfo "CXXFLAGS=\"${CXXFLAGS}\""
+
+	# Force internal zip based jar script to avoid random
+	# issues with 3rd party jar implementations.  #384291
+	export JAR=no
+
+	# For hardened gcc 4.3 piepatchset to build the hardened specs
+	# file (build.specs) to use when building gcc.
+	if ! tc_version_is_at_least 4.4 && want_minispecs ; then
+		setup_minispecs_gcc_build_specs
+	fi
+	# Build in a separate build tree
+	mkdir -p "${WORKDIR}"/build
+	pushd "${WORKDIR}"/build > /dev/null
+
+	einfo "Configuring ${PN} ..."
+	gcc_do_configure
+
+	touch "${S}"/gcc/c-gperf.h
+
+	# Do not make manpages if we do not have perl ...
+	[[ ! -x ${EPREFIX}/usr/bin/perl ]] \
+		&& find "${WORKDIR}"/build -name '*.[17]' | xargs touch
+
+	einfo "Compiling ${PN} ..."
+	gcc_do_make ${GCC_MAKE_TARGET}
+
+	popd > /dev/null
+}
+
+toolchain_src_test() {
+	if use regression-test ; then
+		cd "${WORKDIR}"/build
+		emake -k check
+	fi
+}
+
+toolchain_src_install() {
+	cd "${WORKDIR}"/build
+
+	# Do allow symlinks in private gcc include dir as this can break the build
+	find gcc/include*/ -type l -delete
+
+	# Copy over the info pages.  We disabled their generation earlier, but the
+	# build system only expects to install out of the build dir, not the source.  #464008
+	mkdir -p gcc/doc
+	local x=
+	for x in "${S}"/gcc/doc/*.info* ; do
+		if [[ -f ${x} ]] ; then
+			cp "${x}" gcc/doc/ || die
+		fi
+	done
+
+	# Remove generated headers, as they can cause things to break
+	# (ncurses, openssl, etc).
+	while read x ; do
+		grep -q 'It has been auto-edited by fixincludes from' "${x}" \
+			&& rm -f "${x}"
+	done < <(find gcc/include*/ -name '*.h')
+
+	# Do the 'make install' from the build directory
+	S="${WORKDIR}"/build emake -j1 DESTDIR="${D}" install || die
+
+	# Punt some tools which are really only useful while building gcc
+	find "${ED}" -name install-tools -prune -type d -exec rm -rf "{}" \;
+	# This one comes with binutils
+	find "${ED}" -name libiberty.a -delete
+
+	# Move the libraries to the proper location
+	gcc_movelibs
+
+	# Basic sanity check
+	if ! is_crosscompile ; then
+		local EXEEXT
+		eval $(grep ^EXEEXT= "${WORKDIR}"/build/gcc/config.log)
+		[[ -r ${ED}${BINPATH}/gcc${EXEEXT} ]] || die "gcc not found in ${ED}"
+	fi
+
+	dodir /etc/env.d/gcc
+	create_gcc_env_entry
+
+	# Setup the gcc_env_entry for hardened gcc 4 with minispecs
+	want_minispecs && copy_minispecs_gcc_specs
+
+	# Make sure we dont have stuff lying around that
+	# can nuke multiple versions of gcc
+	gcc_slot_java
+
+	dodir /usr/bin
+	cd "${ED}"${BINPATH}
+	# Ugh: we really need to auto-detect this list.
+	#      It's constantly out of date.
+	for x in cpp gcc g++ c++ gcov g77 gcj gcjh gfortran gccgo ; do
+		# For some reason, g77 gets made instead of ${CTARGET}-g77...
+		# this should take care of that
+		[[ -f ${x} ]] && mv ${x} ${CTARGET}-${x}
+
+		if [[ -f ${CTARGET}-${x} ]] ; then
+			if ! is_crosscompile ; then
+				ln -sf ${CTARGET}-${x} ${x}
+				dosym ${BINPATH}/${CTARGET}-${x} \
+					/usr/bin/${x}-${GCC_CONFIG_VER}
+			fi
+			# Create versioned symlinks
+			dosym ${BINPATH}/${CTARGET}-${x} \
+				/usr/bin/${CTARGET}-${x}-${GCC_CONFIG_VER}
+		fi
+
+		if [[ -f ${CTARGET}-${x}-${GCC_CONFIG_VER} ]] ; then
+			rm -f ${CTARGET}-${x}-${GCC_CONFIG_VER}
+			ln -sf ${CTARGET}-${x} ${CTARGET}-${x}-${GCC_CONFIG_VER}
+		fi
+	done
+
+	# Now do the fun stripping stuff
+	env RESTRICT="" CHOST=${CHOST} prepstrip "${ED}${BINPATH}"
+	env RESTRICT="" CHOST=${CTARGET} prepstrip "${ED}${LIBPATH}"
+	# gcc used to install helper binaries in lib/ but then moved to libexec/
+	[[ -d ${ED}${PREFIX}/libexec/gcc ]] && \
+		env RESTRICT="" CHOST=${CHOST} prepstrip "${ED}${PREFIX}/libexec/gcc/${CTARGET}/${GCC_CONFIG_VER}"
+
+	cd "${S}"
+	if is_crosscompile; then
+		rm -rf "${ED}"/usr/share/{man,info}
+		rm -rf "${ED}"${DATAPATH}/{man,info}
+	else
+		if tc_version_is_at_least 3.0 ; then
+			local cxx_mandir=$(find "${WORKDIR}/build/${CTARGET}/libstdc++-v3" -name man)
+			if [[ -d ${cxx_mandir} ]] ; then
+				# clean bogus manpages #113902
+				find "${cxx_mandir}" -name '*_build_*' -exec rm {} \;
+				cp -r "${cxx_mandir}"/man? "${ED}/${DATAPATH}"/man/
+			fi
+		fi
+		has noinfo ${FEATURES} \
+			&& rm -r "${ED}/${DATAPATH}"/info \
+			|| prepinfo "${DATAPATH}"
+		has noman ${FEATURES} \
+			&& rm -r "${ED}/${DATAPATH}"/man \
+			|| prepman "${DATAPATH}"
+	fi
+	# prune empty dirs left behind
+	find "${ED}" -depth -type d -delete 2>/dev/null
+
+	# install testsuite results
+	if use regression-test; then
+		docinto testsuite
+		find "${WORKDIR}"/build -type f -name "*.sum" -print0 | xargs -0 dodoc
+		find "${WORKDIR}"/build -type f -path "*/testsuite/*.log" -print0 \
+			| xargs -0 dodoc
+	fi
+
+	# Rather install the script, else portage with changing $FILESDIR
+	# between binary and source package borks things ....
+	if ! is_crosscompile ; then
+		cp "${GCC_FILESDIR}"/fix_libtool_files.sh "${T}"
+		cp "${GCC_FILESDIR}"/awk/fixlafiles.awk-no_gcc_la "${T}"
+		cp "${GCC_FILESDIR}"/awk/fixlafiles.awk "${T}"
+		eprefixify \
+			"${T}"/fix_libtool_files.sh \
+			"${T}"/fixlafiles.awk-no_gcc_la \
+			"${T}"/fixlafiles.awk
+
+		insinto "${DATAPATH}"
+		if tc_version_is_at_least 4.0 ; then
+			newins "${T}"/fixlafiles.awk-no_gcc_la fixlafiles.awk || die
+			find "${ED}/${LIBPATH}" -name libstdc++.la -type f -exec rm "{}" \;
+		else
+			doins "${T}"/fixlafiles.awk || die
+		fi
+		exeinto "${DATAPATH}"
+		doexe "${T}"/fix_libtool_files.sh || die
+		doexe "${GCC_FILESDIR}"/c{89,99} || die
+	fi
+
+	# Use gid of 0 because some stupid ports don't have
+	# the group 'root' set to gid 0.  Send to /dev/null
+	# for people who are testing as non-root.
+	chown -R ${PORTAGE_INST_UID:-0}:${PORTAGE_INST_GID:-0} "${ED}"${LIBPATH} 2>/dev/null
+
+	# Move pretty-printers to gdb datadir to shut ldconfig up
+	local py gdbdir=/usr/share/gdb/auto-load${LIBPATH/\/lib\//\/$(get_libdir)\/}
+	pushd "${ED}"${LIBPATH} >/dev/null
+	for py in $(find . -name '*-gdb.py') ; do
+		local multidir=${py%/*}
+		insinto "${gdbdir}/${multidir}"
+		sed -i "/^libdir =/s:=.*:= '${LIBPATH}/${multidir}':" "${py}" || die #348128
+		doins "${py}" || die
+		rm "${py}" || die
+	done
+	popd >/dev/null
+
+	# Don't scan .gox files for executable stacks - false positives
+	export QA_EXECSTACK="usr/lib*/go/*/*.gox"
+	export QA_WX_LOAD="usr/lib*/go/*/*.gox"
+
+	# Disable RANDMMAP so PCH works. #301299
+	if tc_version_is_at_least 4.3 ; then
+		pax-mark -r "${ED}${PREFIX}/libexec/gcc/${CTARGET}/${GCC_CONFIG_VER}/cc1"
+		pax-mark -r "${ED}${PREFIX}/libexec/gcc/${CTARGET}/${GCC_CONFIG_VER}/cc1plus"
+	fi
+}
+
+gcc_slot_java() {
+	local x
+
+	# Move Java headers to compiler-specific dir
+	for x in "${ED}"${PREFIX}/include/gc*.h "${ED}"${PREFIX}/include/j*.h ; do
+		[[ -f ${x} ]] && mv -f "${x}" "${ED}"${LIBPATH}/include/
+	done
+	for x in gcj gnu java javax org ; do
+		if [[ -d ${ED}${PREFIX}/include/${x} ]] ; then
+			dodir /${LIBPATH}/include/${x}
+			mv -f "${ED}"${PREFIX}/include/${x}/* "${ED}"${LIBPATH}/include/${x}/
+			rm -rf "${ED}"${PREFIX}/include/${x}
+		fi
+	done
+
+	if [[ -d ${ED}${PREFIX}/lib/security ]] || [[ -d ${ED}${PREFIX}/$(get_libdir)/security ]] ; then
+		dodir /${LIBPATH}/security
+		mv -f "${ED}"${PREFIX}/lib*/security/* "${ED}"${LIBPATH}/security
+		rm -rf "${ED}"${PREFIX}/lib*/security
+	fi
+
+	# Move random gcj files to compiler-specific directories
+	for x in libgcj.spec logging.properties ; do
+		x="${ED}${PREFIX}/lib/${x}"
+		[[ -f ${x} ]] && mv -f "${x}" "${ED}"${LIBPATH}/
+	done
+
+	# Rename jar because it could clash with Kaffe's jar if this gcc is
+	# primary compiler (aka don't have the -<version> extension)
+	cd "${ED}"${BINPATH}
+	[[ -f jar ]] && mv -f jar gcj-jar
+}
+
+# Move around the libs to the right location.  For some reason,
+# when installing gcc, it dumps internal libraries into /usr/lib
+# instead of the private gcc lib path
+gcc_movelibs() {
+	# older versions of gcc did not support --print-multi-os-directory
+	tc_version_is_at_least 3.2 || return 0
+
+	local x multiarg removedirs=""
+	for multiarg in $($(XGCC) -print-multi-lib) ; do
+		multiarg=${multiarg#*;}
+		multiarg=${multiarg//@/ -}
+
+		local OS_MULTIDIR=$($(XGCC) ${multiarg} --print-multi-os-directory)
+		local MULTIDIR=$($(XGCC) ${multiarg} --print-multi-directory)
+		local TODIR=${ED}${LIBPATH}/${MULTIDIR}
+		local FROMDIR=
+
+		[[ -d ${TODIR} ]] || mkdir -p ${TODIR}
+
+		for FROMDIR in \
+			${LIBPATH}/${OS_MULTIDIR} \
+			${LIBPATH}/../${MULTIDIR} \
+			${PREFIX}/lib/${OS_MULTIDIR} \
+			${PREFIX}/${CTARGET}/lib/${OS_MULTIDIR}
+		do
+			removedirs="${removedirs} ${FROMDIR}"
+			FROMDIR=${ED}${FROMDIR}
+			if [[ ${FROMDIR} != "${TODIR}" && -d ${FROMDIR} ]] ; then
+				local files=$(find "${FROMDIR}" -maxdepth 1 ! -type d 2>/dev/null)
+				if [[ -n ${files} ]] ; then
+					mv ${files} "${TODIR}"
+				fi
+			fi
+		done
+		fix_libtool_libdir_paths "${LIBPATH}/${MULTIDIR}"
+
+		# SLOT up libgcj.pc if it's available (and let gcc-config worry about links)
+		FROMDIR="${PREFIX}/lib/${OS_MULTIDIR}"
+		for x in "${ED}${FROMDIR}"/pkgconfig/libgcj*.pc ; do
+			[[ -f ${x} ]] || continue
+			sed -i "/^libdir=/s:=.*:=${LIBPATH}/${MULTIDIR}:" "${x}"
+			mv "${x}" "${ED}${FROMDIR}"/pkgconfig/libgcj-${GCC_PV}.pc || die
+		done
+	done
+
+	# We remove directories separately to avoid this case:
+	#	mv SRC/lib/../lib/*.o DEST
+	#	rmdir SRC/lib/../lib/
+	#	mv SRC/lib/../lib32/*.o DEST  # Bork
+	for FROMDIR in ${removedirs} ; do
+		rmdir "${ED}"${FROMDIR} >& /dev/null
+	done
+	find "${ED}" -type d | xargs rmdir >& /dev/null
+}
+#----<< src_* >>----
+
+#---->> unorganized crap in need of refactoring follows
+
+# gcc_quick_unpack will unpack the gcc tarball and patches in a way that is
+# consistant with the behavior of get_gcc_src_uri. The only patch it applies
+# itself is the branch update if present.
+#
+# Travis Tilley <lv@gentoo.org> (03 Sep 2004)
+#
+gcc_quick_unpack() {
+	pushd "${WORKDIR}" > /dev/null
+	export PATCH_GCC_VER=${PATCH_GCC_VER:-${GCC_RELEASE_VER}}
+	export UCLIBC_GCC_VER=${UCLIBC_GCC_VER:-${PATCH_GCC_VER}}
+	export PIE_GCC_VER=${PIE_GCC_VER:-${GCC_RELEASE_VER}}
+	export HTB_GCC_VER=${HTB_GCC_VER:-${GCC_RELEASE_VER}}
+	export SPECS_GCC_VER=${SPECS_GCC_VER:-${GCC_RELEASE_VER}}
+
+	if [[ -n ${GCC_A_FAKEIT} ]] ; then
+		unpack ${GCC_A_FAKEIT}
+	elif [[ -n ${PRERELEASE} ]] ; then
+		unpack gcc-${PRERELEASE}.tar.bz2
+	elif [[ -n ${SNAPSHOT} ]] ; then
+		unpack gcc-${SNAPSHOT}.tar.bz2
+	elif [[ ${PV} != *9999* ]] ; then
+		unpack gcc-${GCC_RELEASE_VER}.tar.bz2
+		# We want branch updates to be against a release tarball
+		if [[ -n ${BRANCH_UPDATE} ]] ; then
+			pushd "${S}" > /dev/null
+			epatch "${DISTDIR}"/gcc-${GCC_RELEASE_VER}-branch-update-${BRANCH_UPDATE}.patch.bz2
+			popd > /dev/null
+		fi
+	fi
+
+	if [[ -n ${D_VER} ]] && use d ; then
+		pushd "${S}"/gcc > /dev/null
+		unpack gdc-${D_VER}-src.tar.bz2
+		cd ..
+		ebegin "Adding support for the D language"
+		./gcc/d/setup-gcc.sh >& "${T}"/dgcc.log
+		if ! eend $? ; then
+			eerror "The D gcc package failed to apply"
+			eerror "Please include this log file when posting a bug report:"
+			eerror "  ${T}/dgcc.log"
+			die "failed to include the D language"
+		fi
+		popd > /dev/null
+	fi
+
+	[[ -n ${PATCH_VER} ]] && \
+		unpack gcc-${PATCH_GCC_VER}-patches-${PATCH_VER}.tar.bz2
+
+	[[ -n ${UCLIBC_VER} ]] && \
+		unpack gcc-${UCLIBC_GCC_VER}-uclibc-patches-${UCLIBC_VER}.tar.bz2
+
+	if want_pie ; then
+		if [[ -n ${PIE_CORE} ]] ; then
+			unpack ${PIE_CORE}
+		else
+			unpack gcc-${PIE_GCC_VER}-piepatches-v${PIE_VER}.tar.bz2
+		fi
+		[[ -n ${SPECS_VER} ]] && \
+			unpack gcc-${SPECS_GCC_VER}-specs-${SPECS_VER}.tar.bz2
+	fi
+
+	use_if_iuse boundschecking && unpack "bounds-checking-gcc-${HTB_GCC_VER}-${HTB_VER}.patch.bz2"
+
+	popd > /dev/null
+}
+
+do_gcc_HTB_patches() {
+	use_if_iuse boundschecking || return 0
+
+	# modify the bounds checking patch with a regression patch
+	epatch "${WORKDIR}/bounds-checking-gcc-${HTB_GCC_VER}-${HTB_VER}.patch"
+	BRANDING_GCC_PKGVERSION="${BRANDING_GCC_PKGVERSION}, HTB-${HTB_GCC_VER}-${HTB_VER}"
+}
+
+# do various updates to PIE logic
+do_gcc_PIE_patches() {
+	want_pie || return 0
+
+	use vanilla && return 0
+
+	if tc_version_is_at_least 4.3.2 ; then
+		guess_patch_type_in_dir "${WORKDIR}"/piepatch/
+		EPATCH_MULTI_MSG="Applying pie patches ..." \
+		epatch "${WORKDIR}"/piepatch/
+	else
+		guess_patch_type_in_dir "${WORKDIR}"/piepatch/upstream
+
+		# corrects startfile/endfile selection and shared/static/pie flag usage
+		EPATCH_MULTI_MSG="Applying upstream pie patches ..." \
+		epatch "${WORKDIR}"/piepatch/upstream
+		# adds non-default pie support (rs6000)
+		EPATCH_MULTI_MSG="Applying non-default pie patches ..." \
+		epatch "${WORKDIR}"/piepatch/nondef
+		# adds default pie support (rs6000 too) if DEFAULT_PIE[_SSP] is defined
+		EPATCH_MULTI_MSG="Applying default pie patches ..." \
+		epatch "${WORKDIR}"/piepatch/def
+	fi
+
+	# we want to be able to control the pie patch logic via something other
+	# than ALL_CFLAGS...
+	sed -e '/^ALL_CFLAGS/iHARD_CFLAGS = ' \
+		-e 's|^ALL_CFLAGS = |ALL_CFLAGS = $(HARD_CFLAGS) |' \
+		-i "${S}"/gcc/Makefile.in
+	# Need to add HARD_CFLAGS to ALL_CXXFLAGS on >= 4.7
+	if tc_version_is_at_least 4.7 ; then
+		sed -e '/^ALL_CXXFLAGS/iHARD_CFLAGS = ' \
+                        -e 's|^ALL_CXXFLAGS = |ALL_CXXFLAGS = $(HARD_CFLAGS) |' \
+                        -i "${S}"/gcc/Makefile.in
+	fi
+
+	BRANDING_GCC_PKGVERSION="${BRANDING_GCC_PKGVERSION}, pie-${PIE_VER}"
+}
+
+should_we_gcc_config() {
+	# if the current config is invalid, we definitely want a new one
+	# Note: due to bash quirkiness, the following must not be 1 line
+	local curr_config
+	curr_config=$(env -i ROOT="${ROOT}" "${EPREFIX}"/usr/bin/gcc-config -c ${CTARGET} 2>&1) || return 0
+
+	# if the previously selected config has the same major.minor (branch) as
+	# the version we are installing, then it will probably be uninstalled
+	# for being in the same SLOT, make sure we run gcc-config.
+	local curr_config_ver=$(env -i ROOT="${ROOT}" "${EPREFIX}"/usr/bin/gcc-config -S ${curr_config} | awk '{print $2}')
+
+	local curr_branch_ver=$(get_version_component_range 1-2 ${curr_config_ver})
+
+	# If we're using multislot, just run gcc-config if we're installing
+	# to the same profile as the current one.
+	use multislot && return $([[ ${curr_config_ver} == ${GCC_CONFIG_VER} ]])
+
+	if [[ ${curr_branch_ver} == ${GCC_BRANCH_VER} ]] ; then
+		return 0
+	else
+		# if we're installing a genuinely different compiler version,
+		# we should probably tell the user -how- to switch to the new
+		# gcc version, since we're not going to do it for him/her.
+		# We don't want to switch from say gcc-3.3 to gcc-3.4 right in
+		# the middle of an emerge operation (like an 'emerge -e world'
+		# which could install multiple gcc versions).
+		# Only warn if we're installing a pkg as we might be called from
+		# the pkg_{pre,post}rm steps.  #446830
+		if [[ ${EBUILD_PHASE} == *"inst" ]] ; then
+			einfo "The current gcc config appears valid, so it will not be"
+			einfo "automatically switched for you.  If you would like to"
+			einfo "switch to the newly installed gcc version, do the"
+			einfo "following:"
+			echo
+			einfo "gcc-config ${CTARGET}-${GCC_CONFIG_VER}"
+			einfo "source /etc/profile"
+			echo
+		fi
+		return 1
+	fi
+}
+
+do_gcc_config() {
+	if ! should_we_gcc_config ; then
+		env -i ROOT="${ROOT}" "${EPREFIX}"/usr/bin/gcc-config --use-old --force
+		return 0
+	fi
+
+	local current_gcc_config="" current_specs="" use_specs=""
+
+	current_gcc_config=$(env -i ROOT="${ROOT}" "${EPREFIX}"/usr/bin/gcc-config -c ${CTARGET} 2>/dev/null)
+	if [[ -n ${current_gcc_config} ]] ; then
+		# figure out which specs-specific config is active
+		current_specs=$(gcc-config -S ${current_gcc_config} | awk '{print $3}')
+		[[ -n ${current_specs} ]] && use_specs=-${current_specs}
+	fi
+	if [[ -n ${use_specs} ]] && \
+	   [[ ! -e ${EROOT}/etc/env.d/gcc/${CTARGET}-${GCC_CONFIG_VER}${use_specs} ]]
+	then
+		ewarn "The currently selected specs-specific gcc config,"
+		ewarn "${current_specs}, doesn't exist anymore. This is usually"
+		ewarn "due to enabling/disabling hardened or switching to a version"
+		ewarn "of gcc that doesnt create multiple specs files. The default"
+		ewarn "config will be used, and the previous preference forgotten."
+		use_specs=""
+	fi
+
+	gcc-config ${CTARGET}-${GCC_CONFIG_VER}${use_specs}
+}
+
+# This function allows us to gentoo-ize GCCs version number and bugzilla
+# URL without needing to use patches.
+gcc_version_patch() {
+	# gcc-4.3+ has configure flags (whoo!)
+	tc_version_is_at_least 4.3 && return 0
+
+	local version_string=${GCC_CONFIG_VER}
+	[[ -n ${BRANCH_UPDATE} ]] && version_string+=" ${BRANCH_UPDATE}"
+
+	einfo "patching gcc version: ${version_string} (${BRANDING_GCC_PKGVERSION})"
+
+	local gcc_sed=( -e 's:gcc\.gnu\.org/bugs\.html:bugs\.gentoo\.org/:' )
+	if grep -qs VERSUFFIX "${S}"/gcc/version.c ; then
+		gcc_sed+=( -e "/VERSUFFIX \"\"/s:\"\":\" (${BRANDING_GCC_PKGVERSION})\":" )
+	else
+		version_string="${version_string} (${BRANDING_GCC_PKGVERSION})"
+		gcc_sed+=( -e "/const char version_string\[\] = /s:= \".*\":= \"${version_string}\":" )
+	fi
+	sed -i "${gcc_sed[@]}" "${S}"/gcc/version.c || die
+}
+
+# This is a historical wart.  The original Gentoo/amd64 port used:
+#    lib32 - 32bit binaries (x86)
+#    lib64 - 64bit binaries (x86_64)
+#    lib   - "native" binaries (a symlink to lib64)
+# Most other distros use the logic (including mainline gcc):
+#    lib   - 32bit binaries (x86)
+#    lib64 - 64bit binaries (x86_64)
+# Over time, Gentoo is migrating to the latter form.
+#
+# Unfortunately, due to distros picking the lib32 behavior, newer gcc
+# versions will dynamically detect whether to use lib or lib32 for its
+# 32bit multilib.  So, to keep the automagic from getting things wrong
+# while people are transitioning from the old style to the new style,
+# we always set the MULTILIB_OSDIRNAMES var for relevant targets.
+setup_multilib_osdirnames() {
+	is_multilib || return 0
+
+	local config
+	local libdirs="../lib64 ../lib32"
+
+	# this only makes sense for some Linux targets
+	case ${CTARGET} in
+	x86_64*-linux*)    config="i386" ;;
+	powerpc64*-linux*) config="rs6000" ;;
+	sparc64*-linux*)   config="sparc" ;;
+	s390x*-linux*)     config="s390" ;;
+	*)	               return 0 ;;
+	esac
+	config+="/t-linux64"
+
+	local sed_args=()
+	if tc_version_is_at_least 4.6 ; then
+		sed_args+=( -e 's:$[(]call if_multiarch[^)]*[)]::g' )
+	fi
+	if [[ ${SYMLINK_LIB} == "yes" ]] ; then
+		einfo "updating multilib directories to be: ${libdirs}"
+		if tc_version_is_at_least 4.6.4 || tc_version_is_at_least 4.7 ; then
+			sed_args+=( -e '/^MULTILIB_OSDIRNAMES.*lib32/s:[$][(]if.*):../lib32:' )
+		else
+			sed_args+=( -e "/^MULTILIB_OSDIRNAMES/s:=.*:= ${libdirs}:" )
+		fi
+	else
+		einfo "using upstream multilib; disabling lib32 autodetection"
+		sed_args+=( -r -e 's:[$][(]if.*,(.*)[)]:\1:' )
+	fi
+	sed -i "${sed_args[@]}" "${S}"/gcc/config/${config} || die
+}
+
+# make sure the libtool archives have libdir set to where they actually
+# -are-, and not where they -used- to be.  also, any dependencies we have
+# on our own .la files need to be updated.
+fix_libtool_libdir_paths() {
+	pushd "${ED}" >/dev/null
+
+	pushd "./${1}" >/dev/null
+	local dir="${PWD#${D%/}}"
+	local allarchives=$(echo *.la)
+	allarchives="\(${allarchives// /\\|}\)"
+	popd >/dev/null
+
+	sed -i \
+		-e "/^libdir=/s:=.*:='${EPREFIX}/${dir##/}':" \
+		./${dir}/*.la
+	sed -i \
+		-e "/^dependency_libs=/s:/[^ ]*/${allarchives}:${EPREFIX}/${LIBPATH##/}/\1:g" \
+		$(find ./${PREFIX}/lib* -maxdepth 3 -name '*.la') \
+		./${dir}/*.la
+
+	popd >/dev/null
+}
+
+is_multilib() {
+	tc_version_is_at_least 3 || return 1
+	use multilib
+}
+
+is_cxx() {
+	gcc-lang-supported 'c++' || return 1
+	use cxx
+}
+
+is_d() {
+	gcc-lang-supported d || return 1
+	use_if_iuse d
+}
+
+is_f77() {
+	gcc-lang-supported f77 || return 1
+	use fortran
+}
+
+is_f95() {
+	gcc-lang-supported f95 || return 1
+	use fortran
+}
+
+is_fortran() {
+	gcc-lang-supported fortran || return 1
+	use fortran
+}
+
+is_gcj() {
+	gcc-lang-supported java || return 1
+	use cxx && use_if_iuse gcj
+}
+
+is_go() {
+	gcc-lang-supported go || return 1
+	use cxx && use_if_iuse go
+}
+
+is_objc() {
+	gcc-lang-supported objc || return 1
+	use_if_iuse objc
+}
+
+is_objcxx() {
+	gcc-lang-supported 'obj-c++' || return 1
+	use cxx && use_if_iuse objc++
+}
+
+is_ada() {
+	gcc-lang-supported ada || return 1
+	use ada
+}
+
+is_treelang() {
+	use_if_iuse boundschecking && return 1 #260532
+	is_crosscompile && return 1 #199924
+	gcc-lang-supported treelang || return 1
+	#use treelang
+	return 0
+}

diff --git a/eclass/wxwidgets.eclass b/eclass/wxwidgets.eclass
new file mode 100644
index 0000000..16a0cc5
--- /dev/null
+++ b/eclass/wxwidgets.eclass
@@ -0,0 +1,285 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/eclass/wxwidgets.eclass,v 1.34 2013/08/16 07:59:17 heroxbd Exp $
+
+# @ECLASS:			wxwidgets.eclass
+# @MAINTAINER:
+#  wxwidgets@gentoo.org
+# @BLURB:			Manages build configuration for wxGTK-using packages.
+# @DESCRIPTION:
+#  The wxGTK libraries come in several different possible configurations
+#  (release, debug, ansi, unicode, etc.) most of which can be installed
+#  side-by-side.  The purpose of this eclass is to provide ebuilds the ability
+#  to build against a specific type of profile without interfering with the
+#  user-set system configuration.
+#
+#  Ebuilds that use wxGTK _must_ inherit this eclass.
+#
+# - Using this eclass -
+#
+#  1. set WX_GTK_VER to a valid wxGTK SLOT
+#  2. inherit wxwidgets
+#  3. add an appropriate DEPEND
+#  4. done
+#
+# @CODE
+#    WX_GTK_VER="2.8"
+#
+#    inherit wxwidgets
+#
+#    DEPEND="x11-libs/wxGTK:2.8[X]"
+#    RDEPEND="${DEPEND}"
+#    [...]
+# @CODE
+#
+#  This will get you the default configuration, which is what you want 99%
+#  of the time (in 2.6 the default is "ansi", all other versions default to
+#  "unicode").
+#
+#  If your package has optional wxGTK support controlled by a USE flag or you
+#  need to use the wxBase libraries (USE="-X") then you should not set
+#  WX_GTK_VER before inherit and instead refer to the need-wxwidgets function
+#  below.
+#
+#  The variable WX_CONFIG is exported, containing the absolute path to the
+#  wx-config file to use.  Most configure scripts use this path if it's set in
+#  the environment or accept --with-wx-config="${WX_CONFIG}".
+
+inherit eutils multilib
+
+case "${EAPI:-0}" in
+	0|1)
+		EXPORT_FUNCTIONS pkg_setup
+		;;
+	*)
+		;;
+esac
+
+# We do this globally so ebuilds can get sane defaults just by inheriting.  They
+# can be overridden with need-wxwidgets later if need be.
+
+# ensure this only runs once
+if [[ -z ${WX_CONFIG} ]]; then
+	# and only if WX_GTK_VER is set before inherit
+	if [[ -n ${WX_GTK_VER} ]]; then
+		if [[ ${WX_GTK_VER} == 2.6 ]]; then
+			wxchar="ansi"
+		else
+			wxchar="unicode"
+		fi
+		for wxtoolkit in gtk2 base; do
+			# newer versions don't have a seperate debug profile
+			for wxdebug in xxx release- debug-; do
+				wxconf="${wxtoolkit}-${wxchar}-${wxdebug/xxx/}${WX_GTK_VER}"
+				if [[ -f ${EPREFIX}/usr/$(get_libdir)/wx/config/${wxconf} ]]; then
+					# if this is a wxBase install, die in pkg_setup
+					[[ ${wxtoolkit} == "base" ]] && WXBASE_DIE=1
+				else
+					continue
+				fi
+				WX_CONFIG="${EPREFIX}/usr/$(get_libdir)/wx/config/${wxconf}"
+				WX_ECLASS_CONFIG="${WX_CONFIG}"
+				break
+			done
+			[[ -n ${WX_CONFIG} ]] && break
+		done
+		[[ -n ${WX_CONFIG} ]] && export WX_CONFIG WX_ECLASS_CONFIG
+	fi
+fi
+
+# @FUNCTION:		wxwidgets_pkg_setup
+# @DESCRIPTION:
+#
+#  It's possible for wxGTK to be installed with USE="-X", resulting in something
+#  called wxBase.  There's only ever been a couple packages in the tree that use
+#  wxBase so this is probably not what you want.  Whenever possible, use EAPI 2
+#  USE dependencies(tm) to ensure that wxGTK was built with USE="X".  This
+#  function is only exported for EAPI 0 or 1 and catches any remaining cases.
+#
+#  If you do use wxBase, don't set WX_GTK_VER before inherit.  Use
+#  need-wxwidgets() instead.
+
+wxwidgets_pkg_setup() {
+	[[ -n $WXBASE_DIE ]] && check_wxuse X
+}
+
+# @FUNCTION:		need-wxwidgets
+# @USAGE:			<configuration>
+# @DESCRIPTION:
+#
+#  Available configurations are:
+#
+#    [2.6] ansi          [>=2.8] unicode
+#          unicode               base-unicode
+#          base
+#          base-unicode
+#
+#  If your package has optional wxGTK support controlled by a USE flag, set
+#  WX_GTK_VER inside a conditional rather than before inherit.  Some broken
+#  configure scripts will force wxGTK on if they find ${WX_CONFIG} set.
+#
+# @CODE
+#    src_configure() {
+#      if use wxwidgets; then
+#          WX_GTK_VER="2.8"
+#          if use X; then
+#            need-wxwidgets unicode
+#          else
+#            need-wxwidgets base-unicode
+#          fi
+#      fi
+# @CODE
+#
+
+need-wxwidgets() {
+	debug-print-function $FUNCNAME $*
+
+	local wxtoolkit wxchar wxdebug wxconf
+
+	if [[ -z ${WX_GTK_VER} ]]; then
+		echo
+		eerror "WX_GTK_VER must be set before calling $FUNCNAME."
+		echo
+		die "WX_GTK_VER missing"
+	fi
+
+	if [[ ${WX_GTK_VER} != 2.6 && ${WX_GTK_VER} != 2.8 && ${WX_GTK_VER} != 2.9 ]]; then
+			echo
+			eerror "Invalid WX_GTK_VER: ${WX_GTK_VER} - must be set to a valid wxGTK SLOT."
+			echo
+			die "Invalid WX_GTK_VER"
+	fi
+
+	debug-print "WX_GTK_VER is ${WX_GTK_VER}"
+
+	case $1 in
+		ansi)
+			debug-print-section ansi
+			if [[ ${WX_GTK_VER} == 2.6 ]]; then
+				wxchar="ansi"
+			else
+				wxchar="unicode"
+			fi
+			check_wxuse X
+			;;
+		unicode)
+			debug-print-section unicode
+			check_wxuse X
+			[[ ${WX_GTK_VER} == 2.6 ]] && check_wxuse unicode
+			wxchar="unicode"
+			;;
+		base)
+			debug-print-section base
+			if [[ ${WX_GTK_VER} == 2.6 ]]; then
+				wxchar="ansi"
+			else
+				wxchar="unicode"
+			fi
+			;;
+		base-unicode)
+			debug-print-section base-unicode
+			[[ ${WX_GTK_VER} == 2.6 ]] && check_wxuse unicode
+			wxchar="unicode"
+			;;
+		# backwards compatibility
+		gtk2)
+			debug-print-section gtk2
+			if [[ ${WX_GTK_VER} == 2.6 ]]; then
+				wxchar="ansi"
+			else
+				wxchar="unicode"
+			fi
+			check_wxuse X
+			;;
+		*)
+			echo
+			eerror "Invalid $FUNCNAME argument: $1"
+			echo
+			die "Invalid argument"
+			;;
+	esac
+
+	debug-print "wxchar is ${wxchar}"
+
+	# TODO: remove built_with_use
+
+	# wxBase can be provided by both gtk2 and base installations
+	if built_with_use =x11-libs/wxGTK-${WX_GTK_VER}* X; then
+		wxtoolkit="gtk2"
+	else
+		wxtoolkit="base"
+	fi
+
+	debug-print "wxtoolkit is ${wxtoolkit}"
+
+	# debug or release?
+	if [[ ${WX_GTK_VER} == 2.6 || ${WX_GTK_VER} == 2.8 ]]; then
+		if built_with_use =x11-libs/wxGTK-${WX_GTK_VER}* debug; then
+			wxdebug="debug-"
+		else
+			wxdebug="release-"
+		fi
+	fi
+
+	debug-print "wxdebug is ${wxdebug}"
+
+	# put it all together
+	wxconf="${wxtoolkit}-${wxchar}-${wxdebug}${WX_GTK_VER}"
+
+	debug-print "wxconf is ${wxconf}"
+
+	# if this doesn't work, something is seriously screwed
+	if [[ ! -f ${EPREFIX}/usr/$(get_libdir)/wx/config/${wxconf} ]]; then
+		echo
+		eerror "Failed to find configuration ${wxconf}"
+		echo
+		die "Missing wx-config"
+	fi
+
+	debug-print "Found config ${wxconf} - setting WX_CONFIG"
+
+	export WX_CONFIG="${EPREFIX}/usr/$(get_libdir)/wx/config/${wxconf}"
+
+	debug-print "WX_CONFIG is ${WX_CONFIG}"
+
+	export WX_ECLASS_CONFIG="${WX_CONFIG}"
+
+	echo
+	einfo "Requested wxWidgets:        ${1} ${WX_GTK_VER}"
+	einfo "Using wxWidgets:            ${wxconf}"
+	echo
+}
+
+
+# @FUNCTION:		check_wxuse
+# @USAGE:			<USE flag>
+# @DESCRIPTION:
+#
+#  Provides a consistant way to check if wxGTK was built with a particular USE
+#  flag enabled.  A better way is EAPI 2 USE dependencies (hint hint).
+
+check_wxuse() {
+	debug-print-function $FUNCNAME $*
+
+	if [[ -z ${WX_GTK_VER} ]]; then
+		echo
+		eerror "WX_GTK_VER must be set before calling $FUNCNAME."
+		echo
+		die "WX_GTK_VER missing"
+	fi
+
+	# TODO: Remove built_with_use
+
+	ebegin "Checking wxGTK-${WX_GTK_VER} for ${1} support"
+	if built_with_use =x11-libs/wxGTK-${WX_GTK_VER}* "${1}"; then
+		eend 0
+	else
+		eend 1
+		echo
+		eerror "${FUNCNAME} - You have requested functionality that requires ${1} support to"
+		eerror "have been built into x11-libs/wxGTK."
+		eerror
+		eerror "Please re-merge =x11-libs/wxGTK-${WX_GTK_VER}* with the ${1} USE flag enabled."
+		die "Missing USE flags."
+	fi
+}

diff --git a/profiles/default/linux/amd64/13.0/rap/make.defaults b/profiles/default/linux/amd64/13.0/rap/make.defaults
new file mode 100644
index 0000000..fc2914e
--- /dev/null
+++ b/profiles/default/linux/amd64/13.0/rap/make.defaults
@@ -0,0 +1,3 @@
+# accept unstable keyword before RAP matures
+# accept Prefix keyword to use Prefix overlay for transition
+ACCEPT_KEYWORDS="~amd64 ~amd64-linux"

diff --git a/profiles/default/linux/amd64/13.0/rap/parent b/profiles/default/linux/amd64/13.0/rap/parent
new file mode 100644
index 0000000..7df3b6e
--- /dev/null
+++ b/profiles/default/linux/amd64/13.0/rap/parent
@@ -0,0 +1,2 @@
+../no-multilib
+../../../../../features/rap

diff --git a/profiles/default/linux/arm/13.0/armv7a/rap/make.defaults b/profiles/default/linux/arm/13.0/armv7a/rap/make.defaults
new file mode 100644
index 0000000..61ca581
--- /dev/null
+++ b/profiles/default/linux/arm/13.0/armv7a/rap/make.defaults
@@ -0,0 +1,3 @@
+# accept unstable keyword before RAP matures
+# accept Prefix keyword to use Prefix overlay for transition
+ACCEPT_KEYWORDS="~arm ~arm-linux"

diff --git a/profiles/default/linux/arm/13.0/armv7a/rap/parent b/profiles/default/linux/arm/13.0/armv7a/rap/parent
new file mode 100644
index 0000000..8a04a12
--- /dev/null
+++ b/profiles/default/linux/arm/13.0/armv7a/rap/parent
@@ -0,0 +1,2 @@
+..
+../../../../../../features/rap

diff --git a/profiles/default/linux/x86/13.0/rap/make.defaults b/profiles/default/linux/x86/13.0/rap/make.defaults
new file mode 100644
index 0000000..5682e93
--- /dev/null
+++ b/profiles/default/linux/x86/13.0/rap/make.defaults
@@ -0,0 +1,3 @@
+# accept unstable keyword before RAP matures
+# accept Prefix keyword to use Prefix overlay for transition
+ACCEPT_KEYWORDS="~x86 ~x86-linux"

diff --git a/profiles/default/linux/x86/13.0/rap/parent b/profiles/default/linux/x86/13.0/rap/parent
new file mode 100644
index 0000000..3659747
--- /dev/null
+++ b/profiles/default/linux/x86/13.0/rap/parent
@@ -0,0 +1,2 @@
+..
+../../../../../features/rap

diff --git a/profiles/features/rap/make.defaults b/profiles/features/rap/make.defaults
new file mode 100644
index 0000000..ed808e9
--- /dev/null
+++ b/profiles/features/rap/make.defaults
@@ -0,0 +1,2 @@
+# sandbox not prefixified yet.
+FEATURES="-sandbox"

diff --git a/profiles/features/rap/packages b/profiles/features/rap/packages
new file mode 100644
index 0000000..c574b8e
--- /dev/null
+++ b/profiles/features/rap/packages
@@ -0,0 +1,11 @@
+# kmod has not been prefixified
+-*virtual/modutils
+
+# shadow has not been prefixified
+-*virtual/shadow
+
+# don't need in rap
+-*virtual/dev-manager
+
+# permission is not handled by portage for normal users
+-*net-misc/iputils

diff --git a/profiles/features/rap/profile.bashrc b/profiles/features/rap/profile.bashrc
new file mode 100644
index 0000000..40cc40c
--- /dev/null
+++ b/profiles/features/rap/profile.bashrc
@@ -0,0 +1,9 @@
+# use sysroot of toolchain to get include and library at compile time work
+# Benda Xu <heroxbd@gentoo.org> (17 Jun, 2013)
+
+if [[ ${CATEGORY} == sys-devel ]] && [[ ${PN} == gcc || ${PN} == binutils || ${PN} == libtool ]] \
+	&& [[ ${EBUILD_PHASE} == unpack ]]; then
+	elog "append --with-sysroot=${EPREFIX} to configure for Prefix libc"
+	EXTRA_ECONF+="--with-sysroot=${EPREFIX}"
+fi
+

diff --git a/profiles/features/rap/use.force b/profiles/features/rap/use.force
new file mode 100644
index 0000000..193e6d8
--- /dev/null
+++ b/profiles/features/rap/use.force
@@ -0,0 +1,5 @@
+# force Prefix
+prefix
+
+# force rap (Prefix with libc)
+rap

diff --git a/profiles/features/rap/use.mask b/profiles/features/rap/use.mask
new file mode 100644
index 0000000..4c45f2d
--- /dev/null
+++ b/profiles/features/rap/use.mask
@@ -0,0 +1,8 @@
+# unmask prefix
+-prefix
+
+# sys-libs/gpm has not been prefixified
+gpm
+
+# sys-libs/pam has not been prefixified
+pam

diff --git a/profiles/prefix/features/with-libc/packages b/profiles/prefix/features/with-libc/packages
new file mode 100644
index 0000000..be6a3cb
--- /dev/null
+++ b/profiles/prefix/features/with-libc/packages
@@ -0,0 +1,3 @@
+# use OpenRC from gentoo-x86
+-*sys-apps/baselayout-prefix
+*sys-apps/baselayout

diff --git a/profiles/prefix/linux/amd64/with-libc/.unison.packages.78a8f6ffc32b4d5af3a26b6758688d4f.unison.tmp b/profiles/prefix/linux/amd64/with-libc/.unison.packages.78a8f6ffc32b4d5af3a26b6758688d4f.unison.tmp
new file mode 100644
index 0000000..d781c37
--- /dev/null
+++ b/profiles/prefix/linux/amd64/with-libc/.unison.packages.78a8f6ffc32b4d5af3a26b6758688d4f.unison.tmp
@@ -0,0 +1,2 @@
+# use OpenRC
+-*sys-apps/baselayout-prefix

diff --git a/profiles/prefix/linux/arm/with-libc/parent b/profiles/prefix/linux/arm/with-libc/parent
new file mode 100644
index 0000000..76f4041
--- /dev/null
+++ b/profiles/prefix/linux/arm/with-libc/parent
@@ -0,0 +1,2 @@
+../../../features/with-libc
+..

diff --git a/profiles/prefix/linux/x86/with-libc/make.defaults b/profiles/prefix/linux/x86/with-libc/make.defaults
new file mode 100644
index 0000000..3a95173
--- /dev/null
+++ b/profiles/prefix/linux/x86/with-libc/make.defaults
@@ -0,0 +1,6 @@
+# Copyright 1999-2009 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/profiles/prefix/linux/x86/make.defaults,v 1.3 2009/11/04 13:25:03 haubi Exp $
+
+# add back x86. add ~x86 for testing.
+ACCEPT_KEYWORDS="x86 ~x86 ~x86-linux"

diff --git a/profiles/prefix/linux/x86/with-libc/parent b/profiles/prefix/linux/x86/with-libc/parent
new file mode 100644
index 0000000..510455a
--- /dev/null
+++ b/profiles/prefix/linux/x86/with-libc/parent
@@ -0,0 +1,2 @@
+..
+../../../features/with-libc

diff --git a/sys-devel/binutils/Manifest b/sys-devel/binutils/Manifest
index 5a6bdd8..c781f7a 100644
--- a/sys-devel/binutils/Manifest
+++ b/sys-devel/binutils/Manifest
@@ -23,6 +23,7 @@ AUX binutils-2.23-ar-ranlib-truncate.patch 1095 SHA256 6d09ce8e2fbf370fd73f9ff61
 AUX binutils-2.23-mbstate_t.patch 5739 SHA256 ec17ce4d4e47d861f2300dcbdf4f4143c38c7919af9bdb8dd82350e8f0f332e7 SHA512 33eff1d30b93f13dbd11959c9110bf0f787b1e2318f2cd03f9918f8089c136aa6a5188d759825e8b0bb819000ab552234dd18568b121cc6ea9b537538a97e79b WHIRLPOOL 3da5ad51d0a13d0028570cf61b8b60ea19722073a70af6b5d9d07f5845b9970243a65d3359ae91ce58f4167e47837439eecec94db5d3f86a0e3fab03736bfcd0
 AUX binutils-2.23-no-ld-script-sysroot.patch 376 SHA256 0439bfa86a1f4dfd18b56b0104e78a3c670584424ebb6205c673fc6f5015b7e0 SHA512 4624f2ceebba47c2656430d1923c72a6a20cff2c57b58ecb001fd4e67e3a34c7054f1f0f12be7ef21f4789298800106219f4a5dd19cafadf9858ba0d4bee5f43 WHIRLPOOL 40de5dc12ca11855188fe16b85d892085e64cbaedcb04a266085502f2cea9de3d94d2c61036548ed3248f7d48b986ac5748aed7bf750f0f9f78c53af515d3329
 AUX binutils-2.23-no-rpath-sysroot.patch 1008 SHA256 9c35d21c8a5ac0edf8812ea126b6cc7f8ed630a73f4c91db3cc27652b638d8b6 SHA512 d5b311f18f3f6b0e21fbb3da355cd99e98e9ed10d23b9b684a2f0de263966c959b39d22866f93cefb1d81814fd1a7ade14302338c57a12614fd9d64c5b390710 WHIRLPOOL 10b832f32a0f9acc9924bd0d5d81ee99cc13549309691025e8d90a874bf99dfde0efe9a0a357c9c924edf2cd34a2f3371c43a79ea8375d7377507fa5c961d34c
+AUX binutils-2.23-runtime-sysroot.patch 4476 SHA256 123e8de7d74a65ad45dcd0d4f6a6248b45b02938547b9c3fb9f8b2c3f776054e SHA512 48bea81d36d5fa53ae9981d2332490f4063ad50937363f4b7701bbc218c95fb7e1551ca3ca880f317d2ab7e9fbda736075a98d034b1aa969013aab1b0c48e3a1 WHIRLPOOL 8db49092cbea421a3e520bd94ba41ab287e1950ca67d577a369b35da5c93dc318a6a80600bba643bcc6b62ffa16de3055551cba2eb24a06d100827748e2ee211
 DIST binutils-2.19.1-patches-1.2.tar.bz2 10544 SHA256 128c949a46e6c516b5ebb2dbb7be553db7d8f1ee174896d1b63adbd0950030b3 SHA512 6aa2c923748d5b80f8e495176f19d8df8defcaa53915835b57a1da7c7a78668cb63d3380dd027593c8909a35de61adf2ea3d0ace64eeb537171271a6c6cbf33e WHIRLPOOL 04b26a82b2021626d4402c3275776bd9f91139082ae799350f9605bfa7e72fd3d72aac7636fbeb0e1fcdb93b6e903b396320b439502462baad06a61b0a3960e6
 DIST binutils-2.19.1.tar.bz2 16306586 SHA256 2dbd2c554b70d915c5b32fcfd401d03afcbf202529059c7a80af3993885ad1c2 SHA512 22af3cf65ad2f76469440fb992e50a10895fcec1265b98781138db0fc40bf06565af86dc73ca0b97bee764ec797439a89b5dbca2a5da74f375af55383887c436 WHIRLPOOL 340c12072a60c8f7b4b930a857e87d9723bdd2b0c61bef5a06810e11406f3e7955632a93a59c68b60220a882ff99273af3a9995872aa7a11604dd04182ebc6a2
 DIST binutils-2.20.1-patches-1.2.tar.bz2 15747 SHA256 30738e18f492bd653421d4bc4d52b841680fe4b17a69524e081d9befadef6d3b SHA512 23c1026db7748f9f958d32f6bfd2b362dae3bdee33612fb6a0cc4277fcb360a55c5618dc748a7119b12794a1bc22ea70af92c04f5283c0041bc681e5db4266b4 WHIRLPOOL fc73133cbd0aaf9447296425dd22907d3b984a9d8c0631be5155cd887ca44932b5d3651d538783ac10e520c6b43a077fb045ea720d95855f04b4ba47cb9076a2
@@ -49,6 +50,6 @@ EBUILD binutils-2.23.51.0.3.ebuild 1926 SHA256 d0ced61c78ac4b32e1d2ba5d4175ede6f
 EBUILD binutils-2.23.51.0.5.ebuild 1926 SHA256 5acbc0b45224ef8cadfa29ab59dbf656db8a68c5399b5b60bcd392144b1c1b6d SHA512 d16696d16e8fcb39f66daf6a7b6a5b1fc9361e75a5a3d432c0ba828f29d6f12230124b6d9d8cd175c9530a3ff8d59998c3e74080fe5fa39f8a3976ac9eafd0bf WHIRLPOOL adb0754bb3cb1a52137905c32149d281fab69a2e860ccbbbd610b0647b319777bdf6c6ff1a45d6123d41787d25c0d7310e3702f950aea470aaa45234ef974b2f
 EBUILD binutils-2.23.51.0.6.ebuild 1926 SHA256 dc592c519f9b3eae5587db82029c61f2377eff12680362d4c611895a21e259bd SHA512 2a3c053484c4edee75aeec65310088046ca53e978a23705a432db57f08ee2f064af7d71548f16dbb38c053586881b1d2d39497a892a31d7f7ab8e49b548108c0 WHIRLPOOL f1ee641ed30639264904d3fc0db5bca3ec9efb5c890eabff79fd400c92558ed6b5a80898bc6b349d110ac7290f39dcd23c8a7fc02533ebfe79896cb9b2a91636
 EBUILD binutils-2.23.51.0.8.ebuild 1926 SHA256 108ad27215ebb8602193ead950a3962c724f1b24e5e14e05277b96a189d63876 SHA512 7a1b7840aa428ee2e52446c8082c16db07f61b7434ba9562d48e1b9e68e3bf449c0a54c31d250ece8fd371f09bb694162a6ed5bdf9f6c8539710c5295601ad20 WHIRLPOOL ed01c0234f6da5f75d700184ded119106d66462c5327b48b9d7ed6d0dd74aec70f866dbc043aaf6bc5bc2d9f98cf313eb11a7df96ae28f7f1ec6dccb9ba3b645
-EBUILD binutils-2.23.ebuild 2165 SHA256 cacab6f23177dc813907db61a525b233733a28a50c54c0641c9b4897aaa3b881 SHA512 4825fcfbd8713ab242702c23e37f931328906b1868bff479da1eab3d7eff5ec12b378abd211f558a7c279f5abc4ba0102371efb9bf8680d8ee7f5bd075362f54 WHIRLPOOL fbaa3edfcc364c4c0aa7b4abb837a8a7bbcf9dc886650f3be769f1311c3372b7e05fd6e89f1a5bb734f7b6628b9c726baa9fed2da44ed43eaaf9a1911001cfcf
+EBUILD binutils-2.23.ebuild 2135 SHA256 1849d4d616080f5ed8dee63ce5591a443cd55894cef188a93772109b8ac796a4 SHA512 c42bc7ea2f3ccd0ddad0fefbec91db6d1851c7d70f028d119994e445b98c5af5d77f89a0cd6787b1bec25f32a67e08eb35ac141d9e9a3d6455e04db968433090 WHIRLPOOL 8221b0257ee32f5db9746e26b8d34d637c21ac6949fd24e8ecbed5aeebf725e006104bd36a8a08bfb1cb5efdc41be541646616d505a6162251fa824511e64fb2
 MISC ChangeLog 79130 SHA256 eec9a2c9c8eaed424daddcbe78677d8512ebe8072ab5828d6c329cbaf4c74557 SHA512 c0b47a76155c56dcc25863cc8174a379470e1d2620602b34dd452c1b56b9b818af545bed30cabc8e8f4d68f019aa5c87bd10081784bb5c4c9cb6e2adaf1a9f44 WHIRLPOOL fbf0a664cd49d9faa29006768342890ff4906580aedbb4ebfeacba4dd32754badab6c941700f078a8bc020456c985dc255eeb26a9144d7f72a30bdd7b64398a9
 MISC metadata.xml 386 SHA256 58db91727c014c22db0fde315c25cb22c59dc5c15af5d30ee4c01a248500b67c SHA512 f5c6d289f0018d0eeb4ebb2fbbfda7c08aa70a98771f1c0795838137a0e3b848fc9e2b2355cbc7367a72dc00dd5e0a946c0eb5349a86eb3796af43918961733a WHIRLPOOL 92b3371b27092dbaed212837f544b059d5b0b2c547ef8c965836ac1dab1cdee198bb6ab63ab495eccdd1be1c1f5ce9e93624722a9ffd433a7615be202134336a

diff --git a/sys-devel/binutils/binutils-2.23.ebuild b/sys-devel/binutils/binutils-2.23.ebuild
index a191758..a6c8d42 100644
--- a/sys-devel/binutils/binutils-2.23.ebuild
+++ b/sys-devel/binutils/binutils-2.23.ebuild
@@ -17,8 +17,7 @@ src_unpack() {
 	epatch "${FILESDIR}"/${PN}-2.19.50.0.1-mint.patch
 	epatch "${FILESDIR}"/${PN}-2.23-mbstate_t.patch
 	epatch "${FILESDIR}"/${PN}-2.23-ar-ranlib-truncate.patch
-	is_cross || epatch "${FILESDIR}"/${PN}-2.23-no-ld-script-sysroot.patch
-	is_cross || epatch "${FILESDIR}"/${PN}-2.23-no-rpath-sysroot.patch
+	epatch "${FILESDIR}"/${PN}-2.23-runtime-sysroot.patch
 }
 
 src_compile() {
@@ -33,6 +32,8 @@ src_compile() {
 	*-interix*) EXTRA_ECONF="${EXTRA_ECONF} --without-gnu-ld --without-gnu-as" ;;
 	esac
 
+	use rap && EXTRA_ECONF+=" --disable-runtime-sysroot"
+
 	toolchain-binutils_src_compile
 }
 

diff --git a/sys-devel/binutils/files/binutils-2.23-runtime-sysroot.patch b/sys-devel/binutils/files/binutils-2.23-runtime-sysroot.patch
new file mode 100644
index 0000000..436e3df
--- /dev/null
+++ b/sys-devel/binutils/files/binutils-2.23-runtime-sysroot.patch
@@ -0,0 +1,116 @@
+The feature sysroot originally for cross compiling has two parts. The
+first is to prepend lib path, done in configure phase, which we call
+configure-time sysroot. The second is to prepend rpath in libraries
+and path inside ld scripts when ld is called, which we call runtime
+sysroot.
+
+In the case of cross compilation, both are needed. While in the case
+of native sysroot, which runs userland in a directory prefix natively,
+only configure-time sysroot is needed.
+
+Here we add an additional option of --enable-runtime-sysroot to fine
+control such features.
+
+2013-08-25  Benda Xu  <heroxbd@gentoo.org>
+
+	* configure.in: add enable-runtime-sysroot to control the 
+	macro ENABLE_RUNTIME_SYSROOT
+	* emultempl/elf32.em: only prepend rpath with sysroot when
+	ENABLE_RUNTIME_SYSROOT is defined
+	* ldfile.c: only prepend lib path with sysroot when
+	ENABLE_RUNTIME_SYSROOT is defined
+	* ld.texinfo: document this new behavior for ld script
+
+Index: binutils-2.23/ld/configure.in
+===================================================================
+--- binutils-2.23.orig/ld/configure.in
++++ binutils-2.23/ld/configure.in
+@@ -70,6 +70,18 @@ AC_SUBST(use_sysroot)
+ AC_SUBST(TARGET_SYSTEM_ROOT)
+ AC_SUBST(TARGET_SYSTEM_ROOT_DEFINE)
+ 
++AC_ARG_ENABLE(runtime-sysroot,
++[AS_HELP_STRING([--enable-runtime-sysroot],
++		 [prepend sysroot to libpath in ld script and rpath,
++                 only used in addition to --with-sysroot (default is yes)])],
++[case "${enableval}" in
++  no) ;;
++  *) AC_DEFINE(ENABLE_RUNTIME_SYSROOT, [], \
++               [prepend sysroot to libpath in ld script and rpath]) ;;
++esac],
++AC_DEFINE(ENABLE_RUNTIME_SYSROOT, [], \
++          [prepend sysroot to libpath in ld script and rpath]))
++
+ dnl Use --enable-gold to decide if this linker should be the default.
+ dnl "install_as_default" is set to false if gold is the default linker.
+ dnl "installed_linker" is the installed BFD linker name.
+Index: binutils-2.23/ld/emultempl/elf32.em
+===================================================================
+--- binutils-2.23.orig/ld/emultempl/elf32.em
++++ binutils-2.23/ld/emultempl/elf32.em
+@@ -525,7 +525,10 @@ static char *
+ gld${EMULATION_NAME}_add_sysroot (const char *path)
+ {
+   int len, colons, i;
+-  char *ret, *p;
++  char *ret;
++
++#ifdef ENABLE_RUNTIME_SYSROOT
++  char *p;
+ 
+   len = strlen (path);
+   colons = 0;
+@@ -553,6 +556,11 @@ gld${EMULATION_NAME}_add_sysroot (const
+       *p++ = path[i++];
+ 
+   *p = 0;
++#else
++  ret = xmalloc (strlen (path) + 1);
++  strcpy (ret, path);
++#endif
++
+   return ret;
+ }
+ 
+Index: binutils-2.23/ld/ldfile.c
+===================================================================
+--- binutils-2.23.orig/ld/ldfile.c
++++ binutils-2.23/ld/ldfile.c
+@@ -463,7 +463,11 @@ try_open (const char *name, bfd_boolean
+   result = fopen (name, "r");
+ 
+   if (result != NULL)
++#ifdef ENABLE_RUNTIME_SYSROOT
+     *sysrooted = is_sysrooted_pathname (name);
++#else
++    *sysrooted = 0;
++#endif
+ 
+   if (verbose)
+     {
+Index: binutils-2.23/ld/ld.texinfo
+===================================================================
+--- binutils-2.23.orig/ld/ld.texinfo
++++ binutils-2.23/ld/ld.texinfo
+@@ -3026,13 +3026,14 @@ then you can put @samp{INPUT (subr.o)} i
+ In fact, if you like, you can list all of your input files in the linker
+ script, and then invoke the linker with nothing but a @samp{-T} option.
+ 
+-In case a @dfn{sysroot prefix} is configured, and the filename starts
+-with the @samp{/} character, and the script being processed was
+-located inside the @dfn{sysroot prefix}, the filename will be looked
+-for in the @dfn{sysroot prefix}.  Otherwise, the linker will try to
+-open the file in the current directory.  If it is not found, the
+-linker will search through the archive library search path.  See the
+-description of @samp{-L} in @ref{Options,,Command Line Options}.
++In case a @dfn{sysroot prefix} is configured without explict
++--disable-runtime-sysroot, and the filename starts with the @samp{/}
++character, and the script being processed was located inside the
++@dfn{sysroot prefix}, the filename will be looked for in the
++@dfn{sysroot prefix}.  Otherwise, the linker will try to open the file
++in the current directory.  If it is not found, the linker will search
++through the archive library search path.  See the description of
++@samp{-L} in @ref{Options,,Command Line Options}.
+ 
+ If you use @samp{INPUT (-l@var{file})}, @command{ld} will transform the
+ name to @code{lib@var{file}.a}, as with the command line argument

diff --git a/sys-devel/gcc/Manifest b/sys-devel/gcc/Manifest
index f850b69..8377b0c 100644
--- a/sys-devel/gcc/Manifest
+++ b/sys-devel/gcc/Manifest
@@ -74,6 +74,7 @@ AUX gcc-4.1.2-darwin-fpic.patch 619 SHA256 468cd067347194cd00175a08d88960ba5b8b9
 AUX gcc-4.1.2-freebsd.patch 204 SHA256 de33014a03741e46d027f7210f96221b3db45fd4161abf6c54c62342918b22f0 SHA512 1f550dbac6532a46c9eea70f7560d83d4239d96d788a704f6624e275f83c2ad9cbba67c148e01e5d833b6b7fb42e29c7082815b9f4f2c3b5f73122245d956583 WHIRLPOOL 95494bf1c3b0faa4464cec1343e505025b11b172e6db58e3cae30780704db3377965dfedc8bceb1aa20d4b2cfe69aa24b5d1f41c35d76020f23f61463541385d
 AUX gcc-4.2-ia64-hpux-always-pthread.patch 868 SHA256 5a0f38a7df257ccba771b16336682f363e70bbb8c07d72a0b4d3f7f173f413f8 SHA512 d92ec8072309fdece588b4874b4a555d9afcf78302492de0ffb167b46038f9fe1e0d64c65a63cacec9d0672c76984165e517a3e3d3aba1b34894ed58c063a5f3 WHIRLPOOL 2c8f03ba53fbbc9dc5df19a25b883826a4a939d8ccc443d6c83cc8187c871f40471e434b30da297e2426e80d3e68590370a3f4692ed2468137c4e8f4821e3724
 AUX gcc-4.2-pa-hpux-libgcc_s-soname.patch 483 SHA256 6bf38ec9e85b6b4da839e1781ddd06ba689d1b5ad8257e5c8052289343b664c3 SHA512 66b7f1888918d132fd751be5d00f30bb4646b279ac803cb76a00a5388e33fc7b0792689d049c8a3526652ef77dd32a759c2f43f5e1ede42e4cbfc892c717d6f2 WHIRLPOOL 18cf4d80c86b4eb3bc835f00fd27cf55664646a47733666821b6426378507d3c6fc1192f4559c2a62eff501b835b531fb66c3b7e09bdf7752af170b4764b13be
+AUX gcc-4.2-rap.patch 1250 SHA256 1b458c52b2d81a031882547f5784721ea00012ad5377f3557ef176eaa80fd936 SHA512 3ae8db2bd956cb42dc121653506d286f7e098524e5a3b2ca28cacd7622af7c555e1a3fb5fe0a33e02801271a8c9b4bb0a83d86593633f176eb12425b2be198f2 WHIRLPOOL eeb41d50970d1843c9c96c2c31b9f7b6fb33fdecb6f280a35f320b71e582d7f5811db6dcde534de4768f3e4162403276a5d081c9d1c7af930d7ffb9acd490c2f
 AUX gcc-4.2.3-aix-largefiles.patch 9519 SHA256 b9b035ec252a118c1725a69900a73ae4c3f22f08350038504face1b9438446af SHA512 bac988d25176a302b3ab2272f0f89b1d37fdebc49f15a7d01fd985d9a7e5adbaf270cb5dceb02298a3e8e420e54ffa906f8c8cdf65fe255eb9f67b721c3bfae0 WHIRLPOOL 794aa70c42af00fc4ad013b4b7450bf2ccc9200c55067e59a9636b6ec642d65e2dd0d123723d8d94a67492e161e7ca0ef2393638d70d4a5e54434546c0226121
 AUX gcc-4.2.3-mint.patch 786101 SHA256 2420dda14ee894b95f322dee1452fc4fde25cdbe77c4b416b0d77d276f1c67bc SHA512 b12bc5c70c9cd6f9fa15f94132e972405f6693d001f4cbb5c902edba4e8a3de6bc1beb3746984fa5b1c268f5f904f6ffee82ac67ea6201cd7a48afe30257c1ce WHIRLPOOL 4656603088dd4e84fbf76ad764721985f7d2075b68d3576ea22aaf75546ecde5071e93d2f54aabae1ea9096e47770c42977616ebd1bb6a219d74229e3a5ce31c
 AUX gcc-4.2.3-mint2.patch 19829 SHA256 7c7a5147d74cff334b4946cfe5f7a3ecb99f2c9204ccc39c989424b4c161eda5 SHA512 93f1e7249174127c6492918951be87eee6a180f930c6ed14d5846fcf7dda6aff3ebcdf22d85cdb01e5d0f7b0084995bc6f87aee11ac6efe727fa62f0d9a0b5f5 WHIRLPOOL 08cd3ecaa0740afc8dc480c1f1253690f6441588c61c2af0b1af82ca995417cdf7b83d85f487e3dd8be346d39b42bd6a1cc8585e70c19f9ab8ec2cb031437257
@@ -86,7 +87,6 @@ AUX gcc-4.4.1-interix-avoid-bs.patch 1916 SHA256 3c3c7019b3164ed463ddbee41131ff7
 AUX gcc-4.4.1-interix.patch 12986 SHA256 33953e755b4de1e5b5d272b3e35a8d63a68a16457e6fe8b10df9eb65e4ca98d3 SHA512 3194dd9477b3a1cff15b0e5034d8f8e0eb33e6ae861a4b2ead725ca25fc129e347cccc8e8300bdf8c60350e359852696727b12bd04351eaf4cbc3165a66ec5ce WHIRLPOOL 3669bf6cb5cc465ab6acdb7f2c755081b34c95f59a0fdb60ea29d5203d5c55ddb33b0ae9f5788be51214edce214b12cc2f71c5725810642b20abd9524b4200a2
 AUX gcc-4.4.1-linux-x86-on-amd64.patch 1559 SHA256 cf300a35076e42ab530d3c6b4a81fb0ebaf0174bfba5e26cf565d63cef5fd670 SHA512 53c929926837487678d80acfbfe24b37a7aec8af0def837d2c699a1df4c9839d54cc91de4f33c696aa114d52059e245aa9614b86fdfd5fe1c5c1a1715dc1cfdb WHIRLPOOL 4bb0644b6d147b9bb69f94212b414b108f35f1c6d4b8d3dbd41319aca0ccd70ceb9e2ca947f180ab2d1f7ff1408065024199e89e4796bbef226960ee58901d56
 AUX gcc-4.7-rap.patch 1913 SHA256 75842d968d21d9916d41c4e75be12387d818221465fb2335546418c744b2eee1 SHA512 aee8bc93aebd9a217b53cd4c6d6fd79780eb77ef490164d35a056d08d0cc5b550ed7b6e298f963cbe61511caf2b03d47ff5df50a6de95b86c104dfac3ed0f273 WHIRLPOOL 7702b0cefb958f6fb7cef5bb0e1f056412d5f972e3a4653735f33b56245db7d984d7c21a5e47282d6283efadefb76bc850877d151d15bcd3f081aba1360a0d7d
-AUX gcc-4.7.3-no-sysroot-to-ld.patch 344 SHA256 9dac13ca1009c7d088f603d30e87e5c47156b553f7dc1fd175c3d1c0a76e26e4 SHA512 283a50e1e6bd4f28db4d5ece7440cb1e79c26b0b5e2d8cd9084f1082315820c8ddc6a7a22c57b2bdd02db3ed7928e1751f9b6cc354061d02f6511fb722b09569 WHIRLPOOL 86200482591e1b5a035e1f74dfd6f2f4976408bd002adfac9869264ca9341f621d329f79154c8d9b966773bc0dbf6d9fe16cc1f6d0a64eac9bf5c6734e4f81f3
 AUX gcc-4.9-extra-specs.patch 3894 SHA256 942654807a350bdfc1f587766238bea0caabe4d804e48a8705ea5faa56701641 SHA512 32a477d66b85793cdd6c51a1dee29393914b5ecd5db4022387457ff01e871a1efd1ad77be3b05275cdf96e0ae822a7d353ed40ad1476326c60e9bdd9054930cc WHIRLPOOL 47bf1ed50db265235f5f5cae5e45831c1059a2c26fa93d6ce86299c5986da2c38b10b2ca39e59ba8c796716f4e88eadf85f84c5b4a6b5acf25dc56e5a86c182a
 AUX gcc-configure-LANG.patch 2052 SHA256 63de6d2dcfe14f21d147abeb1390405b9220c03f8e968f482d4b4c1cf279c88b SHA512 a694c7ac2f45cc657097ff5b0cf1356ac88a9c06035c9ba15167e9d444844d0d8a478eb1b9b62195dd063774f79697b9148b9cdb6c261640b472c291061b2129 WHIRLPOOL 3cc1ec912fb192ff1058de5b93e49a994ba30d1501a932290dd5b3df1cd783875621cda56edeb41894cd5fa10c04917e693a40a60be8d742ddd7992bf5d8afeb
 AUX gcc-configure-texinfo.patch 337 SHA256 74b73a7ecec2d88889876b4db480cd173632f49d5396bb8e5b3c93673f9b5b98 SHA512 a15fba8bf2ff02bdeca54d6f186bfa08c1079c6a8ba0a3beef154483ce5c1b8c497e7ffeec32371968f0037e0ff8384609eb0c367d0155a4e5a7eef8aad084d5 WHIRLPOOL 39d008aad06f7621e4e5db15f5e85a59e583b43f8d247029bd4944466bb60a9795bda157d185c45c329294078e282703a243aad5c468d90c77665dd6336870d4
@@ -107,19 +107,14 @@ AUX stubs/gcc-3.4-htb-stub.patch 722 SHA256 0768dcafc35be6d35c9aa0106b0c8b87932e
 AUX stubs/gcc-3.4-ssp-stub.patch 1068 SHA256 259b08fc6ba1a5fcc6848c1a0742e9b90dd43985c61fab4ea2e9e79ec795d982 SHA512 d797117e2663c5e0d3dfbc983e5f943a0724fbf7b28359451c12572d7af8cfe7667afe36aa6db1fd831da681be8492100231f0913bae662898d40a42adb8d56f WHIRLPOOL d96c065c8a85adca2915f965975a7a33221c0109354f22b1e3c4cbf00b264bb5b178888476ff56f022453749565e41b02ebe91f092762164dd5c225e208e7b8c
 AUX stubs/gcc-4.0-htb-stub.patch 722 SHA256 e9b63d3644c0c10e871d5bd94ceae55bec0726b76e9a7c43c83daf6c840dfb5c SHA512 a7eaff57c2ec6a6947ef5d938320638dd9206c2e274431251c3be3928caeca941a679e74b6238880db589fe5b00cb6d1da644e6f06d02b331b5646cebaacd330 WHIRLPOOL 9b30fbd1dac7143491d79d3821370c11c4a79dab1f6294ab5a60578605e4d2e86d51730da6d48ee08df0618bb0deddf6d2da36b91a5b632cef14dbd2178c042c
 AUX stubs/gcc-4.0-ssp-stub.patch 1068 SHA256 259b08fc6ba1a5fcc6848c1a0742e9b90dd43985c61fab4ea2e9e79ec795d982 SHA512 d797117e2663c5e0d3dfbc983e5f943a0724fbf7b28359451c12572d7af8cfe7667afe36aa6db1fd831da681be8492100231f0913bae662898d40a42adb8d56f WHIRLPOOL d96c065c8a85adca2915f965975a7a33221c0109354f22b1e3c4cbf00b264bb5b178888476ff56f022453749565e41b02ebe91f092762164dd5c225e208e7b8c
-DIST bounds-checking-gcc-3.3.6-1.00-r2.patch.bz2 829688 SHA256 eacdaecd9c07b6573a6522ac776d8daad7658c4214a7fb0ff950cd47ff811ae6 SHA512 d4533d02289dcd2ee11952f83dc687d82624d6e31ddb548e4f54cde4ef9cced5a1aac5b64086441f8930274e31f20d0ee82850fe1257f96c08b05d406d3b2e26 WHIRLPOOL c9d39cef9408472634a689a61e914ea01e6f67294162d16fcd5b451d1b33aed86f842adca8e4995c863ca1ed7a4e5fc0ce68d99a78f1e765cc3caad06ecbf6e9
-DIST bounds-checking-gcc-3.4.4-1.00.1.patch.bz2 815566 SHA256 6568f904eb26ff4bc90e23792b3346aaf98c0ffe38a1abe853d823b3c2157e96 SHA512 da11cb354d5ec95c74081c2cbb29bcb49817a1f9d6875587b4a27f1c9fdea8f07eec8147b739bd18a4fa2365e5da50e4bca7d7531612fbf2514c50516d225ac2 WHIRLPOOL fedeb8ca85af5bcc924243cafde3a96f0ddf69df13a1e2c68a207c0dda3d598af59b49a92c35e104a16f70af86a0027a7630306d23aaf873f48149a64e86347f
 DIST ecj-4.3.jar 1377431 SHA256 9de193ea393ed50d868b730bad6916f7a8ef4ba80216f8606d3e1a0dd886e74b SHA512 c4be72186d81747f1adce5a50de303c24bd6ed9f401bfa8871b1b864fe7591392218b1937b10d0e76014de8e0b6a1d5c4280475976218141cd1878c4a35217ff WHIRLPOOL 9137d6aa5b0e34a596e8d3de8843b5478cec8cdd4113303d554120ba8c6d467e802414f861ff0d7ef1d85dbcb09d4ccc10668385460d1a476345e2de86798bce
 DIST ecj-4.5.jar 1470676 SHA256 98fd128f1d374d9e42fd9d4836bdd249c6d511ebc6c0df17fbc1b9df96c3d781 SHA512 d4e1bf7538ace56e3d69fa91da5bbd16c272923b4de0a9d8dee23ea2b75f9f38c603de72fc4061df49285c450b63f3df211cee5270e9fffc5447445d1a9c9e4e WHIRLPOOL db54206cfd5eba935e707b8d36ebac40f3c4ed3c1f06ede794288cbdd9c7da9d90c0898e8c98b383af276ea4c1b40c861ebd9e1fc1dce712946184321339d3ad
-DIST gcc-3.3.6-patches-1.8.tar.bz2 51585 SHA256 8510a62f0e8c5e16d9b3d667d94e8c45b877c103dacf57ca625c6c72b668ef4a SHA512 35f8c5b3654618606110dde9f99f846e56d7d0dc5dfbcaf3cbd061589e7571484692133e2298680b39d52d4f054fbf43b919bb9e1e6e3ea280b96f8270e5dc54 WHIRLPOOL e6a8b9528578ddccf01e32f9c4894397d126d4190e5757767083f1a3209c2047676a2b2858299b0b74e7104377b049b70ac1ed5ea6d5abd52e9fc14a23be460a
-DIST gcc-3.3.6-uclibc-patches-1.0.tar.bz2 28882 SHA256 c007f38cb0c57291adf0b367f31e14c84dd1d6f48a388896eb63b6cd4328e418 SHA512 d060c1552d4f21b8b1cd6a6e56b9af4f62f61ce8ef4362afb1982b2ad9defe6a9648705cf780103d4f2061737553b6737c276d79b803b6b75ae94035bc881f0e WHIRLPOOL 524204cc41097f13e0de2ad8e99ff80d449c490d602625d24ddda6b874cf63194d62c22f98469f5ee89c8283df82a25fbc989db32a52f31f2a31928b5a522f2f
-DIST gcc-3.3.6.tar.bz2 23972413 SHA256 1c1aa533c67e9da5e55ed4f5736258dc753466bd716bdae3fb88fb66e6ff1d7f SHA512 576b88e2fa675314a79a85f180684fe5af370c596476a0bf02e33e8ae0e2be838417ea80675ce4194a8213792cf7ada50cae5131149e4b890ab61e0b8d50d0ed WHIRLPOOL 27372f9d12cdedaad38e75c3efea3430d6873d92f85ec0024e2cc5ad986c710ed940edecc926a4c25ce14d14cddc1aec3eb35ac2c29e8c85309685d525a99cf1
-DIST gcc-3.4.5-uclibc-patches-1.1.tar.bz2 70923 SHA256 5b92fac2afe835a127976fdb6602fb5628cf28e67dd19e8289768a3bb8631ec2 SHA512 c0534a374e2e0416d0792373f9d11526226f9ce1a98e771469efa68388b709c72672b8db8fe77901144a96a23e4fd9f9a99f1d278f1e8fffda8a6b01e3b770fa WHIRLPOOL 79a7bb14e220dad7ea818afae12839ff7cc624f128bbf7a29c8005478f6da9742ff08100088baeaf36c038f7ddadc4ec64e78d5283ed19efb4d3625916a3b00a
-DIST gcc-3.4.6-patches-1.7.tar.bz2 59052 SHA256 5e520ee48be297f5e5c4cadafcf883c61938680fa4115670d3b65f751d3f2241 SHA512 025120ab1235ade1c5ddd0df97b8f5872fd4d4adbd830569cf11d02df528701055a183389c5898b3b3a8415f4460deff0db7d2520436ea0b6069ff5eab13e358 WHIRLPOOL 85e5ae834f2ebceb61d4afd35433fe39287b178413a550775473778d830545945f01211d744e1c336ce61cecc2e5ab357b0c7a989f9480e1d52c422fece68c29
-DIST gcc-3.4.6.tar.bz2 28193401 SHA256 7791a601878b765669022b8b3409fba33cc72f9e39340fec8af6d0e6f72dec39 SHA512 d235e1223d5faf8f37f2d73db35edeff44c88974b09dfcf325f4b181b16d7124710d93b1b65b60206ce3525f062236ea0f338b3a5341d7ecbe196d8e90c3ff18 WHIRLPOOL 19fc447592f1feee56da74ee6d9436e0813e5a29ced37f8bf91836bbf0b1b9023fe2f717f8c3cf6dc84f11d2029cd87b65e9176b19727996420b589716cdfa45
 DIST gcc-4.1.2-patches-1.4.tar.bz2 53188 SHA256 50959f19bf5a7d3c131c67b2df0437156039c6b799e49cfeb32de483727c1eb7 SHA512 3d22033b285fb63c7df58ffff4d8054f844a9142bf7e6dfa5d8453705b7a64c2da8c3169a1c3390dc92c072800e60c7d7e95e2d8bb6622e0773562fd5fb268a8 WHIRLPOOL 003246e7560ee87109aacebd1ef5ec1f7bcdd2f2dbc24a2fb9f9c7ca98e502ee8734e44c3bca5f337d3cad31dcefdc5473ff125cf603c596adc191ac6cda666c
 DIST gcc-4.1.2-uclibc-patches-1.0.tar.bz2 20980 SHA256 c6ed88711a727ed11847c9b9f1cef7023037bc80c0840eda5fca6d60fa02e35a SHA512 57789f4236a3085136afa83be3cef677bd813afd258d67bfdbecd2058f497cd459366d5515044c0208ab753946dc951dac6a3889752ca6dae836d837c22ce33b WHIRLPOOL 6a0eee923be11ad415eed56f4acc11480747aff92d97baf083526866d3c7eb63ca1fe51375fa70b9223f863a25e4487ebe9ce9da2acf1bbf6b55c6ad2d1a7010
 DIST gcc-4.1.2.tar.bz2 39707720 SHA256 cfc0efbcc6fcde0d416a32dfb246c9df022515a312683fac412578c4fd09a9bc SHA512 b97d3b72a3b0355611d5090b2c715b7a774f0e466a89326a0226c2809d12dfafb2d7c5a7af54bd5e00c135bbb6596f535e1a484740f7f1f691e8a57e6f0425cc WHIRLPOOL 5822040f7e96919bb906ce55e0bd19c4c85b3a47ce73f0a4b6d0da62ce9d7651b6cbeb6199dafc38582b206a98126e3efec8d54cc58c7f303ca708c9261bec57
+DIST gcc-4.2.4-patches-1.2.tar.bz2 24215 SHA256 0dad9f1345027b620f6345a125804de16c8693a859e0a4fefc2612823a9f65ae SHA512 0099f348972e128e8d7b5d694f0212fd9b5ce29e0845e96fd08c7854bcb40133ea5e3e90a762245fbb04ae9d19e41bf04078123c7b58fb0d09ade05f1e43cfa6 WHIRLPOOL cb6300a7f84e3bcc85ea677977852a5d13d41473a7aff82f9c6dcbc68331bb34ba456642f323d326c7e1b47083f0ba4ebd3f5a63edfb876fb8b03fc6b788f960
+DIST gcc-4.2.4-uclibc-patches-1.0.tar.bz2 19167 SHA256 45fe49c144db3c23f928f0303a80071145361242566671afc96b6dfea5ece221 SHA512 5545cfe6bfa7ab9a69a474cc051cc8744380077dcc193afefeb455e959e408a5e4dfd1adde5357886c7f598835400273ef80ad5c14976c0552b44f5cd48704ed WHIRLPOOL baa4c6bc76deff38d3f85e7b91f53e6f3785e2d315cd835aa8d4a80b580f43c2fa21046df85f17d8c81f95a91c0fa782078963a2849ee1604f3202c9790b9d27
+DIST gcc-4.2.4.tar.bz2 44025458 SHA256 afba845e2d38547a63bd3976e90245c81ea176786f9e6966339c6d3761f1133a SHA512 c6e3e4fce1d27d0c56ab24f4809367d9329b620b7c124e88de190f2ea2ae57b5e06d0bda85c5a74237a4f94ddba53dc91faea0611fff7b19ad720edc312cb0d9 WHIRLPOOL 242177c7adc1538dfbf0b5519132902479c9a8f21158ed04bcf29a3616bbf98d0cf4def13e602ad0226e745875c327d33e8f45eae1b1e6de6d61e2a0ca1b0b90
 DIST gcc-4.3.6-patches-1.1.tar.bz2 75898 SHA256 919b4e78057764fc37b670e731a7d34dde2b8ec646d096fe69a25aa9b8abe7c8 SHA512 fb586f95a01f921e3364d506a19600ee4431280ecd00ea4ffed40ed67503e904773107b7a1ddf3e572d06d9ef358b3567b41f7edb3ea49217aca103342110b8c WHIRLPOOL 1b0bf0410596b20ddc46b81738f94321164e175d4e8ddd0e14a2d8ebbdd2c4ccf450ce030fe79f1ff44da5c7f0b10924dbfc51535e938c1968234b6e57a28693
 DIST gcc-4.3.6-piepatches-v10.1.5.tar.bz2 6713 SHA256 3509c693a5f3c808d148ec0385150ea4e396c500d62dfa9cba77eec38ce26587 SHA512 d28dd42025761a3d26108ca972b80cc1f71d402bdda2f16caf8a15f0e0f7b34f13b18cdace89057bb0e6e73a5cef2181a885b1e20c361092f5f731ff7572d0f8 WHIRLPOOL 1805c02cfc0e987d37c3729614f538e2d7ec887dd0dffeedd876f4d7c18a56bf4ed83765f04f5284aefb7996fc9a709e8b30879ded82cba199eb2382e71a90c1
 DIST gcc-4.3.6-specs-0.9.4.tar.bz2 780 SHA256 c10e74f4fc189f43a455ac83b778287879e0e18533aed9e654fa71d5d57b8aa2 SHA512 3c77078e4e86640ca15f99ea658846829434adeb411f381b06a6a7cc8dc3226ec86b6f7d356f8f877bd8f6f72e466547c4109e8f772d84af3ce0f60805bb8a9d WHIRLPOOL da35f0e2c47def76056683184340c62307525ffb03522779d82e8cb560ffce654f26e07856a42611acf81f38db895b6883f246190b9c708851267cb204979fdf
@@ -155,9 +150,8 @@ DIST gcc-4.7.3-piepatches-v0.5.5.tar.bz2 15378 SHA256 b6f6b6709e7b13f6c05090f3bf
 DIST gcc-4.7.3-uclibc-patches-1.0.tar.bz2 3013 SHA256 731c518f31db8debd08bea92db8e3bf1e9962552909407452dc2ac3c491cf11c SHA512 6119159300e76be87732f2a44b1a9388228235d7832370dbae531c2c96694ea42ed4c75acf7abca98ec0035fbc50a8bf84225574505358c2739e64b0f3fd6a95 WHIRLPOOL 4a874a5684937907720aa5a4a1dbc237aa7d985292befd1c591cf0789c71e0da22ced5b7f7e049731bc2d6496e959cbe3c9010047ceb1b05675e61865004c71a
 DIST gcc-4.7.3.tar.bz2 82904224 SHA256 2f7c37eb4fc14422ff2358a9ef59c974a75ab41204ef0e49fc34ab1d8981a9c3 SHA512 5671a2dd3b6ac0d23f305cb11a796aebd823c1462b873136b412e660966143f4e07439bd8926c1443b78442beb6ae370ef91d819ec615920294875b722b7b0bd WHIRLPOOL cb3408e3e251833f38ae7cf2388a1ddce864614fe1c68de9729a1a9a1f8f028ab92c0f2b863e7fa3ac16dbf443306ac864e74c9cce90690230c081ee2ac309d3
 DIST gdc-0.24-src.tar.bz2 1012099 SHA256 cc6a97c76c9e6db31e76ff97014d24b3d43e21f018a3c6218e3fb2a4500fc79a SHA512 9aec7e4b102e602dfb61cd09ea4b4a96af637ceb3d726235261d09ebd35dbd416abcbfe0e46918e48474bd241fe9bb29abc145a65aa834669295aaee4fca0686 WHIRLPOOL 22322b0c3e2d67b3b37bd7fa92a29c593688f934d4ffd62b9cc87eb63a44a4f8bbc9d75cadf11209c73bdc9942c9b4430036629d0eefcd04de9055c502b85f12
-EBUILD gcc-3.3.6-r1.ebuild 1551 SHA256 93d937ad10fa25af8fedbb9144562587fb8ab6f2f211b8938c821abf3add33cc SHA512 e9cad71be7db400663eff4b3a67350b48d190b9e760632c8fb0c1c8c563a872cc965ecb4f9ca0489968d8bc4d82418efbdaa03b2523258d0a1f38de0e4be4d17 WHIRLPOOL 74fafc5da47e7608d80c0b71bb4c81708c52bb41e80d295d48c2d04ce61d40a9f8b7b184a42a44981655f5964d75911926f92346e29966f2311fb5288857b356
-EBUILD gcc-3.4.6-r2.ebuild 2844 SHA256 29b96db464bb8ab40bf481023ffbf7520233b7bc8b01663e44e11609026bbdae SHA512 28f02d342418e1500007978cfb9b7e3940f700603440a6e9333766495e84dd899a2c273095edc7036a5e0fe1cd57523895c3308a649a7ae53984b4f66f859c0f WHIRLPOOL 0e25ab38dc783edcd2bcfa69a236b0d7797be0fc2bbe1a6d172e217984beca256893defd0858137c321daf1fd8c8c2b1ee7ea2b6d63455b7730a30766c233599
 EBUILD gcc-4.1.2.ebuild 2376 SHA256 cf642ce130a342967c66d5132b1ff96bf03981d9bf2b904bf37efdd6cae03aa4 SHA512 dc546c49d2b0ccb069b1cf5f63060bacc0dc1fd60ec9afd5b93bad290f8751cae0fe80e001e2f081caf14cd6550ab17e51a183b6f080df81755ff848a9a670ee WHIRLPOOL 9d6ce3c964c662163e70dafef01b6281d19b9f636ad2a60a1acf44514077d02e81bb4896abff011caf446870a6f4501511b4963f43fd46ff492ca1157af60c29
+EBUILD gcc-4.2.4-r1.ebuild 1089 SHA256 2e0e08c98ac9ded9710f714df626094b6f1820bfd7f51414a04e1ee3776d09b2 SHA512 975ee100ae6d978e3b9a368fcad93fd5d80a3ed734288e75c26872b6018bd93d9706ed96ed6c7d0ff9e18c44ddda71bfca80ae5b4555ee7a66dc536e9597b6f5 WHIRLPOOL ef4ef321bdd5b8cc795647560b08c5a7664cf95ef2f4c42d44aecef27486f308f250226dd7353e0bc9c6bb3615eb78c8f92e1ba52d9a214faf3c0081d165ef6d
 EBUILD gcc-4.3.6-r1.ebuild 4768 SHA256 9f197aeaa19c7ea89bcc183f0108babfa1fb978b6f5052fac9a44d563d62f99a SHA512 8799eb13ee05edf40d3cbaffa9339538b0807392f8f7e4b9aed6df3bec0c68c0c88f11f2e54fa4bc7f62a6094c8de2dddc7959b59571f78de0f43ad064c749c2 WHIRLPOOL f45ae84433ac97cc40e6dfe191be1b09986d936e88718577a1b46fb76f27fb89881e323475bfd0bc1308b2b49475857cb2effd10b9fdae965f5b397294805fbf
 EBUILD gcc-4.4.6-r1.ebuild 7872 SHA256 ca2bd3610bd15c2514ccf196f4660134f458cb8c7c2acfebbd11fb2259590dd2 SHA512 ba4be6611df9272e39ce5ae27821da0414e230dce89c2f7e2192f6259d04d2e4dad34c772802e88125abc95146836619c7f61125cc40f879dcb6942e5a161ba3 WHIRLPOOL 59395d90bbacb9e39a51571e4525b3f7b530e42a193ded89c48df460c17babcebb18203b42e98f522551e0208db625c64cf4ccbf7f95c2cc907341c25c8efb7c
 EBUILD gcc-4.5.3-r2.ebuild 7043 SHA256 f184391b9ff408aa60268e0ba4bfa936abd55e0043dfdc97ed02bcb4533b212a SHA512 a1a4a0ec1fd1b08550177e8d08ea49179ebc79a41451de55ea3cd81573772df13834ed62ade572301fdffa0f986a929868b463bb7c371588728b8d568c966882 WHIRLPOOL 6a4ca79035453ad081dc9ab7aeee6fcf542907f0296dc2a15cf9fd04cf87b6d415cb011282f81915dcd833efb56ba66c05b9bd785db0cfbfd57a77b046bcb853

diff --git a/sys-devel/gcc/files/gcc-4.2-rap.patch b/sys-devel/gcc/files/gcc-4.2-rap.patch
new file mode 100644
index 0000000..e907d9b
--- /dev/null
+++ b/sys-devel/gcc/files/gcc-4.2-rap.patch
@@ -0,0 +1,28 @@
+Index: gcc-4.2.4/gcc/config/i386/linux64.h
+===================================================================
+--- gcc-4.2.4.orig/gcc/config/i386/linux64.h
++++ gcc-4.2.4/gcc/config/i386/linux64.h
+@@ -48,8 +48,8 @@ along with GCC; see the file COPYING3.
+    When the -shared link option is used a final link is not being
+    done.  */
+ 
+-#define GLIBC_DYNAMIC_LINKER32 "/lib/ld-linux.so.2"
+-#define GLIBC_DYNAMIC_LINKER64 "/lib64/ld-linux-x86-64.so.2"
++#define GLIBC_DYNAMIC_LINKER32 "@GENTOO_PORTAGE_EPREFIX@/lib/ld-linux.so.2"
++#define GLIBC_DYNAMIC_LINKER64 "@GENTOO_PORTAGE_EPREFIX@/lib64/ld-linux-x86-64.so.2"
+ 
+ #undef	LINK_SPEC
+ #define LINK_SPEC "%{!m32:-m elf_x86_64} %{m32:-m elf_i386} \
+Index: gcc-4.2.4/gcc/config/i386/linux.h
+===================================================================
+--- gcc-4.2.4.orig/gcc/config/i386/linux.h
++++ gcc-4.2.4/gcc/config/i386/linux.h
+@@ -100,7 +100,7 @@ along with GCC; see the file COPYING3.
+ 
+ /* These macros may be overridden in k*bsd-gnu.h and i386/k*bsd-gnu.h. */
+ #define LINK_EMULATION "elf_i386"
+-#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
++#define GLIBC_DYNAMIC_LINKER "@GENTOO_PORTAGE_EPREFIX@/lib/ld-linux.so.2"
+ 
+ #undef  SUBTARGET_EXTRA_SPECS
+ #define SUBTARGET_EXTRA_SPECS \

diff --git a/sys-devel/gcc/files/gcc-4.7.3-no-sysroot-to-ld.patch b/sys-devel/gcc/files/gcc-4.7.3-no-sysroot-to-ld.patch
deleted file mode 100644
index 78209c7..0000000
--- a/sys-devel/gcc/files/gcc-4.7.3-no-sysroot-to-ld.patch
+++ /dev/null
@@ -1,13 +0,0 @@
-Index: gcc-4.7.3/gcc/gcc.c
-===================================================================
---- gcc-4.7.3.orig/gcc/gcc.c
-+++ gcc-4.7.3/gcc/gcc.c
-@@ -696,7 +696,7 @@ proper position among the other output f
- #endif
- 
- #ifndef SYSROOT_SPEC
--# define SYSROOT_SPEC "--sysroot=%R"
-+# define SYSROOT_SPEC ""
- #endif
- 
- #ifndef SYSROOT_SUFFIX_SPEC

diff --git a/sys-devel/gcc/gcc-3.3.6-r1.ebuild b/sys-devel/gcc/gcc-3.3.6-r1.ebuild
deleted file mode 100644
index 85d1eca..0000000
--- a/sys-devel/gcc/gcc-3.3.6-r1.ebuild
+++ /dev/null
@@ -1,41 +0,0 @@
-# Copyright 1999-2012 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/sys-devel/gcc/gcc-3.3.6-r1.ebuild,v 1.24 2012/07/23 16:00:30 vapier Exp $
-
-PATCH_VER="1.8"
-UCLIBC_VER="1.0"
-HTB_VER="1.00-r2"
-
-inherit toolchain eutils
-
-DESCRIPTION="The GNU Compiler Collection"
-
-# ia64 - broken static handling; USE=static emerge busybox
-KEYWORDS="~amd64-linux ~x86-linux"
-
-# NOTE: we SHOULD be using at least binutils 2.15.90.0.1 everywhere for proper
-# .eh_frame ld optimisation and symbol visibility support, but it hasnt been
-# well tested in gentoo on any arch other than amd64!!
-RDEPEND=">=sys-devel/binutils-2.14.90.0.6-r1"
-DEPEND="${RDEPEND}
-	amd64? ( >=sys-devel/binutils-2.15.90.0.1.1-r1 )"
-
-src_unpack() {
-	toolchain_src_unpack
-
-	if [[ -n ${UCLIBC_VER} ]] && [[ ${CTARGET} == *-uclibc* ]] ; then
-		mv "${S}"/gcc-3.3.2/libstdc++-v3/config/os/uclibc "${S}"/libstdc++-v3/config/os/ || die
-		mv "${S}"/gcc-3.3.2/libstdc++-v3/config/locale/uclibc "${S}"/libstdc++-v3/config/locale/ || die
-	fi
-
-	# misc patches that havent made it into a patch tarball yet
-	[[ ${CHOST} == ${CTARGET} ]] && epatch "${FILESDIR}"/gcc-spec-env.patch
-
-	# Anything useful and objc will require libffi. Seriously. Lets just force
-	# libffi to install with USE="objc", even though it normally only installs
-	# if you attempt to build gcj.
-	if ! use build && use objc && ! use gcj ; then
-		epatch "${FILESDIR}"/3.3.4/libffi-without-libgcj.patch
-		#epatch "${FILESDIR}"/3.4.3/libffi-nogcj-lib-path-fix.patch
-	fi
-}

diff --git a/sys-devel/gcc/gcc-3.4.6-r2.ebuild b/sys-devel/gcc/gcc-3.4.6-r2.ebuild
deleted file mode 100644
index fb431b8..0000000
--- a/sys-devel/gcc/gcc-3.4.6-r2.ebuild
+++ /dev/null
@@ -1,90 +0,0 @@
-# Copyright 1999-2013 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/sys-devel/gcc/gcc-3.4.6-r2.ebuild,v 1.33 2013/01/08 15:27:34 vapier Exp $
-
-PATCH_VER="1.7"
-UCLIBC_VER="1.1"
-UCLIBC_GCC_VER="3.4.5"
-HTB_VER="1.00.1"
-HTB_GCC_VER="3.4.4"
-D_VER="0.24"
-
-inherit toolchain eutils prefix
-
-DESCRIPTION="The GNU Compiler Collection"
-
-KEYWORDS="~ppc-aix ~amd64-linux ~x86-linux"
-IUSE="ip28 ip32r10k n32 n64"
-
-# we need a proper glibc version for the Scrt1.o provided to the pie-ssp specs
-# NOTE: we SHOULD be using at least binutils 2.15.90.0.1 everywhere for proper
-# .eh_frame ld optimisation and symbol visibility support, but it hasnt been
-# well tested in gentoo on any arch other than amd64!!
-RDEPEND=""
-DEPEND="${RDEPEND}
-	|| ( ppc-aix? ( sys-devel/native-cctools )
-		>=sys-devel/binutils-2.14.90.0.8-r1
-	)
-	amd64? ( >=sys-devel/binutils-2.15.90.0.1.1-r1 )"
-
-src_unpack() {
-	toolchain_src_unpack
-
-	# misc patches that havent made it into a patch tarball yet
-	[[ ${CHOST} == ${CTARGET} ]] && epatch "${FILESDIR}"/gcc-spec-env.patch
-
-	# Anything useful and objc will require libffi. Seriously. Lets just force
-	# libffi to install with USE="objc", even though it normally only installs
-	# if you attempt to build gcj.
-	if ! use build && use objc && ! use gcj ; then
-		epatch "${FILESDIR}"/3.4.3/libffi-without-libgcj.patch
-		#epatch ${FILESDIR}/3.4.3/libffi-nogcj-lib-path-fix.patch
-	fi
-
-	# Fix cross-compiling
-	epatch "${FILESDIR}"/3.4.4/gcc-3.4.4-cross-compile.patch
-
-	# http://gcc.gnu.org/PR20366
-	epatch "${FILESDIR}"/${P}-aix-largefiles.patch
-
-	# Always behave as if -pthread were passed on AIX (#266548)
-	epatch "${FILESDIR}"/3.4.4/aix-force-pthread.patch
-
-	# Always behave as if -Wl,-brtl were passed on AIX (#213277)
-	epatch "${FILESDIR}"/3.4.4/aix-runtimelinking.patch
-
-	# AIX 5.3 TL08 binder dumps core for unknown reason (#265540),
-	# adding -bexpfull seems to help.
-	if [[ ${CTARGET} == *-aix5.3* ]]; then
-		epatch "${FILESDIR}"/3.4.4/aix5300-08_ldcore.patch
-	fi
-
-	# replace nasty multilib dirs like ../lib64 that occur on --disable-multilib
-	if use prefix; then
-		epatch "${FILESDIR}"/3.4.4/prefix-search-dirs.patch
-		eprefixify "${S}"/gcc/gcc.c
-	fi
-
-	[[ ${CTARGET} == *-softfloat-* ]] && epatch "${FILESDIR}"/3.4.4/gcc-3.4.4-softfloat.patch
-
-	# Arch stuff
-	case $(tc-arch) in
-		amd64)
-			if is_multilib ; then
-				sed -i -e '/GLIBCXX_IS_NATIVE=/s:false:true:' libstdc++-v3/configure || die
-			fi
-			;;
-	esac
-}
-
-src_compile() {
-	toolchain_src_compile
-
-	if [[ ${CTARGET} == *-aix* ]]; then
-		# Default to -mminimal-toc on AIX, gdb does not like bigtoc (#266483).
-		einfo "adding -mminimal-toc to specs for AIX"
-		sed -i -e '/^\*cc1_options:$/{n; s,^,-mminimal-toc ,}' \
-			"${WORKDIR}"/build/gcc/specs || die "cannot add -mminimal-toc to aix specs"
-		eend
-	fi
-}

diff --git a/sys-devel/gcc/gcc-4.2.4-r1.ebuild b/sys-devel/gcc/gcc-4.2.4-r1.ebuild
new file mode 100644
index 0000000..f2406e7
--- /dev/null
+++ b/sys-devel/gcc/gcc-4.2.4-r1.ebuild
@@ -0,0 +1,38 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/sys-devel/gcc/gcc-4.2.4-r1.ebuild,v 1.14 2013/04/12 06:47:58 ulm Exp $
+
+PATCH_VER="1.2"
+UCLIBC_VER="1.0"
+
+inherit toolchain
+
+DESCRIPTION="The GNU Compiler Collection"
+
+LICENSE="GPL-3+ LGPL-2.1+ || ( GPL-3+ libgcc libstdc++ ) FDL-1.2+"
+KEYWORDS="~alpha ~amd64 ~arm hppa ~ia64 ~m68k ~ppc ~ppc64 ~sparc ~x86 ~sparc-fbsd ~x86-fbsd"
+
+RDEPEND=""
+DEPEND="${RDEPEND}
+	ppc? ( >=${CATEGORY}/binutils-2.17 )
+	ppc64? ( >=${CATEGORY}/binutils-2.17 )
+	>=${CATEGORY}/binutils-2.15.94"
+
+src_unpack() {
+	toolchain_src_unpack
+
+	use vanilla && return 0
+
+	epatch "${FILESDIR}"/${PN}-4.2-rap.patch
+        local dlf
+        case $(tc-arch) in
+        amd64) dlf=i386/linux64.h ;;
+        arm) dlf=arm/linux-eabi.h ;;
+        x86) dlf=i386/linux.h ;;
+        esac
+        eprefixify gcc/config/${dlf}
+
+	[[ ${CHOST} == ${CTARGET} ]] && epatch "${FILESDIR}"/gcc-spec-env.patch
+
+	[[ ${CTARGET} == *-softfloat-* ]] && epatch "${FILESDIR}"/4.0.2/gcc-4.0.2-softfloat.patch
+}


                 reply	other threads:[~2013-09-30 14:02 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1377986136.c98d2ea822845643bc10a40e349eaf16e7ed9291.heroxbd@gentoo \
    --to=heroxbd@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox