# Maintainer: Alad Wenter <alad@archlinux.org>
# Maintainer: Jelle van der Waa <jelle@vdwaa.nl>
# Contributor: Chris Salzberg <chris@dejimata.com>
# Contributor: Leonidas Spyropoulos <artafinde@gmail.com>

pkgname=neomutt
pkgver=20180716
pkgrel=8
pkgdesc='a version of mutt with added features'
url='https://neomutt.org/'
license=('GPL')
arch=('x86_64')
depends=('glibc' 'gpgme' 'lua' 'notmuch-runtime' 'krb5' 'openssl'
	 'libsasl' 'ncurses' 'libidn2' 'lmdb' 'gdbm' 'kyotocabinet')
optdepends=('python: keybase.py')
makedepends=('git' 'gnupg' 'libxslt' 'docbook-xsl' 'w3m')
source=("https://github.com/neomutt/neomutt/archive/$pkgname-$pkgver.tar.gz"
        "https://github.com/neomutt/neomutt/releases/download/$pkgname-$pkgver/$pkgname-$pkgver.tar.gz.sig"
        "pgpewrap.patch::https://github.com/neomutt/neomutt/commit/2249966410400273f1ae4f7b73ce3f33ac40ca57.patch")
sha256sums=('bd89826980b493ba312228c9c14ffe2403e268571aea6008c6dc7ed3848de200'
            'SKIP'
            '732edc4a74feeecb859ffe6fd00b201706dc8f3ce1cb2df8a784843d56380b74')
validpgpkeys=('86C2397270DD7A561263CA4E5FAF0A6EE7371805') # Richard Russon (flatcap) <rich@flatcap.org>

prepare() {
    cd "$pkgname-$pkgname-$pkgver"
    # FS#56741
    patch -Np1 -i $srcdir/pgpewrap.patch
}

build() {
    cd "$pkgname-$pkgname-$pkgver"
    ./configure \
        --prefix=/usr \
        --sysconfdir=/etc \
        --libexecdir=/usr/lib \
        --gpgme \
        --enable-lua \
        --notmuch \
        --gss \
        --ssl \
        --sasl \
        --with-ui=ncurses \
        --with-idn2=/usr \
        --idn=0 \
        --idn2=1 \
        --lmdb \
        --kyotocabinet \
        --gdbm
    make
}

package() {
    cd "$pkgname-$pkgname-$pkgver"
    make DESTDIR="$pkgdir" install
}
