summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin H. Johnson <robbat2@gentoo.org>2015-08-08 13:49:04 -0700
committerRobin H. Johnson <robbat2@gentoo.org>2015-08-08 17:38:18 -0700
commit56bd759df1d0c750a065b8c845e93d5dfa6b549d (patch)
tree3f91093cdb475e565ae857f1c5a7fd339e2d781e /sys-devel/distcc
downloadgentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.tar.gz
gentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.tar.bz2
gentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.zip
proj/gentoo: Initial commit
This commit represents a new era for Gentoo: Storing the gentoo-x86 tree in Git, as converted from CVS. This commit is the start of the NEW history. Any historical data is intended to be grafted onto this point. Creation process: 1. Take final CVS checkout snapshot 2. Remove ALL ChangeLog* files 3. Transform all Manifests to thin 4. Remove empty Manifests 5. Convert all stale $Header$/$Id$ CVS keywords to non-expanded Git $Id$ 5.1. Do not touch files with -kb/-ko keyword flags. Signed-off-by: Robin H. Johnson <robbat2@gentoo.org> X-Thanks: Alec Warner <antarus@gentoo.org> - did the GSoC 2006 migration tests X-Thanks: Robin H. Johnson <robbat2@gentoo.org> - infra guy, herding this project X-Thanks: Nguyen Thai Ngoc Duy <pclouds@gentoo.org> - Former Gentoo developer, wrote Git features for the migration X-Thanks: Brian Harring <ferringb@gentoo.org> - wrote much python to improve cvs2svn X-Thanks: Rich Freeman <rich0@gentoo.org> - validation scripts X-Thanks: Patrick Lauer <patrick@gentoo.org> - Gentoo dev, running new 2014 work in migration X-Thanks: Michał Górny <mgorny@gentoo.org> - scripts, QA, nagging X-Thanks: All of other Gentoo developers - many ideas and lots of paint on the bikeshed
Diffstat (limited to 'sys-devel/distcc')
-rw-r--r--sys-devel/distcc/Manifest2
-rw-r--r--sys-devel/distcc/distcc-3.1-r10.ebuild174
-rw-r--r--sys-devel/distcc/distcc-3.2_rc1-r3.ebuild207
-rw-r--r--sys-devel/distcc/files/2.18-r1/conf45
-rw-r--r--sys-devel/distcc/files/2.18-r1/init39
-rw-r--r--sys-devel/distcc/files/2.18/conf40
-rw-r--r--sys-devel/distcc/files/2.18/init30
-rw-r--r--sys-devel/distcc/files/3.0/conf40
-rw-r--r--sys-devel/distcc/files/3.0/distcc-config123
-rwxr-xr-xsys-devel/distcc/files/3.0/init32
-rw-r--r--sys-devel/distcc/files/3.1/conf35
-rwxr-xr-xsys-devel/distcc/files/3.1/init32
-rw-r--r--sys-devel/distcc/files/distcc-3.0-fix-fortify.patch11
-rw-r--r--sys-devel/distcc/files/distcc-3.0-gentoo.patch33
-rw-r--r--sys-devel/distcc/files/distcc-3.0-svn617.patch13
-rw-r--r--sys-devel/distcc/files/distcc-3.0-uninitialized.patch13
-rw-r--r--sys-devel/distcc/files/distcc-3.0-xinetd.patch15
-rw-r--r--sys-devel/distcc/files/distcc-3.1-argc-fix.patch17
-rw-r--r--sys-devel/distcc/files/distcc-3.1-freedesktop.patch76
-rw-r--r--sys-devel/distcc/files/distcc-3.1-python.patch258
-rw-r--r--sys-devel/distcc/files/distcc-3.2_rc1-freedesktop.patch79
-rw-r--r--sys-devel/distcc/files/distcc-3.2_rc1-gssapi.patch36
-rw-r--r--sys-devel/distcc/files/distcc-3.2_rc1-python.patch246
-rw-r--r--sys-devel/distcc/files/distcc-3.2_rc1-socks5.patch191
-rw-r--r--sys-devel/distcc/files/distcc-as-needed.patch17
-rw-r--r--sys-devel/distcc/files/distcc-avahi-configure.patch29
-rw-r--r--sys-devel/distcc/files/distcc-config165
-rw-r--r--sys-devel/distcc/files/distcc-config-3.2_rc1181
-rw-r--r--sys-devel/distcc/files/distcc-create-dir.patch56
-rw-r--r--sys-devel/distcc/files/distcc-freedesktop.patch84
-rw-r--r--sys-devel/distcc/files/distcc-gentoo-multilib-r1.patch146
-rw-r--r--sys-devel/distcc/files/distcc-gentoo-multilib.patch126
-rw-r--r--sys-devel/distcc/files/distcc-hardened.patch24
-rw-r--r--sys-devel/distcc/files/distcc-march-native.patch16
-rw-r--r--sys-devel/distcc/files/distccd.service10
-rw-r--r--sys-devel/distcc/files/distccd.service.conf6
-rw-r--r--sys-devel/distcc/metadata.xml13
37 files changed, 2660 insertions, 0 deletions
diff --git a/sys-devel/distcc/Manifest b/sys-devel/distcc/Manifest
new file mode 100644
index 000000000000..6e94e6a899ea
--- /dev/null
+++ b/sys-devel/distcc/Manifest
@@ -0,0 +1,2 @@
+DIST distcc-3.1.tar.bz2 588820 SHA256 f55dbafd76bed3ce57e1bbcdab1329227808890d90f4c724fcd2d53f934ddd89 SHA512 0ca7167309badf5d36d2783bab398295b52c43fde0355cf1902032c70b27fc40c21729c98af0ee4c0aeea0c48755e4626308e9385d938b7822de27cdb048e7bd WHIRLPOOL 9152feab2b7def17606259293fe7af7815ec295defa0287b7e5c054f17b0cb73d07f6e721855fd06eec4fc838c44ff509db20fc89c47871f7f1349e08cd126bd
+DIST distcc-3.2rc1.tar.bz2 609904 SHA256 311671e844625d7fdb18dd3d096cd855751cfe8de13827682bcb7beff9133b30 SHA512 98b2e8423d724bbb6a615d946d170441a8e293310785f867d7a277b318c043a37b0af39ae8ed1f7a0667803de9db1d1925199bad85130cf9bd9cb347635125ee WHIRLPOOL d366abb05d10aa5a458acf7b57f5bf52fd4f5ff46c68494e28140eb944524e66d729ebef60190acb1d9b33a0fb8faea6b909509de67294c29dbebcf01d500a36
diff --git a/sys-devel/distcc/distcc-3.1-r10.ebuild b/sys-devel/distcc/distcc-3.1-r10.ebuild
new file mode 100644
index 000000000000..8203e217c7ee
--- /dev/null
+++ b/sys-devel/distcc/distcc-3.1-r10.ebuild
@@ -0,0 +1,174 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+PYTHON_COMPAT=( python2_7 )
+
+inherit eutils fdo-mime flag-o-matic multilib python-single-r1 systemd toolchain-funcs user
+
+DESCRIPTION="Distribute compilation of C code across several machines on a network"
+HOMEPAGE="http://distcc.org/"
+SRC_URI="http://distcc.googlecode.com/files/${P}.tar.bz2"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="alpha amd64 arm arm64 hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~sparc-fbsd ~x86-fbsd"
+IUSE="avahi gtk hardened ipv6 selinux xinetd"
+
+RESTRICT="test"
+
+CDEPEND="${PYTHON_DEPS}
+ dev-libs/popt
+ avahi? ( >=net-dns/avahi-0.6[dbus] )
+ gtk? ( x11-libs/gtk+:2 )"
+DEPEND="${CDEPEND}
+ virtual/pkgconfig"
+RDEPEND="${CDEPEND}
+ !net-misc/pump
+ >=sys-devel/gcc-config-1.4.1
+ selinux? ( sec-policy/selinux-distcc )
+ xinetd? ( sys-apps/xinetd )"
+
+REQUIRED_USE="${PYTHON_REQUIRED_USE}"
+
+DISTCC_LOG=""
+DCCC_PATH="/usr/$(get_libdir)/distcc/bin"
+DISTCC_VERBOSE="0"
+
+pkg_setup() {
+ enewuser distcc 240 -1 -1 daemon
+ python-single-r1_pkg_setup
+}
+
+src_prepare() {
+ epatch "${FILESDIR}/${PN}-3.0-xinetd.patch"
+ # bug #253786
+ epatch "${FILESDIR}/${PN}-3.0-fix-fortify.patch"
+ # bug #255188
+ epatch "${FILESDIR}/${P}-freedesktop.patch"
+ # bug #258364
+ epatch "${FILESDIR}/${P}-python.patch"
+ # bug #351979
+ epatch "${FILESDIR}/${P}-argc-fix.patch"
+ epatch_user
+
+ sed -i -e "/PATH/s:\$distcc_location:${DCCC_PATH}:" pump.in || die
+
+ # Bugs #120001, #167844 and probably more. See patch for description.
+ use hardened && epatch "${FILESDIR}/distcc-hardened.patch"
+}
+
+src_configure() {
+ local myconf="--disable-Werror --with-docdir=/usr/share/doc/${PF}"
+ # More legacy stuff?
+ [ "$(gcc-major-version)" = "2" ] && filter-lfs-flags
+
+ # --disable-rfc2553 b0rked, bug #254176
+ use ipv6 && myconf="${myconf} --enable-rfc2553"
+
+ econf \
+ $(use_with avahi) \
+ $(use_with gtk) \
+ ${myconf}
+}
+
+src_install() {
+ # In rare cases, parallel make install failed
+ MAKEOPTS+=" -j1"
+ default
+
+ dobin "${FILESDIR}/3.0/distcc-config"
+
+ newinitd "${FILESDIR}/${PV}/init" distccd
+ systemd_dounit "${FILESDIR}/distccd.service"
+ systemd_install_serviced "${FILESDIR}/distccd.service.conf"
+
+ cp "${FILESDIR}/3.1/conf" "${T}/distccd" || die
+ if use avahi; then
+ cat >> "${T}/distccd" <<-EOF
+
+ # Enable zeroconf support in distccd
+ DISTCCD_OPTS="\${DISTCCD_OPTS} --zeroconf"
+ EOF
+
+ sed -i '/ExecStart/ s|$| --zeroconf|' "${ED}"/usr/lib/systemd/system/distccd.service || die
+ fi
+ doconfd "${T}/distccd"
+
+ cat > "${T}/02distcc" <<-EOF
+ # This file is managed by distcc-config; use it to change these settings.
+ DISTCC_LOG="${DISTCC_LOG}"
+ DCCC_PATH="${DCCC_PATH}"
+ DISTCC_VERBOSE="${DISTCC_VERBOSE}"
+ EOF
+ doenvd "${T}/02distcc"
+
+ # create the masquerade directory
+ dodir "${DCCC_PATH}"
+ for f in cc c++ gcc g++; do
+ dosym /usr/bin/distcc "${DCCC_PATH}/${f}"
+ if [ "${f}" != "cc" ]; then
+ dosym /usr/bin/distcc "${DCCC_PATH}/${CTARGET:-${CHOST}}-${f}"
+ fi
+ done
+
+ # create the distccd pid directory
+ keepdir /var/run/distccd
+ fowners distcc:daemon /var/run/distccd
+
+ if use gtk; then
+ einfo "Renaming /usr/bin/distccmon-gnome to /usr/bin/distccmon-gui"
+ einfo "This is to have a little sensability in naming schemes between distccmon programs"
+ mv "${ED}/usr/bin/distccmon-gnome" "${ED}/usr/bin/distccmon-gui" || die
+ dosym distccmon-gui /usr/bin/distccmon-gnome
+ fi
+
+ if use xinetd; then
+ insinto /etc/xinetd.d
+ newins "doc/example/xinetd" distcc
+ fi
+
+ rm -rf "${D}/etc/default" || die
+ rm -f "${D}/etc/distcc/clients.allow" || die
+ rm -f "${D}/etc/distcc/commands.allow.sh" || die
+
+ python_fix_shebang "${ED}"
+ python_optimize "${ED}"/$(python_get_sitedir)
+}
+
+pkg_postinst() {
+ use gtk && fdo-mime_desktop_database_update
+
+ if use ipv6; then
+ elog
+ elog "IPv6 is not supported yet by ${P}."
+ fi
+ elog
+ elog "Tips on using distcc with Gentoo can be found at"
+ elog "http://www.gentoo.org/doc/en/distcc.xml"
+ elog
+ elog "How to use pump mode with Gentoo:"
+ elog "# distcc-config --set-hosts \"foo,cpp,lzo bar,cpp,lzo baz,cpp,lzo\""
+ elog "# pump emerge -u world"
+ elog
+ elog "To use the distccmon programs with Gentoo you should use this command:"
+ elog "# DISTCC_DIR=\"${DISTCC_DIR}\" distccmon-text 5"
+
+ if use gtk; then
+ elog "Or:"
+ elog "# DISTCC_DIR=\"${DISTCC_DIR}\" distccmon-gnome"
+ fi
+
+ elog
+ elog "***SECURITY NOTICE***"
+ elog "If you are upgrading distcc please make sure to run etc-update to"
+ elog "update your /etc/conf.d/distccd and /etc/init.d/distccd files with"
+ elog "added security precautions (the --listen and --allow directives)"
+ elog
+}
+
+pkg_postrm() {
+ use gtk && fdo-mime_desktop_database_update
+}
diff --git a/sys-devel/distcc/distcc-3.2_rc1-r3.ebuild b/sys-devel/distcc/distcc-3.2_rc1-r3.ebuild
new file mode 100644
index 000000000000..ed7e734872c2
--- /dev/null
+++ b/sys-devel/distcc/distcc-3.2_rc1-r3.ebuild
@@ -0,0 +1,207 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+PYTHON_COMPAT=( python2_7 )
+
+inherit autotools eutils fdo-mime flag-o-matic multilib python-single-r1 systemd toolchain-funcs user
+
+MY_P="${P/_}"
+DESCRIPTION="Distribute compilation of C code across several machines on a network"
+HOMEPAGE="http://distcc.org/"
+SRC_URI="http://distcc.googlecode.com/files/${MY_P}.tar.bz2"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~sparc-fbsd ~x86-fbsd"
+IUSE="avahi crossdev gnome gssapi gtk hardened ipv6 selinux xinetd"
+
+RESTRICT="test"
+
+CDEPEND="${PYTHON_DEPS}
+ dev-libs/popt
+ avahi? ( >=net-dns/avahi-0.6[dbus] )
+ gnome? (
+ >=gnome-base/libgnome-2
+ >=gnome-base/libgnomeui-2
+ x11-libs/gtk+:2
+ x11-libs/pango
+ )
+ gssapi? ( net-libs/libgssglue )
+ gtk? ( x11-libs/gtk+:2 )"
+DEPEND="${CDEPEND}
+ virtual/pkgconfig"
+RDEPEND="${CDEPEND}
+ !net-misc/pump
+ >=sys-devel/gcc-config-1.4.1
+ selinux? ( sec-policy/selinux-distcc )
+ xinetd? ( sys-apps/xinetd )"
+
+REQUIRED_USE="${PYTHON_REQUIRED_USE}"
+
+S="${WORKDIR}/${MY_P}"
+
+DCCC_PATH="/usr/$(get_libdir)/distcc/bin"
+DISTCC_VERBOSE="0"
+
+pkg_setup() {
+ enewuser distcc 240 -1 -1 daemon
+ python-single-r1_pkg_setup
+}
+
+src_prepare() {
+ epatch "${FILESDIR}/${PN}-3.0-xinetd.patch"
+ # bug #253786
+ epatch "${FILESDIR}/${PN}-3.0-fix-fortify.patch"
+ # bug #255188
+ epatch "${FILESDIR}/${PN}-3.2_rc1-freedesktop.patch"
+ # bug #258364
+ epatch "${FILESDIR}/${PN}-3.2_rc1-python.patch"
+ # for net-libs/libgssglue
+ epatch "${FILESDIR}/${PN}-3.2_rc1-gssapi.patch"
+ # SOCKSv5 support needed for Portage, bug #537616
+ epatch "${FILESDIR}/${PN}-3.2_rc1-socks5.patch"
+ epatch_user
+
+ # Bugs #120001, #167844 and probably more. See patch for description.
+ use hardened && epatch "${FILESDIR}/distcc-hardened.patch"
+
+ sed -i \
+ -e "/PATH/s:\$distcc_location:${EPREFIX}${DCCC_PATH}:" \
+ -e "s:@PYTHON@:${EPYTHON}:" \
+ pump.in || die "sed failed"
+
+ sed \
+ -e "s:@EPREFIX@:${EPREFIX:-/}:" \
+ -e "s:@libdir@:/usr/$(get_libdir):" \
+ "${FILESDIR}/distcc-config-3.2_rc1" > "${T}/distcc-config" || die
+
+ eaclocal -Im4 --output=aclocal.m4
+ eautoconf
+}
+
+src_configure() {
+ local myconf="--disable-Werror --with-docdir=/usr/share/doc/${PF}"
+ # More legacy stuff?
+ [ "$(gcc-major-version)" = "2" ] && filter-lfs-flags
+
+ # --disable-rfc2553 b0rked, bug #254176
+ use ipv6 && myconf="${myconf} --enable-rfc2553"
+
+ econf \
+ $(use_with avahi) \
+ $(use_with gtk) \
+ $(use_with gnome) \
+ $(use_with gssapi auth) \
+ ${myconf}
+}
+
+src_install() {
+ default
+ python_optimize
+
+ dobin "${FILESDIR}/3.0/distcc-config"
+
+ newinitd "${FILESDIR}/3.1/init" distccd
+ systemd_dounit "${FILESDIR}/distccd.service"
+ systemd_install_serviced "${FILESDIR}/distccd.service.conf"
+
+ cp "${FILESDIR}/3.0/conf" "${T}/distccd" || die
+ if use avahi; then
+ cat >> "${T}/distccd" <<-EOF
+
+ # Enable zeroconf support in distccd
+ DISTCCD_OPTS="\${DISTCCD_OPTS} --zeroconf"
+ EOF
+
+ sed -i '/ExecStart/ s|$| --zeroconf|' "${ED}"/usr/lib/systemd/system/distccd.service || die
+ fi
+ doconfd "${T}/distccd" || die
+
+ cat > "${T}/02distcc" <<-EOF
+ # This file is managed by distcc-config; use it to change these settings.
+ # DISTCC_LOG and DISTCC_DIR should not be set.
+ DISTCC_VERBOSE="${DISTCC_VERBOSE:-0}"
+ DISTCC_FALLBACK="${DISTCC_FALLBACK:-1}"
+ DISTCC_SAVE_TEMPS="${DISTCC_SAVE_TEMPS:-0}"
+ DISTCC_TCP_CORK="${DISTCC_TCP_CORK}"
+ DISTCC_SSH="${DISTCC_SSH}"
+ UNCACHED_ERR_FD="${UNCACHED_ERR_FD}"
+ DISTCC_ENABLE_DISCREPANCY_EMAIL="${DISTCC_ENABLE_DISCREPANCY_EMAIL}"
+ DCC_EMAILLOG_WHOM_TO_BLAME="${DCC_EMAILLOG_WHOM_TO_BLAME}"
+ EOF
+ doenvd "${T}/02distcc" || die
+
+ keepdir "${DCCC_PATH}" || die
+
+ dobin "${T}/distcc-config" || die
+
+ # create the distccd pid directory
+ keepdir /var/run/distccd || die
+ fowners distcc:daemon /var/run/distccd || die
+
+ if use gnome || use gtk; then
+ einfo "Renaming /usr/bin/distccmon-gnome to /usr/bin/distccmon-gui"
+ einfo "This is to have a little sensability in naming schemes between distccmon programs"
+ mv "${ED}/usr/bin/distccmon-gnome" "${ED}/usr/bin/distccmon-gui" || die
+ dosym distccmon-gui /usr/bin/distccmon-gnome || die
+ fi
+
+ if use xinetd; then
+ insinto /etc/xinetd.d || die
+ newins "doc/example/xinetd" distcc || die
+ fi
+
+ rm -r "${ED}/etc/default" || die
+ rm "${ED}/etc/distcc/clients.allow" || die
+ rm "${ED}/etc/distcc/commands.allow.sh" || die
+}
+
+pkg_postinst() {
+ if [ -x "${EPREFIX}/usr/bin/distcc-config" ] ; then
+ if use crossdev; then
+ "${EPREFIX}/usr/bin/distcc-config" --update-masquerade-with-crossdev
+ else
+ "${EPREFIX}/usr/bin/distcc-config" --update-masquerade
+ fi
+ fi
+
+ use gnome && fdo-mime_desktop_database_update
+
+ elog
+ elog "Tips on using distcc with Gentoo can be found at"
+ elog "http://www.gentoo.org/doc/en/distcc.xml"
+ elog
+ elog "How to use pump mode with Gentoo:"
+ elog "# distcc-config --set-hosts \"foo,cpp,lzo bar,cpp,lzo baz,cpp,lzo\""
+ elog "# echo 'FEATURES=\"\${FEATURES} distcc distcc-pump\"' >> /etc/make.conf"
+ elog "# emerge -u world"
+ elog
+ elog "To use the distccmon programs with Gentoo you should use this command:"
+ elog "# DISTCC_DIR=\"${DISTCC_DIR:-${BUILD_PREFIX}/.distcc}\" distccmon-text 5"
+
+ if use gnome || use gtk; then
+ elog "Or:"
+ elog "# DISTCC_DIR=\"${DISTCC_DIR:-${BUILD_PREFIX}/.distcc}\" distccmon-gnome"
+ fi
+
+ elog
+ elog "***SECURITY NOTICE***"
+ elog "If you are upgrading distcc please make sure to run etc-update to"
+ elog "update your /etc/conf.d/distccd and /etc/init.d/distccd files with"
+ elog "added security precautions (the --listen and --allow directives)"
+ elog
+}
+
+pkg_postrm() {
+ # delete the masquerade directory
+ if [ ! -f "${EPREFIX}/usr/bin/distcc" ] ; then
+ einfo "Remove masquerade symbolic links."
+ rm "${EPREFIX}${DCCC_PATH}/"*{cc,c++,gcc,g++}
+ rmdir "${EPREFIX}${DCCC_PATH}"
+ fi
+
+ use gnome && fdo-mime_desktop_database_update
+}
diff --git a/sys-devel/distcc/files/2.18-r1/conf b/sys-devel/distcc/files/2.18-r1/conf
new file mode 100644
index 000000000000..783236aa410f
--- /dev/null
+++ b/sys-devel/distcc/files/2.18-r1/conf
@@ -0,0 +1,45 @@
+# /etc/conf.d/distccd: config file for /etc/init.d/distccd
+
+DISTCCD_OPTS=""
+
+# this is the distccd executable
+DISTCCD_EXEC="/usr/bin/distccd"
+
+# this is where distccd will store its pid file
+DISTCCD_PIDFILE="/var/run/distccd/distccd.pid"
+
+# set this option to run distccd with extra parameters
+# Default port is 3632. For most people the default is okay.
+DISTCCD_OPTS="${DISTCCD_OPTS} --port 3632"
+
+# Logging
+# You can change some logging options here:
+# --log-file FILE
+# --log-level LEVEL [critical,error,warning, notice, info, debug]
+#
+# Leaving --log-file blank will log to syslog
+# example: --log-file /dev/null --log-level warning
+# example: --log-level critical
+
+DISTCCD_OPTS="${DISTCCD_OPTS} --log-level critical"
+
+# SECURITY NOTICE:
+# It is HIGHLY recomended that you use the --listen option
+# for increased security. You can specify an IP to permit connections
+# from or a CIDR mask
+# --listen accepts only a single IP
+# --allow is now mandatory as of distcc-2.18.
+# example: --allow 192.168.0.0/24
+# example: --allow 192.168.0.5 --allow 192.168.0.150
+# example: --listen 192.168.0.2
+DISTCCD_OPTS="${DISTCCD_OPTS} --allow 192.168.0.0/24"
+#DISTCCD_OPTS="${DISTCCD_OPTS} --listen 192.168.0.2"
+
+# set this for niceness
+# Default is 15
+DISTCCD_NICE="15"
+
+#ifdef AVAHI
+# Enable zeroconf support in distccd
+DISTCCD_AVAHI="yes"
+#endif
diff --git a/sys-devel/distcc/files/2.18-r1/init b/sys-devel/distcc/files/2.18-r1/init
new file mode 100644
index 000000000000..7676e9827891
--- /dev/null
+++ b/sys-devel/distcc/files/2.18-r1/init
@@ -0,0 +1,39 @@
+#!/sbin/runscript
+# $Id$
+
+depend() {
+ local avahi
+#ifdef AVAHI
+ [ ${DISTCCD_AVAHI} = yes ] && avahi="avahi-daemon"
+#endif
+ need net ${avahi}
+ use ypbind
+}
+
+start() {
+ [ -e "${DISTCCD_PIDFILE}" ] && rm -f ${DISTCCD_PIDFILE} &>/dev/null
+
+ local args
+#ifdef AVAHI
+ [ ${DISTCCD_AVAHI} = yes ] && args="--zeroconf"
+#endif
+
+ ebegin "Starting distccd"
+ chown distcc `dirname ${DISTCCD_PIDFILE}` &>/dev/null
+ TMPDIR="${TMPDIR}" \
+ PATH="$(gcc-config --get-bin-path):${PATH}" \
+ /sbin/start-stop-daemon --start --quiet --startas ${DISTCCD_EXEC} \
+ --pidfile ${DISTCCD_PIDFILE} -- \
+ --pid-file ${DISTCCD_PIDFILE} -N ${DISTCCD_NICE} --user distcc \
+ ${args} ${DISTCCD_OPTS}
+
+ eend $?
+}
+
+stop() {
+ ebegin "Stopping distccd"
+ start-stop-daemon --stop --quiet --pidfile "${DISTCCD_PIDFILE}"
+ rm -f "${DISTCCD_PIDFILE}"
+ eend $?
+}
+
diff --git a/sys-devel/distcc/files/2.18/conf b/sys-devel/distcc/files/2.18/conf
new file mode 100644
index 000000000000..3f6c3f07fa76
--- /dev/null
+++ b/sys-devel/distcc/files/2.18/conf
@@ -0,0 +1,40 @@
+# /etc/conf.d/distccd: config file for /etc/init.d/distccd
+
+DISTCCD_OPTS=""
+
+# this is the distccd executable
+DISTCCD_EXEC="/usr/bin/distccd"
+
+# this is where distccd will store its pid file
+DISTCCD_PIDFILE="/var/run/distccd/distccd.pid"
+
+# set this option to run distccd with extra parameters
+# Default port is 3632. For most people the default is okay.
+DISTCCD_OPTS="${DISTCCD_OPTS} --port 3632"
+
+# Logging
+# You can change some logging options here:
+# --log-file FILE
+# --log-level LEVEL [critical,error,warning, notice, info, debug]
+#
+# Leaving --log-file blank will log to syslog
+# example: --log-file /dev/null --log-level warning
+# example: --log-level critical
+
+DISTCCD_OPTS="${DISTCCD_OPTS} --log-level critical"
+
+# SECURITY NOTICE:
+# It is HIGHLY recomended that you use the --listen option
+# for increased security. You can specify an IP to permit connections
+# from or a CIDR mask
+# --listen accepts only a single IP
+# --allow is now mandatory as of distcc-2.18.
+# example: --allow 192.168.0.0/24
+# example: --allow 192.168.0.5 --allow 192.168.0.150
+# example: --listen 192.168.0.2
+DISTCCD_OPTS="${DISTCCD_OPTS} --allow 192.168.0.0/24"
+#DISTCCD_OPTS="${DISTCCD_OPTS} --listen 192.168.0.2"
+
+# set this for niceness
+# Default is 15
+DISTCCD_NICE="15"
diff --git a/sys-devel/distcc/files/2.18/init b/sys-devel/distcc/files/2.18/init
new file mode 100644
index 000000000000..f9bf8ed4b86f
--- /dev/null
+++ b/sys-devel/distcc/files/2.18/init
@@ -0,0 +1,30 @@
+#!/sbin/runscript
+# $Id$
+
+depend() {
+ need net
+ use ypbind
+}
+
+start() {
+ [ -e "${DISTCCD_PIDFILE}" ] && rm -f ${DISTCCD_PIDFILE} &>/dev/null
+
+ ebegin "Starting distccd"
+ chown distcc `dirname ${DISTCCD_PIDFILE}` &>/dev/null
+ TMPDIR="${TMPDIR}" \
+ PATH="$(gcc-config --get-bin-path):${PATH}" \
+ /sbin/start-stop-daemon --start --quiet --startas ${DISTCCD_EXEC} \
+ --pidfile ${DISTCCD_PIDFILE} -- \
+ --pid-file ${DISTCCD_PIDFILE} -N ${DISTCCD_NICE} --user distcc \
+ ${DISTCCD_OPTS}
+
+ eend $?
+}
+
+stop() {
+ ebegin "Stopping distccd"
+ start-stop-daemon --stop --quiet --pidfile "${DISTCCD_PIDFILE}"
+ rm -f "${DISTCCD_PIDFILE}"
+ eend $?
+}
+
diff --git a/sys-devel/distcc/files/3.0/conf b/sys-devel/distcc/files/3.0/conf
new file mode 100644
index 000000000000..eb784c3ac88b
--- /dev/null
+++ b/sys-devel/distcc/files/3.0/conf
@@ -0,0 +1,40 @@
+# /etc/conf.d/distccd: config file for /etc/init.d/distccd
+
+DISTCCD_OPTS=""
+
+# this is the distccd executable
+DISTCCD_EXEC="/usr/bin/distccd"
+
+# this is where distccd will store its pid file
+DISTCCD_PIDFILE="/var/run/distccd/distccd.pid"
+
+# set this option to run distccd with extra parameters
+# Default port is 3632. For most people the default is okay.
+DISTCCD_OPTS="${DISTCCD_OPTS} --port 3632"
+
+# Logging
+# You can change some logging options here:
+# --log-file FILE
+# --log-level LEVEL [critical,error,warning, notice, info, debug]
+#
+# Leaving --log-file blank will log to syslog
+# example: --log-file /dev/null --log-level warning
+# example: --log-level critical
+
+DISTCCD_OPTS="${DISTCCD_OPTS} --log-level critical"
+
+# SECURITY NOTICE:
+# It is HIGHLY recomended that you use the --listen option
+# for increased security. You can specify an IP to permit connections
+# from or a CIDR mask
+# --listen accepts only a single IP
+# --allow is now mandatory as of distcc-2.18.
+# example: --allow 192.168.0.0/24
+# example: --allow 192.168.0.5 --allow 192.168.0.150
+# example: --listen 192.168.0.2
+DISTCCD_OPTS="${DISTCCD_OPTS} --allow 192.168.0.0/24"
+#DISTCCD_OPTS="${DISTCCD_OPTS} --listen 192.168.0.2"
+
+# set this for niceness
+# Default is 15
+DISTCCD_OPTS="${DISTCCD_OPTS} -N 15"
diff --git a/sys-devel/distcc/files/3.0/distcc-config b/sys-devel/distcc/files/3.0/distcc-config
new file mode 100644
index 000000000000..9aec95503633
--- /dev/null
+++ b/sys-devel/distcc/files/3.0/distcc-config
@@ -0,0 +1,123 @@
+#!/usr/bin/env python
+# Copyright 1999-2004 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+import os, re, signal, sys
+from string import rstrip
+from subprocess import Popen
+
+options=[
+ '--get-hosts',
+ '--set-hosts',
+ '--get-verbose',
+ '--set-verbose',
+ '--get-log',
+ '--set-log',
+ '--help',
+ '--get-env',
+ '--set-env'
+]
+
+tmpcmdline=sys.argv[1:]
+cmdline=[]
+envfile = '/etc/env.d/02distcc'
+
+def exithandler(foo,bar):
+ os.kill(0,signal.SIGKILL)
+ sys.exit(1)
+
+signal.signal(signal.SIGINT,exithandler)
+
+def isroot(ret=0):
+ if os.getuid() != 0:
+ if ret == 0:
+ print '!!!',sys.argv[:1][0],tmpcmdline[0],'must be run as root'
+ sys.exit(1)
+ else:
+ retval = 0
+ else:
+ retval = 1
+ return retval
+
+def writeenv(var,value):
+ isroot()
+ distcc_env = []
+ distcc_env = open(envfile, 'r').readlines()
+ distcc_env_new = open(envfile, 'w')
+ for i in range(len(distcc_env)):
+ if re.compile(var+'="(.*)"').match(distcc_env[i]):
+ distcc_env[i] = var+'="'+value+'"\n'
+ distcc_env_new.write(distcc_env[i])
+ #print 'Set',var,'to:',value
+ Popen('/usr/sbin/env-update', shell=True)
+ print 'If you want to use these new settings in an existing shell,'
+ print 'you need to "source /etc/profile" to get the changes.'
+
+def readenv(var):
+ distcc_env = open(envfile, 'r').read()
+ match = re.compile(var+'="(.*)"').search(distcc_env)
+ if match:
+ print var+'='+match.group(1)
+ else:
+ print var,'not set.'
+
+def createdistccdir(dir):
+ if not os.path.exists(dir):
+ os.mkdir(dir)
+ os.chmod(dir, 0755)
+
+for x in tmpcmdline:
+ if not x:
+ continue
+ if x[0:2]=="--":
+ if not x in options:
+ print "!!! Error:",x,"is an invalid option."
+ sys.exit(1)
+ else:
+ cmdline = x
+
+if '--get-hosts' in tmpcmdline:
+ HOSTS_ENV = os.environ.get('DISTCC_HOSTS')
+ HOSTS_HOME = os.environ.get('HOME')+'/hosts'
+ if HOSTS_ENV:
+ print HOSTS_ENV
+ elif os.path.isfile(HOSTS_HOME) and os.path.getsize(HOSTS_HOME) != 0:
+ print rstrip(open(HOSTS_HOME, 'r').read())
+ elif os.path.exists('/etc/distcc/hosts'):
+ print rstrip(open('/etc/distcc/hosts', 'r').read())
+ else:
+ print 'No configuration file found. Setup your hosts with --set-hosts.'
+elif '--set-hosts' in tmpcmdline:
+ if isroot(1):
+ PATH = '/etc/distcc'
+ else:
+ PATH = os.environ.get('HOME')
+ createdistccdir(PATH)
+ open(PATH+'/hosts', 'w').write(cmdline + '\n')
+elif '--get-verbose' in tmpcmdline:
+ readenv('DISTCC_VERBOSE')
+elif '--set-verbose' in tmpcmdline:
+ writeenv('DISTCC_VERBOSE',tmpcmdline[1])
+elif '--get-log' in tmpcmdline:
+ readenv('DISTCC_LOG')
+elif '--set-log' in tmpcmdline:
+ writeenv('DISTCC_LOG',tmpcmdline[1])
+elif '--get-env' in tmpcmdline:
+ if len(tmpcmdline) == 1:
+ print rstrip(open(envfile, 'r').read())
+ elif len(tmpcmdline) == 2:
+ readenv(tmpcmdline[1])
+ else:
+ print '!!! Error: Specify only one variable.'
+elif '--set-env' in tmpcmdline:
+ if len(tmpcmdline) > 2 and len(tmpcmdline) <= 3:
+ isroot()
+ writeenv(tmpcmdline[1],tmpcmdline[2])
+ else:
+ print '!!! Error: Awaiting two parameters.'
+else:
+ print 'Usage: %s --set-hosts DISTCC_HOSTS | --get-hosts' % sys.argv[0]
+ print ' %s --set-verbose { 0 | 1 } | --get-verbose' % sys.argv[0]
+ print ' %s --set-log FILE | --get-log' % sys.argv[0]
+ print ' %s --set-env VARIABLE VALUE | --get-env [VARIABLE]' % sys.argv[0]
diff --git a/sys-devel/distcc/files/3.0/init b/sys-devel/distcc/files/3.0/init
new file mode 100755
index 000000000000..2740f2b5636a
--- /dev/null
+++ b/sys-devel/distcc/files/3.0/init
@@ -0,0 +1,32 @@
+#!/sbin/runscript
+# Copyright 1999-2008 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+depend() {
+ need net
+ use avahi-daemon ypbind
+}
+
+start() {
+ ebegin "Starting distccd"
+
+ if [ ! -e /var/run/distccd ] ; then
+ mkdir -p /var/run/distccd
+ chown distcc:daemon /var/run/distccd
+ fi
+
+ # Load GCC_SPECS from profile.env bug #164818
+ GCC_SPECS="$(. /etc/profile.env; echo "${GCC_SPECS}")" \
+ PATH="$(gcc-config --get-bin-path):${PATH}" \
+ start-stop-daemon --start --quiet --exec "${DISTCCD_EXEC}" -- \
+ --daemon --pid-file "${DISTCCD_PIDFILE}" --user distcc \
+ ${DISTCCD_OPTS}
+ eend $?
+}
+
+stop() {
+ ebegin "Stopping distccd"
+ start-stop-daemon --stop --quiet --pidfile "${DISTCCD_PIDFILE}"
+ eend $?
+}
diff --git a/sys-devel/distcc/files/3.1/conf b/sys-devel/distcc/files/3.1/conf
new file mode 100644
index 000000000000..4b1faf145b75
--- /dev/null
+++ b/sys-devel/distcc/files/3.1/conf
@@ -0,0 +1,35 @@
+# /etc/conf.d/distccd: config file for /etc/init.d/distccd
+
+# this is the distccd executable
+DISTCCD_EXEC="/usr/bin/distccd"
+
+# this is where distccd will store its pid file
+DISTCCD_PIDFILE="/var/run/distccd/distccd.pid"
+
+# Ports:
+# Default port is 3632. For most people the default is okay.
+#
+# Logging:
+# You can change some logging options here:
+# --log-file FILE
+# --log-level LEVEL [critical,error,warning, notice, info, debug]
+#
+# Leaving --log-file blank will log to syslog
+# example: --log-file /dev/null --log-level warning
+# example: --log-level critical
+#
+# Nice level:
+# The default nice level is 15. You can change it by adding: -N xx
+# where xx is the nice level.
+
+# SECURITY NOTICE:
+# It is HIGHLY recomended that you use the --listen option
+# for increased security. You can specify an IP to permit connections
+# from or a CIDR mask
+# --listen accepts only a single IP
+# --allow is now mandatory as of distcc-2.18.
+# example: --allow 192.168.0.0/24
+# example: --allow 192.168.0.5 --allow 192.168.0.150
+# example: --listen 192.168.0.2
+
+DISTCCD_OPTS="--port 3632 --log-level notice --log-file /var/log/distccd.log -N 15"
diff --git a/sys-devel/distcc/files/3.1/init b/sys-devel/distcc/files/3.1/init
new file mode 100755
index 000000000000..f7009f6e3101
--- /dev/null
+++ b/sys-devel/distcc/files/3.1/init
@@ -0,0 +1,32 @@
+#!/sbin/runscript
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+depend() {
+ need net
+ use avahi-daemon ypbind
+}
+
+start() {
+ ebegin "Starting distccd"
+
+ if [ ! -e /var/run/distccd ] ; then
+ mkdir -p /var/run/distccd
+ chown distcc:daemon /var/run/distccd
+ fi
+
+ # Load PATH and GCC_SPECS from gcc-config, bug #262773
+ eval "$(gcc-config -E)"
+
+ start-stop-daemon --start --quiet --exec "${DISTCCD_EXEC}" --user distcc -- \
+ --daemon --pid-file "${DISTCCD_PIDFILE}" \
+ ${DISTCCD_OPTS}
+ eend $?
+}
+
+stop() {
+ ebegin "Stopping distccd"
+ start-stop-daemon --stop --quiet --pidfile "${DISTCCD_PIDFILE}"
+ eend $?
+}
diff --git a/sys-devel/distcc/files/distcc-3.0-fix-fortify.patch b/sys-devel/distcc/files/distcc-3.0-fix-fortify.patch
new file mode 100644
index 000000000000..8edc330e324b
--- /dev/null
+++ b/sys-devel/distcc/files/distcc-3.0-fix-fortify.patch
@@ -0,0 +1,11 @@
+diff -ru a/src/snprintf.h b/src/snprintf.h
+--- a/src/snprintf.h 2008-08-06 15:52:06.000000000 -0500
++++ b/src/snprintf.h 2009-01-04 15:19:22.000000000 -0600
+@@ -7,6 +7,7 @@
+ */
+
+ #include <stdarg.h>
++#include "config.h"
+
+ #ifdef __GNUC__
+ /** Use gcc attribute to check printf fns. a1 is the 1-based index of
diff --git a/sys-devel/distcc/files/distcc-3.0-gentoo.patch b/sys-devel/distcc/files/distcc-3.0-gentoo.patch
new file mode 100644
index 000000000000..e2464dfa5abc
--- /dev/null
+++ b/sys-devel/distcc/files/distcc-3.0-gentoo.patch
@@ -0,0 +1,33 @@
+diff -Naur distcc-3.0.orig/include_server/c_extensions/distcc_pump_c_extensions_module.c distcc-3.0/include_server/c_extensions/distcc_pump_c_extensions_module.c
+--- distcc-3.0.orig/include_server/c_extensions/distcc_pump_c_extensions_module.c 2008-08-07 05:52:20.000000000 +0900
++++ distcc-3.0/include_server/c_extensions/distcc_pump_c_extensions_module.c 2008-10-14 22:34:38.000000000 +0900
+@@ -23,17 +23,18 @@
+
+ #include "Python.h"
+
+-static char *version = ".01";
++static const char *version = ".01";
+
+ /* To suppress compiler warnings */
+ #define UNUSED(v) ((void)&v)
+
+-char *rs_program_name = "distcc_include_server";
++const char *rs_program_name = "distcc_include_server";
+
+ #include "distcc.h"
+ #include "rpc.h"
+
+ static PyObject *distcc_pump_c_extensionsError;
++void initdistcc_pump_c_extensions(void);
+
+
+ /***********************************************************************
+@@ -385,7 +386,7 @@
+ PyObject *module;
+ PyObject *py_str;
+ distcc_pump_c_extensionsError = PyErr_NewException(
+- "distcc_pump_c_extensions.Error", NULL, NULL);
++ (char *)"distcc_pump_c_extensions.Error", NULL, NULL);
+
+ module = Py_InitModule4("distcc_pump_c_extensions",
+ methods,
diff --git a/sys-devel/distcc/files/distcc-3.0-svn617.patch b/sys-devel/distcc/files/distcc-3.0-svn617.patch
new file mode 100644
index 000000000000..54f55dcea15a
--- /dev/null
+++ b/sys-devel/distcc/files/distcc-3.0-svn617.patch
@@ -0,0 +1,13 @@
+Index: src/arg.c
+===================================================================
+--- src/arg.c (revision 616)
++++ src/arg.c (revision 617)
+@@ -453,7 +453,7 @@
+ dest_argv[i] = strdup(opt);
+ if (!dest_argv[i]) return EXIT_OUT_OF_MEMORY;
+ i++;
+- if (strcmp(opt, "-MD") == 0 || strcmp(opt, "-MMD")) {
++ if (strcmp(opt, "-MD") == 0 || strcmp(opt, "-MMD") == 0) {
+ char *filename;
+ if (!comma) {
+ rs_log_warning("'-Wp,-MD' or '-Wp,-MMD' option is missing "
diff --git a/sys-devel/distcc/files/distcc-3.0-uninitialized.patch b/sys-devel/distcc/files/distcc-3.0-uninitialized.patch
new file mode 100644
index 000000000000..28b226b7966c
--- /dev/null
+++ b/sys-devel/distcc/files/distcc-3.0-uninitialized.patch
@@ -0,0 +1,13 @@
+Index: src/where.c
+===================================================================
+--- src/where.c (revision 622)
++++ src/where.c (working copy)
+@@ -190,7 +190,7 @@
+ int dcc_lock_local_cpp(int *cpu_lock_fd)
+ {
+ int ret;
+- struct dcc_hostdef *chosen;
++ struct dcc_hostdef *chosen = NULL;
+ ret = dcc_lock_one(dcc_hostdef_local_cpp, &chosen, cpu_lock_fd);
+ dcc_note_state(DCC_PHASE_CPP, NULL, chosen->hostname);
+ return ret;
diff --git a/sys-devel/distcc/files/distcc-3.0-xinetd.patch b/sys-devel/distcc/files/distcc-3.0-xinetd.patch
new file mode 100644
index 000000000000..47877ad45b42
--- /dev/null
+++ b/sys-devel/distcc/files/distcc-3.0-xinetd.patch
@@ -0,0 +1,15 @@
+diff -Naur distcc-3.0.orig/doc/example/xinetd distcc-3.0/doc/example/xinetd
+--- distcc-3.0.orig/doc/example/xinetd 2008-08-07 05:52:13.000000000 +0900
++++ distcc-3.0/doc/example/xinetd 2008-10-27 15:32:14.000000000 +0900
+@@ -19,10 +19,6 @@
+ socket_type = stream
+ wait = no
+ user = distcc
+- server = /usr/local/bin/distccd
++ server = /usr/bin/distccd
+ server_args = --inetd
+-
+- # This makes xinetd cope if there is no service listed in
+- # /etc/services
+- type = UNLISTED
+ }
diff --git a/sys-devel/distcc/files/distcc-3.1-argc-fix.patch b/sys-devel/distcc/files/distcc-3.1-argc-fix.patch
new file mode 100644
index 000000000000..d7f30b5567fa
--- /dev/null
+++ b/sys-devel/distcc/files/distcc-3.1-argc-fix.patch
@@ -0,0 +1,17 @@
+this fixes virtualbox not compiling with distcc
+
+https://bugs.gentoo.org/show_bug.cgi?id=351979
+http://code.google.com/p/distcc/issues/detail?id=83
+http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=626926
+
+--- distcc-3.1.orig/source/src/arg.c
++++ distcc-3.1/source/src/arg.c
+@@ -515,6 +515,8 @@
+ }
+ free(argv);
+ *argv_ptr = argv = new_argv;
++ i += extra_args - 1;
++ argc += extra_args - 1;
+ }
+ }
+ return 0;
diff --git a/sys-devel/distcc/files/distcc-3.1-freedesktop.patch b/sys-devel/distcc/files/distcc-3.1-freedesktop.patch
new file mode 100644
index 000000000000..b23db21a2558
--- /dev/null
+++ b/sys-devel/distcc/files/distcc-3.1-freedesktop.patch
@@ -0,0 +1,76 @@
+diff -Naur distcc-3.1.orig/Makefile.in distcc-3.1/Makefile.in
+--- distcc-3.1.orig/Makefile.in 2008-12-03 06:50:31.000000000 +0900
++++ distcc-3.1/Makefile.in 2009-02-02 00:40:20.000000000 +0900
+@@ -49,13 +49,14 @@
+ includedir = @includedir@
+ oldincludedir = /usr/include
+ docdir = @docdir@
+-pkgdatadir = $(datadir)/@PACKAGE_NAME@
++icondir = $(datadir)/pixmaps
++desktopdir = $(datadir)/applications
+
+ include_server_builddir = $(builddir)/_include_server
+
+ # These must be done from here, not from autoconf, because they can
+ # contain variable expansions written in Make syntax. Ew.
+-DIR_DEFS = -DSYSCONFDIR="\"${sysconfdir}\"" -DPKGDATADIR="\"${pkgdatadir}\""
++DIR_DEFS = -DSYSCONFDIR="\"${sysconfdir}\"" -DICONDIR="\"${icondir}\""
+
+ # arguments to pkgconfig
+ GNOME_PACKAGES = @GNOME_PACKAGES@
+@@ -1003,7 +1004,8 @@
+ @echo " documents $(DESTDIR)$(docdir)"
+ @echo " programs $(DESTDIR)$(bindir)"
+ @echo " system configuration $(DESTDIR)$(sysconfdir)"
+- @echo " shared data files $(DESTDIR)$(pkgdatadir)"
++ @echo " icons $(DESTDIR)$(icondir)"
++ @echo " .desktop file $(DESTDIR)$(desktopdir)"
+
+
+ # install-sh can't handle multiple arguments, but we don't need any
+@@ -1086,10 +1088,10 @@
+ done
+
+ install-gnome-data: $(gnome_data)
+- $(mkinstalldirs) "$(DESTDIR)$(pkgdatadir)"
+- for p in $(gnome_data); do \
+- $(INSTALL_DATA) "$$p" "$(DESTDIR)$(pkgdatadir)" || exit 1; \
+- done
++ $(mkinstalldirs) $(DESTDIR)$(icondir)
++ $(mkinstalldirs) $(DESTDIR)$(desktopdir)
++ $(INSTALL_DATA) gnome/distccmon-gnome-icon.png $(DESTDIR)$(icondir)
++ $(INSTALL_DATA) gnome/distccmon-gnome.desktop $(DESTDIR)$(desktopdir)
+
+ install-conf: $(conf_files) $(default_files)
+ $(mkinstalldirs) "$(DESTDIR)$(sysconfdir)/distcc"
+diff -Naur distcc-3.1.orig/gnome/distccmon-gnome.desktop distcc-3.1/gnome/distccmon-gnome.desktop
+--- distcc-3.1.orig/gnome/distccmon-gnome.desktop 2008-12-03 06:50:27.000000000 +0900
++++ distcc-3.1/gnome/distccmon-gnome.desktop 2009-02-02 00:40:55.000000000 +0900
+@@ -1,13 +1,11 @@
+ [Desktop Entry]
+-Version=0.9.4
+-Encoding=UTF-8
+ Exec=distccmon-gnome
+ Name=distcc monitor
+ GenericName=Distributed Compile Monitor
+ Comment=Graphical view of distributed compile tasks
+-Icon=distccmon-gnome-icon.png
++Icon=distccmon-gnome-icon
+ TryExec=distccmon-gnome
+ Terminal=false
+ Type=Application
+-Categories=GNOME;Application;Development;
++Categories=GNOME;Development;
+ StartupNotify=true
+diff -Naur distcc-3.1.orig/src/mon-gnome.c distcc-3.1/src/mon-gnome.c
+--- distcc-3.1.orig/src/mon-gnome.c 2008-12-03 06:50:25.000000000 +0900
++++ distcc-3.1/src/mon-gnome.c 2009-02-02 00:41:18.000000000 +0900
+@@ -599,7 +599,7 @@
+
+ #if GTK_CHECK_VERSION(2,2,0)
+ gtk_window_set_icon_from_file (GTK_WINDOW (mainwin),
+- PKGDATADIR "/distccmon-gnome-icon.png",
++ ICONDIR "/distccmon-gnome-icon.png",
+ NULL);
+ #endif
+
diff --git a/sys-devel/distcc/files/distcc-3.1-python.patch b/sys-devel/distcc/files/distcc-3.1-python.patch
new file mode 100644
index 000000000000..733357a53932
--- /dev/null
+++ b/sys-devel/distcc/files/distcc-3.1-python.patch
@@ -0,0 +1,258 @@
+diff -Naur distcc-3.1.orig/bench/statistics.py distcc-3.1/bench/statistics.py
+--- distcc-3.1.orig/bench/statistics.py 2008-12-03 06:50:21.000000000 +0900
++++ distcc-3.1/bench/statistics.py 2009-03-17 01:29:26.000000000 +0900
+@@ -1,4 +1,4 @@
+-#! /usr/bin/env python2.2
++#! /usr/bin/env python
+
+ # benchmark -- automated system for testing distcc correctness
+ # and performance on various source trees.
+diff -Naur distcc-3.1.orig/configure distcc-3.1/configure
+--- distcc-3.1.orig/configure 2008-12-03 06:50:34.000000000 +0900
++++ distcc-3.1/configure 2009-03-17 01:31:09.000000000 +0900
+@@ -3629,7 +3629,7 @@
+ #
+ # NB: Cannot use AC_CONFIG_LIBOBJ_DIR here, because it's not present
+ # in autoconf 2.53.
+-for ac_prog in python2.5 python-2.5 python2.4 python-2.4 python
++for ac_prog in python
+ do
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
+ set dummy $ac_prog; ac_word=$2
+diff -Naur distcc-3.1.orig/configure.ac distcc-3.1/configure.ac
+--- distcc-3.1.orig/configure.ac 2008-12-03 06:50:31.000000000 +0900
++++ distcc-3.1/configure.ac 2009-03-17 01:29:04.000000000 +0900
+@@ -243,7 +243,7 @@
+ #
+ # NB: Cannot use AC_CONFIG_LIBOBJ_DIR here, because it's not present
+ # in autoconf 2.53.
+-AC_PATH_PROGS(PYTHON, [python2.5 python-2.5 python2.4 python-2.4 python])
++AC_PATH_PROGS(PYTHON, [python])
+ AC_ARG_VAR(PYTHON, [Python interpreter])
+ # Python 1 doesn't even support -V
+ if ! "$PYTHON" -V 2>&1 | grep "^Python" >/dev/null; then
+diff -Naur distcc-3.1.orig/include_server/basics.py distcc-3.1/include_server/basics.py
+--- distcc-3.1.orig/include_server/basics.py 2008-12-03 06:50:31.000000000 +0900
++++ distcc-3.1/include_server/basics.py 2009-03-17 01:30:46.000000000 +0900
+@@ -1,4 +1,4 @@
+-#!/usr/bin/python2.4
++#!/usr/bin/python
+ #
+ # Copyright 2007 Google Inc.
+ #
+diff -Naur distcc-3.1.orig/include_server/basics_test.py distcc-3.1/include_server/basics_test.py
+--- distcc-3.1.orig/include_server/basics_test.py 2008-12-03 06:50:31.000000000 +0900
++++ distcc-3.1/include_server/basics_test.py 2009-03-17 01:30:46.000000000 +0900
+@@ -1,4 +1,4 @@
+-#! /usr/bin/python2.4
++#! /usr/bin/python
+
+ # Copyright 2007 Google Inc.
+ #
+diff -Naur distcc-3.1.orig/include_server/c_extensions_test.py distcc-3.1/include_server/c_extensions_test.py
+--- distcc-3.1.orig/include_server/c_extensions_test.py 2008-12-03 06:50:31.000000000 +0900
++++ distcc-3.1/include_server/c_extensions_test.py 2009-03-17 01:30:46.000000000 +0900
+@@ -1,4 +1,4 @@
+-#!/usr/bin/python2.4
++#!/usr/bin/python
+
+ # Copyright 2007 Google Inc.
+ #
+diff -Naur distcc-3.1.orig/include_server/cache_basics.py distcc-3.1/include_server/cache_basics.py
+--- distcc-3.1.orig/include_server/cache_basics.py 2008-12-03 06:50:31.000000000 +0900
++++ distcc-3.1/include_server/cache_basics.py 2009-03-17 01:30:46.000000000 +0900
+@@ -1,4 +1,4 @@
+-#! /usr/bin/python2.4
++#! /usr/bin/python
+
+ # Copyright 2007 Google Inc.
+ #
+diff -Naur distcc-3.1.orig/include_server/compiler_defaults.py distcc-3.1/include_server/compiler_defaults.py
+--- distcc-3.1.orig/include_server/compiler_defaults.py 2008-12-03 06:50:31.000000000 +0900
++++ distcc-3.1/include_server/compiler_defaults.py 2009-03-17 01:30:46.000000000 +0900
+@@ -1,4 +1,4 @@
+-#! /usr/bin/python2.4
++#! /usr/bin/python
+
+ # Copyright 2007 Google Inc.
+ #
+diff -Naur distcc-3.1.orig/include_server/compress_files.py distcc-3.1/include_server/compress_files.py
+--- distcc-3.1.orig/include_server/compress_files.py 2008-12-03 06:50:31.000000000 +0900
++++ distcc-3.1/include_server/compress_files.py 2009-03-17 01:30:46.000000000 +0900
+@@ -1,4 +1,4 @@
+-#! /usr/bin/python2.4
++#! /usr/bin/python
+
+ # Copyright 2007 Google Inc.
+ #
+diff -Naur distcc-3.1.orig/include_server/include_analyzer.py distcc-3.1/include_server/include_analyzer.py
+--- distcc-3.1.orig/include_server/include_analyzer.py 2008-12-03 06:50:31.000000000 +0900
++++ distcc-3.1/include_server/include_analyzer.py 2009-03-17 01:30:46.000000000 +0900
+@@ -1,4 +1,4 @@
+-#! /usr/bin/python2.4
++#! /usr/bin/python
+
+ # Copyright 2007 Google Inc.
+ #
+diff -Naur distcc-3.1.orig/include_server/include_analyzer_memoizing_node.py distcc-3.1/include_server/include_analyzer_memoizing_node.py
+--- distcc-3.1.orig/include_server/include_analyzer_memoizing_node.py 2008-12-03 06:50:31.000000000 +0900
++++ distcc-3.1/include_server/include_analyzer_memoizing_node.py 2009-03-17 01:30:46.000000000 +0900
+@@ -1,4 +1,4 @@
+-#! /usr/bin/python2.4
++#! /usr/bin/python
+
+ # Copyright 2007 Google Inc.
+ #
+diff -Naur distcc-3.1.orig/include_server/include_analyzer_memoizing_node_test.py distcc-3.1/include_server/include_analyzer_memoizing_node_test.py
+--- distcc-3.1.orig/include_server/include_analyzer_memoizing_node_test.py 2008-12-03 06:50:31.000000000 +0900
++++ distcc-3.1/include_server/include_analyzer_memoizing_node_test.py 2009-03-17 01:30:46.000000000 +0900
+@@ -1,4 +1,4 @@
+-#! /usr/bin/python2.4
++#! /usr/bin/python
+
+ # Copyright 2007 Google Inc.
+ #
+diff -Naur distcc-3.1.orig/include_server/include_analyzer_test.py distcc-3.1/include_server/include_analyzer_test.py
+--- distcc-3.1.orig/include_server/include_analyzer_test.py 2008-12-03 06:50:31.000000000 +0900
++++ distcc-3.1/include_server/include_analyzer_test.py 2009-03-17 01:30:46.000000000 +0900
+@@ -1,4 +1,4 @@
+-#! /usr/bin/python2.4
++#! /usr/bin/python
+
+ # Copyright 2007 Google Inc.
+ #
+diff -Naur distcc-3.1.orig/include_server/include_server.py distcc-3.1/include_server/include_server.py
+--- distcc-3.1.orig/include_server/include_server.py 2008-12-03 06:50:31.000000000 +0900
++++ distcc-3.1/include_server/include_server.py 2009-03-17 01:30:46.000000000 +0900
+@@ -1,4 +1,4 @@
+-#!/usr/bin/python2.4
++#!/usr/bin/python
+
+ # Copyright 2007 Google Inc.
+ #
+diff -Naur distcc-3.1.orig/include_server/include_server_test.py distcc-3.1/include_server/include_server_test.py
+--- distcc-3.1.orig/include_server/include_server_test.py 2008-12-03 06:50:31.000000000 +0900
++++ distcc-3.1/include_server/include_server_test.py 2009-03-17 01:30:46.000000000 +0900
+@@ -1,4 +1,4 @@
+-#!/usr/bin/python2.4
++#!/usr/bin/python
+
+ # Copyright 2007 Google Inc.
+ #
+diff -Naur distcc-3.1.orig/include_server/macro_eval.py distcc-3.1/include_server/macro_eval.py
+--- distcc-3.1.orig/include_server/macro_eval.py 2008-12-03 06:50:31.000000000 +0900
++++ distcc-3.1/include_server/macro_eval.py 2009-03-17 01:30:46.000000000 +0900
+@@ -1,4 +1,4 @@
+-#! /usr/bin/python2.4
++#! /usr/bin/python
+
+ # Copyright 2007 Google Inc.
+ #
+diff -Naur distcc-3.1.orig/include_server/macro_eval_test.py distcc-3.1/include_server/macro_eval_test.py
+--- distcc-3.1.orig/include_server/macro_eval_test.py 2008-12-03 06:50:31.000000000 +0900
++++ distcc-3.1/include_server/macro_eval_test.py 2009-03-17 01:30:46.000000000 +0900
+@@ -1,4 +1,4 @@
+-#! /usr/bin/python2.4
++#! /usr/bin/python
+
+ # Copyright 2007 Google Inc.
+ #
+diff -Naur distcc-3.1.orig/include_server/mirror_path.py distcc-3.1/include_server/mirror_path.py
+--- distcc-3.1.orig/include_server/mirror_path.py 2008-12-03 06:50:31.000000000 +0900
++++ distcc-3.1/include_server/mirror_path.py 2009-03-17 01:30:46.000000000 +0900
+@@ -1,4 +1,4 @@
+-#!/usr/bin/python2.4
++#!/usr/bin/python
+
+ # Copyright 2007 Google Inc.
+ #
+diff -Naur distcc-3.1.orig/include_server/mirror_path_test.py distcc-3.1/include_server/mirror_path_test.py
+--- distcc-3.1.orig/include_server/mirror_path_test.py 2008-12-03 06:50:31.000000000 +0900
++++ distcc-3.1/include_server/mirror_path_test.py 2009-03-17 01:30:46.000000000 +0900
+@@ -1,4 +1,4 @@
+-#! /usr/bin/python2.4
++#! /usr/bin/python
+
+ # Copyright 2007 Google Inc.
+ #
+diff -Naur distcc-3.1.orig/include_server/parse_command.py distcc-3.1/include_server/parse_command.py
+--- distcc-3.1.orig/include_server/parse_command.py 2008-12-03 06:50:31.000000000 +0900
++++ distcc-3.1/include_server/parse_command.py 2009-03-17 01:30:46.000000000 +0900
+@@ -1,4 +1,4 @@
+-#! /usr/bin/python2.4
++#! /usr/bin/python
+
+ # Copyright 2007 Google Inc.
+ #
+diff -Naur distcc-3.1.orig/include_server/parse_command_test.py distcc-3.1/include_server/parse_command_test.py
+--- distcc-3.1.orig/include_server/parse_command_test.py 2008-12-03 06:50:31.000000000 +0900
++++ distcc-3.1/include_server/parse_command_test.py 2009-03-17 01:30:46.000000000 +0900
+@@ -1,4 +1,4 @@
+-#! /usr/bin/python2.4
++#! /usr/bin/python
+
+ # Copyright 2007 Google Inc.
+ #
+diff -Naur distcc-3.1.orig/include_server/parse_file.py distcc-3.1/include_server/parse_file.py
+--- distcc-3.1.orig/include_server/parse_file.py 2008-12-03 06:50:31.000000000 +0900
++++ distcc-3.1/include_server/parse_file.py 2009-03-17 01:30:46.000000000 +0900
+@@ -1,4 +1,4 @@
+-#! /usr/bin/python2.4
++#! /usr/bin/python
+
+ # Copyright 2007 Google Inc.
+ #
+diff -Naur distcc-3.1.orig/include_server/parse_file_test.py distcc-3.1/include_server/parse_file_test.py
+--- distcc-3.1.orig/include_server/parse_file_test.py 2008-12-03 06:50:31.000000000 +0900
++++ distcc-3.1/include_server/parse_file_test.py 2009-03-17 01:30:46.000000000 +0900
+@@ -1,4 +1,4 @@
+-#! /usr/bin/python2.4
++#! /usr/bin/python
+
+ # Copyright 2007 Google Inc.
+ #
+diff -Naur distcc-3.1.orig/include_server/run.py distcc-3.1/include_server/run.py
+--- distcc-3.1.orig/include_server/run.py 2008-12-03 06:50:31.000000000 +0900
++++ distcc-3.1/include_server/run.py 2009-03-17 01:30:46.000000000 +0900
+@@ -1,4 +1,4 @@
+-#! /usr/bin/python2.4
++#! /usr/bin/python
+
+ # Copyright 2007 Google Inc.
+ #
+diff -Naur distcc-3.1.orig/include_server/setup.py distcc-3.1/include_server/setup.py
+--- distcc-3.1.orig/include_server/setup.py 2008-12-03 06:50:31.000000000 +0900
++++ distcc-3.1/include_server/setup.py 2009-03-17 01:30:46.000000000 +0900
+@@ -1,4 +1,4 @@
+-#!/usr/bin/python2.4
++#!/usr/bin/python
+
+ # Copyright 2007 Google Inc.
+ #
+diff -Naur distcc-3.1.orig/include_server/statistics.py distcc-3.1/include_server/statistics.py
+--- distcc-3.1.orig/include_server/statistics.py 2008-12-03 06:50:31.000000000 +0900
++++ distcc-3.1/include_server/statistics.py 2009-03-17 01:30:46.000000000 +0900
+@@ -1,4 +1,4 @@
+-#! /usr/bin/python2.4
++#! /usr/bin/python
+ #
+ # Copyright 2007 Google Inc.
+ #
+diff -Naur distcc-3.1.orig/test/onetest.py distcc-3.1/test/onetest.py
+--- distcc-3.1.orig/test/onetest.py 2008-12-03 06:50:22.000000000 +0900
++++ distcc-3.1/test/onetest.py 2009-03-17 01:29:44.000000000 +0900
+@@ -1,4 +1,4 @@
+-#!/usr/bin/python2.4
++#!/usr/bin/python
+ #
+ # Copyright 2007 Google Inc.
+ #
+diff -Naur distcc-3.1.orig/test/testdistcc.py distcc-3.1/test/testdistcc.py
+--- distcc-3.1.orig/test/testdistcc.py 2008-12-03 06:50:22.000000000 +0900
++++ distcc-3.1/test/testdistcc.py 2009-03-17 01:29:36.000000000 +0900
+@@ -1,4 +1,4 @@
+-#! /usr/bin/env python2.2
++#! /usr/bin/env python
+
+ # Copyright (C) 2002, 2003, 2004 by Martin Pool <mbp@samba.org>
+ # Copyright 2007 Google Inc.
diff --git a/sys-devel/distcc/files/distcc-3.2_rc1-freedesktop.patch b/sys-devel/distcc/files/distcc-3.2_rc1-freedesktop.patch
new file mode 100644
index 000000000000..8f0d8d77a12b
--- /dev/null
+++ b/sys-devel/distcc/files/distcc-3.2_rc1-freedesktop.patch
@@ -0,0 +1,79 @@
+diff -Naur distcc-3.2rc1.orig/Makefile.in distcc-3.2rc1/Makefile.in
+--- distcc-3.2rc1.orig/Makefile.in 2011-10-26 11:07:15.000000000 +0900
++++ distcc-3.2rc1/Makefile.in 2011-10-27 16:57:46.815272689 +0900
+@@ -50,13 +50,14 @@
+ includedir = @includedir@
+ oldincludedir = /usr/include
+ docdir = @docdir@
+-pkgdatadir = $(datadir)/@PACKAGE_NAME@
++icondir = $(datadir)/pixmaps
++desktopdir = $(datadir)/applications
+
+ include_server_builddir = $(builddir)/_include_server
+
+ # These must be done from here, not from autoconf, because they can
+ # contain variable expansions written in Make syntax. Ew.
+-DIR_DEFS = -DSYSCONFDIR="\"${sysconfdir}\"" -DPKGDATADIR="\"${pkgdatadir}\""
++DIR_DEFS = -DSYSCONFDIR="\"${sysconfdir}\"" -DICONDIR="\"${icondir}\""
+
+ # arguments to pkgconfig
+ GNOME_PACKAGES = @GNOME_PACKAGES@
+@@ -1016,7 +1017,8 @@
+ @echo " documents $(DESTDIR)$(docdir)"
+ @echo " programs $(DESTDIR)$(bindir)"
+ @echo " system configuration $(DESTDIR)$(sysconfdir)"
+- @echo " shared data files $(DESTDIR)$(pkgdatadir)"
++ @echo " icons $(DESTDIR)$(icondir)"
++ @echo " .desktop file $(DESTDIR)$(desktopdir)"
+
+
+ # install-sh can't handle multiple arguments, but we don't need any
+@@ -1108,10 +1110,10 @@
+ done
+
+ install-gnome-data: $(gnome_data)
+- $(mkinstalldirs) "$(DESTDIR)$(pkgdatadir)"
+- for p in $(gnome_data); do \
+- $(INSTALL_DATA) "$$p" "$(DESTDIR)$(pkgdatadir)" || exit 1; \
+- done
++ $(mkinstalldirs) "$(DESTDIR)$(icondir)"
++ $(mkinstalldirs) "$(DESTDIR)$(desktopdir)"
++ $(INSTALL_DATA) gnome/distccmon-gnome-icon.png "$(DESTDIR)$(icondir)" || exit 1
++ $(INSTALL_DATA) gnome/distccmon-gnome.desktop "$(DESTDIR)$(desktopdir)" || exit 1
+
+ install-conf: $(conf_files) $(default_files)
+ $(mkinstalldirs) "$(DESTDIR)$(sysconfdir)/distcc"
+diff -Naur distcc-3.2rc1.orig/gnome/distccmon-gnome.desktop distcc-3.2rc1/gnome/distccmon-gnome.desktop
+--- distcc-3.2rc1.orig/gnome/distccmon-gnome.desktop 2011-04-06 03:58:58.000000000 +0900
++++ distcc-3.2rc1/gnome/distccmon-gnome.desktop 2011-10-27 17:01:50.792242592 +0900
+@@ -1,6 +1,4 @@
+ [Desktop Entry]
+-Version=0.9.4
+-Encoding=UTF-8
+ Exec=distccmon-gnome
+ Name=distcc monitor
+ Name[sv]=distcc övervakare
+@@ -8,9 +6,9 @@
+ GenericName[sv]=Distribuerad kompilerings-övervakare
+ Comment=Graphical view of distributed compile tasks
+ Comment[sv]=Grafisk vy av distribuerade kompileringsuppgifter
+-Icon=distccmon-gnome-icon.png
++Icon=distccmon-gnome-icon
+ TryExec=distccmon-gnome
+ Terminal=false
+ Type=Application
+-Categories=GNOME;Application;Development;
++Categories=GNOME;Development;
+ StartupNotify=true
+diff -Naur distcc-3.2rc1.orig/src/mon-gnome.c distcc-3.2rc1/src/mon-gnome.c
+--- distcc-3.2rc1.orig/src/mon-gnome.c 2008-12-03 06:50:25.000000000 +0900
++++ distcc-3.2rc1/src/mon-gnome.c 2011-10-27 16:54:50.220566026 +0900
+@@ -599,7 +599,7 @@
+
+ #if GTK_CHECK_VERSION(2,2,0)
+ gtk_window_set_icon_from_file (GTK_WINDOW (mainwin),
+- PKGDATADIR "/distccmon-gnome-icon.png",
++ ICONDIR "/distccmon-gnome-icon.png",
+ NULL);
+ #endif
+
diff --git a/sys-devel/distcc/files/distcc-3.2_rc1-gssapi.patch b/sys-devel/distcc/files/distcc-3.2_rc1-gssapi.patch
new file mode 100644
index 000000000000..73551f8a7b80
--- /dev/null
+++ b/sys-devel/distcc/files/distcc-3.2_rc1-gssapi.patch
@@ -0,0 +1,36 @@
+diff -Naur distcc-3.2rc1.orig/configure.ac distcc-3.2rc1/configure.ac
+--- distcc-3.2rc1.orig/configure.ac 2011-10-21 13:40:55.000000000 +0900
++++ distcc-3.2rc1/configure.ac 2011-10-27 18:06:58.938922585 +0900
+@@ -15,6 +15,8 @@
+ AC_CONFIG_HEADERS(src/config.h)
+ AC_CANONICAL_HOST
+
++PKG_PROG_PKG_CONFIG
++
+ # FreeBSD installs its version of libpopt into /usr/local/, but does
+ # not put that on the default library and header path.
+ # Solaris doesn't even ship libpopt. We used to add that path if
+@@ -502,16 +504,17 @@
+ [provide mutual authentication services via the GSS-API])])
+
+ if test x"$with_auth" = xyes; then
+- AC_SEARCH_LIBS([gss_init_sec_context],
+- [gssapi gssapi_krb5],
+- AC_DEFINE(HAVE_GSSAPI, 1, [Define if the GSS_API is available])
++ PKG_CHECK_MODULES(GSSAPI, libgssglue,
++ [AC_DEFINE(HAVE_GSSAPI, 1, [Define if the GSS_API is available])
++ CFLAGS="$CFLAGS $GSSAPI_CFLAGS"
++ LIBS="$LIBS $GSSAPI_LIBS"
+ AUTH_COMMON_OBJS="src/auth_common.o"
+ AUTH_DISTCC_OBJS="src/auth_distcc.o"
+- AUTH_DISTCCD_OBJS="src/auth_distccd.o",
+- AC_MSG_FAILURE([--with-auth was given but no GSS-API library found])
++ AUTH_DISTCCD_OBJS="src/auth_distccd.o"],
++ [AC_MSG_FAILURE([--with-auth was given but no GSS-API library found])
+ AUTH_COMMON_OBJS=""
+ AUTH_DISTCC_OBJS=""
+- AUTH_DISTCCD_OBJS="")
++ AUTH_DISTCCD_OBJS=""])
+ fi
+
+ AC_SUBST(AUTH_COMMON_OBJS)
diff --git a/sys-devel/distcc/files/distcc-3.2_rc1-python.patch b/sys-devel/distcc/files/distcc-3.2_rc1-python.patch
new file mode 100644
index 000000000000..409b5a19d321
--- /dev/null
+++ b/sys-devel/distcc/files/distcc-3.2_rc1-python.patch
@@ -0,0 +1,246 @@
+diff -Naur distcc-3.2rc1.orig/bench/statistics.py distcc-3.2rc1/bench/statistics.py
+--- distcc-3.2rc1.orig/bench/statistics.py 2008-12-03 06:50:21.000000000 +0900
++++ distcc-3.2rc1/bench/statistics.py 2011-10-27 17:05:08.418023081 +0900
+@@ -1,4 +1,4 @@
+-#! /usr/bin/env python2.2
++#! /usr/bin/env python
+
+ # benchmark -- automated system for testing distcc correctness
+ # and performance on various source trees.
+diff -Naur distcc-3.2rc1.orig/configure.ac distcc-3.2rc1/configure.ac
+--- distcc-3.2rc1.orig/configure.ac 2011-10-21 13:40:55.000000000 +0900
++++ distcc-3.2rc1/configure.ac 2011-10-27 17:05:31.179112690 +0900
+@@ -243,7 +243,7 @@
+ #
+ # NB: Cannot use AC_CONFIG_LIBOBJ_DIR here, because it's not present
+ # in autoconf 2.53.
+-AC_PATH_PROGS(PYTHON, [python2.6 python-2.6 python2.5 python-2.5 python2.4 python-2.4 python])
++AC_PATH_PROGS(PYTHON, [python])
+ AC_ARG_VAR(PYTHON, [Python interpreter])
+ # Python 1 doesn't even support -V
+ if ! "$PYTHON" -V 2>&1 | grep "^Python" >/dev/null; then
+diff -Naur distcc-3.2rc1.orig/include_server/basics.py distcc-3.2rc1/include_server/basics.py
+--- distcc-3.2rc1.orig/include_server/basics.py 2008-12-03 06:50:31.000000000 +0900
++++ distcc-3.2rc1/include_server/basics.py 2011-10-27 17:05:08.421023097 +0900
+@@ -1,4 +1,4 @@
+-#!/usr/bin/python2.4
++#!/usr/bin/python
+ #
+ # Copyright 2007 Google Inc.
+ #
+diff -Naur distcc-3.2rc1.orig/include_server/basics_test.py distcc-3.2rc1/include_server/basics_test.py
+--- distcc-3.2rc1.orig/include_server/basics_test.py 2008-12-03 06:50:31.000000000 +0900
++++ distcc-3.2rc1/include_server/basics_test.py 2011-10-27 17:05:08.421023097 +0900
+@@ -1,4 +1,4 @@
+-#! /usr/bin/python2.4
++#! /usr/bin/python
+
+ # Copyright 2007 Google Inc.
+ #
+diff -Naur distcc-3.2rc1.orig/include_server/c_extensions_test.py distcc-3.2rc1/include_server/c_extensions_test.py
+--- distcc-3.2rc1.orig/include_server/c_extensions_test.py 2008-12-03 06:50:31.000000000 +0900
++++ distcc-3.2rc1/include_server/c_extensions_test.py 2011-10-27 17:05:08.421023097 +0900
+@@ -1,4 +1,4 @@
+-#!/usr/bin/python2.4
++#!/usr/bin/python
+
+ # Copyright 2007 Google Inc.
+ #
+diff -Naur distcc-3.2rc1.orig/include_server/cache_basics.py distcc-3.2rc1/include_server/cache_basics.py
+--- distcc-3.2rc1.orig/include_server/cache_basics.py 2008-12-03 06:50:31.000000000 +0900
++++ distcc-3.2rc1/include_server/cache_basics.py 2011-10-27 17:05:08.422023101 +0900
+@@ -1,4 +1,4 @@
+-#! /usr/bin/python2.4
++#! /usr/bin/python
+
+ # Copyright 2007 Google Inc.
+ #
+diff -Naur distcc-3.2rc1.orig/include_server/compiler_defaults.py distcc-3.2rc1/include_server/compiler_defaults.py
+--- distcc-3.2rc1.orig/include_server/compiler_defaults.py 2011-04-06 03:58:59.000000000 +0900
++++ distcc-3.2rc1/include_server/compiler_defaults.py 2011-10-27 17:05:08.422023101 +0900
+@@ -1,4 +1,4 @@
+-#! /usr/bin/python2.4
++#! /usr/bin/python
+
+ # Copyright 2007 Google Inc.
+ #
+diff -Naur distcc-3.2rc1.orig/include_server/compress_files.py distcc-3.2rc1/include_server/compress_files.py
+--- distcc-3.2rc1.orig/include_server/compress_files.py 2008-12-03 06:50:31.000000000 +0900
++++ distcc-3.2rc1/include_server/compress_files.py 2011-10-27 17:05:08.422023101 +0900
+@@ -1,4 +1,4 @@
+-#! /usr/bin/python2.4
++#! /usr/bin/python
+
+ # Copyright 2007 Google Inc.
+ #
+diff -Naur distcc-3.2rc1.orig/include_server/include_analyzer.py distcc-3.2rc1/include_server/include_analyzer.py
+--- distcc-3.2rc1.orig/include_server/include_analyzer.py 2008-12-03 06:50:31.000000000 +0900
++++ distcc-3.2rc1/include_server/include_analyzer.py 2011-10-27 17:05:08.422023101 +0900
+@@ -1,4 +1,4 @@
+-#! /usr/bin/python2.4
++#! /usr/bin/python
+
+ # Copyright 2007 Google Inc.
+ #
+diff -Naur distcc-3.2rc1.orig/include_server/include_analyzer_memoizing_node.py distcc-3.2rc1/include_server/include_analyzer_memoizing_node.py
+--- distcc-3.2rc1.orig/include_server/include_analyzer_memoizing_node.py 2008-12-03 06:50:31.000000000 +0900
++++ distcc-3.2rc1/include_server/include_analyzer_memoizing_node.py 2011-10-27 17:05:08.422023101 +0900
+@@ -1,4 +1,4 @@
+-#! /usr/bin/python2.4
++#! /usr/bin/python
+
+ # Copyright 2007 Google Inc.
+ #
+diff -Naur distcc-3.2rc1.orig/include_server/include_analyzer_memoizing_node_test.py distcc-3.2rc1/include_server/include_analyzer_memoizing_node_test.py
+--- distcc-3.2rc1.orig/include_server/include_analyzer_memoizing_node_test.py 2008-12-03 06:50:31.000000000 +0900
++++ distcc-3.2rc1/include_server/include_analyzer_memoizing_node_test.py 2011-10-27 17:05:08.423023105 +0900
+@@ -1,4 +1,4 @@
+-#! /usr/bin/python2.4
++#! /usr/bin/python
+
+ # Copyright 2007 Google Inc.
+ #
+diff -Naur distcc-3.2rc1.orig/include_server/include_analyzer_test.py distcc-3.2rc1/include_server/include_analyzer_test.py
+--- distcc-3.2rc1.orig/include_server/include_analyzer_test.py 2008-12-03 06:50:31.000000000 +0900
++++ distcc-3.2rc1/include_server/include_analyzer_test.py 2011-10-27 17:05:08.423023105 +0900
+@@ -1,4 +1,4 @@
+-#! /usr/bin/python2.4
++#! /usr/bin/python
+
+ # Copyright 2007 Google Inc.
+ #
+diff -Naur distcc-3.2rc1.orig/include_server/include_server.py distcc-3.2rc1/include_server/include_server.py
+--- distcc-3.2rc1.orig/include_server/include_server.py 2008-12-03 06:50:31.000000000 +0900
++++ distcc-3.2rc1/include_server/include_server.py 2011-10-27 17:05:08.423023105 +0900
+@@ -1,4 +1,4 @@
+-#!/usr/bin/python2.4
++#!/usr/bin/python
+
+ # Copyright 2007 Google Inc.
+ #
+diff -Naur distcc-3.2rc1.orig/include_server/include_server_test.py distcc-3.2rc1/include_server/include_server_test.py
+--- distcc-3.2rc1.orig/include_server/include_server_test.py 2008-12-03 06:50:31.000000000 +0900
++++ distcc-3.2rc1/include_server/include_server_test.py 2011-10-27 17:05:08.423023105 +0900
+@@ -1,4 +1,4 @@
+-#!/usr/bin/python2.4
++#!/usr/bin/python
+
+ # Copyright 2007 Google Inc.
+ #
+diff -Naur distcc-3.2rc1.orig/include_server/macro_eval.py distcc-3.2rc1/include_server/macro_eval.py
+--- distcc-3.2rc1.orig/include_server/macro_eval.py 2011-04-06 03:58:59.000000000 +0900
++++ distcc-3.2rc1/include_server/macro_eval.py 2011-10-27 17:05:08.423023105 +0900
+@@ -1,4 +1,4 @@
+-#! /usr/bin/python2.4
++#! /usr/bin/python
+
+ # Copyright 2007 Google Inc.
+ #
+diff -Naur distcc-3.2rc1.orig/include_server/macro_eval_test.py distcc-3.2rc1/include_server/macro_eval_test.py
+--- distcc-3.2rc1.orig/include_server/macro_eval_test.py 2008-12-03 06:50:31.000000000 +0900
++++ distcc-3.2rc1/include_server/macro_eval_test.py 2011-10-27 17:05:08.423023105 +0900
+@@ -1,4 +1,4 @@
+-#! /usr/bin/python2.4
++#! /usr/bin/python
+
+ # Copyright 2007 Google Inc.
+ #
+diff -Naur distcc-3.2rc1.orig/include_server/mirror_path.py distcc-3.2rc1/include_server/mirror_path.py
+--- distcc-3.2rc1.orig/include_server/mirror_path.py 2008-12-03 06:50:31.000000000 +0900
++++ distcc-3.2rc1/include_server/mirror_path.py 2011-10-27 17:05:08.424023109 +0900
+@@ -1,4 +1,4 @@
+-#!/usr/bin/python2.4
++#!/usr/bin/python
+
+ # Copyright 2007 Google Inc.
+ #
+diff -Naur distcc-3.2rc1.orig/include_server/mirror_path_test.py distcc-3.2rc1/include_server/mirror_path_test.py
+--- distcc-3.2rc1.orig/include_server/mirror_path_test.py 2008-12-03 06:50:31.000000000 +0900
++++ distcc-3.2rc1/include_server/mirror_path_test.py 2011-10-27 17:05:08.424023109 +0900
+@@ -1,4 +1,4 @@
+-#! /usr/bin/python2.4
++#! /usr/bin/python
+
+ # Copyright 2007 Google Inc.
+ #
+diff -Naur distcc-3.2rc1.orig/include_server/parse_command.py distcc-3.2rc1/include_server/parse_command.py
+--- distcc-3.2rc1.orig/include_server/parse_command.py 2011-04-06 03:58:59.000000000 +0900
++++ distcc-3.2rc1/include_server/parse_command.py 2011-10-27 17:05:08.424023109 +0900
+@@ -1,4 +1,4 @@
+-#! /usr/bin/python2.4
++#! /usr/bin/python
+
+ # Copyright 2007 Google Inc.
+ #
+diff -Naur distcc-3.2rc1.orig/include_server/parse_command_test.py distcc-3.2rc1/include_server/parse_command_test.py
+--- distcc-3.2rc1.orig/include_server/parse_command_test.py 2011-04-06 03:58:59.000000000 +0900
++++ distcc-3.2rc1/include_server/parse_command_test.py 2011-10-27 17:05:08.424023109 +0900
+@@ -1,4 +1,4 @@
+-#! /usr/bin/python2.4
++#! /usr/bin/python
+
+ # Copyright 2007 Google Inc.
+ #
+diff -Naur distcc-3.2rc1.orig/include_server/parse_file.py distcc-3.2rc1/include_server/parse_file.py
+--- distcc-3.2rc1.orig/include_server/parse_file.py 2011-04-06 03:58:59.000000000 +0900
++++ distcc-3.2rc1/include_server/parse_file.py 2011-10-27 17:05:08.424023109 +0900
+@@ -1,4 +1,4 @@
+-#! /usr/bin/python2.4
++#! /usr/bin/python
+
+ # Copyright 2007 Google Inc.
+ #
+diff -Naur distcc-3.2rc1.orig/include_server/parse_file_test.py distcc-3.2rc1/include_server/parse_file_test.py
+--- distcc-3.2rc1.orig/include_server/parse_file_test.py 2008-12-03 06:50:31.000000000 +0900
++++ distcc-3.2rc1/include_server/parse_file_test.py 2011-10-27 17:05:08.424023109 +0900
+@@ -1,4 +1,4 @@
+-#! /usr/bin/python2.4
++#! /usr/bin/python
+
+ # Copyright 2007 Google Inc.
+ #
+diff -Naur distcc-3.2rc1.orig/include_server/run.py distcc-3.2rc1/include_server/run.py
+--- distcc-3.2rc1.orig/include_server/run.py 2008-12-03 06:50:31.000000000 +0900
++++ distcc-3.2rc1/include_server/run.py 2011-10-27 17:05:08.424023109 +0900
+@@ -1,4 +1,4 @@
+-#! /usr/bin/python2.4
++#! /usr/bin/python
+
+ # Copyright 2007 Google Inc.
+ #
+diff -Naur distcc-3.2rc1.orig/include_server/setup.py distcc-3.2rc1/include_server/setup.py
+--- distcc-3.2rc1.orig/include_server/setup.py 2011-04-06 03:58:59.000000000 +0900
++++ distcc-3.2rc1/include_server/setup.py 2011-10-27 17:05:08.425023113 +0900
+@@ -1,4 +1,4 @@
+-#!/usr/bin/python2.4
++#!/usr/bin/python
+
+ # Copyright 2007 Google Inc.
+ #
+diff -Naur distcc-3.2rc1.orig/include_server/statistics.py distcc-3.2rc1/include_server/statistics.py
+--- distcc-3.2rc1.orig/include_server/statistics.py 2008-12-03 06:50:31.000000000 +0900
++++ distcc-3.2rc1/include_server/statistics.py 2011-10-27 17:05:08.425023113 +0900
+@@ -1,4 +1,4 @@
+-#! /usr/bin/python2.4
++#! /usr/bin/python
+ #
+ # Copyright 2007 Google Inc.
+ #
+diff -Naur distcc-3.2rc1.orig/test/onetest.py distcc-3.2rc1/test/onetest.py
+--- distcc-3.2rc1.orig/test/onetest.py 2008-12-03 06:50:22.000000000 +0900
++++ distcc-3.2rc1/test/onetest.py 2011-10-27 17:05:08.432023140 +0900
+@@ -1,4 +1,4 @@
+-#!/usr/bin/python2.4
++#!/usr/bin/python
+ #
+ # Copyright 2007 Google Inc.
+ #
+diff -Naur distcc-3.2rc1.orig/test/testdistcc.py distcc-3.2rc1/test/testdistcc.py
+--- distcc-3.2rc1.orig/test/testdistcc.py 2011-10-21 11:40:49.000000000 +0900
++++ distcc-3.2rc1/test/testdistcc.py 2011-10-27 17:05:08.432023140 +0900
+@@ -1,4 +1,4 @@
+-#! /usr/bin/env python2.2
++#! /usr/bin/env python
+
+ # Copyright (C) 2002, 2003, 2004 by Martin Pool <mbp@samba.org>
+ # Copyright 2007 Google Inc.
diff --git a/sys-devel/distcc/files/distcc-3.2_rc1-socks5.patch b/sys-devel/distcc/files/distcc-3.2_rc1-socks5.patch
new file mode 100644
index 000000000000..256a16ffd5ba
--- /dev/null
+++ b/sys-devel/distcc/files/distcc-3.2_rc1-socks5.patch
@@ -0,0 +1,191 @@
+From fdd93b1e9545b66d1b3a2a1ec24d4c8613ee43fb Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org>
+Date: Sat, 24 Jan 2015 23:59:21 +0100
+Subject: [PATCH] Support SOCKSv5 proxy
+
+Support using a SOCKSv5 proxy specified as DISTCC_SOCKS_PROXY.
+The variable can either a hostname, a host:port pair or an absolute path
+to a UNIX socket. When SOCKS is used, the hostname is passed to
+the proxy and therefore the name resolution is done remotely.
+---
+ src/clinet.c | 137 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
+ 1 file changed, 135 insertions(+), 2 deletions(-)
+
+diff --git a/src/clinet.c b/src/clinet.c
+index 010a884..4773d8b 100644
+--- a/src/clinet.c
++++ b/src/clinet.c
+@@ -31,6 +31,7 @@
+
+ #include <stdio.h>
+ #include <stdlib.h>
++#include <stddef.h>
+ #include <unistd.h>
+ #include <string.h>
+ #include <fcntl.h>
+@@ -42,8 +43,10 @@
+ #include <sys/types.h>
+ #include <sys/socket.h>
+
++#include <arpa/inet.h>
+ #include <netinet/in.h>
+ #include <netinet/tcp.h>
++#include <sys/un.h>
+
+ #include <netdb.h>
+
+@@ -161,7 +164,7 @@ out_failed:
+ /**
+ * Open a socket to a tcp remote host with the specified port.
+ **/
+-int dcc_connect_by_name(const char *host, int port, int *p_fd)
++static int dcc_connect_by_name_real(const char *host, int port, int *p_fd)
+ {
+ struct addrinfo hints;
+ struct addrinfo *res;
+@@ -201,7 +204,7 @@ int dcc_connect_by_name(const char *host, int port, int *p_fd)
+ *
+ * @todo Don't try for too long to connect.
+ **/
+-int dcc_connect_by_name(const char *host, int port, int *p_fd)
++static int dcc_connect_by_name_real(const char *host, int port, int *p_fd)
+ {
+ struct sockaddr_in sock_out;
+ struct hostent *hp;
+@@ -224,3 +227,133 @@ int dcc_connect_by_name(const char *host, int port, int *p_fd)
+ }
+
+ #endif /* not ENABLE_RFC2553 */
++
++static int dcc_connect_via_socks5(const char *host, int port, int *p_fd, const char *proxy)
++{
++ int ret;
++ char *proxy_host, *proxy_it;
++ int proxy_port;
++ char buf[262];
++ int host_length;
++ struct sockaddr_in addr_buf;
++ int skip_bytes;
++
++ host_length = strlen(host);
++ if (host_length > 255) {
++ rs_log_error("hostname \"%s\" too long for SOCKSv5 (over 255 chars)", host);
++ return EXIT_CONNECT_FAILED;
++ }
++
++ if (proxy[0] == '/') { /* UNIX socket */
++ struct sockaddr_un unix_addr;
++
++ if (strlen(proxy) >= sizeof(unix_addr.sun_path))
++ {
++ rs_log_error("UNIX socket path \"%s\" too long", proxy);
++ return EXIT_CONNECT_FAILED;
++ }
++
++ unix_addr.sun_family = AF_UNIX;
++ strcpy(unix_addr.sun_path, proxy);
++
++ ret = dcc_connect_by_addr((struct sockaddr *) &unix_addr,
++ offsetof(struct sockaddr_un, sun_path) + strlen(proxy) + 1,
++ p_fd);
++
++ } else { /* hostname? IP address? */
++ proxy_host = strdup(proxy);
++ if (proxy_host == NULL) return EXIT_OUT_OF_MEMORY;
++
++ proxy_it = strrchr(proxy_host, ':');
++ if (proxy_it) {
++ *(proxy_it++) = 0;
++ proxy_port = atoi(proxy_it);
++
++ if (proxy_port <= 0) {
++ rs_log_error("invalid proxy port \"%s\"", proxy_it);
++ free(proxy_host);
++ return EXIT_CONNECT_FAILED;
++ }
++ }
++ else
++ proxy_port = 1080;
++
++ ret = dcc_connect_by_name_real(proxy_host, proxy_port, p_fd);
++ free(proxy_host);
++ }
++
++ if (ret != 0)
++ return ret;
++
++ /* connected to proxy, now identifier/method selection */
++ buf[0] = 0x05; /* SOCKSv5 */
++ buf[1] = 0x01; /* one method */
++ buf[2] = 0x00; /* NO AUTHENTICATION REQUIRED */
++ ret = dcc_writex(*p_fd, buf, 3);
++ if (ret != 0)
++ return ret;
++
++ /* wait for method selection */
++ ret = dcc_readx(*p_fd, buf, 2);
++ if (ret != 0)
++ return ret;
++ if (buf[0] != 0x05 || buf[1] != 0x00) { /* version, method */
++ rs_log_error("invalid proxy reply (version 0x%02x, method 0x%02x)",
++ buf[0], buf[1]);
++ return EXIT_CONNECT_FAILED;
++ }
++
++ /* send connect request */
++ buf[0] = 0x05; /* SOCKSv5 */
++ buf[1] = 0x01; /* CONNECT command */
++ buf[2] = 0x00; /* reserved */
++ buf[3] = 0x03; /* DOMAINNAME address type */
++ buf[4] = host_length;
++ memcpy(&buf[5], host, host_length);
++ addr_buf.sin_port = htons(port);
++ memcpy(&buf[5 + host_length], &addr_buf.sin_port, 2);
++ ret = dcc_writex(*p_fd, buf, 7 + host_length);
++ if (ret != 0)
++ return ret;
++
++ /* wait for the connection */
++ /* read first 4 bytes of reply + 2 extra bytes we know will be there */
++ ret = dcc_readx(*p_fd, buf, 6);
++ if (ret != 0)
++ return ret;
++ if (buf[0] != 0x05 || buf[2] != 0x00) { /* version, reserved */
++ rs_log_error("invalid proxy reply (version 0x%02x, reserved 0x%02x)",
++ buf[0], buf[2]);
++ return EXIT_CONNECT_FAILED;
++ }
++ if (buf[1] != 0x00) { /* reply */
++ rs_log_error("proxy connection failed, reason=0x%02x", buf[1]);
++ return EXIT_CONNECT_FAILED;
++ }
++
++ /* now read the remaining (packet size - 6) bytes */
++ switch (buf[3]) { /* address type */
++ case 0x01: skip_bytes = 4; break; /* IPv4 */
++ case 0x03: skip_bytes = buf[4] + 1; break; /* hostname with length field */
++ case 0x04: skip_bytes = 16; break; /* IPv6 */
++ default:
++ rs_log_error("invalid proxy reply (address type 0x%02x)", buf[3]);
++ return EXIT_CONNECT_FAILED;
++ }
++ ret = dcc_readx(*p_fd, buf, skip_bytes);
++ if (ret != 0)
++ return ret;
++
++ return 0;
++}
++
++int dcc_connect_by_name(const char *host, int port, int *p_fd)
++{
++ const char *proxy;
++
++ proxy = getenv("DISTCC_SOCKS_PROXY");
++ if (proxy)
++ return dcc_connect_via_socks5(host, port, p_fd, proxy);
++ else
++ return dcc_connect_by_name_real(host, port, p_fd);
++}
+--
+2.3.0
+
diff --git a/sys-devel/distcc/files/distcc-as-needed.patch b/sys-devel/distcc/files/distcc-as-needed.patch
new file mode 100644
index 000000000000..6678e4d78d1a
--- /dev/null
+++ b/sys-devel/distcc/files/distcc-as-needed.patch
@@ -0,0 +1,17 @@
+Index: distcc-2.18.3/Makefile.in
+===================================================================
+--- distcc-2.18.3.orig/Makefile.in
++++ distcc-2.18.3/Makefile.in
+@@ -377,9 +377,9 @@ src/renderer.o: src/renderer.c
+ $(srcdir)/src/renderer.c
+
+ distccmon-gnome@EXEEXT@: $(mon_obj) $(gnome_obj)
+- $(CC) -o $@ $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) $(LIBS) \
+- $(GNOME_CFLAGS) $(GNOME_LIBS) \
+- $(mon_obj) $(gnome_obj)
++ $(CC) -o $@ $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) \
++ $(mon_obj) $(gnome_obj) \
++ $(LIBS) $(GNOME_CFLAGS) $(GNOME_LIBS)
+
+
+ ## Dist targets
diff --git a/sys-devel/distcc/files/distcc-avahi-configure.patch b/sys-devel/distcc/files/distcc-avahi-configure.patch
new file mode 100644
index 000000000000..cc1097d643d1
--- /dev/null
+++ b/sys-devel/distcc/files/distcc-avahi-configure.patch
@@ -0,0 +1,29 @@
+diff -ur distcc-2.18.3.old/configure.ac distcc-2.18.3/configure.ac
+--- distcc-2.18.3.old/configure.ac 2008-01-01 21:08:02.000000000 +0200
++++ distcc-2.18.3/configure.ac 2008-01-01 21:09:56.000000000 +0200
+@@ -387,14 +387,18 @@
+ [#include <sys/socket.h>])
+
+ dnl check for avahi
++AC_ARG_ENABLE(avahi, AC_HELP_STRING([--enable-avahi], [enable avahi support]), [], [enable_avahi=auto])
++ZEROCONF_DISTCC_OBJS=""
++ZEROCONF_DISTCCD_OBJS=""
+ PKG_CHECK_MODULES(AVAHI, [avahi-client >= 0.6.5],
+-[AC_DEFINE(HAVE_AVAHI, 1, [defined if Avahi is available])
+-CFLAGS="$CFLAGS $AVAHI_CFLAGS"
+-LIBS="$LIBS $AVAHI_LIBS"
+-ZEROCONF_DISTCC_OBJS="src/zeroconf.o src/gcc-id.o"
+-ZEROCONF_DISTCCD_OBJS="src/zeroconf-reg.o src/gcc-id.o"],
+-[ZEROCONF_DISTCC_OBJS=""
+-ZEROCONF_DISTCCD_OBJS=""])
++[if test x"${enable_avahi}" = x"yes" || test x"${enable_avahi}" = x"auto"; then
++ AC_DEFINE(HAVE_AVAHI, 1, [defined if Avahi is available])
++ CFLAGS="$CFLAGS $AVAHI_CFLAGS"
++ LIBS="$LIBS $AVAHI_LIBS"
++ ZEROCONF_DISTCC_OBJS="src/zeroconf.o src/gcc-id.o"
++ ZEROCONF_DISTCCD_OBJS="src/zeroconf-reg.o src/gcc-id.o"
++fi],
++[test x"${enable_avahi}" = x"yes" && AC_MSG_ERROR(avahi support needs avahi-client >= 0.6.5 installed)])
+ AC_SUBST(ZEROCONF_DISTCC_OBJS)
+ AC_SUBST(ZEROCONF_DISTCCD_OBJS)
+
diff --git a/sys-devel/distcc/files/distcc-config b/sys-devel/distcc/files/distcc-config
new file mode 100644
index 000000000000..c7e6622adc3b
--- /dev/null
+++ b/sys-devel/distcc/files/distcc-config
@@ -0,0 +1,165 @@
+#!/usr/bin/env python
+# Copyright 1999-2004 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+import os, re, signal, sys, commands, pwd
+from string import rstrip
+
+options=[
+ '--get-hosts',
+ '--set-hosts',
+ '--get-verbose',
+ '--set-verbose',
+ '--get-log',
+ '--set-log',
+ '--install',
+ '--help',
+ '--get-env',
+ '--set-env'
+]
+
+tmpcmdline=sys.argv[1:]
+cmdline=[]
+envfile = '/etc/env.d/02distcc'
+
+def exithandler(foo,bar):
+ os.kill(0,signal.SIGKILL)
+ sys.exit(1)
+
+signal.signal(signal.SIGINT,exithandler)
+
+def isroot(ret=0):
+ if os.getuid() != 0:
+ if ret == 0:
+ print '!!!',sys.argv[:1][0],tmpcmdline[0],'must be run as root'
+ sys.exit(1)
+ else:
+ retval = 0
+ else:
+ retval = 1
+ return retval
+
+def writeenv(var,value):
+ isroot()
+ distcc_env = []
+ distcc_env = open(envfile, 'r').readlines()
+ distcc_env_new = open(envfile, 'w')
+ for i in range(len(distcc_env)):
+ if re.compile(var+'="(.*)"').match(distcc_env[i]):
+ distcc_env[i] = var+'="'+value+'"\n'
+ distcc_env_new.write(distcc_env[i])
+ #print 'Set',var,'to:',value
+ os.popen('/usr/sbin/env-update')
+ print 'If you want to use these new settings in an existing shell,'
+ print 'you need to "source /etc/profile" to get the changes.'
+
+def readenv(var):
+ distcc_env = open(envfile, 'r').read()
+ match = re.compile(var+'="(.*)"').search(distcc_env)
+ if match:
+ print var+'='+match.group(1)
+ else:
+ print var,'not set.'
+
+def permissions(path,user,group):
+ for file in os.listdir(path):
+ #print 'Configuring',path+file+'...'
+ os.chown(path+file,user,group)
+
+def installlinks(chost=''):
+ for file in ['gcc', 'cc', 'c++', 'g++']:
+ path = '/usr/lib/distcc/bin/'
+ if not chost == '':
+ file = chost+'-'+file
+ if os.path.exists('/usr/bin/'+file):
+ #print 'Creating',path+file,'symlink...'
+ if not os.path.exists(path+file):
+ os.symlink('/usr/bin/distcc',path+file)
+ #else:
+ # print 'Already exists. Skipping...'
+
+def createdistccdir(dir):
+ if not os.path.exists(dir):
+ os.mkdir(dir)
+ os.chmod(dir, 1777)
+
+for x in tmpcmdline:
+ if not x:
+ continue
+ if x[0:2]=="--":
+ if not x in options:
+ print "!!! Error:",x,"is an invalid option."
+ sys.exit(1)
+ else:
+ cmdline = x
+
+if '--get-hosts' in tmpcmdline:
+ HOSTS_ENV = os.environ.get('DISTCC_HOSTS')
+ HOSTS_HOME = os.environ.get('HOME')+'/hosts'
+ if HOSTS_ENV:
+ print HOSTS_ENV
+ elif os.path.isfile(HOSTS_HOME) and os.path.getsize(HOSTS_HOME) != 0:
+ print HOSTS_HOME
+ elif os.path.exists('/etc/distcc/hosts'):
+ print rstrip(open('/etc/distcc/hosts', 'r').read())
+ else:
+ print 'No configuration file found. Setup your hosts with --set-hosts.'
+elif '--set-hosts' in tmpcmdline:
+ if isroot(1):
+ PATH = '/etc/distcc'
+ else:
+ PATH = os.environ.get('HOME')
+ createdistccdir(PATH)
+ open(PATH+'/hosts', 'w').write(cmdline + '\n')
+elif '--get-verbose' in tmpcmdline:
+ readenv('DISTCC_VERBOSE')
+elif '--set-verbose' in tmpcmdline:
+ writeenv('DISTCC_VERBOSE',tmpcmdline[1])
+elif '--get-log' in tmpcmdline:
+ readenv('DISTCC_LOG')
+elif '--set-log' in tmpcmdline:
+ writeenv('DISTCC_LOG',tmpcmdline[1])
+elif '--install' in tmpcmdline:
+ isroot()
+ print 'Creating',envfile+'...'
+ distcc_env = open(envfile, 'w')
+ distcc_env.write('# This file is managed by distcc-config; use it to change these settings.\n')
+ distcc_env.write('DISTCC_LOG=""\n')
+ distcc_env.write('DCCC_PATH="/usr/lib/distcc/bin"\n')
+ distcc_env.write('DISTCC_VERBOSE="0"\n')
+
+ if os.WEXITSTATUS(commands.getstatusoutput('/usr/sbin/useradd -u 240 -g daemon -s /bin/false -d /dev/null -c "distccd" distcc')[0]) == 9:
+ os.WEXITSTATUS(commands.getstatusoutput('/usr/sbin/usermod -g daemon -s /bin/false -d /dev/null -c "distccd" distcc')[0])
+
+ foobar = pwd.getpwnam('distcc')
+ user = foobar[2]
+ group = foobar[3]
+
+ makeconf = open('/etc/make.conf', 'r').read()
+ chost = re.compile('CHOST="(.*)"').search(makeconf).group(1)
+ print 'Creating symlinks...'
+ installlinks()
+ installlinks(chost)
+
+ print 'Checking permissions...'
+ permissions('/usr/lib/distcc/bin/',user,group)
+ permissions('/var/run/distccd/',user,group)
+elif '--get-env' in tmpcmdline:
+ if len(tmpcmdline) == 1:
+ print rstrip(open(envfile, 'r').read())
+ elif len(tmpcmdline) == 2:
+ readenv(tmpcmdline[1])
+ else:
+ print '!!! Error: Specify only one variable.'
+elif '--set-env' in tmpcmdline:
+ if len(tmpcmdline) > 2 and len(tmpcmdline) <= 3:
+ isroot()
+ writeenv(tmpcmdline[1],tmpcmdline[2])
+ else:
+ print '!!! Error: Awaiting two parameters.'
+else:
+ print 'Usage: /usr/bin/distcc-config --set-hosts DISTCC_HOSTS | --get-hosts'
+ print ' /usr/bin/distcc-config --set-verbose { 0 | 1 } | --get-verbose'
+ print ' /usr/bin/distcc-config --set-log FILE | --get-log'
+ print ' /usr/bin/distcc-config --set-env VARIABLE VALUE | --get-env [VARIABLE]'
diff --git a/sys-devel/distcc/files/distcc-config-3.2_rc1 b/sys-devel/distcc/files/distcc-config-3.2_rc1
new file mode 100644
index 000000000000..6f3bd27e40f0
--- /dev/null
+++ b/sys-devel/distcc/files/distcc-config-3.2_rc1
@@ -0,0 +1,181 @@
+#!/usr/bin/env python2
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+import os, re, signal, subprocess, sys
+
+options=[
+ '--get-hosts',
+ '--set-hosts',
+ '--get-verbose',
+ '--set-verbose',
+ '--get-log',
+ '--set-log',
+ '--update-masquerade',
+ '--update-masquerade-with-crossdev',
+ '--help',
+ '--get-env',
+ '--set-env'
+]
+
+tmpcmdline=sys.argv[1:]
+cmdline=[]
+
+eprefix = '@EPREFIX@'
+bindir = os.path.join(eprefix, 'usr', 'bin')
+sbindir = os.path.join(eprefix, 'usr', 'sbin')
+libdir = os.path.join(eprefix, '@libdir@')
+sysconfdir = os.path.join(eprefix, 'etc')
+
+gcc_config = os.path.join(bindir, 'gcc-config')
+env_update = os.path.join(sbindir, 'env-update')
+envfile = os.path.join(sysconfdir, 'env.d', '02distcc')
+default_distcc_dir = os.path.join(sysconfdir, 'distcc')
+hostfile = os.path.join(default_distcc_dir, 'hosts')
+distcc_path = os.path.join(bindir, 'distcc')
+dccc_dir = os.path.join(libdir, 'distcc', 'bin')
+
+def exithandler(foo,bar):
+ os.kill(0,signal.SIGKILL)
+ sys.exit(1)
+
+signal.signal(signal.SIGINT,exithandler)
+
+def isroot(ret=0):
+ if os.getuid() != 0:
+ if ret == 0:
+ print('!!! %s %s must be run as root' % (sys.argv[:1][0],tmpcmdline[0]))
+ sys.exit(1)
+ else:
+ retval = 0
+ else:
+ retval = 1
+ return retval
+
+def writeenv(var,value):
+ isroot()
+ distcc_env = []
+ distcc_env = open(envfile, 'r').readlines()
+ distcc_env_new = open(envfile, 'w')
+ for i in range(len(distcc_env)):
+ if re.compile(var+'="(.*)"').match(distcc_env[i]):
+ distcc_env[i] = var+'="'+value+'"\n'
+ distcc_env_new.write(distcc_env[i])
+ #print('Set %s to: %s ' % (var,value))
+ subprocess.Popen(env_update, shell=True)
+ print('If you want to use these new settings in an existing shell,')
+ print('you need to "source /etc/profile" to get the changes.')
+
+def readenv(var):
+ distcc_env = open(envfile, 'r').read()
+ match = re.compile(var+'="(.*)"').search(distcc_env)
+ if match:
+ print(var+'='+match.group(1))
+ else:
+ print(var,'not set.')
+
+def installlink(chost='', version=''):
+ for file in ['gcc', 'cc', 'c++', 'g++']:
+ if not chost == '':
+ file = '%s-%s' % (chost,file)
+ if not version == '':
+ file = '%s-%s' % (file,version)
+ path = os.path.join(dccc_dir,file)
+ if os.path.exists(os.path.join(bindir,file)):
+ if not os.path.exists(path):
+ print('Creating %s symlink...' % (path))
+ os.symlink(distcc_path,path)
+ #else:
+ # print('Already exists. Skipping...')
+
+def installlinks():
+ p = subprocess.Popen([gcc_config+" -C -l"], shell=True, stdout=subprocess.PIPE)
+ lines = p.stdout.read().rstrip().split('\n')
+ for line in lines:
+ columns = line.split()
+ if len(columns) >= 2:
+ matches = re.match("(.*)-(.*)", columns[1])
+ chost = matches.group(1)
+ version = matches.group(2)
+ installlink(chost)
+ installlink(chost, version)
+
+def uninstalllinks():
+ for root, dirs, files in os.walk(dccc_dir):
+ for file in files:
+ os.remove(os.path.join(root, file))
+
+def createdistccdir(dir):
+ if not os.path.exists(dir):
+ os.mkdir(dir)
+ os.chmod(dir, 0o755)
+
+for x in tmpcmdline:
+ if not x:
+ continue
+ if x[0:2]=="--":
+ if not x in options:
+ print("!!! Error: %s is an invalid option." % (x))
+ sys.exit(1)
+ else:
+ cmdline = x
+
+if '--get-hosts' in tmpcmdline:
+ HOSTS_ENV = os.environ.get('DISTCC_HOSTS')
+ HOSTS_HOME = os.path.join(os.environ.get('HOME'), '.distcc', 'hosts')
+ if HOSTS_ENV:
+ print(HOSTS_ENV)
+ elif os.path.isfile(HOSTS_HOME) and os.path.getsize(HOSTS_HOME) != 0:
+ print(HOSTS_HOME)
+ elif os.path.exists(hostfile):
+ print(open(hostfile, 'r').read().rstrip())
+ else:
+ print('No configuration file found. Setup your hosts with --set-hosts.')
+elif '--set-hosts' in tmpcmdline:
+ if isroot(1):
+ PATH = default_distcc_dir
+ else:
+ PATH = os.path.join(os.environ.get('HOME'), '.distcc')
+ createdistccdir(PATH)
+ open(os.path.join(PATH, 'hosts'), 'w').write(cmdline + '\n')
+elif '--get-verbose' in tmpcmdline:
+ readenv('DISTCC_VERBOSE')
+elif '--set-verbose' in tmpcmdline:
+ writeenv('DISTCC_VERBOSE',tmpcmdline[1])
+elif '--get-log' in tmpcmdline:
+ readenv('DISTCC_LOG')
+elif '--set-log' in tmpcmdline:
+ writeenv('DISTCC_LOG',tmpcmdline[1])
+elif '--update-masquerade' in tmpcmdline:
+ isroot()
+ uninstalllinks()
+ print('Creating symlinks...')
+ installlink()
+ installlinks()
+elif '--update-masquerade-with-crossdev' in tmpcmdline:
+ isroot()
+ uninstalllinks()
+ print('Creating symlinks...')
+ installlinks()
+elif '--get-env' in tmpcmdline:
+ if len(tmpcmdline) == 1:
+ print(open(envfile, 'r').read().rstrip())
+ elif len(tmpcmdline) == 2:
+ readenv(tmpcmdline[1])
+ else:
+ print('!!! Error: Specify only one variable.')
+elif '--set-env' in tmpcmdline:
+ if len(tmpcmdline) > 2 and len(tmpcmdline) <= 3:
+ isroot()
+ writeenv(tmpcmdline[1],tmpcmdline[2])
+ else:
+ print('!!! Error: Awaiting two parameters.')
+else:
+ cmd = sys.argv[:1][0]
+ print('Usage: %s --set-hosts DISTCC_HOSTS | --get-hosts' % (cmd))
+ print(' %s --set-verbose { 0 | 1 } | --get-verbose' % (cmd))
+ print(' %s --set-log FILE | --get-log' % (cmd))
+ print(' %s --set-env VARIABLE VALUE | --get-env [VARIABLE]' % (cmd))
+ print(' %s --update-masquerade' % (cmd))
+ print(' %s --update-masquerade-with-crossdev' % (cmd))
diff --git a/sys-devel/distcc/files/distcc-create-dir.patch b/sys-devel/distcc/files/distcc-create-dir.patch
new file mode 100644
index 000000000000..8c818e1bd8ac
--- /dev/null
+++ b/sys-devel/distcc/files/distcc-create-dir.patch
@@ -0,0 +1,56 @@
+* local directory is at mbp@sourcefrog.net--2004/distcc--devel--2--patch-183
+* comparing to mbp@sourcefrog.net--2004/distcc--devel--2--patch-183
+M ./src/tempfile.c
+
+* modified files
+
+--- orig/src/tempfile.c
++++ mod/src/tempfile.c
+@@ -145,7 +145,7 @@
+ int dcc_get_top_dir(char **path_ret)
+ {
+ char *env;
+- static char *cached;
++ static char *cached = NULL;
+ int ret;
+
+ if (cached) {
+@@ -154,22 +154,23 @@
+ }
+
+ if ((env = getenv("DISTCC_DIR"))) {
+- if ((cached = strdup(env)) == NULL) {
++
++ if ((cached = strdup(env)) == NULL)
+ return EXIT_OUT_OF_MEMORY;
+- } else {
++ else
+ *path_ret = cached;
+- return 0;
+- }
+- }
+
+- if ((env = getenv("HOME")) == NULL) {
+- rs_log_warning("HOME is not set; can't find distcc directory");
+- return EXIT_BAD_ARGUMENTS;
+- }
++ } else {
+
+- if (asprintf(path_ret, "%s/.distcc", env) == -1) {
+- rs_log_error("asprintf failed");
+- return EXIT_OUT_OF_MEMORY;
++ if ((env = getenv("HOME")) == NULL) {
++ rs_log_warning("HOME is not set; can't find distcc directory");
++ return EXIT_BAD_ARGUMENTS;
++ }
++
++ if (asprintf(path_ret, "%s/.distcc", env) == -1) {
++ rs_log_error("asprintf failed");
++ return EXIT_OUT_OF_MEMORY;
++ }
+ }
+
+ ret = dcc_mkdir(*path_ret);
+
+
+
diff --git a/sys-devel/distcc/files/distcc-freedesktop.patch b/sys-devel/distcc/files/distcc-freedesktop.patch
new file mode 100644
index 000000000000..26981097f2dc
--- /dev/null
+++ b/sys-devel/distcc/files/distcc-freedesktop.patch
@@ -0,0 +1,84 @@
+* local directory is at mbp@sourcefrog.net--2004/distcc--devel--2--patch-183
+* comparing to mbp@sourcefrog.net--2004/distcc--devel--2--patch-183
+M src/mon-gnome.c
+M Makefile.in
+M gnome/distccmon-gnome.desktop
+
+* modified files
+
+--- orig/Makefile.in
++++ mod/Makefile.in
+@@ -45,11 +45,12 @@
+ includedir = @includedir@
+ oldincludedir = /usr/include
+ docdir = @docdir@
+-pkgdatadir = $(datadir)/@PACKAGE_NAME@
++icondir = $(datadir)/pixmaps
++desktopdir = $(datadir)/applications
+
+ # These must be done from here, not from autoconf, because they can
+ # contain variable expansions written in Make syntax. Ew.
+-DIR_DEFS = -DSYSCONFDIR="\"${sysconfdir}\"" -DPKGDATADIR="\"${pkgdatadir}\""
++DIR_DEFS = -DSYSCONFDIR="\"${sysconfdir}\"" -DICONDIR="\"${icondir}\""
+
+ # arguments to pkgconfig
+ GNOME_PACKAGES = @GNOME_PACKAGES@
+@@ -508,7 +509,8 @@
+ @echo " documents $(DESTDIR)$(docdir)"
+ @echo " programs $(DESTDIR)$(bindir)"
+ @echo " system configuration $(DESTDIR)$(sysconfdir)"
+- @echo " shared data files $(DESTDIR)$(pkgdatadir)"
++ @echo " icons $(DESTDIR)$(icondir)"
++ @echo " .desktop file $(DESTDIR)$(desktopdir)"
+
+
+ # install-sh can't handle multiple arguments, but we don't need any
+@@ -541,8 +543,8 @@
+ done
+
+ install-gnome-data: $(gnome_data)
+- $(mkinstalldirs) $(DESTDIR)$(pkgdatadir)
+- for p in $^; do \
+- $(INSTALL_DATA) $$p $(DESTDIR)$(pkgdatadir) || exit 1; \
+- done
++ $(mkinstalldirs) $(DESTDIR)$(icondir)
++ $(mkinstalldirs) $(DESTDIR)$(desktopdir)
++ $(INSTALL_DATA) gnome/distccmon-gnome-icon.png $(DESTDIR)$(icondir)
++ $(INSTALL_DATA) gnome/distccmon-gnome.desktop $(DESTDIR)$(desktopdir)
+
+
+
+--- orig/gnome/distccmon-gnome.desktop
++++ mod/gnome/distccmon-gnome.desktop
+@@ -1,13 +1,11 @@
+ [Desktop Entry]
+-Version=0.9.4
+-Encoding=UTF-8
+ Exec=distccmon-gnome
+ Name=distcc monitor
+ GenericName=Distributed Compile Monitor
+ Comment=Graphical view of distributed compile tasks
+-Icon=distccmon-gnome-icon.png
++Icon=distccmon-gnome-icon
+ TryExec=distccmon-gnome
+ Terminal=false
+ Type=Application
+-Categories=GNOME;Application;Development;
++Categories=GNOME;Development;
+ StartupNotify=true
+
+
+--- orig/src/mon-gnome.c
++++ mod/src/mon-gnome.c
+@@ -599,7 +599,7 @@
+
+ #if GTK_CHECK_VERSION(2,2,0)
+ gtk_window_set_icon_from_file (GTK_WINDOW (mainwin),
+- PKGDATADIR "/distccmon-gnome-icon.png",
++ ICONDIR "/distccmon-gnome-icon.png",
+ NULL);
+ #endif
+
+
+
+
diff --git a/sys-devel/distcc/files/distcc-gentoo-multilib-r1.patch b/sys-devel/distcc/files/distcc-gentoo-multilib-r1.patch
new file mode 100644
index 000000000000..8a7b37e878bb
--- /dev/null
+++ b/sys-devel/distcc/files/distcc-gentoo-multilib-r1.patch
@@ -0,0 +1,146 @@
+diff -Naurp distcc-2.18.3.orig/src/distcc.c distcc-2.18.3/src/distcc.c
+--- distcc-2.18.3.orig/src/distcc.c 2004-10-01 17:47:07.000000000 -0700
++++ distcc-2.18.3/src/distcc.c 2005-01-30 22:15:43.883870942 -0800
+@@ -135,7 +135,106 @@ static void dcc_client_catch_signals(voi
+ signal(SIGHUP, &dcc_client_signalled);
+ }
+
++#define MAXNEWFLAGS 32
++#define MAXFLAGLEN 127
+
++static char **getNewArgv(char **argv, const char *newflagsStr) {
++ char **newargv;
++ char newflags[MAXNEWFLAGS][MAXFLAGLEN + 1];
++ unsigned newflagsCount = 0;
++ unsigned argc;
++ unsigned i;
++ char **p;
++
++ unsigned s, f; /* start/finish of each flag. f points to
++ * the char AFTER the end (ie the space/\0
++ */
++
++ /* Tokenize the flag list */
++ for(s=0; s < strlen(newflagsStr); s=f+1) {
++ /* Put s at the start of the next flag */
++ while(newflagsStr[s] == ' ' ||
++ newflagsStr[s] == '\t')
++ s++;
++ if(s == strlen(newflagsStr))
++ break;
++
++ f = s + 1;
++ while(newflagsStr[f] != ' ' &&
++ newflagsStr[f] != '\t' &&
++ newflagsStr[f] != '\0')
++ f++;
++
++ /* Detect overrun */
++ if(MAXFLAGLEN < f - s || MAXNEWFLAGS == newflagsCount)
++ return NULL;
++
++ strncpy(newflags[newflagsCount], newflagsStr + s, f - s);
++ newflags[newflagsCount][f - s]='\0';
++ newflagsCount++;
++ }
++
++ /* Calculate original argc and see if it contains -m{abi,32,64} */
++ for(argc=0, p=argv; *p; p++, argc++) {
++ if(newflagsCount && (strncmp(*p, "-m32", 4) == 0 ||
++ strncmp(*p, "-m64", 4) == 0 ||
++ strncmp(*p, "-mabi", 5) == 0)) {
++ /* Our command line sets the ABI, warn the user about this and ignore
++ newArgs by setting newflagsCount to 0.
++ */
++ newflagsCount = 0;
++ fprintf(stderr, "%s: %s detected on the command line overrides implicit %s added by the wrapper.\n", argv[0], *p, newflagsStr);
++ }
++ }
++
++ /* Allocate our array */
++ newargv = (char **)malloc(sizeof(char *) * (argc + newflagsCount + 1));
++
++ /* Make room for the original, new ones, and the NULL terminator */
++ if(!newargv)
++ return NULL;
++
++ /* Build argv */
++ newargv[0] = argv[0];
++
++ /* The newFlags come first since we want the environment to override them. */
++ for(i=1; i - 1 < newflagsCount; i++) {
++ newargv[i] = newflags[i - 1];
++ }
++
++ /* We just use the existing argv[i] as the start. */
++ for(; i - newflagsCount < argc; i++) {
++ newargv[i] = argv[i - newflagsCount];
++ }
++
++ /* And now cap it off... */
++ newargv[i] = NULL;
++
++ return newargv;
++}
++
++static char **getNewArgvFromEnv(char **argv) {
++ char **newargv = argv;
++
++ if(getenv("ABI")) {
++ char *envar = (char *)malloc(sizeof(char) * (strlen("CFLAGS_") + strlen(getenv("ABI")) + 1 ));
++
++ if(!envar)
++ return NULL;
++
++ /* We use CFLAGS_${ABI} for gcc, g++, g77, etc as they are
++ * the same no matter which compiler we are using.
++ */
++ sprintf(envar, "CFLAGS_%s", getenv("ABI"));
++
++ if(getenv(envar))
++ newargv = getNewArgv(argv, getenv(envar));
++
++ free(envar);
++ }
++
++ return newargv;
++}
+
+ /**
+ * distcc client entry point.
+@@ -150,6 +249,7 @@ int main(int argc, char **argv)
+ int status, sg_level, tweaked_path = 0;
+ char **compiler_args;
+ char *compiler_name;
++ char **newargv;
+ int ret;
+
+ dcc_client_catch_signals();
+@@ -183,7 +283,12 @@ int main(int argc, char **argv)
+ goto out;
+ }
+
+- dcc_find_compiler(argv, &compiler_args);
++ if(!(newargv = getNewArgvFromEnv(argv))) {
++ ret = EXIT_OUT_OF_MEMORY;
++ goto out;
++ }
++ dcc_find_compiler(newargv, &compiler_args);
++ if (newargv != argv) free(newargv);
+ /* compiler_args is now respectively either "cc -c hello.c" or
+ * "gcc -c hello.c" */
+
+@@ -200,7 +305,12 @@ int main(int argc, char **argv)
+ &tweaked_path)) != 0)
+ goto out;
+
+- dcc_copy_argv(argv, &compiler_args, 0);
++ if(!(newargv = getNewArgvFromEnv(argv))) {
++ ret = EXIT_OUT_OF_MEMORY;
++ goto out;
++ }
++ dcc_copy_argv(newargv, &compiler_args, 0);
++ if (newargv != argv) free(newargv);
+ compiler_args[0] = compiler_name;
+ }
+
diff --git a/sys-devel/distcc/files/distcc-gentoo-multilib.patch b/sys-devel/distcc/files/distcc-gentoo-multilib.patch
new file mode 100644
index 000000000000..02e0486c2a8b
--- /dev/null
+++ b/sys-devel/distcc/files/distcc-gentoo-multilib.patch
@@ -0,0 +1,126 @@
+diff -Naur distcc-2.18.3-vanilla/src/distcc.c distcc-2.18.3/src/distcc.c
+--- distcc-2.18.3-vanilla/src/distcc.c 2004-10-01 17:47:07.000000000 -0700
++++ distcc-2.18.3/src/distcc.c 2004-12-28 01:04:51.017574246 -0800
+@@ -135,7 +135,86 @@
+ signal(SIGHUP, &dcc_client_signalled);
+ }
+
++#define MAXNEWFLAGS 32
++#define MAXFLAGLEN 127
+
++static char **getNewArgv(char **argv) {
++ char **newargv;
++ char newflags[MAXNEWFLAGS][MAXFLAGLEN + 1];
++ unsigned newflagsCount = 0;
++ unsigned argc;
++ unsigned i;
++ char **p;
++
++ if(getenv("ABI")) {
++ char *envar = (char *)malloc(sizeof(char) *
++ (strlen("CFLAGS_") + strlen(getenv("ABI")) + 1 ));
++ if(!envar)
++ return NULL;
++
++ /* We use CFLAGS_${ABI} for gcc, g++, g77, etc as they are
++ * the same no matter which compiler we are using.
++ */
++ sprintf(envar, "CFLAGS_%s", getenv("ABI"));
++
++ if(getenv(envar)) {
++ const char *newflagsStr = getenv(envar);
++ unsigned s, f; /* start/finish of each flag. f points to
++ * the char AFTER the end (ie the space/\0
++ */
++
++ /* Tokenize the flag list */
++ for(s=0; s < strlen(newflagsStr); s=f+1) {
++ /* Put s at the start of the next flag */
++ while(newflagsStr[s] == ' ' ||
++ newflagsStr[s] == '\t')
++ s++;
++ if(s == strlen(newflagsStr))
++ break;
++
++ f = s + 1;
++ while(newflagsStr[f] != ' ' &&
++ newflagsStr[f] != '\t' &&
++ newflagsStr[f] != '\0')
++ f++;
++
++ /* Detect overrun */
++ if(MAXFLAGLEN < f - s || MAXNEWFLAGS == newflagsCount)
++ return NULL;
++
++ strncpy(newflags[newflagsCount], newflagsStr + s, f - s);
++ newflagsCount++;
++ }
++ }
++
++ free(envar);
++ }
++
++ /* Calculate argc */
++ for(argc=0, p=argv; *p; p++, argc++);
++
++ /* Allocate our array */
++ newargv = (char **)malloc(sizeof(char *) * (argc + newflagsCount + 1));
++
++ /* Make room for the original, new ones, and the NULL terminator */
++ if(!newargv)
++ return NULL;
++
++ /* We just use the existing argv[i] as the start. */
++ for(i=0; i < argc; i++) {
++ newargv[i] = argv[i];
++ }
++
++ /* Now we want to append our newflags list. */
++ for(; i < argc + newflagsCount; i++) {
++ newargv[i] = newflags[i - argc];
++ }
++
++ /* And now cap it off... */
++ newargv[i] = NULL;
++
++ return newargv;
++}
+
+ /**
+ * distcc client entry point.
+@@ -150,6 +229,7 @@
+ int status, sg_level, tweaked_path = 0;
+ char **compiler_args;
+ char *compiler_name;
++ char **newargv;
+ int ret;
+
+ dcc_client_catch_signals();
+@@ -183,7 +263,12 @@
+ goto out;
+ }
+
+- dcc_find_compiler(argv, &compiler_args);
++ if(!(newargv = getNewArgv(argv))) {
++ ret = EXIT_OUT_OF_MEMORY;
++ goto out;
++ }
++ dcc_find_compiler(newargv, &compiler_args);
++ free(newargv);
+ /* compiler_args is now respectively either "cc -c hello.c" or
+ * "gcc -c hello.c" */
+
+@@ -200,7 +285,12 @@
+ &tweaked_path)) != 0)
+ goto out;
+
+- dcc_copy_argv(argv, &compiler_args, 0);
++ if(!(newargv = getNewArgv(argv))) {
++ ret = EXIT_OUT_OF_MEMORY;
++ goto out;
++ }
++ dcc_copy_argv(newargv, &compiler_args, 0);
++ free(newargv);
+ compiler_args[0] = compiler_name;
+ }
+
diff --git a/sys-devel/distcc/files/distcc-hardened.patch b/sys-devel/distcc/files/distcc-hardened.patch
new file mode 100644
index 000000000000..69b3a6516936
--- /dev/null
+++ b/sys-devel/distcc/files/distcc-hardened.patch
@@ -0,0 +1,24 @@
+From: Gordon Malm <gengor@gentoo.org>
+
+Make distcc client pass -D__KERNEL__ macro. Hardened GCC uses this
+macro to determine if code intended to be run in-kernel is being compiled.
+If the code is kernel code, certain compile flags are not applied.
+
+When using distcc to build kernel code (modules, etc.) without this patch,
+the distccd host doesn't get passed -D__KERNEL__. Consequently, gcc on
+the distccd host applies all kinds of flags that it shouldn't.
+
+--- distcc-2.18.3/src/strip.c
++++ distcc-2.18.3-hardened/src/strip.c
+@@ -73,7 +73,10 @@ int dcc_strip_local_args(char **from, ch
+ /* skip through argv, copying all arguments but skipping ones that
+ * ought to be omitted */
+ for (from_i = to_i = 0; from[from_i]; from_i++) {
+- if (str_equal("-D", from[from_i])
++ if (str_equal("-D__KERNEL__", from[from_i])) {
++ to[to_i++] = from[from_i];
++ }
++ else if (str_equal("-D", from[from_i])
+ || str_equal("-I", from[from_i])
+ || str_equal("-U", from[from_i])
+ || str_equal("-L", from[from_i])
diff --git a/sys-devel/distcc/files/distcc-march-native.patch b/sys-devel/distcc/files/distcc-march-native.patch
new file mode 100644
index 000000000000..a5c9bb2e4da1
--- /dev/null
+++ b/sys-devel/distcc/files/distcc-march-native.patch
@@ -0,0 +1,16 @@
+diff -ur distcc-2.18.3/src/arg.c distcc-modified/src/arg.c
+--- distcc-2.18.3/src/arg.c 2004-11-30 13:13:53.000000000 +0100
++++ distcc-modified/src/arg.c 2008-02-05 17:56:58.000000000 +0100
+@@ -171,6 +171,12 @@
+ to distribute it even if we could. */
+ rs_trace("%s implies -E (maybe) and must be local", a);
+ return EXIT_DISTCC_FAILED;
++ } else if (!strcmp(a, "-march=native")) {
++ rs_trace("-march=native generates code for local machine; must be local");
++ return EXIT_DISTCC_FAILED;
++ } else if (!strcmp(a, "-mtune=native")) {
++ rs_trace("-mtune=native optimizes for local machine; must be local");
++ return EXIT_DISTCC_FAILED;
+ } else if (str_startswith("-Wa,", a)) {
+ /* Look for assembler options that would produce output
+ * files and must be local.
diff --git a/sys-devel/distcc/files/distccd.service b/sys-devel/distcc/files/distccd.service
new file mode 100644
index 000000000000..3eb61396b84c
--- /dev/null
+++ b/sys-devel/distcc/files/distccd.service
@@ -0,0 +1,10 @@
+[Unit]
+Description=Distccd: A Distributed Compilation Server
+After=network.target
+
+[Service]
+User=distcc
+ExecStart=/usr/bin/distccd --verbose --no-detach --daemon --port 3632 -N 15 --allow $ALLOWED_SERVERS
+
+[Install]
+WantedBy=multi-user.target
diff --git a/sys-devel/distcc/files/distccd.service.conf b/sys-devel/distcc/files/distccd.service.conf
new file mode 100644
index 000000000000..a334c3724b96
--- /dev/null
+++ b/sys-devel/distcc/files/distccd.service.conf
@@ -0,0 +1,6 @@
+# --allow is now mandatory as of distcc-2.18.
+# example: --allow 192.168.0.0/24
+# example: --allow 192.168.0.5 --allow 192.168.0.150
+
+[Service]
+Environment="ALLOWED_SERVERS=127.0.0.1"
diff --git a/sys-devel/distcc/metadata.xml b/sys-devel/distcc/metadata.xml
new file mode 100644
index 000000000000..3dcc309a3965
--- /dev/null
+++ b/sys-devel/distcc/metadata.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <herd>cluster</herd>
+ <longdescription lang="en">
+ Distcc is a program to distribute compilation of C code across several
+ machines on a network.
+ </longdescription>
+ <use>
+ <flag name="crossdev">Enable support for <pkg>sys-devel/crossdev</pkg></flag>
+ <flag name="gssapi">Enable support for <pkg>net-libs/libgssglue</pkg></flag>
+ </use>
+</pkgmetadata>