# http://berklix.com/~jhs/src/bsd/fixes/freebsd/ports/jhs/mail/Makefile.local
# /usr/ports/mail/Makefile.local		by jhs_ERASE_@berklix.com
.include "../Makefile.undef"

.if (	defined(BERKLIX_CLIENT)	|| \
	defined(BERKLIX_GATE)	|| defined(BERKLIX_MINIMAL) )	#{
# No BERKLIX_SERVER as not used on server /etc/aliases [yet]
# & the 9.3-RELEASE ports/mail/emil with kernel=9.2-STABLE install
# breaks with  lib/emil.cf: Cannot stat: 
 
SUBDIR += delatt	# for http://www.berklix.com/~jhs/bin/.sh/demime+emil+delatt

SUBDIR += emil		# for http://www.berklix.com/~jhs/bin/.sh/demime+emil+delatt
#	Demime has foolishly been removed from freebsd.org.
#	I now instead sometimes use Emil To strip junk formats from clueless
#	senders, however I still use demime too in ~/.procmailrc*
#	to actually _remove_ enclosures as emil converts but does not remove.
#	Later emil may also be used for stripping quoted-printable from
#	lists on berklix servers.
.endif					#}

.if ( defined(BERKLIX_AMBITIOUS) )	#{	Try Later
.if (	defined(BERKLIX_CLIENT)		#{
SUBDIR += metamail	# jhs added 2017-11-15
.endif					#}
.endif					#}

SUBDIR += mimedefang	# depends on spamassassin

.if ( defined(BERKLIX_SERVER) )	#{
.if ( defined(BERKLIX_AMBITIOUS) )	#{	Try Later
SUBDIR += spamassassin	# Used on ctm-users@freebsd.org Thu, 10 Aug 2017
.endif					#}
.endif					#}

.if ( defined(BERKLIX_SERVER) )	#{
SUBDIR += mime4j
#       "It won''t do any decoding of base64 or quoted-printable
#	 encoded header fields and bodies."
.endif					#}

.if ( defined(BERKLIX_CLIENT) )	#{
#	Subject: Re: How to convert from quoted printable enclosures with Reply button ?
#	From: "Julian H. Stacey" <jhs_ERASE_@berklix.ERASE.com>
#	Date: Tue, 26 Mar 2013 10:27:32 +0100
#	To: Discussion list for EXMH users <exmh-users_ERASE@redhat.ERASE.com>
#	Cc: "Andy Bradford" <amb-xmhe_ERASE@bradfords.ERASE.org>
#	"Andy Bradford" wrote:
#	> Thus said "Julian H. Stacey" on Mon, 25 Mar 2013 18:17:34 +0100:
#	>
#	> > I  want to  auto convert  quoted printable  enclosures from  the Reply
#	> > button, so I don''t have to manually  cean the = mess with vi,, I don''t
#	> > know how [best, or at all?] to do that ?
#	> I use qprint for this.
#	Thanks, I found this:	http://www.fourmilab.ch/webtools/qprint/
#	--------
#	Manual reads like a simpler version of emil
#	qprint-1.0.tar.gz now in my distfiles/
# SUBDIR += qprint	# I jhs could create this. But not till I''ve tried
#			# suggestion from Ken Hornstein <kenh_ERASE@pobox.ERASE.com>
#			# : install nmh-1.5, Use replyfilter.
#			# see in ${prefix}/share/doc/nmh/NEWS.
.endif					#}

.if ( defined(BERKLIX_SERVER) )	#{
SUBDIR += tkrat2
#	graphical Mail User Agent
#	Build size: 19410 K
.endif					#}

.if ( defined(BERKLIX_SERVER) )	#{
# SUBDIR += cucipop		# A POP3 server I dont use.
.endif					#}

.if ( defined(BERKLIX_CLIENT) )	#{
.if ( defined(BERKLIX_AMBITIOUS) )	#{	Try Later
SUBDIR += bogofilter		# Ollivier Robert <roberto_ERASE@keltia.ERASE.net>
#	A spam filter.	Do not instal untill I have tried it.
#			clamav-milter along with milter-greylist
#			rocks. Spam filtering is more done at the
#			user level through bogofilter though.
.endif					#} BERKLIX_AMBITIOUS

# SUBDIR += enigmail		# Does not compile on its own.
#				# Maybe mail/thunderbird
#		"libxul-enigmail-1.4 is an abstract port: \
#		 use one of the slave ports."
.endif					#} BERKLIX_CLIENT

.if ( defined(BERKLIX_SERVER) )	#{
SUBDIR += clamav		# rec. by Xin LI <delphij_ERASE@delphij.ERASE.net>
# 8.3-RELEASE has no mail/clamav, but has:
#	mail/spmfilter-clamav net-mgmt/nagios-check_clamav
#	security/clamav security/clamav-devel security/clamav-milter
#	security/clamav-unofficial-sigs security/py-clamav
#	security/squidclamav www/mod_clamav

.if ( defined(BERKLIX_AMBITIOUS) )	#{	Try Later
SUBDIR +=milter-greylist
#			Ollivier Robert <roberto_ERASE@keltia.net> wrote:
#				  clamav-milter along with
#				  milter-greylist rocks.  Spam
#				  filtering is more done at the
#				  user level through bogofilter
#				  though.
.endif					#}
.endif					#}

# SUBDIR += cyrus-imapd24 # POP & IMAP support
#			used by Xin LI <delphij_ERASE@delphij.net>
#		Supports features like using different storage for
#		different subfolders (i.e. use Mailbox for archive, etc).

.if ( defined(BERKLIX_CLIENT) || defined(BERKLIX_MINIMAL) )	#{
# No longer BERKLIX_SERVER as only needed by my majordomo aliases.
# No longer BERKLIX_GATE as I never run majordomo on the gate.
SUBDIR += demime	# for http://www.berklix.com/~jhs/bin/.sh/demime+emil+delatt
#	For majordomo on list servers,
#	For all the many lazy & incompetents who cant turn off sending
#	HTML to mail lists, despite having had a decade to learn.
#	(& for a few people who do understand they should, have tried to, but
#	can''t find where to turn off their HTML, if their ISP even allows.
#	Missing in FreeBSD-9.1-RELEASE so see also SUBDIR += mail/emil
#	Demime has been removed.
#	Emil now being used @ holz to strip junk formats from clueless people.
.endif				#}

.if (defined(BERKLIX_CLIENT) || defined(BERKLIX_MINIMAL))	#{
SUBDIR += exmh2
.endif				#}

.if defined(BERKLIX_CLIENT )	#{
SUBDIR += sylpheed	# gary used
.endif	#}

.if defined(BERKLIX_CLIENT )	#{
.if ( ${OSVERSION} != 900044 )	#{
.if defined(BERKLIX_AMBITIOUS)	#{ I dont use it.
#	depends on /usr/ports/print/tex-jadetex
#		depends on bloated 2G distfiles/TeX/texlive-*-texmf.tar.xz
#		depends on masses of ports
#					# textproc/docbook-utils
SUBDIR += claws-mail	# gary used after sylpheed,
#			# http://www.claws-mail.org/
#			# http://www.claws-mail.org/downloads.php
#			# http://www.claws-mail.org/win32/
.endif				#} BERKLIX_AMBITIOUS
.endif				#} OSVERSION
.endif				#} BERKLIX_CLIENT

.if ( defined(BERKLIX_CLIENT) || defined(BERKLIX_GATE) \
	|| defined(BERKLIX_MINIMAL) ) #{
SUBDIR += fetchmail
.endif	#} BERKLIX_CLIENT || BERKLIX_GATE || BERKLIX_MINIMAL

.if ( defined(BERKLIX_CLIENT) || defined(BERKLIX_SERVER) ) #{
# SUBDIR += majorcool	# Very interactive build. I''ll be using mailman instead.

.if ( ${OSVERSION} != 900044 )  #{{
#	Breaks on 9.0-RELEASE:
#	Expected no more than 3 tokens for --yesno, have 4.
#			if ports=NFS, lock fails
# SUBDIR += majordomo	# needs package p5-Digest-MD5-2.16   Wont build on nfs.
#	majordomo install prompts:
#        - to prepare proper permissions for the wrapper script, run
#          ports/mail/majordomo/scripts/adaptwrapper (if it has not already
#          been run)

# SUBDIR += tlb	# majordomo install prompts:
#	 - consider using ports/mail/tlb to process your deliveries if you
#          want to hide your outgoing aliases.  This way you can prevent people
#          from evading restrictions for posting to your lists.
.endif				#}} ${OSVERSION}

.endif	#} BERKLIX_CLIENT || BERKLIX_SERVER

.if defined(BERKLIX_CLIENT) #{
# SUBDIR += metamail
#	10.1-RELEASE: exmh2 depends on mail/metamail, so pkg delete  mmencode-2.7
#	pkg-static: metamail-2.7_11 conflicts with mmencode-2.7
#	(installs files into the same place).
#	Problematic file: /usr/local/bin/mimencode
#	exmh wants mmencode


.if ( ${OSVERSION} != 802000 )	#{	bad on 8.2-RELEASE, OK on 8.3
SUBDIR += mutt	# Mail reader - Non graphical.
#			if ports=NFS, lock fails
.endif				#} ${OSVERSION}
.endif	#}

.if ( defined(BERKLIX_CLIENT) || defined(BERKLIX_MINIMAL) ) #{
#			if ports=NFS, lock fails
SUBDIR += nmh		# run time dep. of exmh2,	Wont build on nfs.
.endif	#}

.if defined(BERKLIX_SERVER) #{
# SUBDIR += popd		# A POP3 Server Pre 2013-01
#	Not in 12.0-CURRENT-2017-11-14.
#	I now use dovecot instead
#	/usr/local/libexec/popd /var/db/pkg/popd-2.2.2a_5/
#	Corrupts data:
#	I wrote to hackers@ Wed, 10 Mar 2010 19:39:28 +0100
#  With /usr/ports/mail/popd on 3 servers
#	1 x FreeBSD-6.3 popd-2.2.2a_4
#	2 x FreeBSD-7.2 popd-2.2.2a_4
#	I have definately received periodic data corruption, but
#	never tracked it down to report it, I first noticed
#	on multi meg gpg bins that wouldnt decrypt (prob one doesnt
#	notice when people send eg pictures or .pdf or .wmv )
#  I continued to see the same corruption in 2013-01 with 2 x
#  server=FreeBSD_9.1 popd-2.2.2a_5 & client=freeBSD_6.4 + fetchmail-6.3.8_7
#  release 6.3.8+RPA+SDPS+SSL+OPIE+NLS
#  + also for each of jhs+mk running fetchmail each 5 mins via
#  crontab every 5 mins server /var/log/messages would flood with 2 x
#       popd[61186]: exit_error(): Exiting. Error 'Unable to read socket
#	'Resource temporarily unavailable' - connection probably vanished'
.endif			#}

.if defined(BERKLIX_SERVER) #{
SUBDIR += dovecot	# A POP3 & IMAP server
#			Installed on slim.berklix 2013-01-22
#			Since when Ive seen no more mail corruption :-)
#			(that I used to get with my other pop3 server)
#			-----
#			  Used by Boris Kochergin <spawk_ERASE@acm.poly.edu>
#			  Used by Vitaly Magerya <vmagerya_ERASE@gmail.com>
#			  As a bonus, Postfix can use Dovecot''s SASL
#			http://www.dovecot.org

# dovecot also has a sieve might be useful for demime

# SUBDIR += popper	# A POP3 server I dont use.
.endif			#}

.if ( defined(BERKLIX_CLIENT) || defined(BERKLIX_MINIMAL) )	#{
SUBDIR += procmail
#	Not currently needed on server, maybe later.
.endif				#} BERKLIX_CLIENT || BERKLIX_MINIMAL

.if defined(BERKLIX_SERVER) #{
# SUBDIR += qpopper	# A POP3 server I dont use.
#			# http://www.eudora.com/products/unsupported/qpopper/
#			#  installs /usr/local/libexec/popper
.endif			#} BERKLIX_SERVER

.if ( defined(BERKLIX_CLIENT) || defined(BERKLIX_SERVER) )	#{
#	Do not yet install mailman by default on BERKLIX_SERVER
#	as it [used to] kill hosts, looping ever more pythons on slow machines.
SUBDIR += mailman	# Needs python & apache - crontab killed my slow
#			# host=mini, looping qrunner once per minute.
.endif		#} BERKLIX_CLIENT || ( 0 && defined(BERKLIX_SERVER) )

.if defined(BERKLIX_SERVER) #{
# SUBDIR += openwebmail	# installed on berklix servers, vanished from FreeBSD

SUBDIR += sqwebmail	# installed on berklix servers

# SUBDIR += roundcube	# webmail used by Boris Kochergin <spawk_ERASE@acm.poly.edu>
#	Do not install untill I have tried it.
#				rec. by  Xin LI <delphij_ERASE@delphij.net>
#			Buschini Edouard <moon.bocal_ERASE@gmail.com> wrote:
#				a web pop or imap client. It''s
#				simple and light. And you just need
#				Php and any sql base. Roundcube
#				support ssl/tls on imap connection.
#				You also can use a virtusertable to login.
.endif	#}	BERKLIX_SERVER

# SUBDIR += postfix	# used by Xin LI <delphij_ERASE@delphij.net>
#	Do not install unless & untill I have tried it.
#			   Matthias Andree <matthias.andree_ERASE@gmx.de> wrote
#				The best -- well, you''ll know that with
#				hindsight if you''ve tried both.
#	David Wolfskill <david_ERASE@catwhisker.org> wrote
#		11 Mar 2010 to hackers@@{
#	* The FreeBSD.org mail infrastructure uses Postfix.  In general, I find
#	  its configuration cleaner & more orthogonal than that of sendmail.
#	* I still use sendmail at home -- partly because there are still things
#	  I can do with sendmail that I don''t know how to do with Postfix (e.g.,
#	  taking action based on the lack of a header), partly because I still
#	  find sendmail logs easier to parse and undertsand, and partly from
#	  inertia.  And we have Greg Shapiro shepherding sendmail in the FreeBSD
#	  source tree, which is wonderful.
#	* I worked at an installation that had a fair amount of infrastructure
#	  built around the use of qmail a few years back.  I hope to never
#	  repeat that experience, and would not willingly use qmail ever
#	  again.
#	}

.if defined(BERKLIX_SERVER) #{
# SUBDIR += squirrelmail # webmail used by
#			Bill Moran <wmoran_ERASE@collaborativefusion.com>
#	Do not install untill I have tried it.
#				rec. by  Xin LI <delphij_ERASE@delphij.net>
.endif	#}

.if defined(BERKLIX_CLIENT)	#{
SUBDIR += spamd # used by Vitaly Magerya <vmagerya_ERASE@gmail.com>
#		greytrapping catches 100% of spam on his (low-volume) server
#		(he uses it with Postfix)

SUBDIR += spmfilter-spamassassin  # Doesnt exist on 12.0-CURRENT-2017-11-15
#		# used by Lowell Gilbert <lgusenet_ERASE@be-well.ilk.org>
#				You can plug most other analyzers into it.

SUBDIR += mail/spmfilter 	# Does exist on 12.0-CURRENT-2017-11-15
SUBDIR += mail/spmfilter-clamav	# Does exist on 12.0-CURRENT-2017-11-15
.endif				#} BERKLIX_CLIENT

.if defined(BERKLIX_CLIENT)	#{
.if defined(BERKLIX_AMBITIOUS)	#{ I dont use it.
SUBDIR += thunderbird	# current 2015-06-04 broke
#			# Phillip used on MS 2007.08-2010.03
#			# Build tree 824M Package 13M
# At 2012-06-16 the 100 Meg thunderbird-9.0.source.tar.bz2
# had a checksum on various net sites, not listed in distinfo for 9.0-RELEASE,
# finaly found one with right checksum.
# Meanwhile
# 8.3-RELEASE was on thunderbird-10.0.3esr.source.tar.bz2
# & current   was on thunderbird-13.0.source.tar.bz2
.endif				#} BERKLIX_AMBITIOUS
.endif				#} BERKLIX_CLIENT
