aboutsummaryrefslogtreecommitdiffstats
path: root/main/lua-stringy/APKBUILD
blob: 68798781ff7e7519fdb4da46e94c71714bd8ffc0 (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
72
73
74
75
# Contributor: Natanael Copa <ncopa@alpinelinux.org>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>

_luaversions="5.1 5.2"
pkgname=lua-stringy
pkgver=0.4
pkgrel=2
pkgdesc="Lua string utility library"
url="https://github.com/brentp/lua-projects/"
arch="all"
license="MIT"
depends=""
makedepends=""
install=""
subpackages=""
source="lua-projects-$pkgver.tar.gz::https://github.com/brentp/lua-projects/archive/$pkgver.tar.gz
	link-to-correct-lua-version.patch"

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


_builddir="$srcdir"/lua-projects-$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
	replaces="$pkgname"
	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="cac1787756fe42151d7b60df9f19c9e3  lua-projects-0.4.tar.gz
9c882939f48bf6dd129b93e46d6f4eb3  link-to-correct-lua-version.patch"
sha256sums="72a800d2e3e1cc13fbf458ad5cbc06b8ea705afedfe72221dbe9e7cec935721e  lua-projects-0.4.tar.gz
5df2a0cc52ccdecd2a6b1a8f07d2c53aba805da5ba5cf1b129c94d68c1331026  link-to-correct-lua-version.patch"
sha512sums="7bcd5449a99e5e1633e9cd1175208f1cde65a8dddbd9a06726c16518805387a5d3809fc7644fae090c4f3e948ed1364911e12d923fc26dbf5378c8adb1a07b3a  lua-projects-0.4.tar.gz
dd498d9cda5af9f751d3566bfa01ae575eb2513b7fb5d4cd197f95cc1dcd08a17b5a806b06ae1c65545e69ca961cddde73d1e75682269937e1f568b9f4603083  link-to-correct-lua-version.patch"