# Contributor: Andreas Radke <andyrtr@archlinux.org>
# Contributor: judd <jvinet@zeroflux.org>

_pkgname=libgpg-error
pkgname=static-compat-$_pkgname
pkgver=1.44
pkgrel=1
pkgdesc="Support library for libgcrypt"
arch=(x86_64)
url="https://www.gnupg.org"
license=('LGPL')
depends=('glibc-static-compat' 'sh')
makedepends=('static-compat-configure')
options=(staticlibs)
source=(https://www.gnupg.org/ftp/gcrypt/libgpg-error/${_pkgname}-${pkgver}.tar.bz2{,.sig})
# https://www.gnupg.org/download/integrity_check.html
sha1sums=('c16ab473d1e558ba1712c77ace38bd03e467cbb0'
          'SKIP')
validpgpkeys=('D8692123C4065DEA5E0F3AB5249B39D24F25E3B6'  # Werner Koch
              '031EC2536E580D8EA286A9F22071B08A33BD3F06'  # NIIBE Yutaka (GnuPG Release Key) <gniibe@fsij.org>
              '6DAA6E64A76D2840571B4902528897B826403ADA') # "Werner Koch (dist signing 2020)"

prepare() {
  source static-compat-environment
  cd ${_pkgname}-${pkgver}
  autoreconf -vfi
}

build() {
  source static-compat-environment
  cd ${_pkgname}-${pkgver}
  static-compat-configure --disable-shared --enable-static
  make
}

check() {
  source static-compat-environment
  cd ${_pkgname}-${pkgver}
  #make check
  # note: fails with error message "FAIL: gpg-error-config-test.sh"
}

package() {
  source static-compat-environment
  cd ${_pkgname}-${pkgver}
  make DESTDIR="${pkgdir}/" install
  rm -r "$pkgdir/$static_compat_prefix"/share/{man,info}
}
