homebrew-core/Formula/dovecot.rb

108 lines
3.4 KiB
Ruby

class Dovecot < Formula
desc "IMAP/POP3 server"
homepage "https://dovecot.org/"
url "https://dovecot.org/releases/2.3/dovecot-2.3.19.tar.gz"
sha256 "0173f693d441b6248b8a62aa5fd690021a1f04a12902653e0bf2e5b012fe437b"
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
sha256 arm64_monterey: "4e6965e44ff277016d883d1f838d68eb5075c0a5aa24552ee9f2a2c8f16cb3f4"
sha256 arm64_big_sur: "7744466128fb64d901faf422bfa95b5641bef60535c96f9a2081cfbfb74a1a26"
sha256 monterey: "6eac5a2166b8b7a8ef98752c3defd05b80cc52c4bb444293a530fcfe996798b6"
sha256 big_sur: "62584be2a0ed06a36d110459aac4a563df3ace40a634a7f637eece51069bbaac"
sha256 catalina: "985473635ba7fdf753f8d00b1aad724827c933376f52974e97216d21f4413483"
sha256 x86_64_linux: "92c6f17d69ad305ff36a588b9362c55b74be48fbef4d4e9e760f5f3721fd093f"
end
depends_on "openssl@1.1"
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 "10b923efcc6f3c4d92ecdbb780e12a5c33e6d0fdbe3aba5fcd3ecde4179c730c"
# 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