# Maintainer: Tobias Powalowski <tpowa@archlinux.org>
# Contributor: Manolis Tzanidakis <manolis@archlinux.org>

pkgname=libieee1284
pkgver=0.2.11
_tag=${pkgver//\./_}
pkgrel=11
pkgdesc="A library to query devices connected in parallel port"
arch=('x86_64')
license=('GPL2')
url="https://github.com/twaugh/libieee1284"
optdepends=('python: for python module')
makedepends=('python' 'xmlto' 'docbook-xml' 'docbook-xsl')
source=(libieee1284-$pkgver.zip::https://github.com/twaugh/libieee1284/archive/V$_tag.zip
        upstream_python_fix1.patch
        upstream_python_fix2.patch
        python3.patch)
sha1sums=('5e24fb4e69652e2460e24af0b7ef6ca960c78965'
          '8492a99b3350d0201c8720acda8ef442c36c651d'
          '01dc3aed6266db00e1d0b9c3f6c15aabfdcdcf14'
          '55f92727e761afd3640edae01b6087eb4779ea0b')

prepare() {
  cd $pkgname-$_tag

  patch -p1 < ../upstream_python_fix1.patch # https://github.com/twaugh/libieee1284/commit/c48855528beee1397d883f9c8a5df7aed5c917a6
  patch -p1 < ../upstream_python_fix2.patch # https://github.com/twaugh/libieee1284/commit/b4d63327dfef8dbf12aabf4bba0f6818a3519995

  patch -p1 < ../python3.patch # https://github.com/twaugh/libieee1284/issues/4
}

build() {
  cd $pkgname-$_tag

  ./bootstrap
  ./configure --prefix=/usr --mandir=/usr/share/man --with-python
  make
}

package() {
  cd $pkgname-$_tag
  make DESTDIR="$pkgdir"/ install
}
