aboutsummaryrefslogtreecommitdiffstats
path: root/main/lua-sqlite/APKBUILD
blob: d365c5acf8db8a8053334a0d8ade16dd1945244a (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
# Contributor: Carlo Landmeter <clandmeter@gmail.com>
# Maintainer: Carlo Landmeter <clandmeter@gmail.com>
pkgname=lua-sqlite
pkgver=0.9.3
_realver=fsl09w
_luaversions="5.1 5.2 5.3"
pkgrel=3
pkgdesc="Sqlite3 Binding for Lua"
url="http://lua.sqlite.org/index.cgi/home"
arch="all"
license="MIT"
depends=""
depends_dev=""
makedepends="$depends_dev sqlite-dev"
install=""
subpackages=""
source="$pkgname-$pkgver.zip::http://lua.sqlite.org/index.cgi/zip/lsqlite3_$pkgver.zip?uuid=fsl_9w"

for _v in $_luaversions; do
	makedepends="$makedepends lua$_v-dev"
	subpackages="$subpackages lua$_v-${pkgname#*lua-}:split_${_v/./_}"
	eval "split_${_v/./_}() { _split $_v; }"
done

_builddir="$srcdir"/lsqlite3_$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 _v in $_luaversions; do
		cp -r $_builddir "$srcdir"/$pkgname-$_v
	done
}

build() {
	cd "$_builddir"
}

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

_split() {
	local _ver="$1"
	cd "$srcdir"/$pkgname-$_ver || return 1
	pkgdesc="$pkgdesc (Lua $_ver)"
	install_if="lua$_ver $pkgname=$pkgver-r$pkgrel"
	${CC:-gcc} ${CFLAGS} $(pkg-config --cflags sqlite3) \
		$(pkg-config --cflags lua$_ver) -shared -fPIC \
		-DLSQLITE_VERSION=\"$pkgver\" -o lsqlite3.so lsqlite3.c \
		$(pkg-config --libs sqlite3) || return 1
	install -Dm755 lsqlite3.so \
		"$subpkgdir"/usr/lib/lua/$_ver/lsqlite3.so || return 1
}

md5sums="5f1562412d41db13ba16633728665ca9  lua-sqlite-0.9.3.zip"
sha256sums="557a983ed708080cfb2e99e0610825aa716d3d3b2fec668d1233f7234bc4a7f0  lua-sqlite-0.9.3.zip"
sha512sums="f81efa83b6087d7979c4b2958e3c63397708bf017bb9059d1c8df5adb45c10279925546296cf39fb0b39d0b40d9160b78baf4ac9049ed54b58ed858aa506d0f8  lua-sqlite-0.9.3.zip"