# Packager = Tuxcore <dev@tuxcore.org> 
pkgname=liblouis
pkgver=3.30.0
pkgrel=1
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=('647baf24a09130634e283dc3ac87cc745a5d1a2e25466870cf22c8b7c6b5ff28ea288e9c06c1a6a793ecca6649f29a186c58e6633aa0031e04e668f04a14abe4')

prepare() {
  cd $pkgname
  autoreconf -fi
}

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

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

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