# POWER Maintainer: Alexander Baldeck <alex.bldck@gmail.com>
# Maintainer: Felix Yan <felixonmars@archlinux.org>
# Contributor: Marti Raudsepp <marti@juffo.org>
# Contributor: Radu Andries <admiral0@tuxfamily.org>
# Contributor: Andy Weidenbaum <archbaum@gmail.com>

pkgname=zbar
pkgver=0.23.93
pkgrel=1
pkgdesc="Application and library for reading bar codes from various sources"
arch=(x86_64 powerpc64le powerpc64 powerpc riscv64)
url="https://github.com/mchehab/zbar"
license=('LGPL')
depends=('dbus' 'imagemagick' 'libxv' 'v4l-utils')
makedepends=('gtk3' 'qt5-x11extras' 'python' 'xmlto' 'docbook-xsl' 'gobject-introspection')
optdepends=('gtk3: for zbar-gtk'
            'qt5-x11extras: for zbar-qt'
            'python: for zbar python bindings')
conflicts=('zbar-gtk' 'zbar-qt' 'python-zbar')
provides=('zbar-gtk' 'zbar-qt' 'python-zbar')
replaces=('zbar-gtk' 'zbar-qt' 'python-zbar')
source=(
  "$pkgname-$pkgver.tar.gz::https://github.com/mchehab/zbar/archive/refs/tags/$pkgver.tar.gz"
   https://github.com/mchehab/zbar/commit/368571ff.patch
   https://github.com/mchehab/zbar/commit/a549566e.patch
)
sha512sums=('2dd607afbb1e52346bfb740f916c8616112d14153f071f82458b7c653f647b332290a5089543abebfe1c7679eae98b349a84777185d61cfb9ff275bfecc6e08f'
            'ae3b1123d558d12690651da4ff7e77d5e805f3b2fb5372756cbb50ef18f73c87feee71aada35a2ca889e8f893d60969ed2d7a86c5e54c230902645d458e767e6'
            '8a69dd84731b95ab4d5d0dc37bd83ecf7fa368e197226f0fb63dcce6dce01ef96682b0e12d06489c602d964eedc2ea69ada04b83fba2ef6c4452ca466a25b037')
b2sums=('7476776fbb2b2dca4fb94e4eb8c6c5ca7795e32881e93c45002679bdc048cb0bf8d880d2b31f1469a95d718c6d027b7ee0da195951645478493d6f638ae186b5'
        '618def2024b4b6b3dbfdf298b0c30556a456bfc9e8f0e5bb6515a863e2b33c7603d861602be324b02af68df962f67370ecee7dd76f9a92bb129e1735e0f5b0b1'
        '7283d87ad174c746f79a9d0531e10d5285d25d3e22c6dcc375a62377a12a22656483a69e19288e90367eeb7d31e31397c75fc7f75f3a0aede0cdec2e3bc3d317')

prepare() {
  patch -Np1 -d $pkgname-$pkgver -i ../368571ff.patch # Fix build
  patch -Np1 -d $pkgname-$pkgver -i ../a549566e.patch # Fix build
  cd zbar-$pkgver
  autoreconf -vfi
}

build() {
  cd zbar-$pkgver
  ./configure --prefix=/usr --with-qt --with-gtk=gtk3 --with-dbusconfdir=/usr/share CFLAGS="$CFLAGS -DNDEBUG"
  sed -i -e 's/ -shared / -Wl,-O1,--as-needed\0/g' libtool
  make
}

package() {
  cd zbar-$pkgver
  make DESTDIR="$pkgdir" install
}

# vim:set ts=2 sw=2 et:
