# Packager = Tuxcore <dev@tuxcore.org> 
pkgname=libb2
pkgver=0.98.1
pkgrel=3
arch=(x86_64)
pkgdesc='C library providing BLAKE2b, BLAKE2s, BLAKE2bp, BLAKE2sp hash functions'
url='https://blake2.net/'
license=(CC0-1.0)
depends=(gcc-libs
         glibc)
makedepends=(git)
source=(git+https://github.com/BLAKE2/libb2#tag=v$pkgver)
sha256sums=('eb6b596bc30918427d1e792914f454c1d3e61fef3d4499f6605ede78f835cc1b')

# libb2's build system discards the $CFLAGS variable.
# We can get around this by putting those flags in $CC.
export CC="${CC-cc} $CFLAGS"

prepare() {
  cd $pkgname
  autoreconf -vi
}

build() {
  cd $pkgname
  ./configure \
    --prefix=/usr \
    --disable-static \
    --enable-shared \
    --disable-native \
    --enable-fat
  make
}

check() {
  cd $pkgname
  make check
}

package() {
  cd $pkgname
  make DESTDIR="$pkgdir" install
  install -Dm644 COPYING -t "$pkgdir"/usr/share/licenses/$pkgname
}
