homebrew-core/Formula/notmuch.rb

85 lines
3.3 KiB
Ruby

class Notmuch < Formula
desc "Thread-based email index, search, and tagging"
homepage "https://notmuchmail.org/"
url "https://notmuchmail.org/releases/notmuch-0.36.tar.xz"
sha256 "130231b830fd980efbd2aab12214392b8841f5d2a5a361aa8c79a79a6035ce40"
license "GPL-3.0-or-later"
head "https://git.notmuchmail.org/git/notmuch", using: :git, branch: "master"
livecheck do
url "https://notmuchmail.org/releases/"
regex(/href=.*?notmuch[._-]v?(\d+(?:\.\d+)+)\.t/i)
end
bottle do
sha256 cellar: :any, arm64_monterey: "033f8194e3012df7af907c92dce400b622e37dd01553b570b688804902ac9ece"
sha256 cellar: :any, arm64_big_sur: "941cb39c18b3eca969dac2e3d639330cf59d06eb1d57a2c906d0cdf7364d12a2"
sha256 cellar: :any, monterey: "0869abd8e2652d1bec38753910e14493335c5341ea1de2dbeae58b9f7126b7ec"
sha256 cellar: :any, big_sur: "1e4c00ec1ac42f7f87aeab54c1701fc1565fa25e262abe2a35c5c25393bc4592"
sha256 cellar: :any, catalina: "21b8fb998d0d725869ceb48107fa5ea2c964af8a5849eb2c83d9761277846778"
sha256 cellar: :any_skip_relocation, x86_64_linux: "a3e4c34716845a8371803a77a01a6159dc9bf576142ed25552a9abe25431917b"
end
depends_on "doxygen" => :build
depends_on "emacs" => :build
depends_on "libgpg-error" => :build
depends_on "pkg-config" => :build
depends_on "sphinx-doc" => :build
depends_on "glib"
depends_on "gmime"
depends_on "python@3.9"
depends_on "talloc"
depends_on "xapian"
uses_from_macos "zlib", since: :sierra
def install
args = %W[
--prefix=#{prefix}
--mandir=#{man}
--emacslispdir=#{elisp}
--emacsetcdir=#{elisp}
--bashcompletiondir=#{bash_completion}
--zshcompletiondir=#{zsh_completion}
--without-ruby
]
ENV.append_path "PYTHONPATH", Formula["sphinx-doc"].opt_libexec/"lib/python3.9/site-packages"
ENV.cxx11 if OS.linux?
system "./configure", *args
system "make", "V=1", "install"
elisp.install Dir["emacs/*.el"]
bash_completion.install "completion/notmuch-completion.bash"
(prefix/"vim/plugin").install "vim/notmuch.vim"
(prefix/"vim/doc").install "vim/notmuch.txt"
(prefix/"vim").install "vim/syntax"
cd "bindings/python" do
system Formula["python@3.9"].opt_bin/"python3", *Language::Python.setup_install_args(prefix)
end
# If installed in non-standard prefixes, such as is the default with
# Homebrew on Apple Silicon machines, other formulae can fail to locate
# libnotmuch.dylib due to not checking locations like /opt/homebrew for
# libraries. This is a bug in notmuch rather than Homebrew; globals.py
# uses a vanilla CDLL instead of CDLL wrapped with `find_library`
# which effectively causes the issue.
#
# CDLL("libnotmuch.dylib") = OSError: dlopen(libnotmuch.dylib, 6): image not found
# find_library("libnotmuch") = '/opt/homebrew/lib/libnotmuch.dylib'
# http://notmuch.198994.n3.nabble.com/macOS-globals-py-issue-td4044216.html
inreplace lib/"python3.9/site-packages/notmuch/globals.py",
"libnotmuch.{0:s}.dylib",
opt_lib/"libnotmuch.{0:s}.dylib"
end
test do
(testpath/".notmuch-config").write "[database]\npath=#{testpath}/Mail"
(testpath/"Mail").mkpath
assert_match "0 total", shell_output("#{bin}/notmuch new")
end
end