1 # Copyright 1999-2015 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
7 PYTHON_COMPAT=( python2_7 )
9 inherit eutils fdo-mime flag-o-matic multilib python-single-r1 systemd toolchain-funcs user
11 DESCRIPTION="Distribute compilation of C code across several machines on a network"
12 HOMEPAGE="http://distcc.org/"
13 SRC_URI="https://distcc.googlecode.com/files/${P}.tar.bz2"
17 KEYWORDS="alpha amd64 arm arm64 hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~sparc-fbsd ~x86-fbsd"
18 IUSE="avahi gtk hardened ipv6 selinux xinetd"
22 CDEPEND="${PYTHON_DEPS}
24 avahi? ( >=net-dns/avahi-0.6[dbus] )
25 gtk? ( x11-libs/gtk+:2 )"
30 >=sys-devel/gcc-config-1.4.1
31 selinux? ( sec-policy/selinux-distcc )
32 xinetd? ( sys-apps/xinetd )"
34 REQUIRED_USE="${PYTHON_REQUIRED_USE}"
37 DCCC_PATH="/usr/$(get_libdir)/distcc/bin"
41 enewuser distcc 240 -1 -1 daemon
42 python-single-r1_pkg_setup
46 epatch "${FILESDIR}/${PN}-3.0-xinetd.patch"
48 epatch "${FILESDIR}/${PN}-3.0-fix-fortify.patch"
50 epatch "${FILESDIR}/${P}-freedesktop.patch"
52 epatch "${FILESDIR}/${P}-python.patch"
54 epatch "${FILESDIR}/${P}-argc-fix.patch"
57 sed -i -e "/PATH/s:\$distcc_location:${DCCC_PATH}:" pump.in || die
59 # Bugs #120001, #167844 and probably more. See patch for description.
60 use hardened && epatch "${FILESDIR}/distcc-hardened.patch"
64 local myconf="--disable-Werror --with-docdir=/usr/share/doc/${PF}"
66 [ "$(gcc-major-version)" = "2" ] && filter-lfs-flags
68 # --disable-rfc2553 b0rked, bug #254176
69 use ipv6 && myconf="${myconf} --enable-rfc2553"
78 # In rare cases, parallel make install failed
82 dobin "${FILESDIR}/3.0/distcc-config"
84 newinitd "${FILESDIR}/${PV}/init" distccd
85 systemd_dounit "${FILESDIR}/distccd.service"
86 systemd_install_serviced "${FILESDIR}/distccd.service.conf"
88 cp "${FILESDIR}/3.1/conf" "${T}/distccd" || die
90 cat >> "${T}/distccd" <<-EOF
92 # Enable zeroconf support in distccd
93 DISTCCD_OPTS="\${DISTCCD_OPTS} --zeroconf"
96 sed -i '/ExecStart/ s|$| --zeroconf|' "${ED}"/usr/lib/systemd/system/distccd.service || die
98 doconfd "${T}/distccd"
100 cat > "${T}/02distcc" <<-EOF
101 # This file is managed by distcc-config; use it to change these settings.
102 DISTCC_LOG="${DISTCC_LOG}"
103 DCCC_PATH="${DCCC_PATH}"
104 DISTCC_VERBOSE="${DISTCC_VERBOSE}"
106 doenvd "${T}/02distcc"
108 # create the masquerade directory
110 for f in cc c++ gcc g++; do
111 dosym /usr/bin/distcc "${DCCC_PATH}/${f}"
112 if [ "${f}" != "cc" ]; then
113 dosym /usr/bin/distcc "${DCCC_PATH}/${CTARGET:-${CHOST}}-${f}"
117 # create the distccd pid directory
118 keepdir /var/run/distccd
119 fowners distcc:daemon /var/run/distccd
122 einfo "Renaming /usr/bin/distccmon-gnome to /usr/bin/distccmon-gui"
123 einfo "This is to have a little sensability in naming schemes between distccmon programs"
124 mv "${ED}/usr/bin/distccmon-gnome" "${ED}/usr/bin/distccmon-gui" || die
125 dosym distccmon-gui /usr/bin/distccmon-gnome
129 insinto /etc/xinetd.d
130 newins "doc/example/xinetd" distcc
133 rm -rf "${ED}/etc/default" || die
134 rm -f "${ED}/etc/distcc/clients.allow" || die
135 rm -f "${ED}/etc/distcc/commands.allow.sh" || die
137 python_fix_shebang "${ED}"
142 use gtk && fdo-mime_desktop_database_update
146 elog "IPv6 is not supported yet by ${P}."
149 elog "Tips on using distcc with Gentoo can be found at"
150 elog "https://wiki.gentoo.org/wiki/Distcc"
152 elog "How to use pump mode with Gentoo:"
153 elog "# distcc-config --set-hosts \"foo,cpp,lzo bar,cpp,lzo baz,cpp,lzo\""
154 elog "# pump emerge -u world"
156 elog "To use the distccmon programs with Gentoo you should use this command:"
157 elog "# DISTCC_DIR=\"${DISTCC_DIR}\" distccmon-text 5"
161 elog "# DISTCC_DIR=\"${DISTCC_DIR}\" distccmon-gnome"
165 elog "***SECURITY NOTICE***"
166 elog "If you are upgrading distcc please make sure to run etc-update to"
167 elog "update your /etc/conf.d/distccd and /etc/init.d/distccd files with"
168 elog "added security precautions (the --listen and --allow directives)"
173 use gtk && fdo-mime_desktop_database_update