aboutsummaryrefslogtreecommitdiffstats
path: root/main/lua-mqtt-publish/APKBUILD
blob: fc33b985d3a5a5f59a28d64f6eb72693c19b1919 (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
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
_luaversions="5.1 5.2 5.3"
pkgname=lua-mqtt-publish
pkgver=0.3
pkgrel=0
pkgdesc="Lua module for simple MQTT connect, publish and disconnect"
url="https://github.com/ncopa/lua-mqtt-publish"
arch="all"
license="MIT"
depends=""
depends_dev=""
makedepends="$depends_dev"
install=""
subpackages=""

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

source="lua-mqtt-publish-$pkgver.tar.gz::https://github.com/ncopa/lua-mqtt-publish/archive/v$pkgver.tar.gz"

_builddir="$srcdir"/lua-mqtt-publish-$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
}

build() {
	return 0
}

package() {
	cd "$_builddir"
	for i in $_luaversions; do
		install -Dm644 "$_builddir"/mqtt/publish.lua \
			"$pkgdir"/usr/share/lua/$i/mqtt/publish.lua || return 1
	done
}

_split() {
	local d= _ver=$1
	pkgdesc="$pkgdesc for Lua $_ver"
	install_if="lua$_ver $pkgname=$pkgver-r$pkgrel"
	depends="lua$_ver-mosquitto"
	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

sha512sums="ccbf87c53305e19a2dd04f07ac7b3d1fdae3ce0a6c726b89f357d3d5a68a73c0ce830d0ca47d57eaf1990224fcc97794720bdbc8e4e0caa408003cc33dce3b65  lua-mqtt-publish-0.3.tar.gz"