# Contributor: Bartłomiej Piotrowski <nospam@bpiotrowski.pl>
# Contributor: Danilo Godec <danilo.godec@agenda.si>
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
pkgname=haveged
pkgver=1.9.18
pkgrel=2
pkgdesc="Entropy harvesting daemon using CPU timings"
url="https://www.issihosts.com/haveged/"
arch="all"
license="GPL-3.0-or-later"
subpackages="$pkgname-dev $pkgname-doc $pkgname-openrc"
makedepends="autoconf automake libtool linux-headers"
source="$pkgname-$pkgver.tar.gz::https://github.com/jirka-h/haveged/archive/v$pkgver.tar.gz
	haveged.initd
	haveged.confd"

prepare() {
	default_prepare

	sed -i 's|/bin/bash|/bin/sh|' ent/test.sh

	autoreconf -vif
}

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

check() {
	make check
}

package() {
	make DESTDIR="$pkgdir" install

	rm "$pkgdir"/usr/lib/libhavege.la

	install -Dm755 "$srcdir"/haveged.initd \
		"$pkgdir"/etc/init.d/haveged
	install -Dm644 "$srcdir"/haveged.confd \
		"$pkgdir"/etc/conf.d/haveged
}

sha512sums="
ef2e0ae3be68a8fba16371c3347d52ecf9748269ae30eef2e5c26aad6cfb516f87295e1e56be902df1064e7d4ace04863dd094d62b69e584608f779d63b42d8e  haveged-1.9.18.tar.gz
99dfe4e40b99041a34cfff8539d6148c88413d2fadc2ab8db7edda95f8c84e21b61643de51855d70f0f6d20bbe1f46fc8198bfd5d512099545fad74d1c7132b6  haveged.initd
c2dcaf151d314500c9147b97ce08bb65c902431ac1c60e76072f5237164fa4ff4aa9115eba9329fffb14add7759e4d9acc894bcf49dcc4ea37339a01c2aa1ed7  haveged.confd
"
