| 1 |
|
# Copyright 2021-2026 Gentoo Authors
|
|
1 |
# Copyright 1999-2026 Gentoo Authors
|
| 2 |
2 |
# Distributed under the terms of the GNU General Public License v2
|
| 3 |
3 |
|
| 4 |
4 |
EAPI=8
|
| 5 |
5 |
|
| 6 |
|
DISTUTILS_USE_PEP517=setuptools
|
| 7 |
|
PYTHON_COMPAT=( pypy3_11 python3_{11..14} )
|
|
6 |
inherit autotools eapi9-ver linux-info xdg multilib-minimal optfeature pam toolchain-funcs
|
| 8 |
7 |
|
| 9 |
|
inherit distutils-r1
|
|
8 |
MY_PV="${PV/_beta/b}"
|
|
9 |
MY_PV="${MY_PV/_rc/rc}"
|
|
10 |
MY_PV="${MY_PV/_p/op}"
|
|
11 |
MY_P="${PN}-${MY_PV}"
|
|
12 |
|
|
13 |
if [[ ${PV} == *9999 ]] ; then
|
|
14 |
inherit git-r3
|
|
15 |
EGIT_REPO_URI="https://github.com/OpenPrinting/cups.git"
|
|
16 |
[[ ${PV} != 9999 ]] && EGIT_BRANCH=branch-${PV/.9999}
|
|
17 |
else
|
|
18 |
SRC_URI="https://github.com/OpenPrinting/cups/releases/download/v${MY_PV}/cups-${MY_PV}-source.tar.gz"
|
|
19 |
if [[ ${PV} != *_beta* && ${PV} != *_rc* ]] ; then
|
|
20 |
KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~loong ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
|
|
21 |
fi
|
|
22 |
fi
|
| 10 |
23 |
|
| 11 |
|
MY_P=${P/_p/.post}
|
| 12 |
|
DESCRIPTION="Ahead of Time compiler for numeric kernels"
|
| 13 |
|
HOMEPAGE="
|
| 14 |
|
https://pypi.org/project/pythran/
|
| 15 |
|
https://github.com/serge-sans-paille/pythran/
|
| 16 |
|
"
|
| 17 |
|
SRC_URI="
|
| 18 |
|
https://github.com/serge-sans-paille/pythran/archive/${PV/_p/.post}.tar.gz
|
| 19 |
|
-> ${MY_P}.gh.tar.gz
|
| 20 |
|
"
|
| 21 |
|
S=${WORKDIR}/${MY_P}
|
|
24 |
DESCRIPTION="The Common Unix Printing System"
|
|
25 |
HOMEPAGE="https://www.cups.org/ https://github.com/OpenPrinting/cups"
|
|
26 |
S="${WORKDIR}/${MY_P}"
|
| 22 |
27 |
|
| 23 |
|
LICENSE="BSD"
|
|
28 |
LICENSE="Apache-2.0"
|
| 24 |
29 |
SLOT="0"
|
| 25 |
|
KEYWORDS="amd64 arm arm64 ~loong ppc64 ~riscv ~s390 ~sparc x86"
|
|
30 |
IUSE="acl dbus debug kerberos openssl pam selinux static-libs systemd test usb X xinetd zeroconf"
|
| 26 |
31 |
|
| 27 |
|
RDEPEND="
|
| 28 |
|
dev-libs/boost
|
| 29 |
|
dev-cpp/xsimd
|
| 30 |
|
=dev-python/beniget-0.4*[${PYTHON_USEDEP}]
|
| 31 |
|
=dev-python/gast-0.6*[${PYTHON_USEDEP}]
|
| 32 |
|
dev-python/numpy:=[${PYTHON_USEDEP}]
|
| 33 |
|
>=dev-python/ply-3.4[${PYTHON_USEDEP}]
|
| 34 |
|
>=dev-python/setuptools-73.0.1[${PYTHON_USEDEP}]
|
|
32 |
RESTRICT="!test? ( test )"
|
|
33 |
|
|
34 |
BDEPEND="
|
|
35 |
acct-group/lp
|
|
36 |
acct-group/lpadmin
|
|
37 |
virtual/pkgconfig
|
| 35 |
38 |
"
|
| 36 |
|
DEPEND="
|
| 37 |
|
test? (
|
| 38 |
|
dev-libs/boost
|
| 39 |
|
dev-cpp/xsimd
|
|
39 |
COMMON_DEPEND="
|
|
40 |
app-text/libpaper:=
|
|
41 |
virtual/zlib:=
|
|
42 |
acl? (
|
|
43 |
kernel_linux? (
|
|
44 |
sys-apps/acl
|
|
45 |
)
|
| 40 |
46 |
)
|
|
47 |
dbus? ( >=sys-apps/dbus-1.6.18-r1[${MULTILIB_USEDEP}] )
|
|
48 |
kerberos? ( >=virtual/krb5-0-r1[${MULTILIB_USEDEP}] )
|
|
49 |
pam? ( sys-libs/pam )
|
|
50 |
!pam? ( virtual/libcrypt:= )
|
|
51 |
!openssl? ( >=net-libs/gnutls-2.12.23-r6:=[${MULTILIB_USEDEP}] )
|
|
52 |
openssl? ( dev-libs/openssl:=[${MULTILIB_USEDEP}] )
|
|
53 |
systemd? ( sys-apps/systemd )
|
|
54 |
usb? ( virtual/libusb:1 )
|
|
55 |
X? ( x11-misc/xdg-utils )
|
|
56 |
xinetd? ( sys-apps/xinetd )
|
|
57 |
zeroconf? ( >=net-dns/avahi-0.6.31-r2[dbus,${MULTILIB_USEDEP}] )
|
| 41 |
58 |
"
|
| 42 |
|
BDEPEND="
|
| 43 |
|
test? (
|
| 44 |
|
dev-python/pip[${PYTHON_USEDEP}]
|
| 45 |
|
dev-python/packaging[${PYTHON_USEDEP}]
|
| 46 |
|
dev-python/scipy[${PYTHON_USEDEP}]
|
| 47 |
|
dev-python/wheel[${PYTHON_USEDEP}]
|
| 48 |
|
virtual/cblas
|
| 49 |
|
!!dev-python/setuptools-declarative-requirements
|
| 50 |
|
)
|
|
59 |
# if libcupsfilters is installed, more tests are run. They fail without at least one of the two formats enabled.
|
|
60 |
DEPEND="
|
|
61 |
${COMMON_DEPEND}
|
|
62 |
test? ( || ( net-print/libcupsfilters[jpeg] net-print/libcupsfilters[png] ) )
|
|
63 |
"
|
|
64 |
RDEPEND="
|
|
65 |
${COMMON_DEPEND}
|
|
66 |
acct-group/lp
|
|
67 |
acct-group/lpadmin
|
|
68 |
selinux? ( sec-policy/selinux-cups )
|
| 51 |
69 |
"
|
| 52 |
|
|
| 53 |
|
EPYTEST_PLUGINS=()
|
| 54 |
|
EPYTEST_XDIST=1
|
| 55 |
|
distutils_enable_tests pytest
|
| 56 |
70 |
|
| 57 |
71 |
PATCHES=(
|
| 58 |
|
"${FILESDIR}"/${P}-numpy-float128-tests.patch
|
|
72 |
"${FILESDIR}/${PN}-2.4.1-nostrip.patch"
|
|
73 |
"${FILESDIR}/${PN}-2.4.1-user-AR.patch"
|
| 59 |
74 |
)
|
| 60 |
75 |
|
| 61 |
|
src_configure() {
|
| 62 |
|
# vendored C++ headers -- use system copies
|
| 63 |
|
rm -r pythran/{boost,xsimd} || die
|
| 64 |
|
|
| 65 |
|
# https://bugs.gentoo.org/916461
|
| 66 |
|
sed -i \
|
| 67 |
|
-e 's|blas=blas|blas=cblas|' \
|
| 68 |
|
-e 's|libs=|libs=cblas|' \
|
| 69 |
|
pythran/pythran-*.cfg || die
|
| 70 |
|
}
|
| 71 |
|
|
| 72 |
|
python_test() {
|
| 73 |
|
local EPYTEST_DESELECT=(
|
| 74 |
|
# multiple extra deps (meson, openblas)
|
| 75 |
|
# also broken on pypy3*
|
| 76 |
|
pythran/tests/test_distutils.py::TestMeson::test_meson_build
|
| 77 |
|
# numpy.distutils is dead and broken
|
| 78 |
|
pythran/tests/test_distutils.py::TestDistutils
|
| 79 |
|
)
|
| 80 |
|
local EPYTEST_IGNORE=(
|
| 81 |
|
pythran/benchmarks
|
|
76 |
MULTILIB_CHOST_TOOLS=(
|
|
77 |
/usr/bin/cups-config
|
|
78 |
)
|
|
79 |
|
|
80 |
pkg_setup() {
|
|
81 |
if use kernel_linux; then
|
|
82 |
linux-info_pkg_setup
|
|
83 |
if ! linux_config_exists; then
|
|
84 |
ewarn "Can't check the linux kernel configuration."
|
|
85 |
ewarn "You might have some incompatible options enabled."
|
|
86 |
else
|
|
87 |
# Recheck that we don't have usblp to collide with libusb; this should now work in most cases (bug #501122)
|
|
88 |
if use usb; then
|
|
89 |
if linux_chkconfig_present USB_PRINTER; then
|
|
90 |
elog "Your USB printers will be managed via libusb. In case you run into problems, "
|
|
91 |
elog "please try disabling USB_PRINTER support in your kernel or blacklisting the"
|
|
92 |
elog "usblp kernel module."
|
|
93 |
elog "Alternatively, just disable the usb useflag for cups (your printer will still work)."
|
|
94 |
fi
|
|
95 |
else
|
|
96 |
if ! linux_chkconfig_present USB_PRINTER; then
|
|
97 |
ewarn "If you plan to use USB printers you should enable the USB_PRINTER"
|
|
98 |
ewarn "support in your kernel."
|
|
99 |
ewarn "Please enable it:"
|
|
100 |
ewarn " CONFIG_USB_PRINTER=y"
|
|
101 |
ewarn "in /usr/src/linux/.config or"
|
|
102 |
ewarn " Device Drivers --->"
|
|
103 |
ewarn " USB support --->"
|
|
104 |
ewarn " [*] USB Printer support"
|
|
105 |
ewarn "Alternatively, enable the usb useflag for cups and use the libusb code."
|
|
106 |
fi
|
|
107 |
fi
|
|
108 |
fi
|
|
109 |
fi
|
|
110 |
}
|
|
111 |
|
|
112 |
src_prepare() {
|
|
113 |
default
|
|
114 |
|
|
115 |
# Remove ".SILENT" rule for verbose output (bug #524338).
|
|
116 |
sed 's#^.SILENT:##g' -i Makedefs.in || die
|
|
117 |
|
|
118 |
# Remove redefinition of _FORTIFY_SOURCE (bug #907683)
|
|
119 |
sed 's#-D_FORTIFY_SOURCE=3##g' -i config-scripts/cups-compiler.m4 || die
|
|
120 |
|
|
121 |
AT_M4DIR="config-scripts" eautoreconf
|
|
122 |
|
|
123 |
# Custom Makefiles
|
|
124 |
multilib_copy_sources
|
|
125 |
}
|
|
126 |
|
|
127 |
multilib_src_configure() {
|
|
128 |
export DSOFLAGS="${LDFLAGS}"
|
|
129 |
|
|
130 |
# Explicitly specify compiler wrt bug #524340
|
|
131 |
#
|
|
132 |
# Need to override KRB5CONFIG for proper flags
|
|
133 |
# https://github.com/apple/cups/issues/4423
|
|
134 |
local myeconfargs=(
|
|
135 |
CC="$(tc-getCC)"
|
|
136 |
CXX="$(tc-getCXX)"
|
|
137 |
KRB5CONFIG="${EPREFIX}"/usr/bin/${CHOST}-krb5-config
|
|
138 |
--libdir="${EPREFIX}"/usr/$(get_libdir)
|
|
139 |
--localstatedir="${EPREFIX}"/var
|
|
140 |
# Follow Fedora permission setting
|
|
141 |
--with-cupsd-file-perm=0755
|
|
142 |
--with-exe-file-perm=755
|
|
143 |
--with-log-file-perm=0640
|
|
144 |
# Used by Debian, also prevents printers from getting
|
|
145 |
# disabled and users not knowing how to re-enable them
|
|
146 |
--with-error-policy=retry-job
|
|
147 |
# Used in Debian and Fedora
|
|
148 |
--enable-sync-on-close
|
|
149 |
#
|
|
150 |
--with-rundir="${EPREFIX}"/run/cups
|
|
151 |
--with-pkgconfpath="${EPREFIX}"/usr/$(get_libdir)/pkgconfig
|
|
152 |
--with-cups-user=lp
|
|
153 |
--with-cups-group=lp
|
|
154 |
--with-docdir="${EPREFIX}"/usr/share/cups/html
|
|
155 |
# See bug #863221 for adding root
|
|
156 |
--with-system-groups="root lpadmin"
|
|
157 |
--with-xinetd="${EPREFIX}"/etc/xinetd.d
|
|
158 |
$(multilib_native_use_enable acl)
|
|
159 |
$(use_enable dbus)
|
|
160 |
$(use_enable debug)
|
|
161 |
$(use_enable debug debug-guards)
|
|
162 |
$(use_enable debug debug-printfs)
|
|
163 |
$(use_enable kerberos gssapi)
|
|
164 |
$(multilib_native_use_enable pam)
|
|
165 |
$(use_enable static-libs static)
|
|
166 |
--with-tls=$(usex openssl openssl gnutls)
|
|
167 |
$(use_with systemd ondemand systemd)
|
|
168 |
$(multilib_native_use_enable usb libusb)
|
|
169 |
$(use_with zeroconf dnssd avahi)
|
|
170 |
$(multilib_is_native_abi && echo --enable-libpaper || echo --disable-libpaper)
|
| 82 |
171 |
)
|
| 83 |
172 |
|
| 84 |
|
if ! has_version "dev-python/ipython[${PYTHON_USEDEP}]"; then
|
| 85 |
|
EPYTEST_IGNORE+=(
|
| 86 |
|
pythran/tests/test_ipython.py
|
|
173 |
# Handle empty LINGUAS properly, bug #771162
|
|
174 |
if [[ -n "${LINGUAS+x}" ]] ; then
|
|
175 |
myeconfargs+=(
|
|
176 |
--with-languages="${LINGUAS}"
|
| 87 |
177 |
)
|
| 88 |
178 |
fi
|
| 89 |
179 |
|
| 90 |
|
case ${ARCH} in
|
| 91 |
|
arm)
|
| 92 |
|
EPYTEST_DESELECT+=(
|
| 93 |
|
# TODO
|
| 94 |
|
pythran/tests/test_numpy_fft.py::TestNumpyFFT::test_fft_3d_axis
|
| 95 |
|
pythran/tests/test_numpy_fft.py::TestNumpyFFTN
|
| 96 |
|
)
|
| 97 |
|
;;
|
| 98 |
|
esac
|
| 99 |
|
|
| 100 |
|
# can easily fill up ccache with no real benefit
|
| 101 |
|
local -x CCACHE_DISABLE=1
|
| 102 |
|
local -x COLUMNS=80
|
| 103 |
|
epytest
|
|
180 |
if tc-is-static-only; then
|
|
181 |
myeconfargs+=(
|
|
182 |
--disable-shared
|
|
183 |
)
|
|
184 |
fi
|
|
185 |
|
|
186 |
# Install in /usr/libexec always, instead of using /usr/lib/cups, as that
|
|
187 |
# makes more sense when facing multilib support.
|
|
188 |
sed -i -e 's:CUPS_SERVERBIN="$exec_prefix/lib/cups":CUPS_SERVERBIN="$exec_prefix/libexec/cups":g' configure ||die
|
|
189 |
|
|
190 |
econf "${myeconfargs[@]}"
|
|
191 |
|
|
192 |
sed -i -e "s:SERVERBIN.*:SERVERBIN = \"\$\(BUILDROOT\)${EPREFIX}/usr/libexec/cups\":" Makedefs || die
|
|
193 |
sed -i -e "s:#define CUPS_SERVERBIN.*:#define CUPS_SERVERBIN \"${EPREFIX}/usr/libexec/cups\":" config.h || die
|
|
194 |
sed -i -e "s:cups_serverbin=.*:cups_serverbin=\"${EPREFIX}/usr/libexec/cups\":" cups-config || die
|
|
195 |
|
|
196 |
# Additional path corrections needed for prefix, see bug #597728
|
|
197 |
sed \
|
|
198 |
-e "s:ICONDIR.*:ICONDIR = ${EPREFIX}/usr/share/icons:" \
|
|
199 |
-e "s:INITDIR.*:INITDIR = ${EPREFIX}/etc:" \
|
|
200 |
-e "s:DBUSDIR.*:DBUSDIR = ${EPREFIX}/etc/dbus-1:" \
|
|
201 |
-e "s:MENUDIR.*:MENUDIR = ${EPREFIX}/usr/share/applications:" \
|
|
202 |
-i Makedefs || die
|
|
203 |
}
|
|
204 |
|
|
205 |
multilib_src_compile() {
|
|
206 |
if multilib_is_native_abi; then
|
|
207 |
default
|
|
208 |
else
|
|
209 |
emake libs
|
|
210 |
fi
|
|
211 |
}
|
|
212 |
|
|
213 |
multilib_src_test() {
|
|
214 |
# We only build some of CUPS for multilib, so can't run the tests.
|
|
215 |
if multilib_is_native_abi; then
|
|
216 |
# Avoid using /tmp
|
|
217 |
export CUPS_TESTBASE="${T}"/cups-tests
|
|
218 |
|
|
219 |
mkdir "${T}"/cups-tests || die
|
|
220 |
|
|
221 |
# avoid building *and running* test binaries in src_compile
|
|
222 |
# https://github.com/OpenPrinting/cups/commit/b1d42061e9286f50eefc851ed906d17c6e80c4b0
|
|
223 |
emake UNITTESTS=unittests
|
|
224 |
default
|
|
225 |
fi
|
|
226 |
}
|
|
227 |
|
|
228 |
multilib_src_install() {
|
|
229 |
if multilib_is_native_abi; then
|
|
230 |
emake BUILDROOT="${D}" install
|
|
231 |
else
|
|
232 |
emake BUILDROOT="${D}" install-libs install-headers
|
|
233 |
|
|
234 |
# Manually install pkgconfig file to avoid tangling with duplicate file behavior
|
|
235 |
insinto /usr/$(get_libdir)/pkgconfig
|
|
236 |
doins cups.pc
|
|
237 |
|
|
238 |
dobin cups-config
|
|
239 |
fi
|
|
240 |
}
|
|
241 |
|
|
242 |
multilib_src_install_all() {
|
|
243 |
dodoc {CHANGES,CREDITS,README}.md
|
|
244 |
|
|
245 |
# Move the default config file to docs
|
|
246 |
dodoc "${ED}"/etc/cups/cupsd.conf.default
|
|
247 |
rm "${ED}"/etc/cups/cupsd.conf.default || die
|
|
248 |
|
|
249 |
# Clean out cups init scripts
|
|
250 |
rm -r "${ED}"/etc/{init.d/cups,rc*} || die
|
|
251 |
|
|
252 |
# Install our init script
|
|
253 |
local neededservices=(
|
|
254 |
$(usex zeroconf avahi-daemon '')
|
|
255 |
$(usex dbus dbus '')
|
|
256 |
)
|
|
257 |
[[ -n ${neededservices[@]} ]] && neededservices="need ${neededservices[@]}"
|
|
258 |
cp "${FILESDIR}"/cupsd.init.d-r4 "${T}"/cupsd || die
|
|
259 |
sed -i -e "s/@neededservices@/${neededservices}/" "${T}"/cupsd || die
|
|
260 |
doinitd "${T}"/cupsd
|
|
261 |
|
|
262 |
if use pam ; then
|
|
263 |
rm "${ED}"/etc/pam.d/${PN} || die
|
|
264 |
pamd_mimic_system cups auth account
|
|
265 |
fi
|
|
266 |
|
|
267 |
if use xinetd ; then
|
|
268 |
# Correct path
|
|
269 |
sed -i -e "s:server = .*:server = /usr/libexec/cups/daemon/cups-lpd:" \
|
|
270 |
"${ED}"/etc/xinetd.d/cups-lpd || die
|
|
271 |
# It is safer to disable this by default, bug #137130
|
|
272 |
grep -w 'disable' "${ED}"/etc/xinetd.d/cups-lpd || \
|
|
273 |
{ sed -i -e "s:}:\tdisable = yes\n}:" "${ED}"/etc/xinetd.d/cups-lpd || die ; }
|
|
274 |
# Write permission for file owner (root), bug #296221
|
|
275 |
fperms u+w /etc/xinetd.d/cups-lpd
|
|
276 |
else
|
|
277 |
# Always configure with --with-xinetd= and clean up later,
|
|
278 |
# bug #525604
|
|
279 |
rm -r "${ED}"/etc/xinetd.d || die
|
|
280 |
fi
|
|
281 |
|
|
282 |
keepdir /etc/cups/{interfaces,ppd,ssl}
|
|
283 |
|
|
284 |
if ! use X ; then
|
|
285 |
rm -r "${ED}"/usr/share/applications || die
|
|
286 |
fi
|
|
287 |
|
|
288 |
# Create /etc/cups/client.conf, bug #196967 and bug #266678
|
|
289 |
echo "ServerName ${EPREFIX}/run/cups/cups.sock" >> "${ED}"/etc/cups/client.conf
|
|
290 |
|
|
291 |
# The following file is now provided by cups-filter:
|
|
292 |
rm -r "${ED}"/usr/share/cups/banners || die
|
|
293 |
|
|
294 |
# The following are created by the init script
|
|
295 |
rm -r "${ED}"/var/cache || die
|
|
296 |
rm -r "${ED}"/run || die
|
|
297 |
|
|
298 |
keepdir /usr/libexec/cups/driver /usr/share/cups/{model,profiles} /var/log/cups /var/spool/cups/tmp
|
|
299 |
}
|
|
300 |
|
|
301 |
pkg_postinst() {
|
|
302 |
xdg_pkg_postinst
|
|
303 |
|
|
304 |
if ver_replacing -lt 2.2.2-r2 ; then
|
|
305 |
ewarn "The cupsd init script switched to using pidfiles. Shutting down"
|
|
306 |
ewarn "cupsd will fail the next time. To fix this, please run once as root"
|
|
307 |
ewarn " killall cupsd ; /etc/init.d/cupsd zap ; /etc/init.d/cupsd start"
|
|
308 |
fi
|
|
309 |
|
|
310 |
if [[ -n ${REPLACING_VERSIONS} ]]; then
|
|
311 |
elog
|
|
312 |
elog "For information about installing a printer and general cups setup"
|
|
313 |
elog "take a look at: https://wiki.gentoo.org/wiki/Printing"
|
|
314 |
fi
|
|
315 |
|
|
316 |
optfeature_header "CUPS may need installing the following for certain features to work:"
|
|
317 |
use zeroconf && optfeature "local hostname resolution using a hostname.local naming scheme" sys-auth/nss-mdns
|
| 104 |
318 |
}
|