Gentoo Archives: gentoo-commits

From: Lars Wendler <polynomial-c@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: net-print/cups/
Date: Sat, 14 Dec 2019 11:26:58
Message-Id: 1576322807.16b21623f1919a44dd48a7aa49271fd2b0260cb0.polynomial-c@gentoo
1 commit: 16b21623f1919a44dd48a7aa49271fd2b0260cb0
2 Author: Lars Wendler <polynomial-c <AT> gentoo <DOT> org>
3 AuthorDate: Sat Dec 14 11:26:26 2019 +0000
4 Commit: Lars Wendler <polynomial-c <AT> gentoo <DOT> org>
5 CommitDate: Sat Dec 14 11:26:47 2019 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=16b21623
7
8 net-print/cups: Security bump to versions 2.2.13 and 2.3.1
9
10 CVE-2019-2228
11
12 Bug: https://bugs.gentoo.org/702826
13 Package-Manager: Portage-2.3.81, Repoman-2.3.20
14 Signed-off-by: Lars Wendler <polynomial-c <AT> gentoo.org>
15
16 net-print/cups/Manifest | 2 +
17 net-print/cups/cups-2.2.13.ebuild | 339 ++++++++++++++++++++++++++++++++++++++
18 net-print/cups/cups-2.3.1.ebuild | 336 +++++++++++++++++++++++++++++++++++++
19 3 files changed, 677 insertions(+)
20
21 diff --git a/net-print/cups/Manifest b/net-print/cups/Manifest
22 index c4d4ef2a259..0cf1f648f85 100644
23 --- a/net-print/cups/Manifest
24 +++ b/net-print/cups/Manifest
25 @@ -1,2 +1,4 @@
26 DIST cups-2.2.12-source.tar.gz 10409313 BLAKE2B 126ea81f7108b3b62f5e062ed522898dd48d4e5b4077c834e8fe89012445dd0a903bafa62f593551ed5f1c92cce4fbd22f56834e0615ed65ca4a6ae84dc2ca1c SHA512 b8e7be512938ad388d469d093ad0c882ab42ea1408c27a91340f8424aa0e79e588df3d59795624973b89074a2af650fa9b5b6ed5224138b17e4c6dbbcbf0a2e6
27 +DIST cups-2.2.13-source.tar.gz 10410121 BLAKE2B 662ad7fe95a9cb82748a6035cf61bad8a823656522259fc8eafe4426cc57541beb29da9116174f9d6750ec207eacb83ab4e314021506d6a342577f03ff25b0cd SHA512 dc323bdcec86f11ec98e4881c540aa8be24f82d289c8a4f866e42bfd6f107b686346f1418b6347b3794dabac3c23d6e604e212aa8e169879c58b746fb1bc490d
28 DIST cups-2.3.0-source.tar.gz 8129049 BLAKE2B 738dbc7ee5ddcc9ffee44083cd93d8a0e75f4d3bf0b704dd643dc59db2cc2381dd65f676c0979bc65fee03438d160d9d650ceb93f8c702102eb1449d306a81a3 SHA512 c51f173b5fbae1554a3f4a3786fb3b5566e50d9f775473788ee3553922ac7e02e4785492c87c93fd46f159f50d97cc10ff6feafb3397cd9c1840840f3a9cdfae
29 +DIST cups-2.3.1-source.tar.gz 8135891 BLAKE2B fab46dfeb8a1846c4d8c8a1c166b465e72928ecc5b52dedd9d6a6328619f6eda822a85da9545c405b7bc7375acd2f2677497b94ab00735979487417537438831 SHA512 e3f3ad9e78c1c723d46cc2276957ac67495483882f639421203d9dad227eacbb1259717a92489e710995fdc89e2d575202e4b43117aff08ff1230dcf06674376
30
31 diff --git a/net-print/cups/cups-2.2.13.ebuild b/net-print/cups/cups-2.2.13.ebuild
32 new file mode 100644
33 index 00000000000..b6b538b9e4f
34 --- /dev/null
35 +++ b/net-print/cups/cups-2.2.13.ebuild
36 @@ -0,0 +1,339 @@
37 +# Copyright 1999-2019 Gentoo Authors
38 +# Distributed under the terms of the GNU General Public License v2
39 +
40 +EAPI=7
41 +
42 +PYTHON_COMPAT=( python2_7 )
43 +
44 +inherit autotools flag-o-matic linux-info xdg multilib-minimal pam python-single-r1 user java-pkg-opt-2 systemd toolchain-funcs
45 +
46 +MY_P="${P/_rc/rc}"
47 +MY_P="${MY_P/_beta/b}"
48 +MY_PV="${PV/_rc/rc}"
49 +MY_PV="${MY_PV/_beta/b}"
50 +
51 +if [[ ${PV} == *9999 ]]; then
52 + inherit git-r3
53 + EGIT_REPO_URI="https://github.com/apple/cups.git"
54 + if [[ ${PV} != 9999 ]]; then
55 + EGIT_BRANCH=branch-${PV/.9999}
56 + fi
57 +else
58 + #SRC_URI="https://github.com/apple/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz"
59 + SRC_URI="https://github.com/apple/cups/releases/download/v${PV}/${P}-source.tar.gz"
60 + KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~m68k-mint"
61 +fi
62 +
63 +DESCRIPTION="The Common Unix Printing System"
64 +HOMEPAGE="https://www.cups.org/"
65 +
66 +LICENSE="GPL-2"
67 +SLOT="0"
68 +IUSE="acl dbus debug java kerberos lprng-compat pam python selinux +ssl static-libs systemd +threads usb X xinetd zeroconf"
69 +
70 +CDEPEND="
71 + app-text/libpaper
72 + sys-libs/zlib
73 + acl? (
74 + kernel_linux? (
75 + sys-apps/acl
76 + sys-apps/attr
77 + )
78 + )
79 + dbus? ( >=sys-apps/dbus-1.6.18-r1[${MULTILIB_USEDEP}] )
80 + java? ( >=virtual/jre-1.6:* )
81 + kerberos? ( >=virtual/krb5-0-r1[${MULTILIB_USEDEP}] )
82 + !lprng-compat? ( !net-print/lprng )
83 + pam? ( sys-libs/pam )
84 + python? ( ${PYTHON_DEPS} )
85 + ssl? ( >=net-libs/gnutls-2.12.23-r6:0=[${MULTILIB_USEDEP}] )
86 + systemd? ( sys-apps/systemd )
87 + usb? ( virtual/libusb:1 )
88 + X? ( x11-misc/xdg-utils )
89 + xinetd? ( sys-apps/xinetd )
90 + zeroconf? ( >=net-dns/avahi-0.6.31-r2[${MULTILIB_USEDEP}] )
91 +"
92 +
93 +DEPEND="${CDEPEND}"
94 +BDEPEND="
95 + acct-group/lp
96 + >=virtual/pkgconfig-0-r1[${MULTILIB_USEDEP}]
97 +"
98 +
99 +RDEPEND="${CDEPEND}
100 + acct-group/lp
101 + selinux? ( sec-policy/selinux-cups )
102 +"
103 +
104 +PDEPEND=">=net-print/cups-filters-1.0.43"
105 +
106 +REQUIRED_USE="
107 + python? ( ${PYTHON_REQUIRED_USE} )
108 + usb? ( threads )
109 +"
110 +
111 +# upstream includes an interactive test which is a nono for gentoo
112 +RESTRICT="test"
113 +
114 +# systemd-socket.patch from Fedora
115 +PATCHES=(
116 + "${FILESDIR}/${PN}-2.2.0-dont-compress-manpages.patch"
117 + "${FILESDIR}/${PN}-2.2.6-fix-install-perms.patch"
118 + "${FILESDIR}/${PN}-1.4.4-nostrip.patch"
119 + "${FILESDIR}/${PN}-2.0.2-rename-systemd-service-files.patch"
120 + "${FILESDIR}/${PN}-2.0.1-xinetd-installation-fix.patch"
121 +)
122 +
123 +MULTILIB_CHOST_TOOLS=(
124 + /usr/bin/cups-config
125 +)
126 +
127 +pkg_setup() {
128 + #enewgroup lp -> acct-group/lp
129 + enewuser lp -1 -1 -1 lp
130 + enewgroup lpadmin 106
131 +
132 + use python && python-single-r1_pkg_setup
133 +
134 + if use kernel_linux; then
135 + linux-info_pkg_setup
136 + if ! linux_config_exists; then
137 + ewarn "Can't check the linux kernel configuration."
138 + ewarn "You might have some incompatible options enabled."
139 + else
140 + # recheck that we don't have usblp to collide with libusb; this should now work in most cases (bug 501122)
141 + if use usb; then
142 + if linux_chkconfig_present USB_PRINTER; then
143 + elog "Your USB printers will be managed via libusb. In case you run into problems, "
144 + elog "please try disabling USB_PRINTER support in your kernel or blacklisting the"
145 + elog "usblp kernel module."
146 + elog "Alternatively, just disable the usb useflag for cups (your printer will still work)."
147 + fi
148 + else
149 + #here we should warn user that he should enable it so he can print
150 + if ! linux_chkconfig_present USB_PRINTER; then
151 + ewarn "If you plan to use USB printers you should enable the USB_PRINTER"
152 + ewarn "support in your kernel."
153 + ewarn "Please enable it:"
154 + ewarn " CONFIG_USB_PRINTER=y"
155 + ewarn "in /usr/src/linux/.config or"
156 + ewarn " Device Drivers --->"
157 + ewarn " USB support --->"
158 + ewarn " [*] USB Printer support"
159 + ewarn "Alternatively, enable the usb useflag for cups and use the libusb code."
160 + fi
161 + fi
162 + fi
163 + fi
164 +}
165 +
166 +src_prepare() {
167 + default
168 +
169 + # Remove ".SILENT" rule for verbose output (bug 524338).
170 + sed 's#^.SILENT:##g' -i "${S}"/Makedefs.in || die "sed failed"
171 +
172 + # Fix install-sh, posix sh does not have 'function'.
173 + sed 's#function gzipcp#gzipcp()#g' -i "${S}/install-sh"
174 +
175 + AT_M4DIR=config-scripts eaclocal
176 + eautoconf
177 +
178 + # custom Makefiles
179 + multilib_copy_sources
180 +}
181 +
182 +multilib_src_configure() {
183 + export DSOFLAGS="${LDFLAGS}"
184 +
185 + einfo LINGUAS=\"${LINGUAS}\"
186 +
187 + # explicitly specify compiler wrt bug 524340
188 + #
189 + # need to override KRB5CONFIG for proper flags
190 + # https://github.com/apple/cups/issues/4423
191 + local myeconfargs=(
192 + CC="$(tc-getCC)"
193 + CXX="$(tc-getCXX)"
194 + KRB5CONFIG="${EPREFIX}"/usr/bin/${CHOST}-krb5-config
195 + --libdir="${EPREFIX}"/usr/$(get_libdir)
196 + --localstatedir="${EPREFIX}"/var
197 + --with-exe-file-perm=755
198 + --with-rundir="${EPREFIX}"/run/cups
199 + --with-cups-user=lp
200 + --with-cups-group=lp
201 + --with-docdir="${EPREFIX}"/usr/share/cups/html
202 + --with-languages="${LINGUAS}"
203 + --with-system-groups=lpadmin
204 + --with-xinetd="${EPREFIX}"/etc/xinetd.d
205 + $(multilib_native_use_enable acl)
206 + $(use_enable dbus)
207 + $(use_enable debug)
208 + $(use_enable debug debug-guards)
209 + $(use_enable debug debug-printfs)
210 + $(multilib_native_use_with java)
211 + $(use_enable kerberos gssapi)
212 + $(multilib_native_use_enable pam)
213 + $(multilib_native_use_with python python "${PYTHON}")
214 + $(use_enable static-libs static)
215 + $(use_enable threads)
216 + $(use_enable ssl gnutls)
217 + $(use_enable systemd)
218 + $(multilib_native_use_enable usb libusb)
219 + $(use_enable zeroconf avahi)
220 + --disable-dnssd
221 + --without-perl
222 + --without-php
223 + $(multilib_is_native_abi && echo --enable-libpaper || echo --disable-libpaper)
224 + )
225 +
226 + if tc-is-static-only; then
227 + myeconfargs+=(
228 + --disable-shared
229 + )
230 + fi
231 +
232 + econf "${myeconfargs[@]}"
233 +
234 + # install in /usr/libexec always, instead of using /usr/lib/cups, as that
235 + # makes more sense when facing multilib support.
236 + sed -i -e "s:SERVERBIN.*:SERVERBIN = \"\$\(BUILDROOT\)${EPREFIX}/usr/libexec/cups\":" Makedefs || die
237 + sed -i -e "s:#define CUPS_SERVERBIN.*:#define CUPS_SERVERBIN \"${EPREFIX}/usr/libexec/cups\":" config.h || die
238 + sed -i -e "s:cups_serverbin=.*:cups_serverbin=\"${EPREFIX}/usr/libexec/cups\":" cups-config || die
239 +
240 + # additional path corrections needed for prefix, see bug 597728
241 + sed \
242 + -e "s:ICONDIR.*:ICONDIR = ${EPREFIX}/usr/share/icons:" \
243 + -e "s:INITDIR.*:INITDIR = ${EPREFIX}/etc:" \
244 + -e "s:DBUSDIR.*:DBUSDIR = ${EPREFIX}/etc/dbus-1:" \
245 + -e "s:MENUDIR.*:MENUDIR = ${EPREFIX}/usr/share/applications:" \
246 + -i Makedefs || die
247 +}
248 +
249 +multilib_src_compile() {
250 + if multilib_is_native_abi; then
251 + default
252 + else
253 + emake libs
254 + fi
255 +}
256 +
257 +multilib_src_test() {
258 + multilib_is_native_abi && default
259 +}
260 +
261 +multilib_src_install() {
262 + if multilib_is_native_abi; then
263 + emake BUILDROOT="${D}" install
264 + else
265 + emake BUILDROOT="${D}" install-libs install-headers
266 + dobin cups-config
267 + fi
268 +}
269 +
270 +multilib_src_install_all() {
271 + dodoc {CHANGES,CREDITS,README}.md
272 +
273 + # move the default config file to docs
274 + dodoc "${ED}"/etc/cups/cupsd.conf.default
275 + rm -f "${ED}"/etc/cups/cupsd.conf.default
276 +
277 + # clean out cups init scripts
278 + rm -rf "${ED}"/etc/{init.d/cups,rc*,pam.d/cups}
279 +
280 + # install our init script
281 + local neededservices=(
282 + $(usex zeroconf avahi-daemon '')
283 + $(usex dbus dbus '')
284 + )
285 + [[ -n ${neededservices[@]} ]] && neededservices="need ${neededservices[@]}"
286 + cp "${FILESDIR}"/cupsd.init.d-r3 "${T}"/cupsd || die
287 + sed -i \
288 + -e "s/@neededservices@/${neededservices}/" \
289 + "${T}"/cupsd || die
290 + doinitd "${T}"/cupsd
291 +
292 + # install our pam script
293 + pamd_mimic_system cups auth account
294 +
295 + if use xinetd ; then
296 + # correct path
297 + sed -i \
298 + -e "s:server = .*:server = /usr/libexec/cups/daemon/cups-lpd:" \
299 + "${ED}"/etc/xinetd.d/cups-lpd || die
300 + # it is safer to disable this by default, bug #137130
301 + grep -w 'disable' "${ED}"/etc/xinetd.d/cups-lpd || \
302 + { sed -i -e "s:}:\tdisable = yes\n}:" "${ED}"/etc/xinetd.d/cups-lpd || die ; }
303 + # write permission for file owner (root), bug #296221
304 + fperms u+w /etc/xinetd.d/cups-lpd
305 + else
306 + # always configure with --with-xinetd= and clean up later,
307 + # bug #525604
308 + rm -rf "${ED}"/etc/xinetd.d
309 + fi
310 +
311 + keepdir /usr/libexec/cups/driver /usr/share/cups/{model,profiles} \
312 + /var/log/cups /var/spool/cups/tmp
313 +
314 + keepdir /etc/cups/{interfaces,ppd,ssl}
315 +
316 + if ! use X ; then
317 + rm -r "${ED}"/usr/share/applications || die
318 + fi
319 +
320 + # create /etc/cups/client.conf, bug #196967 and #266678
321 + echo "ServerName ${EPREFIX}/run/cups/cups.sock" >> "${ED}"/etc/cups/client.conf
322 +
323 + # the following file is now provided by cups-filters:
324 + rm -r "${ED}"/usr/share/cups/banners || die
325 +
326 + # the following are created by the init script
327 + rm -r "${ED}"/var/cache/cups || die
328 + rm -r "${ED}"/run || die
329 +
330 + # for the special case of running lprng and cups together, bug 467226
331 + if use lprng-compat ; then
332 + rm -fv "${ED}"/usr/bin/{lp*,cancel}
333 + rm -fv "${ED}"/usr/sbin/lp*
334 + rm -fv "${ED}"/usr/share/man/man1/{lp*,cancel*}
335 + rm -fv "${ED}"/usr/share/man/man8/lp*
336 + ewarn "Not installing lp... binaries, since the lprng-compat useflag is set."
337 + ewarn "Unless you plan to install an exotic server setup, you most likely"
338 + ewarn "do not want this. Disable the useflag then and all will be fine."
339 + fi
340 +}
341 +
342 +pkg_preinst() {
343 + xdg_pkg_preinst
344 +}
345 +
346 +pkg_postinst() {
347 + # Update desktop file database and gtk icon cache (bug 370059)
348 + xdg_pkg_postinst
349 +
350 + local v
351 +
352 + for v in ${REPLACING_VERSIONS}; do
353 + if ! ver_test ${v} -ge 2.2.2-r2 ; then
354 + echo
355 + ewarn "The cupsd init script switched to using pidfiles. Shutting down"
356 + ewarn "cupsd will fail the next time. To fix this, please run once as root"
357 + ewarn " killall cupsd ; /etc/init.d/cupsd zap ; /etc/init.d/cupsd start"
358 + echo
359 + break
360 + fi
361 + done
362 +
363 + for v in ${REPLACING_VERSIONS}; do
364 + echo
365 + elog "For information about installing a printer and general cups setup"
366 + elog "take a look at: https://wiki.gentoo.org/wiki/Printing"
367 + echo
368 + break
369 + done
370 +}
371 +
372 +pkg_postrm() {
373 + # Update desktop file database and gtk icon cache (bug 370059)
374 + xdg_pkg_postrm
375 +}
376
377 diff --git a/net-print/cups/cups-2.3.1.ebuild b/net-print/cups/cups-2.3.1.ebuild
378 new file mode 100644
379 index 00000000000..46eed692790
380 --- /dev/null
381 +++ b/net-print/cups/cups-2.3.1.ebuild
382 @@ -0,0 +1,336 @@
383 +# Copyright 1999-2019 Gentoo Authors
384 +# Distributed under the terms of the GNU General Public License v2
385 +
386 +EAPI=7
387 +
388 +PYTHON_COMPAT=( python2_7 )
389 +
390 +inherit autotools flag-o-matic linux-info xdg multilib-minimal pam user systemd toolchain-funcs
391 +
392 +MY_PV="${PV/_rc/rc}"
393 +MY_PV="${MY_PV/_beta/b}"
394 +MY_P="${PN}-${MY_PV}"
395 +
396 +if [[ ${PV} == *9999 ]]; then
397 + inherit git-r3
398 + EGIT_REPO_URI="https://github.com/apple/cups.git"
399 + if [[ ${PV} != 9999 ]]; then
400 + EGIT_BRANCH=branch-${PV/.9999}
401 + fi
402 +else
403 + #SRC_URI="https://github.com/apple/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz"
404 + SRC_URI="https://github.com/apple/cups/releases/download/v${MY_PV}/${MY_P}-source.tar.gz"
405 + if [[ "${PV}" != *_beta* ]] && [[ "${PV}" != *_rc* ]] ; then
406 + KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~m68k-mint"
407 + fi
408 +fi
409 +
410 +DESCRIPTION="The Common Unix Printing System"
411 +HOMEPAGE="https://www.cups.org/"
412 +
413 +LICENSE="Apache-2.0"
414 +SLOT="0"
415 +IUSE="acl dbus debug kerberos lprng-compat pam selinux +ssl static-libs systemd +threads usb X xinetd zeroconf"
416 +
417 +CDEPEND="
418 + app-text/libpaper
419 + sys-libs/zlib
420 + acl? (
421 + kernel_linux? (
422 + sys-apps/acl
423 + sys-apps/attr
424 + )
425 + )
426 + dbus? ( >=sys-apps/dbus-1.6.18-r1[${MULTILIB_USEDEP}] )
427 + kerberos? ( >=virtual/krb5-0-r1[${MULTILIB_USEDEP}] )
428 + !lprng-compat? ( !net-print/lprng )
429 + pam? ( sys-libs/pam )
430 + ssl? ( >=net-libs/gnutls-2.12.23-r6:0=[${MULTILIB_USEDEP}] )
431 + systemd? ( sys-apps/systemd )
432 + usb? ( virtual/libusb:1 )
433 + X? ( x11-misc/xdg-utils )
434 + xinetd? ( sys-apps/xinetd )
435 + zeroconf? ( >=net-dns/avahi-0.6.31-r2[${MULTILIB_USEDEP}] )
436 +"
437 +
438 +DEPEND="${CDEPEND}"
439 +BDEPEND="
440 + acct-group/lp
441 + >=virtual/pkgconfig-0-r1[${MULTILIB_USEDEP}]
442 +"
443 +
444 +RDEPEND="${CDEPEND}
445 + acct-group/lp
446 + selinux? ( sec-policy/selinux-cups )
447 +"
448 +
449 +PDEPEND=">=net-print/cups-filters-1.0.43"
450 +
451 +REQUIRED_USE="
452 + usb? ( threads )
453 +"
454 +
455 +# upstream includes an interactive test which is a nono for gentoo
456 +RESTRICT="test"
457 +
458 +# systemd-socket.patch from Fedora
459 +PATCHES=(
460 + "${FILESDIR}/${PN}-2.2.6-fix-install-perms.patch"
461 + "${FILESDIR}/${PN}-1.4.4-nostrip.patch"
462 + "${FILESDIR}/${PN}-2.0.2-rename-systemd-service-files.patch"
463 + "${FILESDIR}/${PN}-2.0.1-xinetd-installation-fix.patch"
464 +)
465 +
466 +MULTILIB_CHOST_TOOLS=(
467 + /usr/bin/cups-config
468 +)
469 +
470 +S="${WORKDIR}/${MY_P}"
471 +
472 +pkg_setup() {
473 + #enewgroup lp -> acct-group/lp
474 + enewuser lp -1 -1 -1 lp
475 + enewgroup lpadmin 106
476 +
477 + if use kernel_linux; then
478 + linux-info_pkg_setup
479 + if ! linux_config_exists; then
480 + ewarn "Can't check the linux kernel configuration."
481 + ewarn "You might have some incompatible options enabled."
482 + else
483 + # recheck that we don't have usblp to collide with libusb; this should now work in most cases (bug 501122)
484 + if use usb; then
485 + if linux_chkconfig_present USB_PRINTER; then
486 + elog "Your USB printers will be managed via libusb. In case you run into problems, "
487 + elog "please try disabling USB_PRINTER support in your kernel or blacklisting the"
488 + elog "usblp kernel module."
489 + elog "Alternatively, just disable the usb useflag for cups (your printer will still work)."
490 + fi
491 + else
492 + #here we should warn user that he should enable it so he can print
493 + if ! linux_chkconfig_present USB_PRINTER; then
494 + ewarn "If you plan to use USB printers you should enable the USB_PRINTER"
495 + ewarn "support in your kernel."
496 + ewarn "Please enable it:"
497 + ewarn " CONFIG_USB_PRINTER=y"
498 + ewarn "in /usr/src/linux/.config or"
499 + ewarn " Device Drivers --->"
500 + ewarn " USB support --->"
501 + ewarn " [*] USB Printer support"
502 + ewarn "Alternatively, enable the usb useflag for cups and use the libusb code."
503 + fi
504 + fi
505 + fi
506 + fi
507 +}
508 +
509 +src_prepare() {
510 + default
511 +
512 + # Remove ".SILENT" rule for verbose output (bug 524338).
513 + sed 's#^.SILENT:##g' -i "${S}"/Makedefs.in || die "sed failed"
514 +
515 + # Fix install-sh, posix sh does not have 'function'.
516 + sed 's#function gzipcp#gzipcp()#g' -i "${S}/install-sh"
517 +
518 + # Do not add -Werror even for live ebuilds
519 + sed '/WARNING_OPTIONS/s@-Werror@@' \
520 + -i config-scripts/cups-compiler.m4 || die
521 +
522 + AT_M4DIR=config-scripts eaclocal
523 + eautoconf
524 +
525 + # custom Makefiles
526 + multilib_copy_sources
527 +}
528 +
529 +multilib_src_configure() {
530 + export DSOFLAGS="${LDFLAGS}"
531 +
532 + einfo LINGUAS=\"${LINGUAS}\"
533 +
534 + # explicitly specify compiler wrt bug 524340
535 + #
536 + # need to override KRB5CONFIG for proper flags
537 + # https://github.com/apple/cups/issues/4423
538 + local myeconfargs=(
539 + CC="$(tc-getCC)"
540 + CXX="$(tc-getCXX)"
541 + KRB5CONFIG="${EPREFIX}"/usr/bin/${CHOST}-krb5-config
542 + --libdir="${EPREFIX}"/usr/$(get_libdir)
543 + --localstatedir="${EPREFIX}"/var
544 + --with-exe-file-perm=755
545 + --with-rundir="${EPREFIX}"/run/cups
546 + --with-cups-user=lp
547 + --with-cups-group=lp
548 + --with-docdir="${EPREFIX}"/usr/share/cups/html
549 + --with-languages="${LINGUAS}"
550 + --with-system-groups=lpadmin
551 + --with-xinetd="${EPREFIX}"/etc/xinetd.d
552 + $(multilib_native_use_enable acl)
553 + $(use_enable dbus)
554 + $(use_enable debug)
555 + $(use_enable debug debug-guards)
556 + $(use_enable debug debug-printfs)
557 + $(use_enable kerberos gssapi)
558 + $(multilib_native_use_enable pam)
559 + $(use_enable static-libs static)
560 + $(use_enable threads)
561 + $(use_enable ssl gnutls)
562 + $(use_enable systemd)
563 + $(multilib_native_use_enable usb libusb)
564 + $(use_enable zeroconf avahi)
565 + --disable-dnssd
566 + $(multilib_is_native_abi && echo --enable-libpaper || echo --disable-libpaper)
567 + )
568 +
569 + if tc-is-static-only; then
570 + myeconfargs+=(
571 + --disable-shared
572 + )
573 + fi
574 +
575 + econf "${myeconfargs[@]}"
576 +
577 + # install in /usr/libexec always, instead of using /usr/lib/cups, as that
578 + # makes more sense when facing multilib support.
579 + sed -i -e "s:SERVERBIN.*:SERVERBIN = \"\$\(BUILDROOT\)${EPREFIX}/usr/libexec/cups\":" Makedefs || die
580 + sed -i -e "s:#define CUPS_SERVERBIN.*:#define CUPS_SERVERBIN \"${EPREFIX}/usr/libexec/cups\":" config.h || die
581 + sed -i -e "s:cups_serverbin=.*:cups_serverbin=\"${EPREFIX}/usr/libexec/cups\":" cups-config || die
582 +
583 + # additional path corrections needed for prefix, see bug 597728
584 + sed \
585 + -e "s:ICONDIR.*:ICONDIR = ${EPREFIX}/usr/share/icons:" \
586 + -e "s:INITDIR.*:INITDIR = ${EPREFIX}/etc:" \
587 + -e "s:DBUSDIR.*:DBUSDIR = ${EPREFIX}/etc/dbus-1:" \
588 + -e "s:MENUDIR.*:MENUDIR = ${EPREFIX}/usr/share/applications:" \
589 + -i Makedefs || die
590 +}
591 +
592 +multilib_src_compile() {
593 + if multilib_is_native_abi; then
594 + default
595 + else
596 + emake libs
597 + fi
598 +}
599 +
600 +multilib_src_test() {
601 + multilib_is_native_abi && default
602 +}
603 +
604 +multilib_src_install() {
605 + if multilib_is_native_abi; then
606 + emake BUILDROOT="${D}" install
607 + else
608 + emake BUILDROOT="${D}" install-libs install-headers
609 + dobin cups-config
610 + fi
611 +}
612 +
613 +multilib_src_install_all() {
614 + dodoc {CHANGES,CREDITS,README}.md
615 +
616 + # move the default config file to docs
617 + dodoc "${ED}"/etc/cups/cupsd.conf.default
618 + rm -f "${ED}"/etc/cups/cupsd.conf.default
619 +
620 + # clean out cups init scripts
621 + rm -rf "${ED}"/etc/{init.d/cups,rc*,pam.d/cups}
622 +
623 + # install our init script
624 + local neededservices=(
625 + $(usex zeroconf avahi-daemon '')
626 + $(usex dbus dbus '')
627 + )
628 + [[ -n ${neededservices[@]} ]] && neededservices="need ${neededservices[@]}"
629 + cp "${FILESDIR}"/cupsd.init.d-r3 "${T}"/cupsd || die
630 + sed -i \
631 + -e "s/@neededservices@/${neededservices}/" \
632 + "${T}"/cupsd || die
633 + doinitd "${T}"/cupsd
634 +
635 + # install our pam script
636 + pamd_mimic_system cups auth account
637 +
638 + if use xinetd ; then
639 + # correct path
640 + sed -i \
641 + -e "s:server = .*:server = /usr/libexec/cups/daemon/cups-lpd:" \
642 + "${ED}"/etc/xinetd.d/cups-lpd || die
643 + # it is safer to disable this by default, bug #137130
644 + grep -w 'disable' "${ED}"/etc/xinetd.d/cups-lpd || \
645 + { sed -i -e "s:}:\tdisable = yes\n}:" "${ED}"/etc/xinetd.d/cups-lpd || die ; }
646 + # write permission for file owner (root), bug #296221
647 + fperms u+w /etc/xinetd.d/cups-lpd
648 + else
649 + # always configure with --with-xinetd= and clean up later,
650 + # bug #525604
651 + rm -rf "${ED}"/etc/xinetd.d
652 + fi
653 +
654 + keepdir /usr/libexec/cups/driver /usr/share/cups/{model,profiles} \
655 + /var/log/cups /var/spool/cups/tmp
656 +
657 + keepdir /etc/cups/{interfaces,ppd,ssl}
658 +
659 + if ! use X ; then
660 + rm -r "${ED}"/usr/share/applications || die
661 + fi
662 +
663 + # create /etc/cups/client.conf, bug #196967 and #266678
664 + echo "ServerName ${EPREFIX}/run/cups/cups.sock" >> "${ED}"/etc/cups/client.conf
665 +
666 + # the following file is now provided by cups-filters:
667 + rm -r "${ED}"/usr/share/cups/banners || die
668 +
669 + # the following are created by the init script
670 + rm -r "${ED}"/var/cache/cups || die
671 + rm -r "${ED}"/run || die
672 +
673 + # for the special case of running lprng and cups together, bug 467226
674 + if use lprng-compat ; then
675 + rm -fv "${ED}"/usr/bin/{lp*,cancel}
676 + rm -fv "${ED}"/usr/sbin/lp*
677 + rm -fv "${ED}"/usr/share/man/man1/{lp*,cancel*}
678 + rm -fv "${ED}"/usr/share/man/man8/lp*
679 + ewarn "Not installing lp... binaries, since the lprng-compat useflag is set."
680 + ewarn "Unless you plan to install an exotic server setup, you most likely"
681 + ewarn "do not want this. Disable the useflag then and all will be fine."
682 + fi
683 +}
684 +
685 +pkg_preinst() {
686 + xdg_pkg_preinst
687 +}
688 +
689 +pkg_postinst() {
690 + # Update desktop file database and gtk icon cache (bug 370059)
691 + xdg_pkg_postinst
692 +
693 + local v
694 +
695 + for v in ${REPLACING_VERSIONS}; do
696 + if ! ver_test ${v} -ge 2.2.2-r2 ; then
697 + echo
698 + ewarn "The cupsd init script switched to using pidfiles. Shutting down"
699 + ewarn "cupsd will fail the next time. To fix this, please run once as root"
700 + ewarn " killall cupsd ; /etc/init.d/cupsd zap ; /etc/init.d/cupsd start"
701 + echo
702 + break
703 + fi
704 + done
705 +
706 + for v in ${REPLACING_VERSIONS}; do
707 + echo
708 + elog "For information about installing a printer and general cups setup"
709 + elog "take a look at: https://wiki.gentoo.org/wiki/Printing"
710 + echo
711 + break
712 + done
713 +}
714 +
715 +pkg_postrm() {
716 + # Update desktop file database and gtk icon cache (bug 370059)
717 + xdg_pkg_postrm
718 +}