homebrew-core/Formula/dovecot.rb
2017-06-26 23:33:24 -07:00

123 lines
3.6 KiB
Ruby

class Dovecot < Formula
desc "IMAP/POP3 server"
homepage "https://dovecot.org/"
url "https://dovecot.org/releases/2.2/dovecot-2.2.31.tar.gz"
mirror "https://fossies.org/linux/misc/dovecot-2.2.31.tar.gz"
sha256 "034be40907748128d65088a4f59789b2f99ae7b33a88974eae0b6a68ece376a1"
bottle do
sha256 "217bf7e7391c9d2c355553038c5d53411233c99f1f4c01fb4e7b88f02b46de8f" => :sierra
sha256 "ebe98a91f0b3db3f6cdf7999821a0aa32f124aefa1811fc2bfd8b8cfd5c5a086" => :el_capitan
sha256 "f4db7d8db401d9c691d7d5a81ac7bbf2d6163b2dbcf2504efea6b8e9e9b90810" => :yosemite
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.2/dovecot-2.2-pigeonhole-0.4.19.tar.gz"
sha256 "629204bfbdcd3480e1ebcdc246da438323c3ea5fea57480ab859e8b201ad8793"
end
resource "stemmer" do
url "https://github.com/snowballstem/snowball.git",
:revision => "5137019d68befd633ce8b1cd48065f41e77ed43e"
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.undent
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.undent
<?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}/, shell_output("#{sbin}/dovecot --version")
end
end