# Contributor: C. Dylan Shearer <dylan@nekonya.info>
# Maintainer: C. Dylan Shearer <dylan@nekonya.info>
pkgname=jobber
pkgdesc="A replacement for cron, with sophisticated status-reporting and error-handling."
url="https://dshearer.github.io/${pkgname}/"
arch="all"
license="MIT"
depends=""
depends_dev=""
makedepends="$depends_dev openrc go>=1.8 rsync"
install="${pkgname}.post-install ${pkgname}.pre-deinstall ${pkgname}.post-deinstall ${pkgname}.post-upgrade"
source="${pkgname}.initd ${pkgname}.tgz"

_builddir="${startdir}/build"

prepare() {
	"${srcdir}/${pkgname}/configure" --prefix=/usr --localstatedir=/var
}

build() {
	make -C "${srcdir}/${pkgname}" build
}

check() {
    make -C "${srcdir}/${pkgname}" check
}

package() {
    set -e

    # install
	make -C "${srcdir}/${pkgname}" install "DESTDIR=${pkgdir}/"

    # install init script
	local INITD="${pkgdir}/etc/init.d"
	mkdir -p "${INITD}"
	cp "${startdir}/${pkgname}.initd" "${INITD}/jobber"
}

sha512sums="7dacd120effe454daded552623c99bb1b695c6ce47819b7f627772a1f6ca494b5ff83adcae2693e35ef600e92268ef5066a92fc7522043316864edde6f892550  jobber.initd
9831f6dc858fa085c317a496affeb63945de5a96a7656008ef493783bebca65ee3445bbad0dfe646378ae9b75622eef395b43a20be7fa435c5b16247c1324702  jobber.tgz"
