# Maintainer: Balló György <ballogyor+arch at gmail dot com>
# Contributor: Jan de Groot <jgc@archlinux.org>
# Contributor: Ionut Biru <ibiru@archlinux.org>

pkgname=liblouis
pkgver=3.29.0
pkgrel=3
pkgdesc='Braille translator and back-translator library'
arch=('x86_64' 'aarch64')
url='https://liblouis.io/'
license=('GPL-3.0-or-later AND LGPL-2.1-or-later')
depends=('glibc' 'libyaml')
makedepends=('help2man' 'python-build' 'python-installer' 'python-setuptools' 'python-wheel')
optdepends=('python: Python bindings')
source=("https://github.com/liblouis/liblouis/releases/download/v$pkgver/$pkgname-$pkgver.tar.gz")
sha256sums=('4e73d86bbfe1a9af5447b3ddd607243b50414989ec290bfb467b9b774675c8f5')

build() {
  cd $pkgname-$pkgver
  ./configure --prefix=/usr --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-$pkgver
  make check
}

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

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