# Contributor: Timo Teräs <timo.teras@iki.fi>
# Maintainer: Timo Teräs <timo.teras@iki.fi>
pkgname=lua-resty-jwt
pkgver=0.2.3
pkgrel=2
pkgdesc="JSON Web Token library for OpenResty"
url="https://github.com/cdbattags/lua-resty-jwt"
# ppc64le, riscv64, loongarch64: no luajit/openresty
# armhf, armv7, s390x, x86: ffi broken -> test suite fails
arch="aarch64 x86_64"
license="Apache-2.0"
depends="lua-resty-hmac lua-resty-openssl"
checkdepends="
	lua-cjson
	openresty
	perl-utils
	perl-test-nginx
	"
source="$pkgname-$pkgver.tar.gz::https://github.com/cdbattags/lua-resty-jwt/archive/v$pkgver.tar.gz
	fix-pkey-op-type-crypt.patch
	"

prepare() {
	default_prepare

	# test suite expects CI/Docker, fix the root path for certs
	sed -i "s,/lua-resty-jwt/,$PWD/,g" t/*.t
}

package() {
	mkdir -p "$pkgdir/usr/share/lua/common"
	cp -r ./lib/resty "$pkgdir/usr/share/lua/common"
}

check() {
	prove -r t
}

sha512sums="
7ec1d69d8097467acdc9bb36c050017d9f3ba84a3db6d84b240f927992b5f67096ed985367920b41d0df4ef1c0891a3ae17b469621cc77fcceed938f4a20b2a1  lua-resty-jwt-0.2.3.tar.gz
a837371415c245b9dc30043b7a1331aafdf18b222e3f76e94d4d714a89f326b84848caf6dd62a6cb82c3270d81f8da4982d40cebf9c7c736c600a195657da33e  fix-pkey-op-type-crypt.patch
"
