# Maintainer: AndyRTR <andyrtr@archlinux.org>
# Contributor: Jan de Groot <jgc@archlinux.org>
# Contributor: Hussam Al-Tayeb <ht990332@gmail.com>

pkgname=xmlsec
pkgver=1.3.4
pkgrel=1
pkgdesc="XML Security Library is a C library based on LibXML2"
license=(MIT)
arch=('x86_64' 'aarch64')
url="https://www.aleksey.com/xmlsec/index.html"
depends=('libxslt' 'openssl' 'gnutls' 'nss' 'libltdl'
         'libgcrypt' 'nspr' 'libxml2' 'glibc' 'sh')
provides=('libxmlsec1.so' 'libxmlsec1-openssl.so' 'libxmlsec1-nss.so' 'libxmlsec1-gnutls.so' 'libxmlsec1-gcrypt.so')
#source=(https://www.aleksey.com/xmlsec/download/${pkgname}1-${pkgver}.{tar.gz,sig}) # signature file not compatible
source=(https://www.aleksey.com/xmlsec/download/older-releases/${pkgname}1-${pkgver}.tar.gz)
sha256sums=('45ad9078d41ae76844ad2f8651600ffeec0fdd128ead988a8d69e907c57aee75')
# https://www.aleksey.com/xmlsec/download/aleksey%40aleksey.com.gpg
#validpgpkeys=('00FDD6A7DFB81C88F34B9BF0E63ECDEF9E1D829E') # "Aleksey Sanin <aleksey@aleksey.com>"

build() {
  cd ${pkgname}1-${pkgver}
  ./configure --prefix=/usr \
    --disable-static \
    --enable-files
  sed -i -e 's/ -shared / -Wl,-O1,--as-needed\0/g' libtool
  make
}

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

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