aboutsummaryrefslogtreecommitdiffstats
path: root/main/lua-mosquitto/APKBUILD
blob: d1403260d0214fa58ca9b5c5f49d1a4bb5c85465 (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
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>

_luaversions="5.1 5.2 5.3"

pkgname=lua-mosquitto
pkgver=0.1
pkgrel=2
pkgdesc="Bindingd to libmosquitto for Lua"
url="https://github.com/flukso/lua-mosquitto"
arch="all"
license="MIT"
depends=""
depends_dev=""
makedepends="$depends_dev mosquitto-dev"
subpackages=""

for _v in $_luaversions; do
	makedepends="$makedepends lua$_v-dev"
	subpackages="$subpackages lua$_v-mosquitto:split_${_v/./_}"
done

install=""
source="lua-mosquitto-$pkgver.tar.gz::https://github.com/flukso/lua-mosquitto/archive/v$pkgver.tar.gz
	lua-5.3.patch
	"

_builddir="$srcdir"/lua-mosquitto-$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
	cd "$srcdir"
	for i in $_luaversions; do
		cp -r lua-mosquitto-$pkgver build-$i || return 1
	done
}

build() {
	for i in $_luaversions; do
		cd "$srcdir"/build-$i
		make LUAPKGC=lua$i || return 1
	done
}

package() {
	for i in $_luaversions; do
		cd "$srcdir"/build-$i
		make install DESTDIR="$pkgdir" LUAPKGC=lua$i \
			LUA_LIBDIR=/usr/lib || return 1
	done
}

_split() {
	local d= _ver=$1
	pkgdesc="$pkgdesc $_ver"
	install_if="lua$_ver $pkgname=$pkgver-r$pkgrel"
	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 _v in $_luaversions; do
	eval "split_${_v/./_}() { _split $_v; }"
done


md5sums="fd26fa08fc855ba4a66ce521fe5aae13  lua-mosquitto-0.1.tar.gz
f75f361ca8c540521216e59f2e0b2d2d  lua-5.3.patch"
sha256sums="9e3197fa95d97f2abfdc24a91067423b88c0bf8bbeab8a582490ba6e098187d6  lua-mosquitto-0.1.tar.gz
19cd4ea19ccdcfeea97021cc6182828c4d7b048d504e3853bcd940f5d670932e  lua-5.3.patch"
sha512sums="1171434266601884dad9c9477c061624c84d67de3f0d92b2420fc1534e194db1a85d6c068ff3829a818206a8f243ebda115271de6dbefb145d857d995c85ee3c  lua-mosquitto-0.1.tar.gz
80144d00e4de410ff284767c9b30b2672ba2510f5125188005f527feaac7a27e7b1602a0828546e2361cd745ef383091e4db01cf23fd8c0b8438612cd5c48224  lua-5.3.patch"