aboutsummaryrefslogtreecommitdiffstats
path: root/main/lua-socket/APKBUILD
blob: 86dea01b90d3ba4e30f1b064b99f19f4933b3ef5 (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
# Contributor: Mika Havela <mika.havela@gmail.com>
# Maintainer: Mika Havela <mika.havela@gmail.com>
_luaversions="5.1 5.2 5.3"
pkgname=lua-socket
_name=luasocket
pkgver=3.0_rc1_git20160306
pkgrel=0
_ver=${pkgver%_git*}
_ver=${_ver/_rc/-rc}
pkgdesc="Networking library for Lua"
url="http://luaforge.net/projects/luasocket/"
arch="all"
license="MIT"
install=""
depends=""
makedepends=""
subpackages=""
for _i in $_luaversions; do
	makedepends="$makedepends lua$_i-dev"
	subpackages="$subpackages lua$_i-socket:split_${_i/./_}"
done
source="luasocket-$_ver.tar.gz::https://github.com/diegonehab/luasocket/archive/v$_ver.tar.gz
	git.patch
	lua-cflags.patch
	"

# default_prepare assumes $_builddir
_builddir="$srcdir/$_name-$_ver"

prepare() {
	default_prepare
	for _i in $_luaversions; do
		cp -r "$_builddir" "$srcdir"/build-$_i
		# set lua version
		sed -i -e "/^LUAV?=/s/=.*/=$_i/" \
			"$srcdir"/build-$_i/src/makefile || return 1
	done
}

build() {
	for _i in $_luaversions; do
		make -C "$srcdir"/build-$_i/src all-unix || return 1
	done
}

package() {
	for _i in $_luaversions; do
		cd "$srcdir"/build-$_i
		make prefix=/usr DESTDIR="$pkgdir" install-unix || return 1
	done
}

_split() {
	local d= _ver=$1
	pkgdesc="Networking library for Lua $_ver"
	install_if="lua$_ver $pkgname=$pkgver-r$pkgrel"
	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="08bd2f265b244eb4bf5c2c36bf89b759  luasocket-3.0-rc1.tar.gz
44c07dc3dd311541a50b21aaa40e36d7  git.patch
d4319e4a20d476ea8d77a3421fca1808  lua-cflags.patch"
sha256sums="8b67d9b5b545e1b694753dab7bd6cdbc24c290f2b21ba1e14c77b32817ea1249  luasocket-3.0-rc1.tar.gz
414cfe53e4455fc2b416779d5eaa3ade6d97c01fa62dbffb6c9d4d4ad84bdd76  git.patch
77d77fe688b27ae51bcf9d3ae51d43141ab85d95fd322b3904b55dbc76900418  lua-cflags.patch"
sha512sums="f6efce259aaacaa11472911471f8a13b118fe009b8953a82c6aa18b9ec829cd1293180904e56935cb130d36d267e3f27c91db2d78e03f7488f3e100571ed0540  luasocket-3.0-rc1.tar.gz
45c80e488fedc879f0217bc8a654d80da003039f5d1ff21b0dea0eb769151787dbe793e44a3dfd72cb07ff2697eceaf4fc7b55b4634cd170fa71281f19f025a5  git.patch
fb482ad22b5caa2054b25c86edc01d1a666035930f6b55e7d12704dd78b9c31343c39eab5f13958941180d819aa37470c75fe27f1b206a4b431fb589663e2685  lua-cflags.patch"