aboutsummaryrefslogtreecommitdiffstats
path: root/main/lua-stringy/APKBUILD
blob: 64bdb7e7df4e8b081eca7348916552c659338ecb (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-stringy
pkgver=0.4.0
pkgrel=5
pkgdesc="Lua string utility library"
url="https://github.com/brentp/lua-stringy/"
arch="all"
license="MIT"
depends=""
makedepends=""
install=""
subpackages=""
source="lua-stringy-$pkgver.tar.gz::https://github.com/brentp/lua-stringy/archive/v$pkgver.tar.gz"

for _v in $_luaversions; do
	makedepends="$makedepends lua$_v-dev"
	subpackages="$subpackages lua$_v-stringy:split_${_v/./_}"
done


_builddir="$srcdir"/lua-stringy-$pkgver/stringy
prepare() {
	local i
	cd "$_builddir"
	for i in $source; do
		case $i in
		*.patch) msg $i; patch -p2 -i "$srcdir"/$i || return 1;;
		esac
	done
}

build() {
	cd "$_builddir"
	for _v in $_luaversions; do
		make CC="${CC:-gcc}" CFLAGS="$CFLAGS" LDFLAGS="$LDFLAGS" \
			LUA_PC="lua$_v" LUA="lua$_v" || return 1
		mv stringy.so stringy.so.$_v
		make clean
	done
}

package() {
	local d
	cd "$_builddir"
	for _v in $_luaversions; do
		d=$pkgdir/usr/lib/lua/$_v
		mkdir -p "$d" || return 1
		cp stringy.so.$_v "$d/stringy.so"
	done
}

_split() {
	local d=usr/lib/lua _ver=$1
	pkgdesc="$pkgdesc for Lua $_ver"
	install_if="lua$_ver $pkgname=$pkgver-r$pkgrel"
	depends=
	mkdir -p "$subpkgdir/$d" || return 1
	mv "$pkgdir/$d/$1" "$subpkgdir/$d"
}

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


md5sums="00a3bb395cc91b597df7d7931c226c47  lua-stringy-0.4.0.tar.gz"
sha256sums="ec4a97a9d0294b8b2df6b5d94576414c4f29e782c4ef7ac6fcff07cd73757e3c  lua-stringy-0.4.0.tar.gz"
sha512sums="909a0d6da308ed97d394b953456446151476a27a122fca503187f13f61a71d94ee3561a179c7d5307db517a31eaaa5b58b53d5abaa6912da3d46fc0dbb3dcc6c  lua-stringy-0.4.0.tar.gz"