APKBUILD 1.88 KB
Newer Older
1
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
2
pkgname=lua-filesystem
3
_pkgname=luafilesystem
4
pkgver=1.7.0.2
5 6
_pkgver=${pkgver//./_}
_rockver=${pkgver%.*}-${pkgver##*.}
7
pkgrel=0
8
pkgdesc="Filesystem functions for Lua"
9
url="http://keplerproject.github.io/luafilesystem/"
10
arch="all"
11
license="GPL"
12
checkdepends=""
13 14
makedepends=""
subpackages=""
15 16
source="$_pkgname-$pkgver.tar.gz::https://github.com/keplerproject/$_pkgname/archive/v$_pkgver.tar.gz"
builddir="$srcdir/$_pkgname-$_pkgver"
17

18 19 20 21 22 23 24 25 26 27 28
# 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
29

30
prepare() {
31 32 33 34
	default_prepare

	local lver; for lver in $_luaversions; do
		cp -r "$builddir" "$builddir-$lver"
35
	done
36 37 38
}

build() {
39 40 41 42
	local lver; for lver in $_luaversions; do
		msg "Building for Lua $lver..."
		make -C "$builddir-$lver" \
			CFLAGS="$CFLAGS $(pkg-config lua$lver --cflags) -fPIC"
43
	done
44 45
}

46 47 48 49 50 51
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
52
	done
53 54
}

55 56
package() {
	mkdir -p "$pkgdir"
57 58
}

59 60 61 62 63 64 65 66 67 68 69 70 71
_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
}
72

73
sha512sums="a1d4d077776e57cd878dbcd21656da141ea3686c587b5420a2b039aeaf086b7e7d05d531ee1cc2bbd7d06660d1315b09593e52143f6711f033ce8eecdc550511  luafilesystem-1.7.0.2.tar.gz"