makedepends=( python-cairo dbus-python python-gobject python-cups python-curl python-smbc desktop-file-utils docbook-xsl intltool xmlto python-setuptools)
run=(dbus-python python-gobject python-cairo python-cups python-curl python-smbc desktop-file-utils)

description="A CUPS printer configuration tool and status applet"
url="https://github.com/zdohnal/system-config-printer"

packager="Great-OS Team"
maintainer="Great-OS Team"

name=system-config-printer
version=1.5.18
release=3

source=(https://github.com/OpenPrinting/$name/releases/download/v$version/$name-${version}.tar.xz)

build() {
  cd $name-$version

  ./configure --prefix=/usr \
              --libdir=/usr/lib \
              --sbindir=/usr/bin \
              --sysconfdir=/etc \
              --with-udev-rules 
  make

  make DESTDIR=$PKG install

  # Compile *.pyc
  # find $PKG -name '*.py' -exec python -mpy_compile {} +
  # Compile *.pyo
  # find $PKG -name '*.py' -exec python -O -mpy_compile {} +

  # new cups 2.0.0 service naming
  sed -i "s|cups.socket|org.cups.cupsd.socket|g" "$PKG"/usr/lib/systemd/system/configure-printer@.service
    
  # fix dbus policy location - --with-dbusdir doens't work
  install -dm755 "$PKG"/usr/share/dbus-1/system.d
  mv "$PKG"/etc/dbus-1/system.d/* "$PKG"/usr/share/dbus-1/system.d
  rm -rf "$PKG"/etc/dbus-1
}
