class Dovecot < Formula desc "IMAP/POP3 server" homepage "https://dovecot.org/" url "https://dovecot.org/releases/2.3/dovecot-2.3.4.1.tar.gz" sha256 "b8873e2ce5c33e58963bb7a8d2ff8427c09dbfdd63e13a0b0f4502864043aa07" bottle do sha256 "df711843d1fd764cc638f483ab864a580c359d5476e0a8d2062808a0b9c432d6" => :mojave sha256 "b9ac5aa1c1b7dc154352213e6100988f0d9bfc786864bc7fc0a711108be54c39" => :high_sierra sha256 "4c852ab0338c5a7696cbfca105e5fd5b436fb59837a40a34581cb7bac98c9088" => :sierra end depends_on "openssl" resource "pigeonhole" do url "https://pigeonhole.dovecot.org/releases/2.3/dovecot-2.3-pigeonhole-0.5.2.tar.gz" sha256 "950e8e15c58e539761255e140dd3678dd2477fa432a5f2b804e53821bdc02535" 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