# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=mqtt-exec
pkgver=0.4
pkgrel=0
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
}

sha512sums="1448b2dda0f27a5275c113331ea2bc073ec1740797c1bb5b472ee3e0fd4d3ef4bcdfa6dc42e7540ee154b291c3d70df89f0646899ebb1bfe585d1384797de5e7  mqtt-exec-0.4.tar.gz
b04b3f43d9079783d5a9af01aba49fa20431e528237e80790cd6ef89ea019d632866d1e2acfc619c3a90ed2cf4469422bac44727088392394792be68a6d13fae  mqtt-exec.initd"
