# Contributor: Bartłomiej Piotrowski <bpiotrowski@alpinelinux.org>
# Maintainer: Patrycja Rosa <alpine@ptrcnull.me>
pkgname=uptimed
pkgver=0.4.6
pkgrel=2
pkgdesc='System uptime record daemon'
arch="all"
options="!check"  # No tests
url="https://github.com/rpodgorny/uptimed"
license="GPL-2.0-only"
subpackages="$pkgname-doc $pkgname-openrc"
makedepends="autoconf automake libtool"
source="$pkgname-$pkgver.tar.gz::https://github.com/rpodgorny/uptimed/archive/v$pkgver.tar.gz
	uptimed.init"

prepare() {
	default_prepare
	autoreconf -vif
}

build() {
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--disable-static
	make
}

package() {
	make install DESTDIR="$pkgdir"
	mv "$pkgdir"/etc/uptimed.conf-dist \
		"$pkgdir"/etc/uptimed.conf
	install -Dm755 "$srcdir"/uptimed.init \
		"$pkgdir"/etc/init.d/uptimed
}

sha512sums="
035caba32182a807312b587b3cb3b6322027b7c8f3e69a3f0b52ea4f44ecfc40505fe58b6a1b56a87a967f1f8b1fbc075414a04b60717577e32972feadb9bc2d  uptimed-0.4.6.tar.gz
52566676d85baa354a3378294559979529fabeb802edaaadca2ee3a76f804a25fe6d8313b3db34e0346b088a097bcef2775f2c9d39ec36451f2d07c26e6eda4a  uptimed.init
"
