aboutsummaryrefslogtreecommitdiffstats
path: root/main/lua-posixtz/APKBUILD
blob: 246efc5d0f4b68f19a93e53e134ced11e1a4081c (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
61
62
63
64
65
66
67
68
69
70
71
# 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"
depends=
install=
depends_dev=""
makedepends="$depends_dev"
subpackages=""
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() {
	local i
	cd "$_sdir"
	for i in $source; do
		case $i in
		*.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;;
		esac
	done
	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 || return 1
	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"
	depends=
	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/ || return 1
		fi
	done
}

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

md5sums="80f8ae1df19dd28e1c8b192c6ea7b836  posixtz-0.5.tar.xz"
sha256sums="e0a79e0922be2da686a1888d79cd253baaf81c2f30b4378fbbcf9ff9d632aab5  posixtz-0.5.tar.xz"
sha512sums="68dbaab9f4aef166ac2f2d40b49366527b840bebe17a47599fe38345835e4adb8a767910745ece9c384b57af815a871243c3e261a29f41d71f8054df3061b3fd  posixtz-0.5.tar.xz"