# Maintainer: Antonio Rojas <arojas@archlinux.org>
# Contributor: Lex Black <autumn-wind@web.de>
# Contributor: Jesin <Jesin00@gmail.com>

# ALARM: Kevin Mihelich <kevin@archlinuxarm.org>
#  - configure with --disable-fat (SSE)

pkgname=libb2
pkgver=0.98.1
pkgrel=2
arch=(x86_64)
pkgdesc='C library providing BLAKE2b, BLAKE2s, BLAKE2bp, BLAKE2sp hash functions'
url='https://blake2.net/'
license=(custom:CC0)
depends=(gcc-libs)
source=("https://github.com/BLAKE2/libb2/releases/download/v$pkgver/$pkgname-$pkgver.tar.gz")
sha256sums=('53626fddce753c454a3fea581cbbc7fe9bbcf0bc70416d48fdbbf5d87ef6c72e')

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

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

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

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