98 lines
3.1 KiB
Ruby
98 lines
3.1 KiB
Ruby
class Exim < Formula
|
|
desc "Complete replacement for sendmail"
|
|
homepage "https://exim.org"
|
|
url "https://ftp.exim.org/pub/exim/exim4/exim-4.88.tar.bz2"
|
|
mirror "https://www.mirrorservice.org/sites/ftp.exim.org/pub/exim/exim4/exim-4.88.tar.bz2"
|
|
sha256 "119d5fd7e31fc224e84dfa458fe182f200856bae7adf852a8287c242161f8a2d"
|
|
revision 1
|
|
|
|
bottle do
|
|
sha256 "9f30aa0e9a3bcf526f46cfb2a00e9b74f31a41285e7eb3f33c415481354932d6" => :sierra
|
|
sha256 "a267c527f5972746372c7fe0737b157ef30e4d16a3615da6f828fd3ee97be5d7" => :el_capitan
|
|
sha256 "7133e4f8b62324185d339d9601b72c4d8b3e749b7da2d76e165fa0594b0b85af" => :yosemite
|
|
end
|
|
|
|
deprecated_option "support-maildir" => "with-maildir"
|
|
option "with-maildir", "Support delivery in Maildir format"
|
|
|
|
depends_on "pcre"
|
|
depends_on "berkeley-db@4"
|
|
depends_on "openssl"
|
|
|
|
def install
|
|
cp "src/EDITME", "Local/Makefile"
|
|
inreplace "Local/Makefile" do |s|
|
|
s.remove_make_var! "EXIM_MONITOR"
|
|
s.change_make_var! "EXIM_USER", ENV["USER"]
|
|
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"
|
|
# https://trac.macports.org/ticket/38654
|
|
s.gsub! 'TMPDIR="/tmp"', "TMPDIR=/tmp"
|
|
s << "SUPPORT_MAILDIR=yes\n" if build.with? "maildir"
|
|
s << "AUTH_PLAINTEXT=yes\n"
|
|
s << "SUPPORT_TLS=yes\n"
|
|
s << "TLS_LIBS=-lssl -lcrypto\n"
|
|
s << "TRANSPORT_LMTP=yes\n"
|
|
|
|
# For non-/usr/local HOMEBREW_PREFIX
|
|
s << "LOOKUP_INCLUDE=-I#{HOMEBREW_PREFIX}/include\n"
|
|
s << "LOOKUP_LIBS=-L#{HOMEBREW_PREFIX}/lib\n"
|
|
end
|
|
|
|
bdb4 = Formula["berkeley-db@4"]
|
|
|
|
inreplace "OS/Makefile-Darwin" do |s|
|
|
s.remove_make_var! %w[CC CFLAGS]
|
|
# Add include and lib paths for BDB 4
|
|
s.gsub! "# Exim: OS-specific make file for Darwin (Mac OS X).", "INCLUDE=-I#{bdb4.include}"
|
|
s.gsub! "DBMLIB =", "DBMLIB=#{bdb4.lib}/libdb-4.dylib"
|
|
end
|
|
|
|
# The compile script ignores CPPFLAGS
|
|
ENV.append "CFLAGS", ENV.cppflags
|
|
|
|
ENV.deparallelize # See: https://lists.exim.org/lurker/thread/20111109.083524.87c96d9b.en.html
|
|
system "make"
|
|
system "make", "INSTALL_ARG=-no_chown", "install"
|
|
man8.install "doc/exim.8"
|
|
(bin/"exim_ctl").write startup_script
|
|
end
|
|
|
|
# Inspired by MacPorts startup script. Fixes restart issue due to missing setuid.
|
|
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
|
|
end
|
|
|
|
def caveats; <<-EOS.undent
|
|
Start with:
|
|
exim_ctl start
|
|
Don't forget to run it as root to be able to bind port 25.
|
|
EOS
|
|
end
|
|
|
|
test do
|
|
assert_match "Mail Transfer Agent", shell_output("#{bin}/exim --help 2>&1", 1)
|
|
end
|
|
end
|