# Maintainer: Andreas Radke <andyrtr@archlinux.org>

_pkgbasename=libcups
pkgname=lib32-$_pkgbasename
pkgver=2.4.7
pkgrel=1
pkgdesc="The CUPS Printing System - client libraries (32-bit)"
arch=('x86_64')
license=('Apache' 'custom')
url="https://www.cups.org/"
depends=(lib32-krb5 lib32-libtiff lib32-libpng lib32-gnutls $_pkgbasename)
source=(https://github.com/OpenPrinting/cups/releases/download/v${pkgver}/cups-${pkgver}-source.tar.gz{,.sig}
        cups-freebind.patch
        guid.patch
)
sha256sums=('dd54228dd903526428ce7e37961afaed230ad310788141da75cebaa08362cf6c'
            'SKIP'
            '3385047b9ac8a7b13aeb8f0ca55d15f793ce7283516db0155fe28a67923c592d'
            '0bf6a75ba1b051771f155d9a5d36b307a6d40c6857d645b250fe93f3fb713474')
#validpgpkeys=('7ADB58203CA5F046F28025B215AA6A7F4D4227D7') # "Zdenek Dohnal (Associate Software Engineer) <zdohnal@redhat.com>"
validpgpkeys=('7082A0A50A2E92640F3880E0E4522DCC9B246FF7') # Zdenek Dohnal (The old 4D4227D7 key revoked) <zdohnal@redhat.com>

build() {
  export CC="gcc -m32"
  export CXX="g++ -m32"
  export PKG_CONFIG_PATH="/usr/lib32/pkgconfig"

  cd cups-${pkgver}

  aclocal -I config-scripts
  autoconf -I config-scripts

  ./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var \
     --disable-ldap --enable-raw-printing --disable-gssapi --disable-dbus \
     --enable-ssl=yes--enable-threads --enable-libusb=no \
	 --with-dnssd=no \
     --with-optim="$CFLAGS" --libdir=/usr/lib32
  make libs
}

package() {
  cd cups-${pkgver}
  make BUILDROOT="${pkgdir}" install-libs
  rm -rf "$pkgdir/usr/lib"

# add license + exception
  install -m644 -Dt "${pkgdir}/usr/share/licenses/${pkgname}" {LICENSE,NOTICE}
}
