# POWER Maintainer: Alexander Baldeck <alex.bldck@gmail.com>
# Maintainer: Maxime Gauduin <alucryd@archlinux.org>
# Contributor: Baptiste Jonglez <archlinux at bitsofnetworks.org>
# Contributor: Giovanni Scafora <giovanni@archlinux.org>
# Contributor: Alexander Rødseth <rodseth@gmail.com>
# Contributor: Andrea Scarpino <andrea@archlinux.org>
# Contributor: Kritoke <kritoke@gamebox.net>
# Contributor: jlvsimoes <jlvsimoes@oninet.pt>

pkgname=crypto++
pkgver=8.9.0
pkgrel=1
pkgdesc='A free C++ class library of cryptographic schemes'
arch=(x86_64 powerpc64le powerpc64 powerpc riscv64)
url=https://www.cryptopp.com/
license=(custom)
depends=(gcc-libs)
makedepends=(
  git
  unzip
)
_tag=843d74c7c97f9e19a615b8ff3c0ca06599ca501b
source=(git+https://github.com/weidai11/cryptopp.git#tag=${_tag})
b2sums=(SKIP)
validpgpkeys=(B8CC19802062211A508B2F5CCE0586AF1F8E37BD) # Jeffrey Walton <noloader@gmail.com>

pkgver() {
  cd cryptopp
  git describe --tags | sed 's/^CRYPTOPP_//; s/_/./g'
}

build() {
  export CXXFLAGS="$CXXFLAGS -DNDEBUG -fPIC"
  make PREFIX=/usr -C cryptopp dynamic cryptest.exe libcryptopp.pc
}

check() {
  make PREFIX=/usr -C cryptopp test
}

package() {
  make DESTDIR="${pkgdir}" PREFIX=/usr -C cryptopp install
  install -Dm 644 cryptopp/License.txt -t "${pkgdir}"/usr/share/licenses/crypto++/
  # Remove cryptest.exe and test files, only needed for check() and bloats the package
  # because cryptest.exe is linked statically.
  rm -rf "${pkgdir}"/usr/{bin,share/cryptopp}
}

# vim: ts=2 sw=2 et:
