# $Id: Portfile,v 1.35 2006/07/26 04:17:25 yeled Exp $

PortSystem 1.0
name		mutt-devel
version		1.5.12
categories	mail
maintainers	mij@opendarwin.org
description	Mongrel of Mail User Agents (part Elm, Pine, Mush, mh, etc)
homepage	http://www.mutt.org/
platforms	darwin linux

long_description Mutt -- "The Mongrel of Mail User Agents" (part Elm, part \
		 Pine, part mh, part slrn, part everything else) is an \
		 interactive screen-oriented mailer program that supersedes \
		 Elm, Pine, mail and mailx.  Features include color support, \
		 message threading, MIME support (including RFC1522 support \
		 for encoded headers), customizable key bindings, POP3, \
		 Delivery Status Notification (DSN) support, and PGP/MIME.

master_sites		ftp://ftp.mutt.org/mutt/devel/
distname			mutt-${portversion}
checksums			${distfiles} md5 57196c816211a72900fdc54341eb0132
patch.args			-p1
default_variants	+pop +imap +ncurses

worksrcdir			mutt-${portversion}

depends_lib-append	port:gettext port:libiconv

configure.args	--disable-warnings \
				--mandir=${prefix}/share/man \
				--with-docdir=${prefix}/share/doc/mutt \
				--with-libiconv-prefix=${prefix}

variant idn {
	configure.args-append	--with-idn=${prefix}
	depends_lib-append		port:libidn port:zlib
}

variant linux {
	configure.env	CFLAGS=-I/usr/kerberos/include
}

variant pop	{ configure.args-append --enable-pop }
variant imap	{ configure.args-append --enable-imap }
variant ssl	{ configure.args-append --with-ssl 
				depends_lib-append port:openssl }
variant sasl { configure.args-append --with-sasl
				depends_lib-append port:cyrus-sasl2 }
variant debug	{ configure.args-append --enable-debug }
# use file size attribute instead of access time
variant buffy { configure.args-append --enable-buffy-size }

variant gnuregex { configure.args-append --with-regex }
variant ncurses { configure.args-append --with-curses=${prefix}/lib
				depends_lib-append port:ncurses 
				configure.env-append LDFLAGS="-Wl,-search_paths_first"
}

variant cvs {
		fetch.type 		cvs
		cvs.root 		:pserver:anonymous@cvs.mutt.org:/home/roessler/cvs
		cvs.module 		mutt
		cvs.password	anonymous 
		cvs.date		20060724
		version			${version}-${cvs.date}
		worksrcdir		mutt
		configure.cmd	${worksrcpath}/prepare
		depends_build-append	port:autoconf
}

variant compress {
	configure.args-append	--enable-compressed
	patch_sites-append		http://www.spinnaker.de/mutt/compressed/
	patchfiles-append		patch-1.5.12.rr.compressed.1.gz
	checksums-append		patch-1.5.12.rr.compressed.1.gz md5 \
								bb7e439d74b22ede912d2d30862b1367
}

if {[variant_isset gdbm]} { 
		variant_unset db4 
		variant_unset qdbm 
} elseif {[variant_isset qdbm]} { 
		variant_unset db4 
		variant_unset gdbm 
} else { 
		variant_set db4 
}

variant headercache { 
	configure.args-append	--enable-hcache
	configure.env-append	LDFLAGS="-L${prefix}/lib -L/usr/lib" 
}

variant qdbm requires cvs {
		depends_build-append	port:qdbm
		configure.args-append	--enable-qdbm --without-bdb --without-gdbm
		configure.env-append	CPPFLAGS="-I${prefix}/include" 
}

variant gdbm {
		depends_build-append	port:gdbm
		configure.args-append	--enable-gdbm --without-bdb --without-qdbm
		configure.env-append	CPPFLAGS="-I${prefix}/include" 
}

variant db4	{
		depends_lib-append		port:db4
		configure.args-append	--enable-bdb --without-qdbm --without-gdbm
		configure.env-append	CPPFLAGS="-I${prefix}/include/db4"
}

variant nntp {
	configure.args-append	--enable-nntp
	patch_sites-append		http://www.mutt.org.ua/download/mutt-1.5.12/
	patchfiles-append		patch-1.5.12.vvv.nntp.gz
	checksums-append		patch-1.5.12.vvv.nntp.gz md5 \
					7cbc1e12a743b3ad9a594a5da29f6d35
}

variant deepif {
	patch_sites-append	http://home.uchicago.edu/~dgc/sw/mutt/
	patchfiles-append	patch-1.5.1.dgc.deepif.1
	checksums-append	patch-1.5.1.dgc.deepif.1 md5 \
							d106063ac67b8afe107ed62abff79976
}

variant trash {
# add purge patch without asking
	patch_sites-append http://cedricduval.free.fr/mutt/patches/download/
	patchfiles-append	patch-1.5.10.cd.trash_folder.3.4 \
						patch-1.5.5.1.cd.purge_message.3.4
	checksums-append	patch-1.5.10.cd.trash_folder.3.4 md5 \
						0d0dc2e8167107414d145fc735cd87ba \
						patch-1.5.5.1.cd.purge_message.3.4 md5 \
						396c8c0d1439217c0ee1322aae761f92
}


# whoa! messy FAIL
#variant unbind conflicts {
#	patch_sites-append http://home.uchicago.edu/~dgc/sw/mutt/
#	patchfiles-append patch-1.5.1.dgc.unbind.1
#	checksums-append	patch-1.5.1.dgc.unbind.1 md5 \
#					067f4702e17e0a80322b940bf206690d
#}

variant date_conditional requires deepif {
# original, but now dgc hosts it with -p1
#	patch_sites-append http://www.schrab.com/aaron/mutt/
	patch_sites-append http://home.uchicago.edu/~dgc/sw/mutt/
	patchfiles-append	patch-1.5.8.ats.date_conditional.1
	checksums-append	patch-1.5.8.ats.date_conditional.1 md5 \
					83479a011390802b3f9f1c0f95b15199
}

variant xlabel {
	patch_sites-append	http://home.uchicago.edu/~dgc/sw/mutt/
	patchfiles-append	patch-0.20051006.1.dgc.xlabel_ext.7 \
						patch-1.5.8.dgc.xlabel_sort.1
	checksums-append	patch-0.20051006.1.dgc.xlabel_ext.7 md5 \
						c81a7c7cc201177205acc6c7f295ee4e \
						patch-1.5.8.dgc.xlabel_sort.1 md5 \
						04d42552ff57c73df47303ed6da30260 
}

variant checkseen conflicts cvs {
		patch_sites-append	http://www.neuronix.cz/coding/mutt_imap/
		patchfiles-append	imap_checkseen_1.5.11.patch
		checksums-append	imap_checkseen_1.5.11.patch md5 \
			37e49d7203149027e30e28a7bc74c365
}

variant smtp {
# Include internal SMTP relay support
		configure.args-append --enable-smtp
		patch_sites-append	http://mutt.kublai.com/patches/
		if {[variant_isset cvs]} {
				patchfiles-append	patch-cvs20060528.bc.smtp
				checksums-append	patch-cvs20060528.bc.smtp md5 \
					426791acc0f3a89f6a5831979b83fb74
		} else {
				patchfiles-append	patch-1.5.11.bc.smtp.14
				checksums-append	patch-1.5.11.bc.smtp.14 md5 \
					04011ba17634db4c3370d152c84b1ff2
				depends_build-append	port:autoconf
		}
}

