1# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
2pkgname=cups
3pkgver=2.4.7
4pkgrel=3
5pkgdesc="The CUPS Printing System"
6url="https://github.com/OpenPrinting/cups/"
7arch="all"
8license="Apache-2.0"
9depends_dev="libgcrypt-dev gnutls-dev zlib-dev"
10makedepends="
11 $depends_dev
12 libjpeg-turbo-dev
13 libpaper-dev
14 libusb-dev
15 linux-headers
16 "
17depends="cups-client poppler-utils openssl"
18install="cups.pre-install"
19pkggroups="lp lpadmin"
20pkgusers="lp"
21subpackages="
22 $pkgname-dbg
23 $pkgname-dev
24 $pkgname-doc
25 $pkgname-libs
26 ipptool
27 $pkgname-client
28 $pkgname-lang
29 $pkgname-openrc
30 "
31source="$pkgname-$pkgver.tar.gz::https://github.com/OpenPrinting/cups/archive/v$pkgver.tar.gz
32 $pkgname.logrotate
33 cupsd.initd
34 cups-no-export-ssllibs.patch
35 cups-nostrip.patch
36 default-config-no-gssapi.patch
37 "
38options="!check"
39
40# secfixes:
41# 2.4.7-r0:
42# - CVE-2023-4504
43# 2.4.2-r7:
44# - CVE-2023-32324
45# 2.4.2-r0:
46# - CVE-2022-26691
47# 2.3.3-r0:
48# - CVE-2020-3898
49# - CVE-2019-8842
50# 2.2.12-r0:
51# - CVE-2019-8696
52# - CVE-2019-8675
53# 2.2.10-r0:
54# - CVE-2018-4700
55
56build() {
57 ./configure \
58 --build=$CBUILD \
59 --host=$CHOST \
60 --prefix=/usr \
61 --libdir=/usr/lib \
62 --sysconfdir=/etc \
63 --localstatedir=/var \
64 --with-menudir=/usr/share/applications \
65 --with-icondir=/usr/share/icons \
66 --with-logdir=/var/log/cups \
67 --with-docdir=/usr/share/cups \
68 --with-rundir=/run/cups \
69 --with-cupsd-file-perm=0755 \
70 --with-cups-user=lp \
71 --with-cups-group=lp \
72 --with-system-groups=lpadmin \
73 --with-domainsocket=/run/cups/cups.sock \
74 --enable-libusb \
75 --without-rcdir \
76 --without-php \
77 --disable-pam \
78 --enable-raw-printing \
79 --enable-libpaper \
80 --enable-ssl=yes \
81 --enable-gnutls \
82 --disable-launchd \
83 --with-optim="$CFLAGS -flto=auto"
84 make
85}
86
87package() {
88 make BUILDROOT="$pkgdir" install
89
90 cd "$pkgdir"
91
92 # These no longer works since CUPS >= 1.6 (http://www.cups.org/str.php?L4120).
93 rm -rf usr/share/cups/banners/* \
94 usr/share/cups/data/testprint
95
96 install -D -m 644 "$srcdir"/cups.logrotate etc/logrotate.d/cups
97 install -D -m 755 "$srcdir"/cupsd.initd etc/init.d/cupsd
98
99 if [ -e usr/share/applications/cups.desktop ] ; then
100 sed -i 's|^Exec=htmlview http://localhost:631/|Exec=xdg-open http://localhost:631/|g' \
101 usr/share/applications/cups.desktop
102 fi
103 find usr/share/cups/model \( -name "*.ppd" -a ! -name "*.gz" \) \
104 -exec gzip -n9f {} \+
105}
106
107dev() {
108 default_dev
109
110 # needed for main cups operation
111 mv "$subpkgdir"/usr/share/cups/ppdc/* \
112 "$pkgdir"/usr/share/cups/ppdc
113 rmdir "$subpkgdir"/usr/share/cups/ppdc
114}
115
116libs() {
117 pkgdesc="CUPS libraries"
118 depends=""
119 replaces="libcups"
120
121 cd "$pkgdir"
122 _mv usr/lib/*.so*
123 install -d "$pkgdir"/etc/cups
124}
125
126ipptool() {
127 pkgdesc="Perform internet printing protocol requests"
128 depends=""
129
130 cd "$pkgdir"
131 _mv usr/bin/ipptool \
132 usr/share/cups/ipptool
133}
134
135client() {
136 pkgdesc="CUPS command-line client programs"
137 depends=""
138
139 cd "$pkgdir"
140 _mv usr/bin \
141 usr/sbin/cupsaccept \
142 usr/sbin/cupsctl \
143 usr/sbin/cupsdisable \
144 usr/sbin/cupsenable \
145 usr/sbin/lpadmin \
146 usr/sbin/lpc \
147 usr/sbin/lpinfo \
148 usr/sbin/lpmove
149}
150
151_mv() {
152 local i; for i in "$@"; do
153 mkdir -p "$subpkgdir"/${i%/*}
154 mv "$pkgdir"/$i "$subpkgdir"/${i%/*}/
155 done
156}
157
158doc() {
159 default_doc
160
161 amove usr/share/cups/help
162}
163
164sha512sums="
16527ca505a2868aa7bc248bac892aafe2a837633e73b6059d3ab4812264e3b0e786ef075751e8cc4300ce6bc43ef095e3d77dd3fce88ce8e72ca69b65093427bca cups-2.4.7.tar.gz
166cf64211da59e79285f99d437c02fdd7db462855fb2920ec9563ba47bd8a9e5cbd10555094940ceedeb41ac805c4f0ddb9147481470112a11a76220d0298aef79 cups.logrotate
167cdc90a542e1dc747dcea1d45550b8516586c3e9bbb685ecfb072cd3cee1771eda82a7820cb97f729770bd99e4ba4acc5707d0d02d2efe0afd18326a10e2cbb22 cupsd.initd
168148eb01f0861e1cd0861a174a5c5262c49b079b27b972b4e90656b9b9357ec710e861604c30e897818f550e9c1cdcefcd8c8bc955ba4a333902a74cdd8dfb5a6 cups-no-export-ssllibs.patch
1697b2f1212b009d4e005eaf4fc288413bde57aff4ca664173202163e8f18be1ddc72c26ec84576a4850d63b08c6ce5948d57c77e81c4f4c85032d7ef7530b1eb81 cups-nostrip.patch
170c492f5e20a1bb73cf6bed86d0343659e839df4003aa1409bf608dd3ff05694d1e06ba26fd3786385d2c96dd668485dcef6cfee7f908416a2b125a8e30e82e670 default-config-no-gssapi.patch
171"