# Maintainer: Manuel Domke <info@13-37.org>

_pkgname=infnoise

pkgname=${_pkgname}
pkgver=0.2.6.r86.g453234b
pkgdesc="Infinite Noise TRNG - The world's easiest TRNG to get right"
license=('custom:CC0')
url='https://github.com/13-37-org/infnoise'
depends=('libftdi-compat')
makedepends=("git")
source=('git+https://github.com/13-37-org/infnoise')
sha256sums=("SKIP")
install='INSTALL'

pkgver() {
  cd "${_pkgname}"
  git describe --long --tags | sed 's/-/.r/;s/-/./'
}

build() {
  cd "${srcdir}/infnoise/software/"
  make -f Makefile.linux
}

package() {
  install -Dvm755 "${srcdir}/infnoise/software/infnoise" "${pkgdir}/usr/bin/infnoise"
  install -Dvm644 "${srcdir}/infnoise/software/libinfnoise.a" "${pkgdir}/usr/lib/libinfnoise.a"
  install -Dvm755 "${srcdir}/infnoise/software/libinfnoise.so" "${pkgdir}/usr/lib/libinfnoise.so"
  install -Dvm644 "${srcdir}/infnoise/software/init_scripts/75-infnoise.rules" "${pkgdir}/etc/udev/rules.d/75-infnoise.rules"
  install -Dvm644 "${srcdir}/infnoise/software/init_scripts/infnoise.conf.systemd" "${pkgdir}/etc/infnoise.conf"
  install -Dvm644 "${srcdir}/infnoise/software/init_scripts/infnoise.service.bin" "${pkgdir}/usr/lib/systemd/system/infnoise.service"
}
