aboutsummaryrefslogtreecommitdiffstats
path: root/main/lua-socket/APKBUILD
blob: d2b12515da647e222b1488d5e9ee4c558ae4cf69 (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
80
81
82
83
84
85
86
87
88
89
90
91
# 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_git20150301
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="lua5.1-socket"
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
	include-luasocket.patch
	"

_sdir="$srcdir/$_name-$_ver"

prepare() {
	cd "$_sdir"
	for i in $source; do
		case $i in
		*.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;;
		esac
	done

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

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

package() {
	cd "$_builddir"
	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"
	replaces="$pkgname"
	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="08bd2f265b244eb4bf5c2c36bf89b759  luasocket-3.0-rc1.tar.gz
2e14aba126cec984e1824a4da35d45f8  git.patch
8adb3bb6f4c6f63de8c56412ef623953  lua-cflags.patch
4bcbbc8d3383db94223155fc7a6d454e  include-luasocket.patch"
sha256sums="8b67d9b5b545e1b694753dab7bd6cdbc24c290f2b21ba1e14c77b32817ea1249  luasocket-3.0-rc1.tar.gz
d64d35ba14a8b1381c20273d1390ee7c170b4ff566ad503621cac9f4c129bbb8  git.patch
e5d38d3b1484b61ab43627efdc302f78c24733aa2d422e6745fe273b1a56d94b  lua-cflags.patch
42b1a439805efaf33110e01a53798b3e8d044101470808fe9478ca3be0ae5165  include-luasocket.patch"
sha512sums="f6efce259aaacaa11472911471f8a13b118fe009b8953a82c6aa18b9ec829cd1293180904e56935cb130d36d267e3f27c91db2d78e03f7488f3e100571ed0540  luasocket-3.0-rc1.tar.gz
85a6dc3b8e674200a2928f397fcb7fb9ca0e41870d5628c9c24aabc140d8fa14c12576cfa6e8bef687ab914d378585557b9a2f3bf09173a003d51f7f8e2a0d34  git.patch
9a155e11e117b9f0485899951051a61d21cdc088d3a5e1ec0e2d018cb257b6edaaf342f5f5304cb229160247ced5ff0fe825f880cb695a201295b4399546de84  lua-cflags.patch
34db925f9e9a1a629d01dc26072f4edec77087f7bf89dda8140326447662efbc53ce5e36087fa9127d708d498c129613f7ed82862dd3176df16796418868548d  include-luasocket.patch"