aboutsummaryrefslogtreecommitdiffstats
path: root/main/lua-dbi/APKBUILD
blob: b732e94857ae1d4fc27afb68143b4b91fb8914a4 (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
# Contributor: Łukasz Jendrysik <scadu@yandex.com>
# Maintainer: Leonardo Arena <rnalrd@alpinelinux.org>
pkgname=lua-dbi
_pkgname=luadbi
pkgver=0.6
pkgrel=2
pkgdesc="A database interface library for Lua"
url="https://github.com/mwild1/luadbi"
arch="all"
license="MIT"
makedepends="mariadb-dev postgresql-dev sqlite-dev"
_subpackages="$pkgname-mysql $pkgname-postgresql $pkgname-sqlite3"
source="https://github.com/mwild1/$_pkgname/archive/v$pkgver/$_pkgname.tar.gz
	fix-table-maxn.patch"
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="cac2390e95c5f41e3cf85694292ec7ed32b70ec3b6d0f52a67245d5bbd189beda11f1041c3f1ea7a11fe4d23aeb825d50332f21e938d654b72a96ebcc227c3eb  luadbi.tar.gz
3d2754b93abca4795ae7ce76c79d95601229e8dd9fdf7a1cceb95086c8f00e235f89bd44cd30aa5394b607c4abbe44010620250a3990b17a219c52bfe1b262f2  fix-table-maxn.patch"