# Maintainer: Developer <dev@opalos.org>
# Maintainer: Developer <dev@opalos.org>

pkgname=cracklib
pkgver=%version%
pkgrel=%release%
pkgdesc="Password Checking Library"
arch=('x86_64')
license=('GPL')
url="https://github.com/cracklib/cracklib"
depends=('glibc' 'zlib')
source=(https://github.com/cracklib/cracklib/releases/download/v$pkgver/$pkgname-$pkgver.tar.gz)
sha256sums=('6213b986a5209fc0d4ca93734e349b8f66b36bfe9a3fae6eead14a15d82a68dc')

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
}
