aboutsummaryrefslogtreecommitdiffstats
path: root/community/lua-srcdiet/APKBUILD
blob: 17fa7345d54596cdf48a95a0c05af545638ee4b3 (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
# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
pkgname=lua-srcdiet
_pkgname=luasrcdiet
pkgver=0.3.0
pkgrel=1
pkgdesc="Compresses Lua source code by removing unnecessary characters"
url="https://github.com/jirutka/luasrcdiet"
arch="noarch"
license="MIT"
depends="lua"
source="$pkgname-$pkgver.tar.gz::https://github.com/jirutka/$_pkgname/archive/v$pkgver.tar.gz"
builddir="$srcdir/$_pkgname-$pkgver"
options="!check"  # upstream does not provide tests yet

_luaversions="5.1 5.2 5.3"
for _v in $_luaversions; do
	subpackages="$subpackages lua$_v-${pkgname#lua-}:_subpackage"
done

package() {
	cd "$builddir"
	install -D -m 755 bin/$_pkgname "$pkgdir"/usr/bin/$_pkgname
}

_subpackage() {
	local lver="${subpkgname:3:3}"
	pkgdesc="$pkgdesc (for Lua $lver)"
	depends="lua$lver ${depends//lua-/lua$lver-}"
	install_if="$pkgname=$pkgver-r$pkgrel lua$lver"
	local lmod_dir="$subpkgdir/usr/share/lua/$lver"
	local rockdir="$subpkgdir/usr/lib/luarocks/rocks-$lver/$_pkgname/$pkgver-1"

	cd "$builddir"

	mkdir -p "$lmod_dir"
	cp -r $_pkgname "$lmod_dir"/

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

sha512sums="3703c0dbcff7610ab375a41971ab3a7cc3db86b0b49dec52f3f9b6ca7ebea7b84dd144f8dc0b042453f6b1b880b61fe8a756231a1bed3d304fda7d2a831a49ab  lua-srcdiet-0.3.0.tar.gz"