aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJakub Jirutka <jakub@jirutka.cz>2020-02-23 00:33:53 +0100
committerJakub Jirutka <jakub@jirutka.cz>2020-02-23 01:39:05 +0100
commit0e8ab7c8407200cf6f71d2b65bf9e010b312b8db (patch)
tree0bd163b415bc10e621f69c87bec082122e38114e
parentd7b40ae44cc42250018d24285e1dbcf43ff0cb17 (diff)
downloadaports-0e8ab7c8407200cf6f71d2b65bf9e010b312b8db.tar.gz
aports-0e8ab7c8407200cf6f71d2b65bf9e010b312b8db.tar.bz2
aports-0e8ab7c8407200cf6f71d2b65bf9e010b312b8db.tar.xz
community/lua-mmdb: new aport (needed for knot-resolver)
-rw-r--r--community/lua-mmdb/APKBUILD70
1 files changed, 70 insertions, 0 deletions
diff --git a/community/lua-mmdb/APKBUILD b/community/lua-mmdb/APKBUILD
new file mode 100644
index 0000000000..c80c5f8c9b
--- /dev/null
+++ b/community/lua-mmdb/APKBUILD
@@ -0,0 +1,70 @@
+# Contributor: Jakub Jirutka <jakub@jirutka.cz>
+# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
+pkgname=lua-mmdb
+_rockname=mmdblua
+# Keep in sync with project's submodule.
+_maxmind_gitrev=f4149c9fb5897f8dd40946ed5f70768033b4f571
+pkgver=0.2
+pkgrel=0
+pkgdesc="Maxmind database parser for lua"
+url="https://github.com/daurnimator/mmdblua"
+arch="noarch"
+license="MIT"
+depends="lua"
+checkdepends="lua-busted lua5.1-compat53 lua5.2-compat53"
+subpackages=""
+source="https://github.com/daurnimator/mmdblua/archive/v$pkgver/$pkgname-$pkgver.tar.gz
+ https://github.com/maxmind/MaxMind-DB/archive/$_maxmind_gitrev/MaxMind-DB-$_maxmind_gitrev.tar.gz
+ "
+builddir="$srcdir/$_rockname-$pkgver"
+
+case "$CARCH" in
+ # luajit is not available for s390x
+ s390x) _luajit="";;
+ *) checkdepends="$checkdepends luajit" _luajit="jit";;
+esac
+
+_luaversions="5.1 5.2 5.3"
+for _v in $_luaversions; do
+ subpackages="$subpackages lua$_v-${pkgname#lua-}:_subpackage"
+ checkdepends="$checkdepends lua$_v lua$_v-busted"
+done
+
+prepare() {
+ default_prepare
+
+ rmdir spec/MaxMind-DB
+ ln -s ../../MaxMind-DB-$_maxmind_gitrev spec/MaxMind-DB
+}
+
+check() {
+ local lver; for lver in $_luaversions $_luajit; do
+ msg "Testing on lua$lver"
+ LUA_PATH='?/init.lua;;' lua$lver /usr/bin/busted
+ done
+}
+
+package() {
+ mkdir -p "$pkgdir"
+}
+
+_subpackage() {
+ local lver="${subpkgname:3:3}"
+ pkgdesc="$pkgdesc $lver"
+ install_if="$pkgname=$pkgver-r$pkgrel lua$lver"
+ local rockdir="$subpkgdir/usr/lib/luarocks/rocks-$lver/$_rockname/$pkgver-0"
+
+ depends="lua$lver"
+ case "$lver" in
+ 5.1 | 5.2) depends="$depends lua$lver-compat53";;
+ esac
+
+ install -m 644 -D "$builddir"/mmdb/init.lua \
+ "$subpkgdir"/usr/share/lua/$lver/mmdb.lua
+
+ mkdir -p "$rockdir"
+ echo 'rock_manifest = {}' > "$rockdir"/rock_manifest
+}
+
+sha512sums="f45dbff51fbf04f11d4cc7592aae4cc72c38a421476cb2c37829fd2c59953148f012ad977251b8c5f9a358d7dc7acbf2abd3bf9f11b0d018d1297831a0bd80e1 lua-mmdb-0.2.tar.gz
+57a5cc563db20eba15c7cdefcab8f9c1d21bf00e36b042c71d610ceb00e6b548651d8b3b54f03f537f05303286fd92d18c2f8c757293f7e32b46dabcd883d274 MaxMind-DB-f4149c9fb5897f8dd40946ed5f70768033b4f571.tar.gz"