description="MailUserAgent, useful for reading, writing, replying to, saving, and deleting your email."
url="http://www.mutt.org/"

packager="spiky <spiky@nutyx.org>"
contributors="Berlius,Tnut,Greg"

makedepends=(aspell aspell-dict cyrus-sasl gdb gnupg gpgme libidn
             kerberos sendmail slang openssl gnutls db libxslt lynx)
run=(shadow)

name=mutt
version=2.2.9
_version=2.2.9

source=(ftp://ftp.mutt.org/pub/mutt/$name-${_version}.tar.gz)
 
prepare() {
SN="mail"
IDN="34"
if ! (getent group $SN > /dev/null); then
   groupadd -g $IDN $SN
fi
}
build() {

cd $name-${_version}

sed -i -e 's/ -with_backspaces//' -e 's/elinks/links/' \
  -e 's/-no-numbering -no-references//' doc/Makefile.in

./configure --prefix=/usr     \
            --sysconfdir=/etc \
            --with-docdir=/usr/share/doc/mutt-$version \
            --enable-pop      \
            --enable-imap     \
            --enable-hcache   \
            --enable-sidebar  \
            --without-qdbm    \
            --with-gdbm       \
            --with-ssl        \
            --without-bdb     \
            --with-sasl       \
            --enable-smtp
make

make DESTDIR=$PKG install

test -s doc/manual.txt ||
install -v -m644 doc/manual.txt.shipped \
$PKG/usr/share/doc/$name-$version

if [ -f $PKG/usr/bin/mutt_dotlock ]; then
  chown root:mail $PKG/usr/bin/mutt_dotlock
  chmod -v 2755 $PKG/usr/bin/mutt_dotlock
fi
}
