# Packager = Tuxcore <dev@tuxcore.org> 
pkgname=liblouis
pkgver=3.32.0
pkgrel=2
pkgdesc='Braille translator and back-translator library'
arch=(x86_64)
url='https://liblouis.io/'
license=('GPL-3.0-or-later AND LGPL-2.1-or-later')
depends=(
  glibc
  libyaml
)
makedepends=(
  git
  help2man
  python-build
  python-installer
  python-setuptools
  python-wheel
)
optdepends=('python: Python bindings')
source=("git+https://github.com/liblouis/liblouis.git#tag=v$pkgver")
b2sums=(f667ca6062d5dc19a0c105ff7da41f3997b20a697bcd38aa1b713eec7739681ebb918210e6cbe30b58e0bb6a0a8b19fb5b995bb113d83876b3c6ab0171bb8eb8)
validpgpkeys=(E9DDC8901A42F78B79CDC46042A55BD5EA40AB1A) # Christian Egli <christian.egli@sbs.ch>

prepare() {
  cd $pkgname
  autoreconf -fi
}

build() {
  cd $pkgname
  ./configure \
    --prefix=/usr \
    --sysconfdir=/etc \
    --localstatedir=/var \
    --enable-ucs4
  sed -i -e 's/ -shared / -Wl,-O1,--as-needed\0/g' libtool
  make

  cd python
  python -m build --wheel --no-isolation
}

check() {
  cd $pkgname
  make check
}

package() {
  cd $pkgname
  make DESTDIR="$pkgdir" install

  cd python
  python -m installer --destdir="$pkgdir" dist/*.whl
}
