# Maintainer:  Christian Hesse <mail@eworm.de>
# Contributor: Bartłomiej Piotrowski <bpiotrowski@archlinux.org>
# Contributor: kfgz <kfgz at interia dot pl>
# Contributor: pootzko <pootzko at gmail dot com>

pkgname=haveged
pkgver=1.9.6
pkgrel=3
pkgdesc='Entropy harvesting daemon using CPU timings'
arch=('x86_64')
url='https://github.com/jirka-h/haveged'
license=('GPL')
depends=('glibc')
validpgpkeys=('8F6B7293B03E5AC5762B65CE2E2F252B05CCA168') # Jirka Hladky <hladky.jiri@gmail.com>
source=("$pkgname-$pkgver.tar.gz::https://github.com/jirka-h/$pkgname/archive/v$pkgver.tar.gz"
        #"https://github.com/jirka-h/$pkgname/releases/download/$pkgver/$pkgname-$pkgver.tar.gz.asc"
        'haveged.service')
sha256sums=('4d4c046755476d3734ffb78772c242c25913ff0eb7509c143671dae6ec9d1189'
            #'SKIP'
            '08482c5cb6aee86e893a8b297be9b09466d506c841787e4f916f285527336a85')

# service file changes sent upstream:
# https://github.com/jirka-h/haveged/pull/21

build() {
  cd $pkgname-$pkgver

  ./configure \
      --prefix=/usr \
      --bindir=/usr/bin \
      --sbindir=/usr/bin
  make
}

check() {
  cd ${pkgname}-${pkgver}
  make check
}

package() {
  cd $pkgname-$pkgver

  make DESTDIR="$pkgdir" install

  install -D -m0644 "${srcdir}"/haveged.service "$pkgdir"/usr/lib/systemd/system/haveged.service
  #install -D -m0644 init.d/service.fedora "$pkgdir"/usr/lib/systemd/system/haveged.service
}
