Files
extra/cups/PKGBUILD
2025-06-22 20:39:04 -05:00

196 lines
7.4 KiB
Bash
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Maintainer: Jesus E. <heckyel@riseup.net>
pkgbase=cups
pkgname=('libcups' 'cups')
pkgver=2.3.3
_debver=$pkgver
_debrel=3
pkgrel=6
arch=('i686' 'x86_64')
license=('custom:Apache-2.0+CUPS-Exceptions')
url='https://www.cups.org/'
makedepends=('libtiff' 'libpng' 'acl' 'xdg-utils' 'krb5' 'gnutls'
'cups-filters' 'bc' 'gzip' 'autoconf' 'libusb'
'hicolor-icon-theme' 'libxcrypt' 'libpaper' 'quilt')
source=("${pkgbase}-${pkgver}.tar.gz::https://deb.debian.org/debian/pool/main/c/cups/cups_${pkgver}op2.orig.tar.gz"
"https://security.debian.org/pool/updates/main/c/cups/cups_${_debver}op2-${_debrel}+deb11u9.debian.tar.xz"
"cups.logrotate"
# improve build and linking
"cups-no-export-ssllibs.patch"
"cups-1.6.2-statedir.patch"
"guid.patch"
"cupsd.initd"
"cupsd.run"
"install-server-executables-in-usrlibexeccups.patch")
sha512sums=('db27dd6fb616bd7ad895b2bdf4ea7b010501358a50dc8f2e7e29558d1cfc088a572b1b35ac512654d3ed410c84df87dc34ca636533a4499117253915d4763117'
'c3091522c0a1ce31636771a1bf80ee8a24d6637832e6ce235d02c1d40d8c115744cd92c2a4165ed0f7265200cb5a8ceebda0e9ab1eb684c5e9c896bad40675e5'
'6a3bec9b9d7625b1c364446afa8e5794934e56cbe8385f53759247702777d257cc229634ce8a8e5d1abe93494c19ac513f559d5c1b115897d1adb44ce0cd66c0'
'7a8cd9ac33b0dd4627c72df4275db8ccd7cf8e201bce3833719b42f532f526bb347b842e3ea1ef0d61855b5c6e1088b5d20b68942f2c2c0acf504d8d9728efd3'
'486295ae3a3404241034aeb8667667b663966c560f37b5b005eaef189b114f1829dfc427464856f68c263a82d201b9cb4ae3f4b0f3b3dc25b22f90d68cbea705'
'1d079c9f0372bd2435ccdc5b1e6ca6edaee8bdd2f7cc116a0787fa50e4d116b2a33f63fd89621e455b3058bfea315bf15b7440142f01f3c18fea3bc334cd8953'
'e635cd76ea5797a33951b62acb8747174abbe9bb309573864a4620df6a097619718122029e2fa8f0f99fbd4f09b0696324d971436653df72736d4e9984e75425'
'bd2f7f8c8961bd7dab70ca03e169ac68f8c092644aaa3f703d4f4ee2fadc88888b72c202d363bdddfba2c4f153334fd03936d9951105ea95ce0513e831c22eb8'
'bb79002f365539d380f5865aaa4e109168fb4a00dffce7dbdd8b17125625b0c182d9f9aa44febac5e6b53ccddfaddc0beba85c91068affa510cb54b1dafc594c')
prepare() {
mv "${pkgbase}-${pkgver}op2" "${pkgbase}-${pkgver}"
cd ${pkgbase}-${pkgver}
if [[ ${pkgver%.*} = ${_debver%.*} ]]; then
# Debian patches
export QUILT_PATCHES=debian/patches
export QUILT_REFRESH_ARGS='-p ab --no-timestamps --no-index'
export QUILT_DIFF_ARGS='--no-timestamps'
mv "$srcdir"/debian .
# Doesn't apply
rm -v debian/patches/0004-Apple-AirPrint-support.patch || true
rm -v debian/patches/0006-Debian-Set-LogFileGroup-to-adm.patch || true
rm -v debian/patches/0010-Debian-Use-dpkg-architecture-in-cups-config-to-make-.patch || true
rm -v debian/patches/0015-Debian-po4a-infrastructure-and-translations-for-manp.patch || true
quilt push -av
fi
# improve build and linking
# Do not export SSL libs in cups-config
patch -Np1 -i ${srcdir}/cups-no-export-ssllibs.patch
# move /var/run -> /run for pid file
patch -Np1 -i ${srcdir}/cups-1.6.2-statedir.patch
# bug fixes
# FS#56818 - https://github.com/apple/cups/issues/5236
patch -Np1 -i "${srcdir}"/guid.patch
# set MaxLogSize to 0 to prevent using cups internal log rotation
sed -i -e '5i\ ' conf/cupsd.conf.in
sed -i -e '6i# Disable cups internal logging - use logrotate instead' conf/cupsd.conf.in
sed -i -e '7iMaxLogSize 0' conf/cupsd.conf.in
# install server executables in /usr/libexec/cups to make it FHS compliant
patch -Np1 -i "${srcdir}"/install-server-executables-in-usrlibexeccups.patch
# additional path corrections needed for prefix
# https://bugs.gentoo.org/show_bug.cgi?id=597728
sed -e "s:ICONDIR.*:ICONDIR = /usr/share/icons:" \
-e "s:INITDIR.*:INITDIR = /etc:" \
-e "s:MENUDIR.*:MENUDIR = /usr/share/applications:" \
-i Makedefs.in
# Rebuild configure script for not zipping man-pages.
aclocal -I config-scripts
autoconf -I config-scripts
}
build() {
cd ${pkgbase}-${pkgver}
./configure \
--prefix=/usr \
--sysconfdir=/etc \
--localstatedir=/var \
--libdir=/usr/lib \
--with-logdir=/var/log/cups \
--with-docdir=/usr/share/cups/doc \
--with-cups-user=daemon \
--with-cups-group=lp \
--disable-pam \
--enable-raw-printing \
--disable-dbus \
--enable-ssl=yes \
--enable-threads \
--disable-avahi \
--disable-dnssd \
--enable-libpaper \
--with-optim="$CFLAGS" #--help
make
}
check() {
cd ${pkgbase}-${pkgver}
#make -k check || /bin/true
}
package_libcups() {
pkgdesc="The CUPS Printing System - client libraries and headers"
depends=('gnutls' 'libtiff>=4.0.0' 'libpng>=1.5.7' 'krb5' 'libusb' 'libxcrypt')
cd ${pkgbase}-${pkgver}
make BUILDROOT=${pkgdir} install-headers install-libs
# put this into the libs pkg to make other software find the libs(no pkg-config file included)
mkdir -p ${pkgdir}/usr/bin
install -m755 ${srcdir}/${pkgbase}-${pkgver}/cups-config ${pkgdir}/usr/bin/cups-config
# install licenses
for i in LICENSE NOTICE; do
install -Dm644 $i $pkgdir/usr/share/licenses/$pkgname/$i
done
}
package_cups() {
pkgdesc="The CUPS Printing System - daemon package"
install=cups.install
backup=(etc/cups/cupsd.conf
etc/cups/snmp.conf
etc/cups/printers.conf
etc/cups/classes.conf
etc/cups/cups-files.conf
etc/cups/subscriptions.conf
etc/logrotate.d/cups)
depends=('acl' "libcups>=${pkgver}" 'cups-filters' 'bc'
'libpaper' 'hicolor-icon-theme')
optdepends=('xdg-utils: xdg .desktop file support'
'logrotate: for logfile rotation support')
cd ${pkgbase}-${pkgver}
make BUILDROOT=${pkgdir} install-data install-exec
# this one we ship in the libcups pkg
rm -f ${pkgdir}/usr/bin/cups-config
# kill the sysv stuff
rm -rf ${pkgdir}/etc/rc*.d
rm -rf ${pkgdir}/etc/init.d
install -D -m644 ../cups.logrotate ${pkgdir}/etc/logrotate.d/cups
# fix perms on /var/spool and /etc
chmod 755 ${pkgdir}/var/spool
chmod 755 ${pkgdir}/etc
# install ssl directory where to store the certs, solves some samba issues
install -dm700 -g lp ${pkgdir}/etc/cups/ssl
# remove directory from package, it will be recreated at each server start
rm -rf ${pkgdir}/run
# install some more configuration files that will get filled by cupsd
touch ${pkgdir}/etc/cups/printers.conf
touch ${pkgdir}/etc/cups/classes.conf
touch ${pkgdir}/etc/cups/subscriptions.conf
chgrp -R lp ${pkgdir}/etc/cups
# fix .desktop file
sed -i 's|^Exec=htmlview http://localhost:631/|Exec=xdg-open http://localhost:631/|g' ${pkgdir}/usr/share/applications/cups.desktop
# compress some driver files, adopted from Fedora
find ${pkgdir}/usr/share/cups/model -name "*.ppd" | xargs gzip -n9f
# remove client.conf man page
rm -f ${pkgdir}/usr/share/man/man5/client.conf.5
# comment out all conversion rules which use any of the removed filters that are now part of cups-filters
perl -p -i -e 's:^(.*\s+bannertops\s*)$:#\1:' $pkgdir/usr/share/cups/mime/mime.convs
# comment out unnecessary PageLogFormat entry
sed -i -e 's:PageLogFormat:#PageLogFormat:' $pkgdir/etc/cups/cupsd.conf*
# OpenRC
install -Dm755 ${srcdir}/cupsd.initd ${pkgdir}/etc/init.d/cupsd
# runit
install -Dm755 ${srcdir}/cupsd.run ${pkgdir}/etc/sv/cupsd/run
# install licenses
for i in LICENSE NOTICE; do
install -Dm644 $i $pkgdir/usr/share/licenses/$pkgname/$i
done
}