# Packager = Tuxcore <dev@tuxcore.org> 
pkgname=cracklib
pkgver=2.10.2
pkgrel=1
pkgdesc="Password Checking Library"
arch=('x86_64')
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)
b2sums=('6a5e7fe2be0bcfbdd6f5e2d85dd83065fc0c60f5a25b9a487c2066ada7326504f4491f7c7415a53a7dbe074520c2d7866ae6d791407928a05d26dcd42ed76b79')

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
}
