aboutsummaryrefslogtreecommitdiffstats
path: root/testing/lua-mimetypes/APKBUILD
blob: 768212c8009a99c30f328a8b7dc32317aff960de (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
# Maintainer: Guilherme Felipe da Silva <gfsilva.eng@gmail.com>
pkgname=lua-mimetypes
_rockname="${pkgname#lua-}"
pkgver=1.0.0
pkgrel=1
pkgdesc="A MIME type database for Lua. You can use this in servers and the like to check the MIME types of files"
url="https://bitbucket.org/leafstorm/lua-mimetypes"
license="MIT"
arch="noarch"
makedepends="luarocks"
checkdepends="luajit"
_commithash="ef4ee2e81596" # v1.0.0 with updated rockspec
source="$_rockname-$pkgver.tar.gz::https://bitbucket.org/leafstorm/lua-mimetypes/get/$_commithash.tar.gz"
builddir="$srcdir/leafstorm-$pkgname-$_commithash"

_luaversions="5.1 5.2 5.3"
for _v in $_luaversions; do
	makedepends="$makedepends lua$_v-dev luarocks$_v"
	checkdepends="$checkdepends lua$_v"
	subpackages="$subpackages lua$_v-${pkgname#lua-}:_subpackage"
done

build() {
	local lver; for lver in $_luaversions; do
		msg "Building for Lua $lver..."

		luarocks-$lver \
		               --deps-mode=none \
		               LUA_INCDIR="$(pkg-config --variable=includedir lua$lver)" \
		               LUA_LIBDIR="$(pkg-config --variable=libdir lua$lver)" \
		               make --tree="./build" \
		               "rockspecs/$_rockname-$pkgver-1.rockspec"

		rm "./build/lib/luarocks/rocks-$lver/manifest"
	done
}

check() {
	local lver; for lver in $_luaversions jit; do
		msg "Testing on lua$lver..."
		lua$lver "test.lua"
	done
}

package() {
	mkdir -p "$pkgdir"
}

_subpackage() {
	local lver="${subpkgname:3:3}"
	pkgdesc="$pkgdesc (for Lua $lver)"
	depends="lua$lver"
	install_if="$pkgname=$pkgver-r$pkgrel lua$lver"

	local path; for path in "lib/luarocks/rocks-$lver" "share/lua/$lver"; do
		mkdir -p "$subpkgdir/usr/${path%/*}"
		mv "$builddir/build/$path" "$subpkgdir/usr/$path/"
	done
}
sha512sums="605618a04d0f8fa13d4077ed0f0a1e7846a8c028a7dc7125c3576fb6214863557cf18e4ee0318fba7de367e90e346313e1a25a03db8049ef7aa4cd2747614811  mimetypes-1.0.0.tar.gz"