| 1 | # Contributor: Celeste <[email protected]> |
| 2 | # Maintainer: John Vogel <[email protected]> |
| 3 | maintainer="John Vogel <[email protected]>" |
| 4 | pkgname=liblouis |
| 5 | pkgver=3.39.0 |
| 6 | pkgrel=0 |
| 7 | pkgdesc="Braille translator and back-translator" |
| 8 | url="https://liblouis.io/" |
| 9 | arch="all" |
| 10 | license="GPL-3.0-or-later" |
| 11 | makedepends=" |
| 12 | help2man |
| 13 | m4 |
| 14 | python3 |
| 15 | py3-gpep517 |
| 16 | py3-setuptools |
| 17 | py3-wheel |
| 18 | " |
| 19 | checkdepends="bash" |
| 20 | subpackages=" |
| 21 | $pkgname-static |
| 22 | $pkgname-dev |
| 23 | $pkgname-bin:_bin |
| 24 | $pkgname-doc |
| 25 | py3-$pkgname-pyc |
| 26 | py3-$pkgname:_py3:noarch |
| 27 | " |
| 28 | source="https://github.com/liblouis/liblouis/releases/download/v$pkgver/liblouis-$pkgver.tar.gz" |
| 29 | |
| 30 | # secfixes: |
| 31 | # 3.22.0-r0: |
| 32 | # - CVE-2022-26981 |
| 33 | |
| 34 | build() { |
| 35 | ./configure \ |
| 36 | --build=$CBUILD \ |
| 37 | --host=$CHOST \ |
| 38 | --prefix=/usr \ |
| 39 | --sysconfdir=/etc \ |
| 40 | --mandir=/usr/share/man \ |
| 41 | --localstatedir=/var \ |
| 42 | --enable-ucs4 |
| 43 | make |
| 44 | |
| 45 | cd python |
| 46 | gpep517 build-wheel \ |
| 47 | --wheel-dir "$builddir"/.dist \ |
| 48 | --output-fd 3 3>&1 >&2 |
| 49 | } |
| 50 | |
| 51 | check() { |
| 52 | make check |
| 53 | |
| 54 | # Tests fail on s390x, very likely due to endianness |
| 55 | if [ "$CARCH" != "s390x" ]; then |
| 56 | python3 -m venv --clear --without-pip --system-site-packages .testenv |
| 57 | .testenv/bin/python3 -m installer .dist/*.whl |
| 58 | |
| 59 | cd python |
| 60 | LD_LIBRARY_PATH="$builddir/liblouis/.libs" \ |
| 61 | LOUIS_TABLEPATH="$builddir/tables" \ |
| 62 | ../.testenv/bin/python3 -m unittest tests/test_louis.py |
| 63 | fi |
| 64 | } |
| 65 | |
| 66 | package() { |
| 67 | make DESTDIR="$pkgdir" install |
| 68 | |
| 69 | python3 -m installer -d "$pkgdir" \ |
| 70 | .dist/*.whl |
| 71 | } |
| 72 | |
| 73 | _bin() { |
| 74 | pkgdesc="$pkgdesc (tools)" |
| 75 | depends="bash make perl py3-$pkgname" |
| 76 | |
| 77 | # s390 doesn't have patgen, but there's other scripts that don't require it |
| 78 | case "$CARCH" in |
| 79 | s390x) ;; |
| 80 | *) depends="$depends cmd:patgen" ;; |
| 81 | esac |
| 82 | |
| 83 | amove usr/bin |
| 84 | } |
| 85 | |
| 86 | _py3() { |
| 87 | pkgdesc="$pkgdesc (python ctypes bindings)" |
| 88 | depends="$pkgname=$pkgver-r$pkgrel" |
| 89 | |
| 90 | amove usr/lib/python* |
| 91 | } |
| 92 | |
| 93 | sha512sums=" |
| 94 | b766759c23dfe9b94c7c1e77e623cf8534090a09e3dd8bdbb448d79115101bb6a3a7abb1a0bf13c02aa9640a72b5597fcd59248004d00951d26803e270ac9005 liblouis-3.39.0.tar.gz |
| 95 | " |