# Template file for 'sequoia-sop'
pkgname=sequoia-sop
version=0.37.3
revision=3
build_style=cargo
configure_args="--bin sqop --no-default-features
 --features cli,sequoia-openpgp/compression,sequoia-openpgp/crypto-openssl"
_deps="openssl-devel sqlite-devel bzip2-devel"
hostmakedepends="pkg-config llvm clang ${_deps}"
makedepends="${_deps}"
short_desc="Implementation of the Stateless OpenPGP CLI using Sequoia"
maintainer="classabbyamp <void@placeviolette.net>"
license="GPL-2.0-or-later"
homepage="https://gitlab.com/sequoia-pgp/sequoia-sop/"
distfiles="https://gitlab.com/sequoia-pgp/sequoia-sop/-/archive/v${version}/sequoia-sop-v${version}.tar.gz"
checksum=136c9201d925acc4b79e9ebc0d09ba3f6ad5be798e9c4a3536fcfe8aa4c8e845

post_patch() {
	# https://github.com/rust-lang/cc-rs/issues/1469
	cargo update --package cc:1.2.45 --precise 1.2.14
	# fix CVE-2026-42783 and CVE-2026-42784
	cargo update --package sequoia-openpgp@2.1.0 --precise 2.3.0
	# fix several vulnerabilities
	vsed -i -e '/sequoia-wot/s/0\.14/0\.15/' Cargo.toml
	cargo update --package sequoia-wot@0.14.0 --precise 0.15.2
}


pre_build() {
	export ASSET_OUT_DIR=assets
}

post_install() {
	for page in assets/man-pages/*; do
		vman ${page}
	done
	vcompletion assets/shell-completions/_sqop zsh
	vcompletion assets/shell-completions/sqop.bash bash
	vcompletion assets/shell-completions/sqop.fish fish
}
