### this file is sourced not run
PKGVER=0.23.18.1
PKGBUILD=1
PKGARCH=x86_64

# source: BLFS 8.2 updated to 9.0
TARBALL=p11-kit-$PKGVER.tar.gz
MD5SUM=79480c3a2c905a74f86e885966148537
SRC_URL=https://github.com/p11-glue/p11-kit/releases/download/$PKGVER/$TARBALL
BUNDLE=

SLACKREQ='' 
SLACKDESC="libp11kit: libp11kit $PKGVER (PKCS #11 library)
libp11kit: 
libp11kit: The p11-kit package provides a way to load and enumerate PKCS #11 (a 
libp11kit: Cryptographic Token Interface Standard) modules.
libp11kit: 
libp11kit: 
libp11kit: 
libp11kit: 
libp11kit: 
libp11kit: 
libp11kit: 
"

### default pkg_download
### prepare
pkg_prepare() {
	pkg_prepare_default &&
	cd tmp/p11* &&

	# BLFS 9.0 patch
	sed '20,$ d' -i trust/trust-extract-compat.in &&
	cat >> trust/trust-extract-compat.in << "EOF"
# Copy existing anchor modifications to /etc/ssl/local
/usr/libexec/make-ca/copy-trust-modifications

# Generate a new trust store
/usr/sbin/make-ca -f -g
EOF

}

### default pkg_package
### build
pkg_build() {
	CONFFLAGS="$CONFFLAGS --disable-static --with-trust-paths=/etc/pki/anchors"
	pkg_build_autoconf &&
	pkg_build_slackdesc &&

	ln -sfv /usr/libexec/p11-kit/trust-extract-compat \
        /usr/bin/update-ca-certificates &&

	# libnssckbi compat
	ln -sfv ./pkcs11/p11-kit-trust.so /usr/$LIBDIR/libnssckbi.so
}
