aboutsummaryrefslogtreecommitdiffstats
path: root/main/lua-mqtt-publish/APKBUILD
blob: 29f6d6e4d68f80765ec83c1390700cd4a68306b0 (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
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
_luaversions="5.1 5.2 5.3 5.4"
pkgname=lua-mqtt-publish
pkgver=0.4
pkgrel=0
pkgdesc="Lua module for simple MQTT connect, publish and disconnect"
url="https://github.com/ncopa/lua-mqtt-publish"
arch="all"
license="MIT"
makedepends="lua-mosquitto" # so build order can be calculated

for _v in $_luaversions; do
	subpackages="$subpackages lua$_v-mqtt-publish:_split"
done

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

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

_split() {
	local d= _ver=${subpkgname#lua}; _ver=${_ver%%-*}
	msg "_ver=$_ver"
	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/
		fi
	done
}

sha512sums="
a4a803002a6dd1af508b5a33296ac2aecdcb26af0a4b6fe11bfe17145e0f4d36c4271591c68e1f1e221cdfe71c3ba00852ae87d7065e0a58e235e8ba48ea0cbb  lua-mqtt-publish-0.4.tar.gz
"