#!/usr/bin/bash
# JOBoRun		: Jwm OpenBox Obarun RUNit
# Maintainer	: Joe Bo Run <joborun@disroot.org>
# PkgSource		: url="https://gittea.disroot.org/joborun-pkg/jobextra/$pkgname"
# Website		: https://pozol.eu
#-----------------------------------------| DESCRIPTION |---------------------------------------

pkgname=cups-filters-no-dbus
_pkgname=cups-filters
pkgver=1.28.16
pkgrel=03
pkgdesc="OpenPrinting CUPS Filters w/o systemd"
arch=('x86_64')
url="https://wiki.linuxfoundation.org/openprinting/cups-filters"
checkdepends=('ttf-dejavu') # ttf-dejavu for make check
depends=('lcms2' 'poppler' 'qpdf' 'ijs' 'libcups-no-dbus>=2.2.4-02' 'libexif')
makedepends=('ghostscript' 'python' 'mupdf-tools' 'liblouis')
optdepends=('ghostscript: for non-PostScript printers to print with CUPS to convert PostScript to raster images'
	    'foomatic-db: drivers use Ghostscript to convert PostScript to a printable form directly'
	    'foomatic-db-engine: drivers use Ghostscript to convert PostScript to a printable form directly'
	    'foomatic-db-nonfree: drivers use Ghostscript to convert PostScript to a printable form directly'
	    'antiword: to convert MS Word documents'
	    'docx2txt: to convert Microsoft OOXML text from DOCX files'
	    'imagemagick: for Braille embosser support'
	    'liblouis: for Braille embosser support')
backup=(etc/cups/cups-browsed.conf)
conflicts=(cups-filters)
replaces=(cups-filters)
provides=(cups-filters)
source=(https://www.openprinting.org/download/cups-filters/$_pkgname-$pkgver.tar.xz)

build() {
  cd "$_pkgname"-$pkgver
  ./configure --prefix=/usr  \
    --sysconfdir=/etc \
    --sbindir=/usr/bin \
    --localstatedir=/var \
    --with-rcdir=no \
    --disable-avahi \
    --with-browseremoteprotocols=DNSSD,CUPS \
    --with-test-font-path=/usr/share/fonts/TTF/DejaVuSans.ttf
  sed -i -e 's/ -shared / -Wl,-O1,--as-needed\0/g' libtool
  make
}

check() {
  cd "$_pkgname"-$pkgver
  make check
}

package() {
  cd "$_pkgname"-$pkgver
  make DESTDIR="$pkgdir/" install
  
  # use cups group from cups pkg FS#56818
  chgrp -R 209 "${pkgdir}"/etc/cups

  # license
  mkdir -p "${pkgdir}"/usr/share/licenses/${_pkgname}
  install -m644 "${srcdir}"/${_pkgname}-${pkgver}/COPYING "${pkgdir}"/usr/share/licenses/${_pkgname}/
}

#---- license gpg-key sha256sums ----

license=('custom')

sha256sums=(3a400bfa751da2020775cd7d48d1647448551ff051f9345abc1df6357b199ac0) # cups-filters-1.28.16.tar.xz
 
