Commit 3cd48b86 authored by Jakub Jirutka's avatar Jakub Jirutka

main/lua-filesystem: rewrite abuild, add check and rock manifest

parent 3a5cca5d
# 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"
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment