# Maintainer: Felix Huettner <huettner94@gmx.de>

pkgname=mutt
pkgver=2.1.2
pkgrel=1
pkgdesc='Small but very powerful text-based mail client (net-utils)'
url='http://www.mutt.org/'
license=('GPL')
groups=('net-utils')
backup=('etc/Muttrc')
arch=('i686' 'x86_64')
depends=('libgpgme' 'libsasl' 'libgdbm' 'ncurses' 'libgnutls' 'libidn2' 'libsqlite' 'zlib')
makedepends=('docbook-xml'
             'docbook-xsl'
             'elinks'
             'libgdbm-devel'
             'libgnutls-devel'
             'libgpgme-devel'
             'libidn2-devel'
             'libsasl-devel'
             'libsqlite-devel'
             'ncurses-devel'
             'zlib-devel')
source=("http://ftp.mutt.org/pub/mutt/${pkgname}-${pkgver}.tar.gz"{,.asc})
sha256sums=('692ab7dafa8ed1574c8e60a0b223584b11fcf55e2daaf643dbb09f269f9f3c69'
            'SKIP')
validpgpkeys=('8975A9B33AA37910385C5308ADEF768480316BDA') # Kevin J. McCarthy <kevin@8t8.us>

build() {
  cd "${srcdir}/${pkgname}-${pkgver}"
  ./configure \
    --prefix=/usr \
    --sysconfdir=/etc \
    --enable-gpgme \
    --enable-pop \
    --enable-imap \
    --enable-smtp \
    --enable-hcache \
    --with-curses=/usr \
    --with-gss=/usr \
    --with-gnutls=/usr \
    --with-sqlite3=/usr \
    --with-sasl \
    --with-idn2 \
    --with-gdbm \
    --with-mailpath=/var/spool/mail

  make
}

check() {
  cd "${srcdir}/${pkgname}-${pkgver}"
  make -k check
}

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

  rm "${pkgdir}"/etc/mime.types{,.dist}
  install -Dm644 contrib/gpg.rc "${pkgdir}"/etc/Muttrc.gpg.dist
}
