class Dovecot < Formula desc "IMAP/POP3 server" homepage "https://dovecot.org/" url "https://dovecot.org/releases/2.3/dovecot-2.3.7.tar.gz" sha256 "11e156ae8539e42892809cc2412c3f1a294188806969f5547191a43abd4083aa" bottle do sha256 "0629ebe157162d42c1bc143b65b9af253629adea890d93c39d74daf798a6dc21" => :mojave sha256 "aa1ca17cf4693721d52d829cab58060408b750c6458d17500bfc4fd5ef242aa0" => :high_sierra sha256 "269434d3870247f29e907c98f6037ff229e710d6907325089f0532ac9fde0947" => :sierra end depends_on "openssl" resource "pigeonhole" do url "https://pigeonhole.dovecot.org/releases/2.3/dovecot-2.3-pigeonhole-0.5.7.tar.gz" sha256 "783849542c272331f60e7c4d371b303f7f2b1d69828bced3094a898876ecdb63" end def install args = %W[ --prefix=#{prefix} --disable-dependency-tracking --libexecdir=#{libexec} --sysconfdir=#{etc} --localstatedir=#{var} --with-bzlib --with-pam --with-sqlite --with-ssl=openssl --with-zlib ] system "./configure", *args system "make", "install" resource("pigeonhole").stage do args = %W[ --disable-dependency-tracking --with-dovecot=#{lib}/dovecot --prefix=#{prefix} ] system "./configure", *args system "make" system "make", "install" end end def caveats; <<~EOS 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 Label #{plist_name} KeepAlive RunAtLoad ProgramArguments #{opt_sbin}/dovecot -F StandardErrorPath #{var}/log/dovecot/dovecot.log StandardOutPath #{var}/log/dovecot/dovecot.log SoftResourceLimits NumberOfFiles 1000 HardResourceLimits NumberOfFiles 1024 EOS end test do assert_match version.to_s, shell_output("#{sbin}/dovecot --version") end end