aboutsummaryrefslogtreecommitdiffstats
path: root/community/lua-compat53/APKBUILD
blob: 2b19c3892c820a7d35170299fe4b3f55aa0f5594 (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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
_luaversions="5.1 5.2 5.3"
pkgname=lua-compat53
_rockname=compat53
_pkgname=lua-compat-5.3
pkgver=0.3
pkgrel=1
pkgdesc="Compatibility module providing Lua-5.3-style APIs for Lua"
url="https://github.com/keplerproject/lua-compat-5.3"
arch="all"
license="MIT"
depends=""
makedepends=""
subpackages=""
for _v in $_luaversions; do
	makedepends="$makedepends lua$_v-dev luarocks$_v"
	subpackages="$subpackages lua$_v-${pkgname#lua-}:_package"
done
source="$pkgname-$pkgver.tar.gz::https://github.com/keplerproject/$_pkgname/archive/v$pkgver.tar.gz"
builddir="$srcdir/$_pkgname-$pkgver"

build() {
	cd "$builddir"

	local lver; for lver in $_luaversions; do
		msg "Building for Lua $lver..."

		luarocks-$lver \
			CC="$CC" \
			CFLAGS="$CFLAGS -fPIC" \
			LUA_INCDIR="$(pkg-config --variable=includedir lua$lver)" \
			LUA_LIBDIR="$(pkg-config --variable=libdir lua$lver)" \
			make --tree=./build rockspecs/compat53-scm-0.rockspec
	done
}

package() {
	mkdir -p "$pkgdir"
}

_package() {
	local lver="${subpkgname:3:3}"
	pkgdesc="$pkgdesc $lver"
	depends="lua$lver"
	install_if="$pkgname=$pkgver-r$pkgrel lua$lver"
	local rockdir="$subpkgdir/usr/lib/luarocks/rocks-$lver/$_rockname/$pkgver-1"

	local path; for path in lib/lua/$lver share/lua/$lver; do
		mkdir -p "$subpkgdir"/usr/${path%/*}
		mv "$builddir"/build/$path "$subpkgdir"/usr/$path/ || return 1
	done

	mkdir -p "$rockdir"
	echo 'rock_manifest = {}' > "$rockdir"/rock_manifest
}

md5sums="98f93f9de24b26ee5f6f7053979599f8  lua-compat53-0.3.tar.gz"
sha256sums="ac61979b944b17a245c6b1a696a23b18e664296d392dc1966788afda6a911ccd  lua-compat53-0.3.tar.gz"
sha512sums="e8be1e0327c445b2025f52b578ecf1e842a108785268e1b82bf3999d00f352ac450d0b5bd22f2c63e382d178fae0b86989c67d8c91eddcf8994eb9c5fc0569c5  lua-compat53-0.3.tar.gz"