# Contributor: Sander Maijers <S.N.Maijers+Alpine@gmail.com>
# Maintainer: Krassy Boykinov <kboykinov@teamcentrixx.com>
pkgname=xmlsec
pkgver=1.3.5
pkgrel=0
pkgdesc="C based implementation for XML Signature Syntax and Processing and XML Encryption Syntax and Processing"
url="https://github.com/lsh123/xmlsec/"
arch="all"
license="MIT"
makedepends="
	libtool
	libxml2-dev
	libxslt-dev
	nss-dev
	openssl-dev>3
	"
checkdepends="nss-tools"
subpackages="$pkgname-nss $pkgname-dev $pkgname-doc"
source="https://github.com/lsh123/xmlsec/releases/download/$pkgver/xmlsec1-$pkgver.tar.gz"
builddir="$srcdir/xmlsec1-$pkgver"

build() {
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--disable-static \
		--enable-pkgconfig \
		--with-openssl=/usr \
		--without-gnutls \
		--without-gcrypt \
		--with-default-crypto=openssl
	make
}

check() {
	make -k check
}

package() {
	make DESTDIR="$pkgdir" install
}

dev() {
	default_dev

	# move plugin back, as the library opens this itself with bare .so
	mv "$subpkgdir"/usr/lib/libxmlsec1-openssl.so "$pkgdir"/usr/lib
}

nss() {
	pkgdesc="xmlsec nss plugin"
	install_if="$pkgname=$pkgver-r$pkgrel nss"

	amove usr/lib/libxmlsec1-nss.so*
}

sha512sums="
69e9f18e2bc6b1b9acaf475a534a666965a561eec6a5a152185d264a4110d97d233af302153577a414e232a8880c6afc66b563118d889e670204d93819fcfdb5  xmlsec1-1.3.5.tar.gz
"
