summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: c50c37d7cd0287da856179f17570e8a57bdc30c5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# Maintainer: haxibami <contact at haxibami dot net>
# Contributor: Klaus Alexander Seistrup <klaus@seistrup.dk>

pkgname=python-qh3
_pkgname="${pkgname/python-/}"
pkgver=1.2.1
pkgrel=1
pkgdesc='Lightweight QUIC and HTTP/3 implementation in Python'
arch=('aarch64' 'x86_64')
url='https://github.com/jawah/qh3'
license=('BSD-3-Clause')
depends=('gcc-libs' 'glibc' 'python>3.7')
makedepends=(
  'clang' 'mold' 'cmake' 'python-build' 'python-installer'
  'python-maturin' 'python-wheel'
)
checkdepends=('python-cryptography')
source=("${pkgname}-${pkgver}.tar.gz::${url}/archive/refs/tags/v${pkgver}.tar.gz")
sha256sums=('68259854ba225960bc02d00e675728fe1370813d21d705bef343ccea7019be4a')

build() {
  cd "${srcdir}/${_pkgname}-${pkgver}"
  # Note: (GCC +) mold or (Clang +) lld is required to build with LTO
  export RUSTFLAGS="${RUSTFLAGS} -Clink-arg=-fuse-ld=mold"
  # export CC=clang CXX=clang++ RUSTFLAGS="${RUSTFLAGS} -Clink-arg=-fuse-ld=lld"
  python -m build --wheel --no-isolation
}

check() {
  cd "${srcdir}/${_pkgname}-${pkgver}"
  python -m installer -d tmp_install dist/*.whl
  local python_version=$(python -c 'import sys; print(".".join(map(str, sys.version_info[:2])))')
  export PYTHONPATH="${PWD}/tmp_install/usr/lib/python${python_version}/site-packages"
  # See: https://github.com/jawah/qh3/blob/7145f484d49ca1f7625b7de5ecb49b03525b54b2/.github/workflows/CI.yml#L102
  rm -fR qh3
  python -m unittest discover -v
}

package() {
  cd "${srcdir}/${_pkgname}-${pkgver}"
  python -m installer --destdir="$pkgdir" dist/*.whl
  install -Dm644 -t "${pkgdir}/usr/share/licenses/${pkgname}/" LICENSE
}