# Compiling Time: 0.01 SBU
# Maintainer: DeX77 <dex+fw@dragonslave.de>

pkgname=sequoia-sq
pkgver=1.3.1
pkgrel=1
pkgdesc='Command-line frontends for Sequoia'
url='https://sequoia-pgp.org/'
archs=('x86_64')
groups=('apps')
depends=('openssl' 'sqlite3' 'nettle' 'bzip2')
makedepends=('cargo' 'clang' 'capnproto')
source=("https://gitlab.com/sequoia-pgp/sequoia-sq/-/archive/v${pkgver}/sequoia-sq-v${pkgver}.tar.bz2")
up2date="lynx -dump https://gitlab.com/api/v4/projects/sequoia-pgp%2F${pkgname}/repository/tags  | jq -r '.[].name' | sed 's/v//g' | head -n 1 "

sha1sums=('ec560bf043602dc5a737f8ae65ff5417f1dd3feb')
_F_cd_path="sequoia-sq-v$pkgver"

build() {
	Fcd
	export RUSTUP_TOOLCHAIN=stable
	Fexec cargo fetch --locked --target "$CARCH-unknown-linux-gnu" || Fdie
  	export CARGO_TARGET_DIR=target
	export RUSTUP_TOOLCHAIN=stable
	export ASSET_OUT_DIR=target
	Fexec cargo build --release --frozen --features 'default' || Fdie

  	Fexerel target/release/sq usr/bin/sq

	Finstallrel 644 target/shell-completions/sq.bash usr/share/bash-completion/completions/sq
	Finstallrel 644 target/shell-completions/_sq usr/share/zsh/site-functions/_sq
	Finstallrel 644 target/shell-completions/sq.fish usr/share/fish/vendor_completions.d/sq.fish
}


# optimization OK
