# $Id$ PNAME="cups" PVER="2.2.7" PBUILD="r1" SPLIT_PACKAGES="libcups cups" PCAT="net-print" HOMEPAGE="http://www.cups.org/" LIB_DEPEND=">= virtual/glibc >= app-crypt/gnutls-3.6 >= media-libs/libpng-1.5 >= media-libs/libtiff-4 >= virtual/libjpeg >= net-dns/avahi-0.7 >= sys-libs/zlib-1.2.5 >= sys-libs/libstdc++-6.3 >= sys-apps/systemd-230" CUPS_DEPEND=">= sys-libs/pam-1.1 >= sys-apps/acl-2.2 >= sys-apps/dbus-1.10 >= dev-libs/libusb-compat-0.1.3 >= dev-libs/dbus-glib-0.108 >= app-text/libpaper-1.1.24 >= app-text/poppler-0.64" SDEPEND="${LIB_DEPEND} ${CUPS_DEPEND} >= sys-dev/automake-9 >= sys-dev/autoconf-10" SRCFILE="${PNAME}-${PVER}-source.tar.gz" SRCDIR="${BUILDDIR}/${PNAME}-${PVER}" sminclude mtools multilib mbuild systemd msetfeature "!check" SRC_URI=( https://github.com/apple/${PNAME}/releases/download/v${PVER}/${SRCFILE} mirror://${PNAME}/${SRCFILE} mirror://${PNAME}/cups.conf.tmpd mirror://${PNAME}/cups.logrotate mirror://${PNAME}/cups.pam-systemauth mirror://${PNAME}/${PNAME}-1.2.11-multilib.patch mirror://${PNAME}/${PNAME}-2.2.7-systemd-socket.patch mirror://${PNAME}/${PNAME}-1.5.0-build-fix.patch mirror://${PNAME}/${PNAME}-2.1.4-dnssd-deviceid.patch mirror://${PNAME}/${PNAME}-2.0.3-no-export-ssllibs.patch mirror://${PNAME}/${PNAME}-2.2.3-no-gzip-man.patch mirror://${PNAME}/${PNAME}-2.0.3-statedir.patch mirror://${PNAME}/${PNAME}-2.2.5-perms.patch ) # exclude beta versions UP2EXCLUDE="b[0-9]" UP2DATE="updatecmd https://github.com/apple/cups/releases | grep ${PNAME}- | sed 's:-source::g' | highesttarball gz" split_info_libcups() { DESCRIPTION="cups: common unix printing system - client libraries and headers" DEPEND="${LIB_DEPEND}" } split_info_cups() { DESCRIPTION="cups: common unix printing system - service daemons." DEPEND="== net-print/libcups-${PVER} ${CUPS_DEPEND}" } pkg_setup() { preinstall_cups } src_prepare() { munpack ${SRCFILE} || die # fix hardcoded /usr/lib in cups-directories.m4 to respect 64bit arches mpatch ${PNAME}-1.2.11-multilib.patch || die # adds systemd socket activation support mpatch ${PNAME}-2.2.7-systemd-socket.patch || die # fix build, adds missing -lrt mpatch ${PNAME}-1.5.0-build-fix.patch || die # mark DNSSD device-ids that have been guessed at with "FZY:1;" mpatch ${PNAME}-2.1.4-dnssd-deviceid.patch || die # do not export SSL libs in cups-config mpatch ${PNAME}-2.0.3-no-export-ssllibs.patch || die # do not compress man pages mpatch ${PNAME}-2.2.3-no-gzip-man.patch || die # move /var/run -> /run mpatch ${PNAME}-2.0.3-statedir.patch || die # fix broken install permissions mpatch ${PNAME}-2.2.5-perms.patch || die # 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 # non standard configure all-abis aclocal -I config-scripts --force || die all-abis autoconf --force || die } src_compile() { mconfigure \ --localstatedir=/var \ --with-docdir=/usr/share/cups/html \ --with-systemdsystemunitdir=$(mget-systemd-unit-dir) \ --with-cups-user=lp \ --with-cups-group=lp \ --with-system-groups=lpadmin \ --enable-threads \ --enable-pam \ --enable-nls \ --enable-dbus \ --enable-png \ --enable-jpeg \ --enable-tiff \ --enable-libpaper \ --enable-avahi \ --enable-ssl=yes \ --enable-gnutls \ --enable-raw-printing \ --disable-slp \ --disable-php \ --disable-ldap \ || die mmake || die } src_install_libcups() { mmake BUILDROOT=${BINDIR} install-headers || die mmake BUILDROOT=${BINDIR} install-libs || die # install config utiliy so other packages can find the libs # because there a no pkgconfig files minstallexec cups-config || die } src_install_cups() { mmake BUILDROOT=${BINDIR} install-data || die mmake BUILDROOT=${BINDIR} install-exec || die # provided by libcups mdelete /usr/bin/cups-config || die # gzip *all* ppd's not just few find ${BINDIR}/usr/share/cups/model -name "*.ppd" | xargs gzip -n9f || die # remove 32bit serverbins and co on 64bit multilib systems if [[ ${ARCH} = x86_64 ]] then if [[ -d ${BINDIR}/usr/lib/cups ]] then mdelete -r /usr/lib/cups || die fi fi # remove possible installed backup configs find ${BINDIR}/etc -name "*.O" | xargs rm -f || die find ${BINDIR}/etc -name "*.N" | xargs rm -f || die # tempfile creation minstalltmp cups.conf.tmpd cups.conf || die # install logrotate config minstalllog cups.logrotate cups || die # install pam config minstallpam cups.pam-systemauth cups || die # ship some config files to keep many apps happy (javapps nxnode etc) memptyfile /etc/cups/printers.conf || die memptyfile /etc/cups/classes.conf || die memptyfile /etc/cups/client.conf || die memptyfile /etc/cups/subscriptions.conf || die # prevents uninstall from prior versions mkeepdir /usr/share/cups/profiles || die mkeepdir /usr/$(mlibdir)/cups/driver || die mkeepdir /var/log/cups || die mkeepdir /var/run/cups/certs || die mkeepdir /var/spool/cups || die mkeepdir /var/spool/cups/tmp || die # create a rss feed directory mkeepdir /var/cache/cups/rss || die mchown lp.lp /var/cache/cups/rss || die mchmod 0740 /var/cache/cups/rss || die # create a ssl directory to store cacerts and to fix some samba issues mkeepdir /etc/cups/ssl || die mchown root:lp /etc/cups/ssl || die mchmod 0700 /etc/cups/ssl || die # fix cupsd permisions mchmod 0755 /usr/sbin/cupsd || die # install missing docs minstalldocs CHANGES* CREDITS* LICENSE* README* || die } preinstall_cups() { mgroupadd -o "-g 106" lpadmin mgroupadd -o "-g 9" lp museradd -o "-u 9 -g lp -d /var/spool/lpd -s /bin/false" lp } postinstall_cups() { # renamed cups services if systemctl is-enabled cups.service &> /dev/null then systemctl disable cups.service fi if systemctl is-enabled cups.socket &> /dev/null then systemctl disable cups.socket fi if systemctl is-enabled cups.path &> /dev/null then systemctl disable cups.path fi mstartunit org.cups.cupsd.service cupsd mstartunit org.cups.cupsd.socket cupsd } postremove_cups() { mstopunit org.cups.cupsd.service cupsd mstopunit org.cups.cupsd.socket cupsd }