aboutsummaryrefslogtreecommitdiffstats
path: root/main/lua-socket/APKBUILD
blob: 6882347b435bdbf678eb44d6d80c328f42954efe (plain) (blame)
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
# Contributor: Mika Havela <mika.havela@gmail.com>
# Maintainer: Mika Havela <mika.havela@gmail.com>
_luaversions="5.1 5.2"
pkgname=lua-socket
_name=luasocket
pkgver=3.0_rc1
pkgrel=0
_ver=${pkgver/_/-}
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
	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"
	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
f869d0f81e347291405fb53dff9a408a  lua-cflags.patch
4bcbbc8d3383db94223155fc7a6d454e  include-luasocket.patch"
sha256sums="8b67d9b5b545e1b694753dab7bd6cdbc24c290f2b21ba1e14c77b32817ea1249  luasocket-3.0-rc1.tar.gz
bbcead4850fcdf6711c70b48db4db17e06fedcae45c4c53fd814ff6f0d9fe4ce  lua-cflags.patch
42b1a439805efaf33110e01a53798b3e8d044101470808fe9478ca3be0ae5165  include-luasocket.patch"
sha512sums="f6efce259aaacaa11472911471f8a13b118fe009b8953a82c6aa18b9ec829cd1293180904e56935cb130d36d267e3f27c91db2d78e03f7488f3e100571ed0540  luasocket-3.0-rc1.tar.gz
58b5d3c239c8be1561060f75bf849bcfa9022626995a5234ec741dc2ae86755d9fed88c12b5644c914c604ea31b017a6679ac33a9a76392242faf139bfd59de1  lua-cflags.patch
34db925f9e9a1a629d01dc26072f4edec77087f7bf89dda8140326447662efbc53ce5e36087fa9127d708d498c129613f7ed82862dd3176df16796418868548d  include-luasocket.patch"