class Dovecot < Formula desc "IMAP/POP3 server" homepage "http://dovecot.org/" url "http://dovecot.org/releases/2.2/dovecot-2.2.21.tar.gz" mirror "https://fossies.org/linux/misc/dovecot-2.2.21.tar.gz" sha256 "7ab7139e59e1f0353bf9c24251f13c893cf1a6ef4bcc47e2d44de437108d0b20" bottle do sha256 "e21b7c37c57abddc4d85f64669e80ea0c0c09bc7abcb2a78aba04a9f79c490c2" => :el_capitan sha256 "58587837e148f035bce2efbf7aeda42565a3857f478bf7b327740e5a30a88134" => :yosemite sha256 "1cb51fc47506ddf25e4887d88f5aebbec894cdf4f26b3d903a561ec8d57eda1a" => :mavericks end option "with-pam", "Build with PAM support" option "with-pigeonhole", "Add Sieve addon for Dovecot mailserver" option "with-pigeonhole-unfinished-features", "Build unfinished new Sieve addon features/extensions" depends_on "openssl" depends_on "clucene" => :optional resource "pigeonhole" do url "http://pigeonhole.dovecot.org/releases/2.2/dovecot-2.2-pigeonhole-0.4.9.tar.gz" sha256 "82892f876d26008a076973dfddf1cffaf5a0451825fd44e06287e94b89078649" end def install args = %W[ --prefix=#{prefix} --disable-dependency-tracking --libexecdir=#{libexec} --sysconfdir=#{etc} --localstatedir=#{var} --with-ssl=openssl --with-sqlite --with-zlib --with-bzlib ] args << "--with-lucene" if build.with? "clucene" args << "--with-pam" if build.with? "pam" system "./configure", *args system "make", "install" if build.with? "pigeonhole" resource("pigeonhole").stage do args = %W[ --disable-dependency-tracking --with-dovecot=#{lib}/dovecot --prefix=#{prefix} ] args << "--with-unfinished-features" if build.with? "pigeonhole-unfinished-features" system "./configure", *args system "make" system "make", "install" end end end plist_options :startup => true def plist; <<-EOS.undent Label #{plist_name} KeepAlive RunAtLoad ProgramArguments #{opt_sbin}/dovecot -F StandardErrorPath #{var}/log/dovecot/dovecot.log StandardOutPath #{var}/log/dovecot/dovecot.log EOS end def caveats; <<-EOS.undent For Dovecot to work, you may need to create a dovecot user and group depending on your configuration file options. EOS end test do assert_match /#{version}/, shell_output("#{sbin}/dovecot --version") end end