# POWER Maintainer: Alexander Baldeck <alex.bldck@gmail.com>
# Maintainer: Tobias Powalowski <tpowa@archlinux.org>
# Contributor: Federico Quagliata (quaqo) <quaqo@despammed.com>

pkgname=cracklib
pkgver=2.10.3
pkgrel=1
pkgdesc="Password Checking Library"
arch=(x86_64 powerpc64le powerpc64 powerpc riscv64)
license=('GPL-2.0-or-later')
url="https://github.com/cracklib/cracklib"
depends=(
  glibc
  zlib)
source=(https://github.com/cracklib/cracklib/releases/download/v$pkgver/$pkgname-$pkgver.tar.gz{,.asc})
validpgpkeys=(
  FCE0F8C65F5B2972C2EB55E2350D0B0705E9C3CB #Nathan Neulinger <nneul@neulinger.org>
)
b2sums=('4b493f3275d81c886c4f2f4d36726c90dd5b2d9a6aead959bb2a3e1e1f7d2b08816f68dc4cceafe32317424212237a20e9cd35066ffb8debbd3c201275a0fa85'
        'SKIP')

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

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

package() {
  cd $pkgname-$pkgver
  make DESTDIR="$pkgdir" install
  # symlink cracklib-small #34778
  mkdir -p "$pkgdir"/usr/share/dict
  ln -sf /usr/share/cracklib/cracklib-small "$pkgdir"/usr/share/dict/cracklib-small
  sh ./util/cracklib-format dicts/cracklib-small \
    | sh ./util/cracklib-packer "$pkgdir"/usr/share/cracklib/pw_dict
}
