122 lines
3.5 KiB
Ruby
122 lines
3.5 KiB
Ruby
class Dovecot < Formula
|
|
desc "IMAP/POP3 server"
|
|
homepage "https://dovecot.org/"
|
|
url "https://dovecot.org/releases/2.3/dovecot-2.3.0.1.tar.gz"
|
|
sha256 "ab772b3e214683aba347203c9391295552255c4d69afb324c7b8c8fc5ad6f153"
|
|
|
|
bottle do
|
|
sha256 "93e7205143d531082246082a2328a3c8437ac01a054274b7b1385854b811227c" => :high_sierra
|
|
sha256 "daaa11ac00a342a4c4214c7cf205dcaed8e85830842d4920c4f7bfe51bd64db1" => :sierra
|
|
sha256 "180b23abc929be1684f6a52201a9eb6c10594e3b2e6db0a9f64a3c6d1973f6d2" => :el_capitan
|
|
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.3/dovecot-2.3-pigeonhole-0.5.0.1.tar.gz"
|
|
sha256 "56356d14b10c45aa472074e85bfc582c2f08a15a43ecf24f481df39b206efad2"
|
|
end
|
|
|
|
resource "stemmer" do
|
|
url "https://github.com/snowballstem/snowball.git",
|
|
:revision => "84e1a4ad1ee8789c81b3541744bb710c7a50a452"
|
|
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
|
|
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
|