# Maintainer: Felix Yan <felixonmars@archlinux.org>
# Contributor: namelessjon <jonathan.stott@gmail.com>
# Contributor: Alessio Sergi <asergi at archlinux dot us>

pkgname=libsodium
pkgver=1.0.21
pkgrel=1
pkgdesc="A modern, portable, easy to use crypto library"
arch=('x86_64' 'aarch64')
url="https://github.com/jedisct1/libsodium"
license=('custom:ISC')
depends=('glibc')
makedepends=('git')
provides=('libsodium.so')
source=("git+${url}.git?signed#tag=${pkgver}-RELEASE"
       https://github.com/jedisct1/libsodium/commit/91fe8a46ecf09ef72885527e898fc3f9494bcfad.patch
       )
sha512sums=('2495cf850fdfd73ab87c56f85162c6968ebf346cfd12d04fefa926c9227de22774eea084b1d2fa8c7a6967a703a3a111486e18ee6a0e55cc28007fd7bcd8e461'
            '5ad1a2b454e29409540bf6768f6885e84b97333d2f8f2992c75b69ecd0c5c7d33248f4df6487958117901dab78ead7001d0ea84d4213817407fc43b6383017c6')
validpgpkeys=('54A2B8892CC3D6A597B92B6C210627AABA709FE1') # Frank Denis

prepare() {
  cd $pkgname
  # Backport from 1.0.22
  patch -p1 -i ../91fe8a46ecf09ef72885527e898fc3f9494bcfad.patch

}

build() {
  cd $pkgname

  ./configure --prefix=/usr
  make
}

check() {
  cd $pkgname
  make check
}

package() {
  cd $pkgname
  make DESTDIR="$pkgdir" install

  # install license
  install -d -m 755 "$pkgdir/usr/share/licenses/$pkgname"
  install -m 644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}

# vim:set ts=2 sw=2 et:
