summaryrefslogtreecommitdiffstats
path: root/main/lua-filesystem/APKBUILD
blob: f0184ec57354bdef06b0b8f7991af9afac0dd5c1 (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
64
65
66
67
68
69
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>

_luaversions="5.1 5.2 5.3"

pkgname=lua-filesystem
pkgver=1.6.3
pkgrel=0
pkgdesc="Filesystem functions for Lua"
url="http://keplerproject.github.io/luafilesystem/"
arch="all"
license="GPL"
depends=""
install=

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"

_sdir="$srcdir"/luafilesystem-v_${pkgver//./_}

prepare() {
	cd "$_sdir"
	# apply patches here
	cd "$srcdir"
	for _i in $_luaversions; do
		cp -r "$_sdir" "$srcdir"/build-$_i
	done
}

build() {
	for _i in $_luaversions; do
		cd "$srcdir"/build-$_i
		make CFLAGS="$CFLAGS $( pkg-config lua$_i --cflags ) -fPIC" \
			|| return 1
	done
}

package() {
	for _i in $_luaversions; do
		cd "$srcdir"/build-$_i
		make LUA_LIBDIR="$pkgdir"/usr/lib/lua/$_i install \
			|| return 1
	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
}

for _i in $_luaversions; do
	eval "split_${_i/./_}() { _split $_i; }"
done

md5sums="d0552c7e5a082f5bb2865af63fb9dc95  luafilesystem-1.6.3.tar.gz"
sha256sums="5525d2b8ec7774865629a6a29c2f94cb0f7e6787987bf54cd37e011bfb642068  luafilesystem-1.6.3.tar.gz"
sha512sums="abfa1b3ac22ed80189560a1a025a7ea21a954defe14e5b539e08f266d180962a691262efc7eb2ddacc2d4aae14d6e356b1a276165b5bed46a13e4d6c61ab99f1  luafilesystem-1.6.3.tar.gz"