aboutsummaryrefslogtreecommitdiffstats
path: root/main/lua-filesystem/APKBUILD
diff options
context:
space:
mode:
authorJakub Jirutka <jakub@jirutka.cz>2017-11-19 00:56:15 +0100
committerJakub Jirutka <jakub@jirutka.cz>2017-11-19 00:57:07 +0100
commit3cd48b869ba6eefb0d8dc2afd8e7ec55762c8fc6 (patch)
tree15425fd620cd6be3860c5ebcdb3b6a60f633ea6d /main/lua-filesystem/APKBUILD
parent3a5cca5df15d88d69ddea4e5ae56d854cb8c68b8 (diff)
downloadaports-3cd48b869ba6eefb0d8dc2afd8e7ec55762c8fc6.tar.bz2
aports-3cd48b869ba6eefb0d8dc2afd8e7ec55762c8fc6.tar.xz
main/lua-filesystem: rewrite abuild, add check and rock manifest
Diffstat (limited to 'main/lua-filesystem/APKBUILD')
-rw-r--r--main/lua-filesystem/APKBUILD86
1 files changed, 46 insertions, 40 deletions
diff --git a/main/lua-filesystem/APKBUILD b/main/lua-filesystem/APKBUILD
index 59f0b00379..58dc0f0c98 100644
--- a/main/lua-filesystem/APKBUILD
+++ b/main/lua-filesystem/APKBUILD
@@ -1,67 +1,73 @@
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
-
-_luaversions="5.1 5.2 5.3"
-
pkgname=lua-filesystem
+_pkgname=luafilesystem
pkgver=1.7.0.2
+_pkgver=${pkgver//./_}
+_rockver=${pkgver%.*}-${pkgver##*.}
pkgrel=0
pkgdesc="Filesystem functions for Lua"
url="http://keplerproject.github.io/luafilesystem/"
arch="all"
license="GPL"
-depends=""
-install=
-
+checkdepends=""
makedepends=""
subpackages=""
-for _i in $_luaversions; do
- makedepends="$makedepends lua$_i-dev"
- subpackages="$subpackages lua$_i-filesystem:split_${_i/./_}"
-done
-source="luafilesystem-$pkgver.tar.gz::https://github.com/keplerproject/luafilesystem/archive/v${pkgver//./_}.tar.gz"
+source="$_pkgname-$pkgver.tar.gz::https://github.com/keplerproject/$_pkgname/archive/v$_pkgver.tar.gz"
+builddir="$srcdir/$_pkgname-$_pkgver"
-_sdir="$srcdir"/luafilesystem-${pkgver//./_}
+# luajit is not available for selected arches
+case "$CARCH" in
+ s390x) _luajit="";;
+ *) checkdepends="$checkdepends luajit" _luajit="jit";;
+esac
+
+_luaversions="5.1 5.2 5.3"
+for _v in $_luaversions; do
+ makedepends="$makedepends lua$_v-dev"
+ subpackages="$subpackages lua$_v-${pkgname#lua-}:_subpackage"
+done
prepare() {
- cd "$_sdir"
- # apply patches here
- cd "$srcdir"
- for _i in $_luaversions; do
- cp -r "$_sdir" "$srcdir"/build-$_i
+ default_prepare
+
+ local lver; for lver in $_luaversions; do
+ cp -r "$builddir" "$builddir-$lver"
done
}
build() {
- for _i in $_luaversions; do
- cd "$srcdir"/build-$_i
- make CFLAGS="$CFLAGS $( pkg-config lua$_i --cflags ) -fPIC" \
- || return 1
+ local lver; for lver in $_luaversions; do
+ msg "Building for Lua $lver..."
+ make -C "$builddir-$lver" \
+ CFLAGS="$CFLAGS $(pkg-config lua$lver --cflags) -fPIC"
done
}
-package() {
- for _i in $_luaversions; do
- cd "$srcdir"/build-$_i
- make LUA_LIBDIR="$pkgdir"/usr/lib/lua/$_i install \
- || return 1
+check() {
+ local lver; for lver in $_luaversions $_luajit; do
+ msg "Testing on lua$lver"
+
+ cd "$builddir-${lver/jit/5.1}"
+ LUA_CPATH=./src/?.so lua$lver tests/test.lua
done
}
-_split() {
- local d= _ver=$1
- pkgdesc="Filesystem functions for Lua $_ver"
- install_if="lua$_ver $pkgname=$pkgver-r$pkgrel"
- depends=
- for d in usr/lib/lua usr/share/lua; do
- if [ -d "$pkgdir"/$d/$_ver ]; then
- mkdir -p "$subpkgdir"/$d
- mv "$pkgdir"/$d/$_ver "$subpkgdir"/$d/ || return 1
- fi
- done
+package() {
+ mkdir -p "$pkgdir"
}
-for _i in $_luaversions; do
- eval "split_${_i/./_}() { _split $_i; }"
-done
+_subpackage() {
+ local lver="${subpkgname:3:3}"
+ pkgdesc="$pkgdesc $lver"
+ depends="lua$lver"
+ install_if="$pkgname=$pkgver-r$pkgrel lua$lver"
+ local install_cmod=$(pkg-config --variable=INSTALL_CMOD lua$lver)
+ local rockdir="$subpkgdir/usr/lib/luarocks/rocks-$lver/$_rockname/$_rockver"
+
+ make -C "$builddir-$lver" LUA_LIBDIR="$subpkgdir/$install_cmod" install
+
+ mkdir -p "$rockdir"
+ echo 'rock_manifest = {}' > "$rockdir"/rock_manifest
+}
sha512sums="a1d4d077776e57cd878dbcd21656da141ea3686c587b5420a2b039aeaf086b7e7d05d531ee1cc2bbd7d06660d1315b09593e52143f6711f033ce8eecdc550511 luafilesystem-1.7.0.2.tar.gz"