# $Id$
# Maintainer: Yuui Tanabe <yuuitanabe@163.com>

_realname=pinentry
pkgbase=mingw-w64-${_realname}
pkgname=(${MINGW_PACKAGE_PREFIX}-${_realname})
pkgver=1.1.0
pkgrel=2
url="https://www.gnupg.org/software/pinentry/index.html"
license=('GPL')
pkgdesc='Collection of simple PIN or passphrase entry dialogs which utilize the Assuan protocol (mingw-w64)'
arch=('any')
mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64')
depends=("${MINGW_PACKAGE_PREFIX}-qt5"
         "${MINGW_PACKAGE_PREFIX}-libsecret"
         "${MINGW_PACKAGE_PREFIX}-libassuan")
makedepends=("${MINGW_PACKAGE_PREFIX}-gcc")
source=(https://www.gnupg.org/ftp/gcrypt/pinentry/pinentry-${pkgver}.tar.bz2{,.sig})
sha256sums=('68076686fa724a290ea49cdf0d1c0c1500907d1b759a3bcbfbec0293e8f56570'
            '8425fbe9ddff3de980cb33ef3ae3bc8a00d214b2554cd73b3a8680eb35fbe6c8')
validpgpkeys=('D8692123C4065DEA5E0F3AB5249B39D24F25E3B6'
              '46CC730865BB5C78EBABADCF04376F3EE0856959'
              '031EC2536E580D8EA286A9F22071B08A33BD3F06')

build()
{
  [[ -d ${srcdir}/build-${MINGW_CHOST} ]] && rm -rf ${srcdir}/build-${MINGW_CHOST}
  mkdir -p "${srcdir}/build-${MINGW_CHOST}" && cd "${srcdir}/build-${MINGW_CHOST}"
  ../${_realname}-${pkgver}/configure \
    --prefix=${MINGW_PREFIX} \
    --build=${MINGW_CHOST} \
    --host=${MINGW_CHOST} \
    --target=${MINGW_CHOST} \
    --disable-pinentry-tty \
    --disable-pinentry-curses \
    --disable-fallback-curses \
    --disable-pinentry-emacs \
    --disable-pinentry-gtk2 \
    --disable-pinentry-gnome3 \
    --enable-pinentry-qt \
    --enable-libsecret

  make
}

package()
{
  cd "${srcdir}/build-${MINGW_CHOST}"
  make DESTDIR=${pkgdir} install
}
