# Maintainer: Johannes Löthberg <johannes@kyriasis.com>
# Contributor: carstene1ns <arch carsten-teibes de> - http://git.io/ctPKG
# Contributor: 謝致邦 <Yeking@Red54.com>
# Contributor: cantabile <cantabile dot desu at gmail dot com>
# Contributor: reMiND <detanator@gmail.com>

pkgname=rhash
pkgver=1.4.4
pkgrel=1

pkgdesc='Utility for verifying hash sums of files'
url='https://github.com/rhash/RHash'
license=('BSD')
arch=('x86_64' 'aarch64')

depends=('glibc')

backup=('etc/rhashrc')

source=(rhash-$pkgver.tar.gz::https://github.com/rhash/RHash/archive/v$pkgver.tar.gz
        rhash-$pkgver.tar.gz.asc::https://github.com/rhash/RHash/releases/download/v$pkgver/v$pkgver.tar.gz.asc)

sha512sums=('00a7e5e058b53ce20ae79509815452ed9cb699d1322b678220b72c61dea3ea2f8fa131acfade8bb6d9f6af913f0c3c472330841181b22314b8755166310c946f'
            'SKIP')
# https://sourceforge.net/p/rhash/wiki/PublicKey/
validpgpkeys=('2875F6B1C2D27A4F0C8AF60B2A714497E37363AE')

prepare() {
  cd RHash-$pkgver
  ./configure --prefix=/usr --sysconfdir=/etc --extra-cflags="$CFLAGS" --extra-ldflags="$LDFLAGS"
}

build() {
  cd RHash-$pkgver
  make
}

check() {
  cd RHash-$pkgver
  make test test-lib
}

package() {
  cd RHash-$pkgver

  # program
  make DESTDIR="$pkgdir" install

  # library, since the makefiles are still broken
  make -C librhash DESTDIR="$pkgdir" install-lib-headers install-lib-shared install-so-link

  # license
  install -Dm644 COPYING "$pkgdir"/usr/share/licenses/rhash/LICENSE
}
