# POWER Maintainer: Alexander Baldeck <alex.bldck@gmail.com>
# Maintainer: Levente Polyak <anthraxx[at]archlinux[dot]org>
# Contributor: Timothy Redaelli <timothy.redaelli@gmail.com>
# Contributor: Florian Loitsch <archlinux@florian.loitsch.com>

pkgbase=miniupnpc
pkgname=(miniupnpc python-miniupnpc)
pkgver=2.2.8
pkgrel=1.1
pkgdesc='Small UPnP client library/tool to access Internet Gateway Devices'
url='https://miniupnp.tuxfamily.org/'
arch=(x86_64 powerpc64le powerpc64 powerpc riscv64)
license=('BSD')
makedepends=('sh' 'glibc' 'lsb-release' 'python' 'python-setuptools')
source=(http://miniupnp.free.fr/files/miniupnpc-${pkgver}.tar.gz{,.sig})
sha512sums=('526c9df1485302d4c9c78062fb058cfd433463f6e7a9f4025a9f5228aef41ee61a4b9e7a76b6cfa8779b91cc3c663846a997dc1470902d7108b129155e6a3360'
            'SKIP')
b2sums=('eae4d97bdf8c494ea6744edfeb870f9d92df8468d23f974e0e44e735fc7c8925189ea58f60a71c37315aebff1269ae69e9413cdf80dc292c4b90df5f12bf58a4'
        'SKIP')
validpgpkeys=(
  '751E9FF6944A3B36A5432216DB511043A31ACAAF' # miniupnp (miniupnp !) <miniupnp@free.fr>
)

build() {
  cd ${pkgname}-${pkgver}
  make
  python setup.py build
}

check() {
  cd ${pkgname}-${pkgver}
  make test
}

package_miniupnpc() {
  depends=(sh glibc)
  provides=(libminiupnpc.so)

  cd ${pkgname}-${pkgver}
  make DESTDIR="${pkgdir}" install
  install -Dm 644 man3/miniupnpc.3 -t "${pkgdir}/usr/share/man/man3"
  install -Dm 644 LICENSE -t "${pkgdir}/usr/share/licenses/${pkgname}"
}

package_python-miniupnpc() {
  pkgdesc='Python bindings for miniupnpc'
  depends=(python glibc)

  cd ${pkgbase}-${pkgver}
  python setup.py install --optimize=1 --skip-build --root="$pkgdir"
  install -Dm 644 LICENSE -t "${pkgdir}/usr/share/licenses/${pkgname}"
}

# vim: ts=2 sw=2 et:
