2010-02-23 21:23:43 +00:00
|
|
|
require 'formula'
|
|
|
|
|
2012-03-18 18:27:32 +00:00
|
|
|
class NoBdb5 < Requirement
|
|
|
|
def message; <<-EOS.undent
|
|
|
|
This software can fail to compile when Berkeley-DB 5.x is installed.
|
|
|
|
You may need to try:
|
|
|
|
brew unlink berkeley-db
|
2012-03-18 21:24:15 +00:00
|
|
|
brew install exim
|
2012-03-18 18:27:32 +00:00
|
|
|
brew link berkeley-db
|
|
|
|
EOS
|
|
|
|
end
|
|
|
|
def satisfied?
|
|
|
|
f = Formula.factory("berkeley-db")
|
|
|
|
not f.installed?
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2011-03-10 05:11:03 +00:00
|
|
|
class Exim < Formula
|
2010-02-23 21:23:43 +00:00
|
|
|
homepage 'http://exim.org'
|
2012-03-18 18:27:32 +00:00
|
|
|
url 'http://ftp.exim.org/pub/exim/exim4/exim-4.77.tar.gz'
|
|
|
|
sha1 '2c1ba6b8f627b71b3b58fc0cc56e394590dcd1dc'
|
2010-02-23 21:23:43 +00:00
|
|
|
|
|
|
|
depends_on 'pcre'
|
2012-03-18 18:27:32 +00:00
|
|
|
depends_on NoBdb5.new
|
|
|
|
|
|
|
|
def options
|
|
|
|
[['--support-maildir', 'Support delivery in Maildir format']]
|
|
|
|
end
|
2010-02-23 21:23:43 +00:00
|
|
|
|
|
|
|
def install
|
2010-04-07 05:58:35 +00:00
|
|
|
cp 'src/EDITME', 'Local/Makefile'
|
2010-02-23 21:23:43 +00:00
|
|
|
inreplace 'Local/Makefile' do |s|
|
|
|
|
s.remove_make_var! "EXIM_MONITOR"
|
|
|
|
s.change_make_var! "EXIM_USER", ENV['USER']
|
2010-04-07 05:58:35 +00:00
|
|
|
s.change_make_var! "SYSTEM_ALIASES_FILE", etc+'aliases'
|
|
|
|
s.gsub! '/usr/exim/configure', etc+'exim.conf'
|
|
|
|
s.gsub! '/usr/exim', prefix
|
|
|
|
s.gsub! '/var/spool/exim', var+'spool/exim'
|
2012-03-18 18:27:32 +00:00
|
|
|
s << "SUPPORT_MAILDIR=yes\n" if ARGV.include? '--support-maildir'
|
2010-02-23 21:23:43 +00:00
|
|
|
|
|
|
|
# For non-/usr/local HOMEBREW_PREFIX
|
|
|
|
s << "LOOKUP_INCLUDE=-I#{HOMEBREW_PREFIX}/include\n"
|
|
|
|
s << "LOOKUP_LIBS=-L#{HOMEBREW_PREFIX}/lib\n"
|
|
|
|
end
|
2010-07-29 19:12:51 +00:00
|
|
|
|
2010-02-23 21:23:43 +00:00
|
|
|
inreplace 'OS/Makefile-Darwin' do |s|
|
|
|
|
s.remove_make_var! %w{CC CFLAGS}
|
|
|
|
end
|
2010-07-29 19:12:51 +00:00
|
|
|
|
|
|
|
# The compile script ignores CPPFLAGS
|
|
|
|
ENV.append "CFLAGS", ENV['CPPFLAGS']
|
|
|
|
|
2012-03-18 18:27:32 +00:00
|
|
|
ENV.j1 # See: https://lists.exim.org/lurker/thread/20111109.083524.87c96d9b.en.html
|
2010-02-23 21:23:43 +00:00
|
|
|
system "make"
|
|
|
|
system "make INSTALL_ARG=-no_chown install"
|
2012-03-18 18:27:32 +00:00
|
|
|
man8.install 'doc/exim.8'
|
2010-04-07 05:58:35 +00:00
|
|
|
(bin+'exim_ctl').write startup_script
|
2010-02-23 21:23:43 +00:00
|
|
|
end
|
2010-07-29 19:12:51 +00:00
|
|
|
|
2010-04-07 05:58:35 +00:00
|
|
|
# Inspired by MacPorts startup script. Fixes restart issue due to missing setuid.
|
2012-03-18 18:27:32 +00:00
|
|
|
def startup_script; <<-EOS.undent
|
|
|
|
#!/bin/sh
|
|
|
|
PID=#{var}/spool/exim/exim-daemon.pid
|
|
|
|
case "$1" in
|
|
|
|
start)
|
|
|
|
echo "starting exim mail transfer agent"
|
|
|
|
#{bin}/exim -bd -q30m
|
|
|
|
;;
|
|
|
|
restart)
|
|
|
|
echo "restarting exim mail transfer agent"
|
|
|
|
/bin/kill -15 `/bin/cat $PID` && sleep 1 && #{bin}/exim -bd -q30m
|
|
|
|
;;
|
|
|
|
stop)
|
|
|
|
echo "stopping exim mail transfer agent"
|
|
|
|
/bin/kill -15 `/bin/cat $PID`
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo "Usage: #{bin}/exim_ctl {start|stop|restart}"
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
EOS
|
2010-02-23 21:23:43 +00:00
|
|
|
end
|
2010-07-29 19:12:51 +00:00
|
|
|
|
2010-04-07 05:58:35 +00:00
|
|
|
def caveats; <<-EOS.undent
|
|
|
|
Start with:
|
|
|
|
exim_ctl start
|
|
|
|
Don't forget to run it as root to be able to bind port 25.
|
2010-02-23 21:23:43 +00:00
|
|
|
EOS
|
|
|
|
end
|
|
|
|
end
|