archrelease: copy trunk to extra-x86_64
[arch-packages.git] / cups / trunk / PKGBUILD
blob63ee7e7a0462c72de3dbc34511f9af39c4d5ebb7
1 # Maintainer: Andreas Radke <andyrtr@archlinux.org>
3 pkgbase="cups"
4 pkgname=('libcups' 'cups')
5 pkgver=2.4.2
6 pkgrel=6
7 epoch=1
8 arch=('x86_64')
9 license=('Apache' 'custom')
10 url="https://openprinting.github.io/cups/"
11 makedepends=('acl' 'pam' 'gnutls' 'cups-filters' 'colord' 
12              'libusb' 'avahi'  'systemd' 'libpaper')
13 #checkdepends=('valgrind')
14 source=(https://github.com/OpenPrinting/cups/releases/download/v${pkgver}/cups-${pkgver}-source.tar.gz{,.sig}
15         cups.logrotate
16         cups.pam
17         cups.sysusers
18         cups-2.4.0-statedir.patch
19         # bugfixes
20         cups-freebind.patch
21         guid.patch
22         0001_Fix_OpenSSL_crash_bug.patch
24 sha256sums=('f03ccb40b087d1e30940a40e0141dcbba263f39974c20eb9f2521066c9c6c908'
25             'SKIP'
26             'd87fa0f0b5ec677aae34668f260333db17ce303aa1a752cba5f8e72623d9acf9'
27             '57dfd072fd7ef0018c6b0a798367aac1abb5979060ff3f9df22d1048bb71c0d5'
28             '06173dfaea37bdd9b39b3e09aba98c34ae7112a2f521db45a688907d8848caa2'
29             'f0b15192952c151b1843742c87850ff3a7d0f3ba5dd236ed16623ef908472ad7'
30             '3385047b9ac8a7b13aeb8f0ca55d15f793ce7283516db0155fe28a67923c592d'
31             '0bf6a75ba1b051771f155d9a5d36b307a6d40c6857d645b250fe93f3fb713474'
32             '632faf08bfd1863e9ad6807aff766983e84030a0e4df441167f17de7266ca152')
33 #validpgpkeys=('3737FD0D0E63B30172440D2DDBA3A7AB08D76223') # CUPS.org (CUPS.org PGP key) <security@cups.org>
34 #validpgpkeys+=('45D083946E3035282B3CCA9AF434104235DA97EB') # "CUPS.org <security@cups.org>"
35 #validpgpkeys+=('845464660B686AAB36540B6F999559A027815955') # "Michael R Sweet <michael.r.sweet@gmail.com>"
36 #validpgpkeys=('7ADB58203CA5F046F28025B215AA6A7F4D4227D7') # "Zdenek Dohnal (Associate Software Engineer) <zdohnal@redhat.com>"
37 validpgpkeys=('7082A0A50A2E92640F3880E0E4522DCC9B246FF7') # Zdenek Dohnal (The old 4D4227D7 key revoked) <zdohnal@redhat.com>
38 #options=(!makeflags)
40 prepare() {
41   cd "${pkgbase}"-${pkgver}
43   # move /var/run -> /run for pid file
44   patch -Np1 -i "${srcdir}"/cups-2.4.0-statedir.patch
46   # bug fixes
48   # https://github.com/OpenPrinting/cups/issues/53
49   # use IP_FREEBIND, because cupsd cannot bind to not yet existing IP address
50   patch -Np1 -i "${srcdir}"/cups-freebind.patch
52   # FS#56818 - https://github.com/apple/cups/issues/5236
53   patch -Np1 -i "${srcdir}"/guid.patch
55   # FS#75005 - Fix OpenSSL crash bug - "tls" pointer wasn't cleared after
56   # Fix OpenSSL crash bug - "tls" pointer wasn't cleared after
57   patch -Np1 -i "${srcdir}"/0001_Fix_OpenSSL_crash_bug.patch
59   # Rebuild configure script
60   aclocal -I config-scripts
61   autoconf -I config-scripts
64 build() {
65   cd "${pkgbase}"-${pkgver}
67   # The build system uses only DSOFLAGS but not LDFLAGS to build some libraries.
68   export DSOFLAGS=${LDFLAGS}
70   # use fixed cups user (id 209) since systemd adds "lp" group without a fixed id
71   ./configure --prefix=/usr \
72      --sysconfdir=/etc \
73      --localstatedir=/var \
74      --sbindir=/usr/bin \
75      --libdir=/usr/lib \
76      --with-logdir=/var/log/cups \
77      --with-docdir=/usr/share/cups/doc \
78      --with-exe-file-perm=0755 \
79      --with-cups-user=209 \
80      --with-cups-group=209 \
81      --with-max-log-size=0 \
82      --enable-pam=yes \
83      --enable-raw-printing \
84      --enable-dbus=yes \
85      --with-tls=gnutls \
86      --with-dbusdir=/usr/share/dbus-1 \
87      --enable-relro \
88      --enable-libpaper \
89      --with-optim="$CFLAGS" #--help
90   make
93 # don't run tests - they take ages
94 #check() {
95 #  cd "${pkgbase}"-${pkgver}
96 ##  make -k check || /bin/true
97 #  make check
100 package_libcups() {
101 pkgdesc="OpenPrinting CUPS - client libraries and headers"
102 depends=('gnutls' 'avahi')
104   cd ${pkgbase}-${pkgver}
105   make BUILDROOT="${pkgdir}" install-headers install-libs
106   # put this into the libs pkg to make other software find the libs(no pkg-config file included)
107   mkdir -p "${pkgdir}"/usr/bin
108   install -m755 "${srcdir}"/"${pkgbase}"-${pkgver}/cups-config "${pkgdir}"/usr/bin/cups-config
110   # add license + exception
111   install -m644 -Dt "${pkgdir}/usr/share/licenses/${pkgname}" {LICENSE,NOTICE}
114 package_cups() {
115 pkgdesc="OpenPrinting CUPS - daemon package"
116 install=cups.install
117 backup=(etc/cups/cupsd.conf
118         etc/cups/snmp.conf
119         etc/cups/printers.conf
120         etc/cups/classes.conf
121         etc/cups/cups-files.conf
122         etc/cups/subscriptions.conf
123         etc/logrotate.d/cups
124         etc/pam.d/cups)
125 depends=('acl' 'pam' "libcups>=${pkgver}" 'cups-filters'
126          'dbus' 'systemd' 'libpaper' 'hicolor-icon-theme')
127 optdepends=('libusb: for usb printer backend'
128             'ipp-usb: allows to send HTTP requests via a USB connection on devices without Ethernet or WiFi connections'
129             'xdg-utils: xdg .desktop file support'
130             'colord: for ICC color profile support'
131             'logrotate: for logfile rotation support')
133   cd "${pkgbase}"-${pkgver}
134   make BUILDROOT="${pkgdir}" install-data install-exec
136   # this one we ship in the libcups pkg
137   rm -f "${pkgdir}"/usr/bin/cups-config
139   # kill the sysv stuff
140   rm -rf "${pkgdir}"/etc/rc*.d
141   rm -rf "${pkgdir}"/etc/init.d
142   install -D -m644 ../cups.logrotate "${pkgdir}"/etc/logrotate.d/cups
143   install -D -m644 ../cups.pam "${pkgdir}"/etc/pam.d/cups
145   # fix perms on /var/spool and /etc
146   chmod 755 "${pkgdir}"/var/spool
147   chmod 755 "${pkgdir}"/etc
149   # use cups group FS#36769
150   install -Dm644 "$srcdir"/cups.sysusers "${pkgdir}/usr/lib/sysusers.d/$pkgname.conf"
151   sed -i "s:#User 209:User 209:" "${pkgdir}"/etc/cups/cups-files.conf{,.default}
152   sed -i "s:#Group 209:Group 209:" "${pkgdir}"/etc/cups/cups-files.conf{,.default}
154   # install ssl directory where to store the certs, solves some samba issues
155   install -dm700 -g 209 "${pkgdir}"/etc/cups/ssl
156   # remove directory from package, it will be recreated at each server start
157   rm -rf "${pkgdir}"/run
159   # install some more configuration files that will get filled by cupsd
160   touch "${pkgdir}"/etc/cups/printers.conf
161   touch "${pkgdir}"/etc/cups/classes.conf
162   touch "${pkgdir}"/etc/cups/subscriptions.conf
163   chgrp -R 209 "${pkgdir}"/etc/cups
165   # fix .desktop file
166   sed -i 's|^Exec=htmlview http://localhost:631/|Exec=xdg-open http://localhost:631/|g' "${pkgdir}"/usr/share/applications/cups.desktop
168   # compress some driver files, adopted from Fedora
169   find "${pkgdir}"/usr/share/cups/model -name "*.ppd" | xargs gzip -n9f
171   # remove client.conf man page
172   rm -f "${pkgdir}"/usr/share/man/man5/client.conf.5
174   # comment out removed filters that are now part of cups-filters
175   perl -p -i -e 's:^(.*\s+bannertops\s*)$:#\1:' "$pkgdir"/usr/share/cups/mime/mime.convs
177   # comment out unnecessary PageLogFormat entry
178   sed -i -e 's:PageLogFormat:#PageLogFormat:' "$pkgdir"/etc/cups/cupsd.conf*
180   # no more xinetd support
181   rm -rf "${pkgdir}"/etc/xinetd.d