aboutsummaryrefslogtreecommitdiffstats
path: root/testing/luarocks/APKBUILD
blob: 819060566aeac22b72126c3b3b2d2f29cf2f93c0 (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
70
71
72
73
74
75
76
77
78
79
# Contributor: Carlo Landmeter <clandmeter@gmail.com>
# Maintainer:
pkgname=luarocks
pkgver=2.3.0
_lua_versions="5.1 5.2 5.3"
pkgrel=0
pkgdesc="Deployment and management system for Lua modules"
url="http://www.luarocks.org/"
arch="noarch"
license="custom"
depends=""
depends_dev=""
makedepends="$depends_dev"
install=""
subpackages=""
source="http://luarocks.org/releases/$pkgname-$pkgver.tar.gz"
for _v in $_lua_versions; do
	makedepends="$makedepends lua$_v-dev lua$_v"
	subpackages="$subpackages ${pkgname}${_v}:split_${_v/./_}"
done

_builddir="$srcdir"/luarocks-$pkgver
prepare() {
	local i
	cd "$_builddir"
	for i in $source; do
		case $i in
		*.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;;
		esac
	done
	# create builddir for each lua version
	for _ver in $_lua_versions; do
		cp -r $_builddir "$srcdir"/$pkgname-$_ver
	done
}

build() {
	for _ver in $_lua_versions; do
		cd "$srcdir"/$pkgname-$_ver
		./configure \
			--prefix=/usr \
			--sysconfdir=/etc/luarocks \
			--lua-version=$_ver \
			--lua-suffix=$_ver \
			--with-downloader=curl \
			--versioned-rocks-dir \
			|| return 1
		make || return 1
	done
}

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

_split() {
	local _ver="$1"
	cd "$srcdir"/$pkgname-$_ver
	pkgdesc="Deployment and management system for Lua $_ver modules"
	install_if="lua$_ver $pkgname=$pkgver-r$pkgrel"
	depends="lua$_ver"
	make install DESTDIR="$subpkgdir" || return 1
	# remove default script names which conflict per lua version
	rm "$subpkgdir"/usr/bin/luarocks \
		"$subpkgdir"/usr/bin/luarocks-admin || return 1
	# set the correct lua version
	sed -i "s/env lua/env lua${_ver}/" \
		"$subpkgdir"/usr/bin/luarocks-${_ver} \
		"$subpkgdir"/usr/bin/luarocks-admin-${_ver} || return 1
}

# call split function for each lua version
for _v in $_lua_versions; do
        eval "split_${_v/./_}() { _split $_v; }"
done

md5sums="a38126684cf42b7d0e7a3c7cf485defb  luarocks-2.3.0.tar.gz"
sha256sums="68e38feeb66052e29ad1935a71b875194ed8b9c67c2223af5f4d4e3e2464ed97  luarocks-2.3.0.tar.gz"
sha512sums="99f99ec59f663b3db22350946eb3357928c0e462ddcc7c3e5e0923e422c7ad6acffb0d2c95d1ec53526b08c33f2ae628276138e2daa7da077fd8de4b0b18eb15  luarocks-2.3.0.tar.gz"