aboutsummaryrefslogtreecommitdiffstats
path: root/community/luasrcdiet/APKBUILD
blob: 0688a2dc3871ba5851e488e923a791f6145e02b4 (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
# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
pkgname=luasrcdiet
pkgver=1.0.0
pkgrel=1
pkgdesc="Compresses Lua source code by removing unnecessary characters"
url="https://github.com/jirutka/luasrcdiet"
arch="noarch"
license="MIT"
depends="lua"
replaces="lua-srcdiet"  # for backward compatibility
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:_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"
	replaces="lua$lver-srcdiet"  # for backward compatibility
	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="12b18058a30c0541578f1ff39abbe45b14d9b79422ace4dfcd106b3b4f2a6398722f57b6ba24eba8f405eaac011fd1673e456f7f3023223b0b9718e611e6e729  luasrcdiet-1.0.0.tar.gz"