# Contributor: Sören Tempel <soeren+alpine@soeren-tempel.net>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=pinentry
pkgver=1.1.0
pkgrel=0
pkgdesc="Collection of simple PIN or passphrase entry dialogs which utilize the Assuan protocol"
url="http://www.gnupg.org/aegypten2"
arch="all"
license="GPL-2.0-or-later"
depends=""
install="pinentry.post-install pinentry.post-deinstall"
makedepends="ncurses-dev libcap-dev gtk+-dev libgpg-error-dev libassuan-dev"
subpackages="$pkgname-doc $pkgname-gtk"
source="ftp://ftp.gnupg.org/gcrypt/$pkgname/$pkgname-$pkgver.tar.bz2"
builddir="$srcdir"/$pkgname-$pkgver

build () {
	cd "$builddir"
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--disable-pinentry-gtk \
		--enable-pinentry-gtk2 \
		--disable-pinentry-qt \
		--enable-pinentry-curses \
		--enable-fallback-curses
	make
}

check() {
	make -C "$builddir" check
}

package() {
	cd "$builddir"
	make DESTDIR="$pkgdir" install

	# created by post install scripts so we can override with gtk version
	rm -f "$pkgdir"/usr/bin/pinentry
}

gtk() {
	install="pinentry-gtk.post-install pinentry-gtk.post-deinstall"
	mkdir -p "$subpkgdir"/usr/bin
	mv "$pkgdir"/usr/bin/pinentry-gtk* \
		"$subpkgdir"/usr/bin/
}

sha512sums="5012672925bcb5f683358c259e55e4b87c67cf063ad52c759308933733025c33f7ce08e5b8019ffc101cbf7ef30499040ef2fd34a7611698e65e1593f80948cd  pinentry-1.1.0.tar.bz2"
