--- /dev/null
+# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
+
+PortSystem 1.0
+
+name neomutt-mp
+version git
+categories mail
+platforms darwin
+license GPL-2+
+maintainers {lbschenkel @lbschenkel} {l2dy @l2dy} openmaintainer
+
+description The Mutt E-Mail Client (patched version with added features)
+long_description Mutt is a small but very powerful text-based MIME \
+ mail client. Mutt is highly configurable, and is \
+ well suited to the mail power user with advanced \
+ features like key bindings, keyboard macros, mail \
+ threading, regular expression searches and \
+ a powerful pattern matching language for selecting \
+ groups of messages.
+homepage https://neomutt.org
+
+fetch.type git
+git.url file://@@REPO_PATH@@
+
+depends_build port:docbook-xml-4.2 port:docbook-xsl-nons port:libxslt port:w3m
+depends_lib path:bin/perl:perl5 \
+ path:lib/libssl.dylib:openssl \
+ port:gettext \
+ port:libiconv \
+ port:ncurses \
+ port:zlib
+depends_run path:share/curl/curl-ca-bundle.crt:curl-ca-bundle
+
+post-patch {
+ # Use MacPorts Perl
+ reinplace -W ${worksrcpath} "s|/usr/bin/perl|${prefix}/bin/perl|g" \
+ doc/gen-map-doc \
+ doxygen/doxygen.conf
+
+ reinplace -W ${worksrcpath} "s|/usr/bin/|${prefix}/bin/|g" \
+ contrib/sample.neomuttrc-tlr \
+ contrib/smime_keys \
+ contrib/smime_keys_test.pl \
+ doc/manual.xml.head
+ reinplace -W ${worksrcpath} "s|/usr/libexec/|${prefix}/libexec/|g" \
+ contrib/gpg.rc \
+ contrib/smime.rc \
+ doc/manual.xml.head
+ reinplace -W ${worksrcpath} "s|/usr/local/|${prefix}/|g" \
+ init.h \
+ contrib/hcache-bench/README.md \
+ contrib/sample.neomuttrc \
+ doc/manual.xml.head
+ reinplace -W ${worksrcpath} "s|/usr/share|${prefix}/share|g" \
+ doc/manual.xml.head
+}
+
+configure.args --disable-idn \
+ --with-ncurses=${prefix} \
+ --with-nls=${prefix} \
+ --with-ssl=${prefix}
+
+# disable ccache, build issues with autosetup
+configure.ccache no
+configure.env-append CCACHE=none
+
+default_variants +idn +mutt
+if {${install.user} ne "root"} {
+ default_variants-append +homespool
+}
+
+variant db4 conflicts db5 description {Support Berkeley DB database} {
+ configure.args-append --with-bdb=${prefix} --with-bdb-version=4.8
+ depends_lib-append port:db48
+}
+variant db5 conflicts db4 description {Support Berkeley DB database} {
+ configure.args-append --with-bdb=${prefix} --with-bdb-version=5.3
+ depends_lib-append port:db53
+}
+variant gdbm description {Support GNU dbm database} {
+ configure.args-append --with-gdbm=${prefix}
+ depends_lib-append port:gdbm
+}
+variant gnutls description {Use GnuTLS} {
+ configure.args-replace --with-ssl=${prefix} --with-gnutls=${prefix}
+ depends_lib-replace path:lib/libssl.dylib:openssl port:gnutls
+}
+variant gpgme description {Enable GPGME crypto support} {
+ configure.args-append --with-gpgme=${prefix}
+ depends_lib-append port:gpgme
+}
+variant gss description {Support GSS API (Kerberos)} {
+ configure.args-append --with-gss=${prefix}
+ depends_lib-append port:kerberos5
+}
+variant homespool description {Spool mail in home directory (allows installing without root privileges)} {
+ configure.args-append --homespool
+}
+variant idn description {Internationalized Domain Name support} {
+ configure.args-replace --disable-idn --with-idn=${prefix}
+ depends_lib-append port:libidn
+}
+variant kyotocabinet description {Support Kyoto Cabinet database} {
+ configure.args-append --with-kyotocabinet=${prefix}
+ depends_lib-append port:kyotocabinet
+}
+variant lmdb description {Support LMDB database} {
+ configure.args-append --with-lmdb=${prefix}
+ depends_lib-append port:lmdb
+}
+variant lua description {Lua scripting support} {
+ configure.args-append --with-lua=${prefix}
+ depends_lib-append port:lua
+}
+variant mutt description {Create 'mutt' symlink} {
+ post-destroot {
+ file link -symbolic ${destroot}${prefix}/bin/mutt neomutt
+ }
+}
+variant notmuch description {Notmuch support} {
+ configure.args-append --with-notmuch=${prefix}
+ depends_lib-append port:notmuch
+}
+variant qdbm description {Support QDBM database} {
+ configure.args-append --with-qdbm=${prefix}
+ depends_lib-append port:qdbm
+}
+variant sasl description {Simple Authentication and Security Layer support} {
+ configure.args-append --with-sasl=${prefix}
+ depends_lib-append port:cyrus-sasl2
+}
+variant slang description {Use S-lang instead of ncurses} {
+ configure.args-append --with-ui=slang --with-slang=${prefix}
+ depends_lib-replace port:ncurses port:slang2
+}
+variant tokyocabinet description {Support Tokyo Cabinet database} {
+ configure.args-append --with-tokyocabinet=${prefix}
+ depends_lib-append port:tokyocabinet
+}
+
+post-destroot {
+ move ${destroot}${prefix}/etc/neomuttrc \
+ ${destroot}${prefix}/etc/neomuttrc.sample
+ # install mime.types in ${prefix}/etc as previous versions used to do
+ copy ${destroot}${prefix}/share/doc/neomutt/mime.types \
+ ${destroot}${prefix}/etc/mime.types.sample
+ # install examples in ${prefix}/share/examples
+ xinstall -d ${destroot}${prefix}/share/examples
+ move ${destroot}${prefix}/share/doc/neomutt/samples \
+ ${destroot}${prefix}/share/examples/neomutt
+}
+
+post-activate {
+ foreach f { mime.types neomuttrc } {
+ if {![file exists ${prefix}/etc/${f}]} {
+ copy ${prefix}/etc/${f}.sample \
+ ${prefix}/etc/${f}
+ }
+ }
+}