# Maintainer: Maxim Baz <$pkgname at maximbaz dot com>
# Maintainer: Frederik Schwan <freswa at archlinux dot org>
# Contributor: Alad Wenter <alad@archlinux.org>
# Contributor: Jelle van der Waa <jelle@vdwaa.nl>
# Contributor: Chris Salzberg <chris@dejimata.com>
# Contributor: Leonidas Spyropoulos <artafinde@gmail.com>
pkgname=neomutt
pkgver=20210205
pkgrel=1
pkgdesc='A version of mutt with added features'
url='https://neomutt.org/'
license=('GPL')
arch=('x86_64')
depends=('glibc' 'gpgme' 'lua53' 'notmuch-runtime' 'krb5' 'gnutls' 'sqlite'
         'libsasl' 'ncurses' 'libidn2' 'lmdb' 'gdbm' 'kyotocabinet'
         'lz4' 'zlib' 'zstd' 'db')
optdepends=('python: keybase.py'
            'perl: smime_keys'
            'ca-certificates: default CA certificates')
makedepends=('git' 'gnupg' 'libxslt' 'docbook-xsl' 'w3m')
_github='https://github.com/neomutt/neomutt'
source=("$pkgname-$pkgver.tar.gz::$_github/archive/$pkgver.tar.gz"
        "$pkgname-$pkgver.tar.gz.sig::$_github/releases/download/$pkgver/$pkgver.tar.gz.sig"
        "default-ca-certificates.patch")
sha256sums=('77e177780fc2d8abb475d9cac4342c7e61d53c243f6ce2f9bc86d819fc962cdb'
            'SKIP'
            '571716b8979e9b43328416c3c56eff228b6c58355d7c080b8987ea89c6360776')
validpgpkeys=('86C2397270DD7A561263CA4E5FAF0A6EE7371805') # Richard Russon (flatcap) <rich@flatcap.org>

prepare() {
    cd "$pkgname-$pkgver"
    patch -Np1 -i "$srcdir/default-ca-certificates.patch"
}

build() {
    cd "$pkgname-$pkgver"
    ./configure \
        --prefix=/usr \
        --sysconfdir=/etc \
        --libexecdir=/usr/lib \
        --gpgme \
        --sqlite \
        --autocrypt \
        --lua \
        --notmuch \
        --gss \
        --gnutls \
        --sasl \
        --with-ui=ncurses \
        --with-idn2=/usr \
        --disable-idn \
        --idn2 \
        --bdb \
        --lmdb \
        --kyotocabinet \
        --gdbm \
        --lz4 \
        --zlib \
        --zstd
    make
}

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