summaryrefslogtreecommitdiff
path: root/main/lua-posixtz/APKBUILD
blob: 2121cffa8a33d138ecfe33d46a97961bdafe72c3 (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
# Contributor: Natanael Copa <ncopa@alpinelinux.org>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
_luaversions="5.1 5.2 5.3"
pkgname=lua-posixtz
pkgver=0.5
pkgrel=1
pkgdesc="Lua module to extract POSIX timezone from tzdata"
url="http://git.alpinelinux.org/cgit/posixtz.git/"
arch="all"
license="GPLv2"
for _i in $_luaversions; do
	makedepends="$makedepends lua$_i-dev"
	subpackages="$subpackages lua$_i-posixtz:split_${_i/./_}"
done
source="http://dev.alpinelinux.org/archive/posixtz/posixtz-$pkgver.tar.xz"

_sdir="$srcdir"/posixtz-$pkgver

prepare() {
	default_prepare
	for _i in $_luaversions; do
		cp -r "$_sdir" "$srcdir"/build-$_i
	done
}

build() {
	for _i in $_luaversions; do
		cd "$srcdir"/build-$_i
		make LUAPC="lua$_i" core.so
	done
}

package() {
	for _i in $_luaversions; do
		cd "$srcdir"/build-$_i
		install -D core.so "$pkgdir"/usr/lib/lua/$_i/posixtz/core.so
		install -D posixtz.lua "$pkgdir"/usr/share/lua/$_i/posixtz.lua
	done
}

_split() {
	local d= _ver=$1
	pkgdesc="Lua $_ver module to extract POSIX timezone from tzdata"
	install_if="lua$_ver $pkgname=$pkgver-r$pkgrel"
	for d in usr/lib/lua usr/share/lua; do
		if [ -d "$pkgdir"/$d/$_ver ]; then
			mkdir -p "$subpkgdir"/$d
			mv "$pkgdir"/$d/$_ver "$subpkgdir"/$d/
		fi
	done
}

for _i in $_luaversions; do
	eval "split_${_i/./_}() { _split $_i; }"
done

sha512sums="68dbaab9f4aef166ac2f2d40b49366527b840bebe17a47599fe38345835e4adb8a767910745ece9c384b57af815a871243c3e261a29f41d71f8054df3061b3fd  posixtz-0.5.tar.xz"