# Maintainer: Developer <dev@opalos.org>
# Maintainer: Developer <dev@opalos.org>

pkgname=liblouis
pkgver=%version%
pkgrel=%release%
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')
makedepends=('help2man' 'libyaml' 'python-build' 'python-installer' 'python-setuptools' 'python-wheel')
optdepends=('libyaml: lou_checkyaml command'
            '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
}
