class Dovecot < Formula desc "IMAP/POP3 server" homepage "https://dovecot.org/" url "https://dovecot.org/releases/2.2/dovecot-2.2.28.tar.gz" mirror "https://fossies.org/linux/misc/dovecot-2.2.28.tar.gz" sha256 "e0288f59e326ab87cb3881fdabadafe542f4dc7ab9996db13863a439ebbc1f25" bottle do sha256 "451e5a9cf041884d19c7c9435d187175ba9d7b1bb26a7e83bff59eb7bebc6ff2" => :sierra sha256 "4e7aee618f21b3738cf638b307f667b058cd8cbdfd0c012d31eed1282934f580" => :el_capitan sha256 "1e2a2348be463de818db8ac31840759c7b16e35d2270d25547099d01774407e2" => :yosemite 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" option "with-stemmer", "Build with libstemmer support" depends_on "openssl" depends_on "clucene" => :optional resource "pigeonhole" do url "https://pigeonhole.dovecot.org/releases/2.2/dovecot-2.2-pigeonhole-0.4.17.tar.gz" sha256 "74d869c7532cbf4fe41e3cc95a1aa6ce32e98f4d423f0d099da1e0fba022dae3" end resource "stemmer" do url "https://github.com/snowballstem/snowball.git", :revision => "304e1160341275565e032b00a9855d272f0c2a51" 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" if build.with? "stemmer" args << "--with-libstemmer" resource("stemmer").stage do system "make", "dist_libstemmer_c" system "tar", "xzf", "dist/libstemmer_c.tgz", "-C", buildpath end end 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 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 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 test do assert_match /#{version}/, shell_output("#{sbin}/dovecot --version") end end