class Dovecot < Formula desc "IMAP/POP3 server" homepage "https://dovecot.org/" url "https://dovecot.org/releases/2.3/dovecot-2.3.8.tar.gz" sha256 "c5778d03bf26ab34a605854098035badec455d07adfab38d974f610c8f78b649" bottle do sha256 "309a862f3cdc959cf2f42e9f18d6b6114b31c11f928414057c15dc18a197a433" => :catalina sha256 "09830a87a9cb50ce4543feeec61024ed4bac334b28728b5393ac7d6038429fbe" => :mojave sha256 "f74d62538df971fd54a56c8795ea23aca238b74149dd9571598bf91c44d3743e" => :high_sierra end depends_on "openssl@1.1" resource "pigeonhole" do url "https://pigeonhole.dovecot.org/releases/2.3/dovecot-2.3-pigeonhole-0.5.8.tar.gz" sha256 "8fb860d50c1b1a09aea9e25f8ee89c22e34ecedfb0e11a1c48a7f67310759022" 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