Gentoo Archives: gentoo-dev

From: "Michał Górny" <mgorny@g.o>
To: gentoo-dev@l.g.o
Cc: cluster@g.o, robbat2@g.o, toolchain@g.o, suse@g.o, llvm@g.o, "Michał Górny" <mgorny@g.o>
Subject: [gentoo-dev] [PATCH 05/12] sys-devel/distcc: Convert to EAPI=6
Date: Thu, 17 Aug 2017 08:39:37
Message-Id: 20170817083641.3507-6-mgorny@gentoo.org
In Reply to: [gentoo-dev] [RFC] [PATCH] dev-util/shadowman: Unified tool to update ccache/distcc/icecc shadow dir by "Michał Górny"
1 ---
2 sys-devel/distcc/distcc-3.2_rc1-r5.ebuild | 199 ++++++++++++++++++++++++++++++
3 1 file changed, 199 insertions(+)
4 create mode 100644 sys-devel/distcc/distcc-3.2_rc1-r5.ebuild
5
6 diff --git a/sys-devel/distcc/distcc-3.2_rc1-r5.ebuild b/sys-devel/distcc/distcc-3.2_rc1-r5.ebuild
7 new file mode 100644
8 index 000000000000..741fa929f503
9 --- /dev/null
10 +++ b/sys-devel/distcc/distcc-3.2_rc1-r5.ebuild
11 @@ -0,0 +1,199 @@
12 +# Copyright 1999-2017 Gentoo Foundation
13 +# Distributed under the terms of the GNU General Public License v2
14 +
15 +EAPI=6
16 +
17 +PYTHON_COMPAT=( python2_7 )
18 +
19 +inherit autotools flag-o-matic python-single-r1 systemd toolchain-funcs user xdg-utils
20 +
21 +MY_P="${P/_}"
22 +DESCRIPTION="Distribute compilation of C code across several machines on a network"
23 +HOMEPAGE="http://distcc.org/"
24 +SRC_URI="https://distcc.googlecode.com/files/${MY_P}.tar.bz2"
25 +
26 +LICENSE="GPL-2"
27 +SLOT="0"
28 +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~sparc-fbsd ~x86-fbsd"
29 +IUSE="crossdev gnome gssapi gtk hardened ipv6 selinux xinetd zeroconf"
30 +
31 +RESTRICT="test"
32 +
33 +CDEPEND="${PYTHON_DEPS}
34 + dev-libs/popt
35 + gnome? (
36 + >=gnome-base/libgnome-2
37 + >=gnome-base/libgnomeui-2
38 + x11-libs/gtk+:2
39 + x11-libs/pango
40 + )
41 + gssapi? ( net-libs/libgssglue )
42 + gtk? ( x11-libs/gtk+:2 )
43 + zeroconf? ( >=net-dns/avahi-0.6[dbus] )
44 +"
45 +DEPEND="${CDEPEND}
46 + virtual/pkgconfig"
47 +RDEPEND="${CDEPEND}
48 + !net-misc/pump
49 + >=sys-devel/gcc-config-1.4.1
50 + selinux? ( sec-policy/selinux-distcc )
51 + xinetd? ( sys-apps/xinetd )"
52 +
53 +REQUIRED_USE="${PYTHON_REQUIRED_USE}"
54 +
55 +S="${WORKDIR}/${MY_P}"
56 +
57 +DCCC_PATH="/usr/$(get_libdir)/distcc/bin"
58 +DISTCC_VERBOSE="0"
59 +
60 +pkg_setup() {
61 + enewuser distcc 240 -1 -1 daemon
62 + python-single-r1_pkg_setup
63 +}
64 +
65 +src_prepare() {
66 + eapply "${FILESDIR}/${PN}-3.0-xinetd.patch"
67 + # bug #253786
68 + eapply "${FILESDIR}/${PN}-3.0-fix-fortify.patch"
69 + # bug #255188
70 + eapply "${FILESDIR}/${PN}-3.2_rc1-freedesktop.patch"
71 + # bug #258364
72 + eapply "${FILESDIR}/${PN}-3.2_rc1-python.patch"
73 + # for net-libs/libgssglue
74 + eapply "${FILESDIR}/${PN}-3.2_rc1-gssapi.patch"
75 + # SOCKSv5 support needed for Portage, bug #537616
76 + eapply "${FILESDIR}/${PN}-3.2_rc1-socks5.patch"
77 + eapply_user
78 +
79 + # Bugs #120001, #167844 and probably more. See patch for description.
80 + use hardened && eapply "${FILESDIR}/distcc-hardened.patch"
81 +
82 + sed -i \
83 + -e "/PATH/s:\$distcc_location:${EPREFIX}${DCCC_PATH}:" \
84 + -e "s:@PYTHON@:${EPYTHON}:" \
85 + pump.in || die "sed failed"
86 +
87 + sed \
88 + -e "s:@EPREFIX@:${EPREFIX:-/}:" \
89 + -e "s:@libdir@:/usr/$(get_libdir):" \
90 + "${FILESDIR}/3.2/distcc-config" > "${T}/distcc-config" || die
91 +
92 + eaclocal -Im4 --output=aclocal.m4
93 + eautoconf
94 +}
95 +
96 +src_configure() {
97 + local myconf="--disable-Werror --with-docdir=\$(datadir)/doc/${PF}"
98 +
99 + # --disable-rfc2553 b0rked, bug #254176
100 + use ipv6 && myconf="${myconf} --enable-rfc2553"
101 +
102 + econf \
103 + $(use_with gtk) \
104 + $(use_with gnome) \
105 + $(use_with gssapi auth) \
106 + $(use_with zeroconf avahi) \
107 + ${myconf}
108 +}
109 +
110 +src_install() {
111 + default
112 + python_optimize
113 +
114 + newinitd "${FILESDIR}/3.2/init" distccd
115 + systemd_dounit "${FILESDIR}/distccd.service"
116 + systemd_install_serviced "${FILESDIR}/distccd.service.conf"
117 +
118 + cp "${FILESDIR}/3.2/conf" "${T}/distccd" || die
119 + if use zeroconf; then
120 + cat >> "${T}/distccd" <<-EOF || die
121 +
122 + # Enable zeroconf support in distccd
123 + DISTCCD_OPTS="\${DISTCCD_OPTS} --zeroconf"
124 + EOF
125 +
126 + sed -i '/ExecStart/ s|$| --zeroconf|' "${D}$(systemd_get_systemunitdir)"/distccd.service || die
127 + fi
128 + doconfd "${T}/distccd" || die
129 +
130 + cat > "${T}/02distcc" <<-EOF || die
131 + # This file is managed by distcc-config; use it to change these settings.
132 + # DISTCC_LOG and DISTCC_DIR should not be set.
133 + DISTCC_VERBOSE="${DISTCC_VERBOSE:-0}"
134 + DISTCC_FALLBACK="${DISTCC_FALLBACK:-1}"
135 + DISTCC_SAVE_TEMPS="${DISTCC_SAVE_TEMPS:-0}"
136 + DISTCC_TCP_CORK="${DISTCC_TCP_CORK}"
137 + DISTCC_SSH="${DISTCC_SSH}"
138 + UNCACHED_ERR_FD="${UNCACHED_ERR_FD}"
139 + DISTCC_ENABLE_DISCREPANCY_EMAIL="${DISTCC_ENABLE_DISCREPANCY_EMAIL}"
140 + DCC_EMAILLOG_WHOM_TO_BLAME="${DCC_EMAILLOG_WHOM_TO_BLAME}"
141 + EOF
142 + doenvd "${T}/02distcc" || die
143 +
144 + keepdir "${DCCC_PATH}" || die
145 +
146 + dobin "${T}/distcc-config" || die
147 +
148 + if use gnome || use gtk; then
149 + einfo "Renaming /usr/bin/distccmon-gnome to /usr/bin/distccmon-gui"
150 + einfo "This is to have a little sensability in naming schemes between distccmon programs"
151 + mv "${ED}/usr/bin/distccmon-gnome" "${ED}/usr/bin/distccmon-gui" || die
152 + dosym distccmon-gui /usr/bin/distccmon-gnome || die
153 + fi
154 +
155 + if use xinetd; then
156 + insinto /etc/xinetd.d || die
157 + newins "doc/example/xinetd" distcc || die
158 + fi
159 +
160 + rm -r "${ED}/etc/default" || die
161 + rm "${ED}/etc/distcc/clients.allow" || die
162 + rm "${ED}/etc/distcc/commands.allow.sh" || die
163 +}
164 +
165 +pkg_postinst() {
166 + if [ -x "${EPREFIX}/usr/bin/distcc-config" ] ; then
167 + if use crossdev; then
168 + "${EPREFIX}/usr/bin/distcc-config" --update-masquerade-with-crossdev
169 + else
170 + "${EPREFIX}/usr/bin/distcc-config" --update-masquerade
171 + fi
172 + fi
173 +
174 + use gnome && xdg_desktop_database_update
175 +
176 + elog
177 + elog "Tips on using distcc with Gentoo can be found at"
178 + elog "https://wiki.gentoo.org/wiki/Distcc"
179 + elog
180 + elog "How to use pump mode with Gentoo:"
181 + elog "# distcc-config --set-hosts \"foo,cpp,lzo bar,cpp,lzo baz,cpp,lzo\""
182 + elog "# echo 'FEATURES=\"\${FEATURES} distcc distcc-pump\"' >> /etc/portage/make.conf"
183 + elog "# emerge -u world"
184 + elog
185 + elog "To use the distccmon programs with Gentoo you should use this command:"
186 + elog "# DISTCC_DIR=\"${DISTCC_DIR:-${BUILD_PREFIX}/.distcc}\" distccmon-text 5"
187 +
188 + if use gnome || use gtk; then
189 + elog "Or:"
190 + elog "# DISTCC_DIR=\"${DISTCC_DIR:-${BUILD_PREFIX}/.distcc}\" distccmon-gnome"
191 + fi
192 +
193 + elog
194 + elog "***SECURITY NOTICE***"
195 + elog "If you are upgrading distcc please make sure to run etc-update to"
196 + elog "update your /etc/conf.d/distccd and /etc/init.d/distccd files with"
197 + elog "added security precautions (the --listen and --allow directives)"
198 + elog
199 +}
200 +
201 +pkg_postrm() {
202 + # delete the masquerade directory
203 + if [ ! -f "${EPREFIX}/usr/bin/distcc" ] ; then
204 + einfo "Remove masquerade symbolic links."
205 + rm "${EPREFIX}${DCCC_PATH}/"*{cc,c++,gcc,g++}
206 + rmdir "${EPREFIX}${DCCC_PATH}"
207 + fi
208 +
209 + use gnome && xdg_desktop_database_update
210 +}
211 --
212 2.14.1