1 # Copyright 1999-2019 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
6 PYTHON_COMPAT=( python3_{5,6} )
8 inherit flag-o-matic python-single-r1 systemd toolchain-funcs user xdg-utils prefix
11 DESCRIPTION="Distribute compilation of C code across several machines on a network"
12 HOMEPAGE="http://distcc.org/"
13 SRC_URI="https://github.com/${PN}/${PN}/releases/download/v${PV}/${P}.tar.gz"
17 KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sparc ~x86"
18 IUSE="gnome gssapi gtk hardened ipv6 selinux xinetd zeroconf"
22 CDEPEND="${PYTHON_DEPS}
25 >=gnome-base/libgnome-2
26 >=gnome-base/libgnomeui-2
30 gssapi? ( net-libs/libgssglue )
31 gtk? ( x11-libs/gtk+:2 )
32 zeroconf? ( >=net-dns/avahi-0.6[dbus] )
35 sys-libs/binutils-libs
40 >=sys-devel/gcc-config-1.4.1
41 selinux? ( sec-policy/selinux-distcc )
42 xinetd? ( sys-apps/xinetd )"
44 REQUIRED_USE="${PYTHON_REQUIRED_USE}"
46 S="${WORKDIR}/${MY_P}"
49 enewuser distcc 240 -1 -1 daemon
50 python-single-r1_pkg_setup
54 eapply "${FILESDIR}/${PN}-3.0-xinetd.patch"
56 eapply "${FILESDIR}/${PN}-3.2_rc1-freedesktop.patch"
57 # SOCKSv5 support needed for Portage, bug #537616
58 eapply "${FILESDIR}/${PN}-3.2_rc1-socks5.patch"
61 # Bugs #120001, #167844 and probably more. See patch for description.
62 use hardened && eapply "${FILESDIR}/distcc-hardened.patch"
65 -e "/PATH/s:\$distcc_location:${EPREFIX}/usr/lib/distcc/bin:" \
66 -e "s:@PYTHON@:${EPYTHON}:" \
67 pump.in || die "sed failed"
70 -e "s:@EPREFIX@:${EPREFIX:-/}:" \
71 -e "s:@libdir@:/usr/lib:" \
72 "${FILESDIR}/3.2/distcc-config" > "${T}/distcc-config" || die
74 hprefixify update-distcc-symlinks.py src/{serve,daemon}.c
82 $(use_with gssapi auth)
83 $(use_with zeroconf avahi)
86 # --disable-rfc2553 b0rked, bug #254176
87 use ipv6 && myconf+=(--enable-rfc2553)
93 # override GZIP_BIN to stop it from compressing manpages
94 emake DESTDIR="${D}" GZIP_BIN=false install
97 newinitd "${FILESDIR}/3.2/init" distccd
98 systemd_dounit "${FILESDIR}/distccd.service"
99 systemd_install_serviced "${FILESDIR}/distccd.service.conf"
101 cp "${FILESDIR}/3.2/conf" "${T}/distccd" || die
102 if use zeroconf; then
103 cat >> "${T}/distccd" <<-EOF || die
105 # Enable zeroconf support in distccd
106 DISTCCD_OPTS="\${DISTCCD_OPTS} --zeroconf"
109 sed -i '/ExecStart/ s|$| --zeroconf|' "${D}$(systemd_get_systemunitdir)"/distccd.service || die
111 doconfd "${T}/distccd"
113 newenvd - 02distcc <<-EOF || die
114 # This file is managed by distcc-config; use it to change these settings.
115 # DISTCC_LOG and DISTCC_DIR should not be set.
116 DISTCC_VERBOSE="${DISTCC_VERBOSE:-0}"
117 DISTCC_FALLBACK="${DISTCC_FALLBACK:-1}"
118 DISTCC_SAVE_TEMPS="${DISTCC_SAVE_TEMPS:-0}"
119 DISTCC_TCP_CORK="${DISTCC_TCP_CORK}"
120 DISTCC_SSH="${DISTCC_SSH}"
121 UNCACHED_ERR_FD="${UNCACHED_ERR_FD}"
122 DISTCC_ENABLE_DISCREPANCY_EMAIL="${DISTCC_ENABLE_DISCREPANCY_EMAIL}"
123 DCC_EMAILLOG_WHOM_TO_BLAME="${DCC_EMAILLOG_WHOM_TO_BLAME}"
126 keepdir /usr/lib/distcc
128 dobin "${T}/distcc-config"
130 if use gnome || use gtk; then
131 einfo "Renaming /usr/bin/distccmon-gnome to /usr/bin/distccmon-gui"
132 einfo "This is to have a little sensability in naming schemes between distccmon programs"
133 mv "${ED}/usr/bin/distccmon-gnome" "${ED}/usr/bin/distccmon-gui" || die
134 dosym distccmon-gui /usr/bin/distccmon-gnome
138 insinto /etc/xinetd.d
139 newins "doc/example/xinetd" distcc
142 insinto /usr/share/shadowman/tools
143 newins - distcc <<<"${EPREFIX}/usr/lib/distcc/bin"
144 newins - distccd <<<"${EPREFIX}/usr/lib/distcc"
146 rm -r "${ED}/etc/default" || die
147 rm "${ED}/etc/distcc/clients.allow" || die
148 rm "${ED}/etc/distcc/commands.allow.sh" || die
152 # remove the old paths when switching from libXX to lib
153 if [[ $(get_libdir) != lib && ${SYMLINK_LIB} != yes && \
154 -d ${EROOT%/}/usr/$(get_libdir)/distcc ]]; then
155 rm -r -f "${EROOT%/}/usr/$(get_libdir)/distcc" || die
158 if [[ ${ROOT} == / ]]; then
159 eselect compiler-shadow update distcc
160 eselect compiler-shadow update distccd
163 use gnome && xdg_desktop_database_update
166 elog "Tips on using distcc with Gentoo can be found at"
167 elog "https://wiki.gentoo.org/wiki/Distcc"
169 elog "distcc-pump is known to cause breakage with multiple packages."
170 elog "Do NOT enable it globally."
172 elog "To use the distccmon programs with Gentoo you should use this command:"
173 elog "# DISTCC_DIR=\"${DISTCC_DIR:-${BUILD_PREFIX}/.distcc}\" distccmon-text 5"
175 if use gnome || use gtk; then
177 elog "# DISTCC_DIR=\"${DISTCC_DIR:-${BUILD_PREFIX}/.distcc}\" distccmon-gnome"
181 elog "***SECURITY NOTICE***"
182 elog "Since distcc-3.3, whitelist is used for what distccd could execute. The whilelist"
183 elog "has been generated by compiler-shadow distccd. To revert to the old behavior, "
184 elog "you need to pass --make-me-a-botnet to distccd in /etc/conf.d/distccd."
185 elog "Cf. https://github.com/distcc/distcc/pull/243."
189 if [[ -z ${REPLACED_BY_VERSION} && ${ROOT} == / ]]; then
190 eselect compiler-shadow remove distcc
195 use gnome && xdg_desktop_database_update