Skip to content
Snippets Groups Projects
APKBUILD 2.95 KiB
Newer Older
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
# Contributor: Bartłomiej Piotrowski <nospam@bpiotrowski.pl>
Cameron Banta's avatar
Cameron Banta committed
pkgname=luajit
_pkgver=${pkgver/_p/-}
pkgrel=0
_gitrev_tests=9ad3724b1a02855a3cad638bba2e564f825954ce
pkgdesc="OpenResty's branch of LuaJIT"
url="https://github.com/openresty/luajit2"
# riscv64: does not build/not supported
arch="all !riscv64"
Cameron Banta's avatar
Cameron Banta committed
license="MIT"
checkdepends="
	perl
	perl-parallel-forkmanager
	sqlite-dev
	zlib-dev
	"
provides="lua"
# lower than 5.1
provider_priority=90
Cameron Banta's avatar
Cameron Banta committed
subpackages="$pkgname-dev $pkgname-doc"
source="https://github.com/openresty/luajit2/archive/v$_pkgver/$_pkgname-$_pkgver.tar.gz
	https://github.com/openresty/luajit2-test-suite/archive/$_gitrev_tests/luajit2-test-suite-$_gitrev_tests.tar.gz
	$pkgname-$pkgver-loongarch64-support.patch::https://github.com/loongson/luajit2/releases/download/v$_pkgver-loongarch64/0001-Add-loongarch64-support-of-all.patch
	fix-tests-alpine.patch
	module-paths.patch
Leo's avatar
Leo committed
	"
builddir="$srcdir/$_pkgname-$_pkgver"

prepare() {
	cp -Rl ../luajit2-test-suite-$_gitrev_tests test-suite

	default_prepare
	case "$CARCH" in
		# bit.tobit test failed (got 280328, expected 277312)
		arm*) rm test-suite/test/misc/bit_op.lua;;
		# 35: declaration specifier expected near '_Alignas' at line 882
		x86) rm test-suite/test/sysdep/ffi_include_std.lua;;
                # jit_record and iter-bug tests failed on ppc64le (module not found).
                ppc64le) rm test-suite/test/misc/jit_record.lua; rm test-suite/test/misc/iter-bug.lua;;
Cameron Banta's avatar
Cameron Banta committed
build() {
	# It's a language runtime, performance does matter. Users for whom disk
	# size is more important can use lua5.1 instead.
	export CFLAGS="${CFLAGS/-Os/-O2}"

	# These flags are recommended by OpenResty.
	local xcflags="-DLUAJIT_ENABLE_LUA52COMPAT -DLUAJIT_NUMMODE=2"

	make amalg PREFIX=/usr XCFLAGS="$xcflags"
	local prefix="$builddir/test-suite/target"
	mkdir -p "$prefix"

	make install PREFIX="$prefix"

	cd test-suite
	LUA52=1 ./run-tests "$prefix"
Cameron Banta's avatar
Cameron Banta committed
}

package() {
	make install DESTDIR="$pkgdir" PREFIX=/usr
	install -Dm644 COPYRIGHT \
		"$pkgdir"/usr/share/licenses/$pkgname/COPYRIGHT
3bf4dd3d7678016baba62ad9fb5130e88c5d66b4b0ffa469c4cd597d18d28533103ee4e5e97921b929b86c7adf4700c916356763426444429acdd7c7b152d27b  luajit2-2.1-20240815.tar.gz
97026778f76cb4ae42b88e3799fc67eb168dd3a6f0c3837c2aa237b916c550e268dfe7dc8c1a5cc864c28ab0331f3299800abbdcefbe26fc7ba48685bee58001  luajit2-test-suite-9ad3724b1a02855a3cad638bba2e564f825954ce.tar.gz
58000c35079e77d2b19e3650c65bf3fbc71afd9f274b3ae6f8757b2ce7518bc519f9f3be83e5f73961f7b19ee8e5c0a3097b6d75b59f1a574f9c86cda30d2bd4  luajit-2.1_p20240815-loongarch64-support.patch
684be4199634ac6e52183e98b65c9bcdc99217865c47b83a1f579a9f0e1ec55fb1a5fe8ae2f1293ac561c8c806aef269e451e3d73bf168ec20a4fd343c7a89d4  fix-tests-alpine.patch
9c6c410e142838c5128c70570e66beb53cc5422df5ecfb8ab0b5f362637b21ab5978c00f19bc1759165df162fd6438a2ed43e25020400011b7bb14014d87c62e  module-paths.patch
"