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

pkgname=xmlsec
pkgver=1.3.9
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'
         'nspr' 'libxml2' 'glibc' 'sh')
provides=('libxmlsec1.so' 'libxmlsec1-openssl.so' 'libxmlsec1-nss.so' 'libxmlsec1-gnutls.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/${pkgname}1-${pkgver}.tar.gz
        https://github.com/lsh123/xmlsec/releases/download/${pkgver}/${pkgname}1-${pkgver}.tar.gz)
sha256sums=('a631c8cd7a6b86e6adb9f5b935d45a9cf9768b3cb090d461e8eb9d043cf9b62f')
# 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 \
    --disable-ripemd160
  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}"
}
