aboutsummaryrefslogtreecommitdiffstats
path: root/main/lua-struct/APKBUILD
blob: bb2599236aafbc3077f7d8036218826b5c03d180 (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
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
_luaversions="5.1 5.2 5.3"
pkgname=lua-struct
pkgver=0.2
pkgrel=2
pkgdesc="Library for Converting Data to and from C Structs for Lua"
url="http://www.inf.puc-rio.br/~roberto/struct/"
arch="all"
license="MIT"
depends_dev=""
makedepends="$depends_dev"
source="http://www.inf.puc-rio.br/~roberto/struct/struct-$pkgver.tar.gz
	makefile.patch
	"

for _i in $_luaversions; do
	makedepends="$makedepends lua$_i-dev"
	subpackages="$subpackages lua$_i-struct:_split${_i/./}"
done

builddir="$srcdir"
prepare() {
	default_prepare
	for i in $_luaversions; do
		mkdir $i
		cp makefile *.c $i/
	done
}

build() {
	for i in $_luaversions; do
		cd "$builddir"/$i
		make OPT_CFLAGS="$CFLAGS -std=c99" LUAPC="lua$i"
	done
}

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

_split() {
	local _v=$1
	pkgdesc="$pkgdesc - Lua $_v"
	install_if="lua$_v $pkgname=$pkgver-r$pkgrel"
	depends=""
	mkdir -p "$subpkgdir"/usr/lib/lua/$_v
	install "$builddir"/$_v/struct.so "$subpkgdir"/usr/lib/lua/$_v/struct.so
}

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

sha512sums="6fea0bb2c04cdc47d402e0c8604bc78d9a68ec60f6d521ce031e4f9ede42fd2e2081f6732d74f2745883ad13bdef9f08fa4db5c0053fdc3204e2938dc01ea328  struct-0.2.tar.gz
444ca21864ec92dde759f0f8f5d9990d029e9dbb1df908b092360b2eb9633c64079aff55ae91a4ea4de4c27a89243db195c2f460a03193e8c493c507387a1501  makefile.patch"