homebrew-core/Formula/mupdf-tools.rb

45 lines
1.5 KiB
Ruby

class MupdfTools < Formula
desc "Lightweight PDF and XPS viewer"
homepage "https://mupdf.com/"
url "https://mupdf.com/downloads/archive/mupdf-1.17.0-source.tar.xz"
sha256 "c935fb2593d9a28d9b56b59dad6e3b0716a6790f8a257a68fa7dcb4430bc6086"
license "AGPL-3.0"
head "https://git.ghostscript.com/mupdf.git"
livecheck do
url "https://mupdf.com/downloads/archive/?C=M&O=D"
regex(/href=.*?mupdf[._-]v?(\d+(?:\.\d+)+)-source\.(?:t|zip)/i)
end
bottle do
cellar :any_skip_relocation
sha256 "469777d46f4da93ca69069fc283b1464ec65db3f03df430290fbfb77c1fd5b2d" => :catalina
sha256 "02993c27c49e2ae8f2bf30a3fe3680770320bec2873124990c7dd5561ec16f19" => :mojave
sha256 "6bd4ca00d57e19125e20cf04e7b6ff1ed7de306d1d0a8f75eb23ad878b94ba99" => :high_sierra
end
conflicts_with "mupdf",
because: "mupdf and mupdf-tools install the same binaries"
def install
# Work around Xcode 11 clang bug
ENV.append_to_cflags "-fno-stack-check" if DevelopmentTools.clang_build_version >= 1010
system "make", "install",
"build=release",
"verbose=yes",
"HAVE_X11=no",
"HAVE_GLUT=no",
"CC=#{ENV.cc}",
"prefix=#{prefix}"
# Symlink `mutool` as `mudraw` (a popular shortcut for `mutool draw`).
bin.install_symlink bin/"mutool" => "mudraw"
man1.install_symlink man1/"mutool.1" => "mudraw.1"
end
test do
assert_match "Homebrew test", shell_output("#{bin}/mudraw -F txt #{test_fixtures("test.pdf")}")
end
end