| 1 | # Contributor: Jakub Jirutka <[email protected]> |
| 2 | # Maintainer: Jakub Jirutka <[email protected]> |
| 3 | pkgname=lua-http |
| 4 | pkgver=0.4 |
| 5 | pkgrel=2 |
| 6 | pkgdesc="HTTP Library for Lua that supports HTTP(S) 1.0, 1.1 and 2.0" |
| 7 | url="https://github.com/daurnimator/lua-http" |
| 8 | arch="noarch" |
| 9 | license="MIT" |
| 10 | depends="lua-binaryheap lua-cqueues lua-basexx lua-fifo lua-lpeg lua-lpeg_patterns>=0.5 lua-ossl" |
| 11 | makedepends="lua-bit32 lua-compat53" |
| 12 | checkdepends="lua-busted lua5.1-compat53 lua5.2-compat53 lua5.1-bit32 luajit" |
| 13 | source="$pkgname-$pkgver.tar.gz::https://github.com/daurnimator/lua-http/archive/v$pkgver.tar.gz |
| 14 | fix-cookie-spec-test.patch |
| 15 | $pkgname-fix-tls-test.patch::https://github.com/daurnimator/lua-http/commit/169c1a7586d39be1bf0d98b69934e8e8b08a87cd.patch |
| 16 | fix-tests-key-too-small.patch |
| 17 | fix-request-spec.patch |
| 18 | CVE-2023-4540.patch |
| 19 | " |
| 20 | |
| 21 | # secfixes: |
| 22 | # 0.4-r2: |
| 23 | # - CVE-2023-4540 |
| 24 | |
| 25 | case "$CARCH" in |
| 26 | # FIXME: Some tests fail with "Address not available". |
| 27 | # ppc64le hangs, riscv64, loongarch64 doesn't have luajit |
| 28 | aarch64|arm*|ppc64le|riscv64|loongarch64) options="!check";; |
| 29 | esac |
| 30 | |
| 31 | _luaversions="5.1 5.2 5.3" |
| 32 | for _v in $_luaversions; do |
| 33 | checkdepends="$checkdepends lua$_v lua$_v-busted" |
| 34 | subpackages="$subpackages lua$_v-${pkgname#lua-}:_subpackage" |
| 35 | done |
| 36 | |
| 37 | check() { |
| 38 | local lver; for lver in $_luaversions jit; do |
| 39 | msg "Testing on lua$lver" |
| 40 | lua$lver /usr/bin/busted |
| 41 | done |
| 42 | } |
| 43 | |
| 44 | package() { |
| 45 | mkdir -p "$pkgdir" |
| 46 | } |
| 47 | |
| 48 | _subpackage() { |
| 49 | local lver="${subpkgname:3:3}" |
| 50 | pkgdesc="$pkgdesc (for Lua $lver)" |
| 51 | depends="lua$lver ${depends//lua-/lua$lver-}" |
| 52 | install_if="$pkgname=$pkgver-r$pkgrel lua$lver" |
| 53 | local lmod_dir="$subpkgdir/usr/share/lua/$lver" |
| 54 | local rockdir="$subpkgdir/usr/lib/luarocks/rocks-$lver/$pkgname/$pkgver-1" |
| 55 | |
| 56 | if [ "$lver" != "5.3" ]; then |
| 57 | depends="$depends lua$lver-compat53" |
| 58 | fi |
| 59 | if [ "$lver" = "5.1" ]; then |
| 60 | depends="$depends lua5.1-bit32" |
| 61 | fi |
| 62 | |
| 63 | mkdir -p "$lmod_dir" |
| 64 | cp -r "$builddir"/http "$lmod_dir"/ |
| 65 | |
| 66 | mkdir -p "$rockdir" |
| 67 | echo 'rock_manifest = {}' > "$rockdir"/rock_manifest |
| 68 | } |
| 69 | |
| 70 | sha512sums=" |
| 71 | 3933c36e2d439c81ba4506d3ab1dd53a85ba3cd641abbd945210bdc6b6edb3e01516adb473cf59c5c194d9f45e7de9196e31265318d01c5b7684bb5e87dbd26a lua-http-0.4.tar.gz |
| 72 | 32208d4389d4f1930a2e3b73868ab3070940e4e4819624556050356624718bbcb71b2da4fd9334ed2171eb14c3ed134d2ce201600948fd2372afca09ea2104b5 fix-cookie-spec-test.patch |
| 73 | 01d558cb2f900bf751557652c04f651326cb352d975c4be1aaeff9126d2c4aebebf61b89327f3508f90df66ba8086a4704ba63000a1ea5a854bb1e08853b94dd lua-http-fix-tls-test.patch |
| 74 | 28e7b37d272664fa4ce49ea815444d4b6668279005ea5f0d97c9b841ff6ea505c7dd778d4c531e7839b27c0e6a8c6f0151d26d534146dd59ac4c07d7474a3a8e fix-tests-key-too-small.patch |
| 75 | a9f98c2428dc595a595beb522a2d725696c8080331cb6326da07ad79148a5482c725a22a753752eab94121e62e4647f3fe9b99ebc5954e142ccedaf631c38673 fix-request-spec.patch |
| 76 | 6cc7b0c63f508e141492c2d72e49cc6e91f0a2efb16d3616d03f8ae56a1d1a9a97d68c837a6215505b191c70e5f6c5247946bffaafee85d7d09c895bc1feafe3 CVE-2023-4540.patch |
| 77 | " |