111 lines
3.6 KiB
Ruby
111 lines
3.6 KiB
Ruby
class Dovecot < Formula
|
|
desc "IMAP/POP3 server"
|
|
homepage "https://dovecot.org/"
|
|
url "https://dovecot.org/releases/2.3/dovecot-2.3.19.1.tar.gz"
|
|
sha256 "db5abcd87d7309659ea6b45b2cb6ee9c5f97486b2b719a5dd05a759e1f6a5c51"
|
|
license all_of: ["BSD-3-Clause", "LGPL-2.1-or-later", "MIT", "Unicode-DFS-2016", :public_domain]
|
|
revision 1
|
|
|
|
livecheck do
|
|
url "https://www.dovecot.org/download/"
|
|
regex(/href=.*?dovecot[._-]v?(\d+(?:\.\d+)+)\.t/i)
|
|
end
|
|
|
|
bottle do
|
|
rebuild 2
|
|
sha256 arm64_ventura: "609bd7c6eed9955480ac302dbbbd09c23d6e22d7efff623f17ddc0ec3c793203"
|
|
sha256 arm64_monterey: "c61525a4c8d147c1c367d5b49b5e00abecd1266bd43c97c889bcbb0248f24b61"
|
|
sha256 arm64_big_sur: "380a5ab03f46726739dccd5ae669ee3789251cd4661924ae9d95bf07dbb481a7"
|
|
sha256 ventura: "ab3458382877149015716ec0e1a5502821f9ee034207e68d0da67ac6197a5552"
|
|
sha256 monterey: "ff965fa934cd3fb1eac7756505e0801474e58f02aeffa7fa64c23b9466392243"
|
|
sha256 big_sur: "33838c9178f95772d49dcd3cf5b2564b21209bae3c01b2cea2ea2728a95a60c4"
|
|
sha256 catalina: "af466c1d81b19cf807945b448ddad4c0f42cd96ead1fb62fdfb0cbb2a99e782f"
|
|
sha256 x86_64_linux: "0f95db254e63970934ec8de7610b4e5032c623300704f5ef46f97caed1ca38c3"
|
|
end
|
|
|
|
depends_on "openssl@3"
|
|
|
|
uses_from_macos "bzip2"
|
|
uses_from_macos "libxcrypt"
|
|
uses_from_macos "sqlite"
|
|
|
|
on_linux do
|
|
depends_on "linux-pam"
|
|
depends_on "zstd"
|
|
end
|
|
|
|
resource "pigeonhole" do
|
|
url "https://pigeonhole.dovecot.org/releases/2.3/dovecot-2.3-pigeonhole-0.5.19.tar.gz"
|
|
sha256 "637709a83fb1338c918e5398049f96b7aeb5ae00696794ed1e5a4d4c0ca3f688"
|
|
|
|
# Fix -flat_namespace being used on Big Sur and later.
|
|
patch do
|
|
url "https://raw.githubusercontent.com/Homebrew/formula-patches/03cf8088210822aa2c1ab544ed58ea04c897d9c4/libtool/configure-big_sur.diff"
|
|
sha256 "35acd6aebc19843f1a2b3a63e880baceb0f5278ab1ace661e57a502d9d78c93c"
|
|
end
|
|
end
|
|
|
|
# Fix -flat_namespace being used on Big Sur and later.
|
|
patch do
|
|
url "https://raw.githubusercontent.com/Homebrew/formula-patches/03cf8088210822aa2c1ab544ed58ea04c897d9c4/libtool/configure-big_sur.diff"
|
|
sha256 "35acd6aebc19843f1a2b3a63e880baceb0f5278ab1ace661e57a502d9d78c93c"
|
|
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
|
|
|
|
service do
|
|
run [opt_sbin/"dovecot", "-F"]
|
|
environment_variables PATH: std_service_path_env
|
|
error_log_path var/"log/dovecot/dovecot.log"
|
|
log_path var/"log/dovecot/dovecot.log"
|
|
end
|
|
|
|
test do
|
|
assert_match version.to_s, shell_output("#{sbin}/dovecot --version")
|
|
|
|
cp_r share/"doc/dovecot/example-config", testpath/"example"
|
|
inreplace testpath/"example/conf.d/10-master.conf" do |s|
|
|
s.gsub! "#default_login_user = dovenull", "default_login_user = #{ENV["USER"]}"
|
|
s.gsub! "#default_internal_user = dovecot", "default_internal_user = #{ENV["USER"]}"
|
|
end
|
|
system bin/"doveconf", "-c", testpath/"example/dovecot.conf"
|
|
end
|
|
end
|