aboutsummaryrefslogtreecommitdiffstats
path: root/main/lua-lgi/APKBUILD
blob: 6e704ea44d88e8d15089baa0d07445c78f319437 (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
76
# Contributor: Natanael Copa <ncopa@alpinelinux.org>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
_luaversions="5.1 5.2 5.3"
pkgname=lua-lgi
pkgver=0.9.0
pkgrel=0
pkgdesc="Dynamic Lua binding to GObject libraries using GObject-Introspection"
url="http://github.com/pavouk/lgi"
arch="all"
license="MIT"
depends=""
depends_dev=""
makedepends="glib-dev gobject-introspection-dev libffi-dev"
install=""
subpackages="$pkgname-doc"
for _i in $_luaversions; do
	makedepends="$makedepends lua$_i-dev"
	subpackages="$subpackages lua$_i-lgi:split_${_i/./_}"
done

source="lgi-$pkgver.tar.gz::https://github.com/pavouk/lgi/archive/$pkgver.tar.gz"

_sdir="$srcdir"/lgi-$pkgver
prepare() {
	local i
	cd "$_builddir"
	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
		msg "build for $_i"
		make -C "$srcdir"/build-$_i PREFIX=/usr LUA_VERSION=$_i \
			LUA_CFLAGS="$(pkg-config --cflags lua$_i)" \
			|| return 1
	done
}

package() {
	for _i in $_luaversions; do
		cd "$srcdir"/build-$_i
		make install PREFIX=/usr DESTDIR="$pkgdir" LUA_VERSION=$_i \
			|| return 1
	done
	cd "$_sdir"
	mkdir -p "$pkgdir"/usr/share/doc/lua-lgi
	cp -r docs/* samples "$pkgdir"/usr/share/doc/lua-lgi/
}

_split() {
	local d= _ver=$1
	pkgdesc="Lua $_ver binding to GObject libraries using introspection"
	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="cc433a597f23cfabdfc905c6c2cd3d7c  lgi-0.9.0.tar.gz"
sha256sums="87c7870f8a1c60b48c4d5587b7fab46863e1cb9e76a68520f47e9ef2764cfe24  lgi-0.9.0.tar.gz"
sha512sums="1a486a40f504740224b1d277368df65e0a30708c02422390517c2fbf961b5fec264bdbc695d306e2f5fb2aa8ad4539212ef5314b18f45e3b488fd5f492a19f9e  lgi-0.9.0.tar.gz"