# Maintainer: Massimiliano Torromeo <massimiliano.torromeo@gmail.com>
# Contributor: Alasdair Haswell <ali at arhaswell dot co dot uk>

pkgname=rng-tools
pkgver=6.7
pkgrel=2
pkgdesc="Random number generator related utilities"
arch=('x86_64')
url="https://github.com/nhorman/rng-tools"
license=('GPL')
depends=('libgcrypt' 'curl' 'libxml2' 'sysfsutils' 'jitterentropy' 'libp11')
backup=(etc/conf.d/rngd)
source=(https://github.com/nhorman/rng-tools/archive/v$pkgver/$pkgname-$pkgver.tar.gz
        rngd.conf
        rngd.service)
sha256sums=('b85e3530dbf943b6da03ebecaf64d0a4febfcc4f562fc7f8d886483906b15f08'
            'f4fd197dd682cdab07ddeabe8d3b73b1bc2e1cf322237be238a26b49a7dcb047'
            '005c039f853596459230395c397599aa9647cfc8fec1d10bf39f5d5b2c2840e1')

prepare() {
	cd "$srcdir"/$pkgname-$pkgver
	mv README{.md,}

	libtoolize --force
	aclocal
	autoheader
	automake --force-missing --add-missing
	autoconf
}

build() {
	cd "$srcdir"/$pkgname-$pkgver
	./configure --prefix=/usr --sbindir=/usr/bin
	make
}

package() {
	cd "$srcdir"/$pkgname-$pkgver
	make DESTDIR="$pkgdir" install
	install -Dm0644 "$srcdir"/rngd.service "$pkgdir"/usr/lib/systemd/system/rngd.service
	install -Dm0644 "$srcdir"/rngd.conf "$pkgdir"/etc/conf.d/rngd
}
