aboutsummaryrefslogtreecommitdiffstats
path: root/main/lua-dbi/APKBUILD
blob: 96d5dceda5fe87edc856fa8d30c9d7d1d9c551f8 (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
# Contributor: Łukasz Jendrysik <scadu@yandex.com>
# Maintainer: Leonardo Arena <rnalrd@alpinelinux.org>
pkgname=lua-dbi
_pkgname=luadbi
pkgver=0.7.2
pkgrel=0
pkgdesc="A database interface library for Lua"
url="https://github.com/mwild1/luadbi"
arch="all"
license="MIT"
makedepends="mariadb-connector-c-dev postgresql-dev sqlite-dev"
_subpackages="$pkgname-mysql $pkgname-postgresql $pkgname-sqlite3"
source="https://github.com/mwild1/$_pkgname/archive/v$pkgver/$_pkgname.tar.gz"
builddir="$srcdir/$_pkgname-$pkgver"
options="!check"  # provided tests require running DBs

_luaversions="5.1 5.2 5.3"
for _v in $_luaversions; do
	makedepends="$makedepends lua$_v-dev"
	for _subpkg in $_subpackages; do
		subpackages="$subpackages lua$_v-${_subpkg#lua-}:_subpackage"
	done
done

prepare() {
	default_prepare

	local lver; for lver in $_luaversions; do
		cp -r "$builddir" "$builddir-$lver"
	done
}

build() {
	local lver; for lver in $_luaversions; do
		msg "Building for Lua $lver..."
		make -C "$builddir-$lver" LUA_V=$lver
	done
}

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

_subpackage() {
	local lver="${subpkgname:3:3}"
	local db=${subpkgname##*-}
	local rockdir="$subpkgdir/usr/lib/luarocks/rocks-$lver/$_pkgname-$db/$pkgver-2"
	pkgdesc="$pkgdesc $lver and $db"
	depends="lua$lver"
	install_if="$pkgname=$pkgver-r$pkgrel lua$lver"

	cd "$builddir-$lver"
	make LUA_V=$lver DESTDIR="$subpkgdir" install_${db/postgresql/psql}

	mkdir -p "$rockdir"
	echo 'rock_manifest = {}' > "$rockdir"/rock_manifest
}

sha512sums="891f99cbc8f1b5327ef820641a1608abf41410f2f28584b975cc3cf65154b9bebf6f1b9ca7d1818b9c965738ad700dd17ae042dfd2a7146cf755871ebae535b9  luadbi.tar.gz"