homebrew-core/Formula/dovecot.rb
2019-07-26 01:48:00 +08:00

96 lines
2.6 KiB
Ruby

class Dovecot < Formula
desc "IMAP/POP3 server"
homepage "https://dovecot.org/"
url "https://dovecot.org/releases/2.3/dovecot-2.3.7.1.tar.gz"
sha256 "c5a51d6f76e6e9c843df69e52a364a4c65c4c60e0c51d992eaa45f22f71803c3"
bottle do
sha256 "cc93b55278a6e76bd30bcba4e91b19fb00aa62f6b4385537db09a40ce6f04e3c" => :mojave
sha256 "b1eaa73ced4ae55e26f8554a2a82bc4a1612c0244470ac422e94ea9e23ae7e2b" => :high_sierra
sha256 "7f02d5d2a741fcfaa8a0ded924dd27460973649f439b5cbb4bba9b6c975c5042" => :sierra
end
depends_on "openssl"
resource "pigeonhole" do
url "https://pigeonhole.dovecot.org/releases/2.3/dovecot-2.3-pigeonhole-0.5.7.1.tar.gz"
sha256 "3270b24c1f75a7c144f54d6d08ce994176e39c2cdb3ac4dd80ad5e64aaaa2028"
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
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>#{plist_name}</string>
<key>KeepAlive</key>
<false/>
<key>RunAtLoad</key>
<true/>
<key>ProgramArguments</key>
<array>
<string>#{opt_sbin}/dovecot</string>
<string>-F</string>
</array>
<key>StandardErrorPath</key>
<string>#{var}/log/dovecot/dovecot.log</string>
<key>StandardOutPath</key>
<string>#{var}/log/dovecot/dovecot.log</string>
<key>SoftResourceLimits</key>
<dict>
<key>NumberOfFiles</key>
<integer>1000</integer>
</dict>
<key>HardResourceLimits</key>
<dict>
<key>NumberOfFiles</key>
<integer>1024</integer>
</dict>
</dict>
</plist>
EOS
end
test do
assert_match version.to_s, shell_output("#{sbin}/dovecot --version")
end
end