aboutsummaryrefslogtreecommitdiffstats
path: root/main/lua-hashids/APKBUILD
blob: f27d459ac593e488577c7f154362e9ecc5cc42b5 (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
# Contributor: Carlo Landmeter <clandmeter@gmail.com>
# Maintainer: Carlo Landmeter <clandmeter@gmail.com>
pkgname=lua-hashids
pkgver=1.0.6
pkgrel=1
pkgdesc="A Lua implementation of hashids"
url="https://github.com/leihog/hashids.lua"
arch="all"
license="MIT"
depends=""
depends_dev=""
makedepends=""
install=""
subpackages=""
options="!check"
source="hashids.lua-$pkgver.tar.gz::https://github.com/leihog/hashids.lua/archive/v$pkgver.tar.gz"

builddir="$srcdir"/hashids.lua-$pkgver

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

prepare() {
	default_prepare

	local lver; for lver in $_luaversions; do
		cp -r "$builddir" "$builddir-$lver"
	done
}

build() {
	local lver; for lver in $_luaversions; do
		msg "Building for Lua $lver..."
		make -C "$builddir-$lver"
	done
}

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

_subpackage() {
	local lver="${subpkgname:3:3}"
	pkgdesc="$pkgdesc (for Lua $lver)"
	depends="lua$lver"
	install_if="$pkgname=$pkgver-r$pkgrel lua$lver"

	cd "$builddir-$lver"
	make INSTALLDIR="$subpkgdir"/usr/lib/lua/$lver/hashids install
	mkdir -p "$subpkgdir"/usr/share/lua/$lver/hashids
	mv "$subpkgdir"/usr/lib/lua/$lver/hashids/init.lua \
		"$subpkgdir"/usr/share/lua/$lver/hashids/
}

sha512sums="33ae6d8e465a35bb04a791da645d6003a25d6917a67aaa4abbb5d80470d6ad6b37ff4ed5b82bc4893be2f0dfb213730c13ae1d14486c5476d0b892b64345f2d7  hashids.lua-1.0.6.tar.gz"