# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=mqtt-exec
pkgver=0.3
pkgrel=3
pkgdesc="simple MQTT client that executes a command on messages"
url="https://github.com/ncopa/mqtt-exec"
arch="all"
license="MIT"
depends=""
depends_dev=""
makedepends="$depends_dev mosquitto-dev"
install=""
subpackages=""
source="mqtt-exec-$pkgver.tar.gz::https://github.com/ncopa/mqtt-exec/archive/v$pkgver.tar.gz
	mqtt-exec.initd
	"

_builddir="$srcdir"/mqtt-exec-$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() {
	cd "$_builddir"
	make || return 1
}

package() {
	cd "$_builddir"
	install -D mqtt-exec "$pkgdir"/usr/bin/mqtt-exec || return 1
	install -Dm755 "$srcdir"/mqtt-exec.initd \
		"$pkgdir"/etc/init.d/mqtt-exec || return 1
}

md5sums="25728ae83fe3e5d6918f15f7d12144b2  mqtt-exec-0.3.tar.gz
57ed1c4a54f1141f60e9b92708d9bef2  mqtt-exec.initd"
sha256sums="8085af26c144f7406933bf122861edb7087db28dc84b812fcfc5cead470bb48f  mqtt-exec-0.3.tar.gz
c5015013a9e0be95f86f2063543f16c426c2144d1141c48735a77273302b7b13  mqtt-exec.initd"
sha512sums="b683329033fa839254763b0628e32da7ec494b84f83dae42c973faa76412f7d195b9499859b790afa1026d24dbdbda1f6abf5542dc24b2288dcad831a9c32389  mqtt-exec-0.3.tar.gz
b04b3f43d9079783d5a9af01aba49fa20431e528237e80790cd6ef89ea019d632866d1e2acfc619c3a90ed2cf4469422bac44727088392394792be68a6d13fae  mqtt-exec.initd"
