aboutsummaryrefslogtreecommitdiffstats
path: root/main/lua-dbi/APKBUILD
blob: 4b8f959c0cb93cb3b668360992edf4ab77a4486a (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
# Contributor: Łukasz Jendrysik <scadu@yandex.com>
# Maintainer: Leonardo Arena <rnarld@alpinelinux.org>
_luaversions="5.1 5.2 5.3"
pkgname=lua-dbi
_realname=luadbi
pkgver=0.5
pkgrel=7
pkgdesc="A database interface library for Lua"
url="http://code.google.com/p/luadbi"
arch="all"
license="GPL"
depends=""
makedepends="lua-dev mariadb-dev postgresql-dev sqlite-dev"
install=""
_subpackages="$pkgname-mysql $pkgname-postgresql $pkgname-sqlite3"
source="https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/luadbi/luadbi.$pkgver.tar.gz
	lua-dbi-0.5-sync-hg-47382fea7a9c.patch"

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

builddir="$srcdir"

prepare() {
	default_prepare || return 1
	local lver; for lver in $_luaversions; do
		cp -r "$builddir" "$builddir-$lver" || return 1
	done
}

build() {
	local lver; for lver in $_luaversions; do
		msg "Building for Lua $lver..."
		cd "$builddir-$lver"
		echo LUA_IMPL=lua$lver >> .config
		make LUA_VERSION=$lver || return 1
	done
}

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

_subpackage() {
	local lver="${subpkgname:3:3}"
	pkgdesc="$pkgdesc (for Lua $lver)"
	depends="lua$lver"
	install_if="$pkgname=$pkgver-r$pkgrel lua$lver"
	cd "$builddir-$lver"
	install -D -m755 "$builddir-$lver"/DBI.lua \
		"$subpkgdir"/usr/share/lua/$lver/DBI.lua  || return 1
	for db in sqlite3 postgresql mysql; do
		if [ "${subpkgname%$db}" != "$subpkgname" ]; then
			install -D -m644 "$builddir-$lver"/dbd${db}.so \
				"$subpkgdir"/usr/lib/lua/$lver/dbd${db}.so
		fi
	done
}

md5sums="ede2b003aadddc151aac87050c3d926e  luadbi.0.5.tar.gz
a1359b3a96a21a010310b505c667f8aa  lua-dbi-0.5-sync-hg-47382fea7a9c.patch"
sha256sums="49116458dd80052536bf5d7e2b2a1f5a0fa42a671ce77f1cb7355ef7faeb331e  luadbi.0.5.tar.gz
c6cd0587d789fa9af4687dac471e8b05aea63022224b0da482ec9dcfc7998dd2  lua-dbi-0.5-sync-hg-47382fea7a9c.patch"
sha512sums="4ed641e113e90acc8a4f6b3b2d0f5d5044c0fbbef3b2fdfb84d15e17115e45c553a33b19bfb165e5af11a2adce501d66859963e3363d3ab1c6a39b0b2ae92e62  luadbi.0.5.tar.gz
e4f5dc5a75204e7fc1221b4322f1044889a417c6bf7f01bfc7249756a3739931423c66282b560f223f4ea8ef7e1d8311fbe5dfa281d0102a835c436ace7470e4  lua-dbi-0.5-sync-hg-47382fea7a9c.patch"