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