103 lines
3.0 KiB
Ruby
103 lines
3.0 KiB
Ruby
class Poppler < Formula
|
|
desc "PDF rendering library (based on the xpdf-3.0 code base)"
|
|
homepage "https://poppler.freedesktop.org/"
|
|
url "https://poppler.freedesktop.org/poppler-21.12.0.tar.xz"
|
|
sha256 "acb840c2c1ec07d07e53c57c4b3a1ff3e3ee2d888d44e1e9f2f01aaf16814de7"
|
|
license "GPL-2.0-only"
|
|
head "https://gitlab.freedesktop.org/poppler/poppler.git", branch: "master"
|
|
|
|
livecheck do
|
|
url :homepage
|
|
regex(/href=.*?poppler[._-]v?(\d+(?:\.\d+)+)\.t/i)
|
|
end
|
|
|
|
bottle do
|
|
sha256 arm64_monterey: "cd16bf882b47d25a821c7403588606d3887040e9614392090af4b522aa624eb9"
|
|
sha256 arm64_big_sur: "09f2559f75bdcc64e53eacfab21aa79965bf814e4c800049107e9d4efa355c44"
|
|
sha256 monterey: "30a686b276d0299510a37c8f506ce5bb14608efaf8d0f962a9ccbdd2722c5fbb"
|
|
sha256 big_sur: "fad8829869b4072c7ae705769e0ab443a89d567938c9de4968d3d6e5363846f8"
|
|
sha256 catalina: "164e8cfd4010abc8bf7a4ca017e2be544cc2acc3294a4c4d025e2b46e0075d50"
|
|
sha256 x86_64_linux: "fe8aac915d923d15295a7fb810979cc696a09cf3df8473607807e7dfec2f25bb"
|
|
end
|
|
|
|
depends_on "cmake" => :build
|
|
depends_on "gobject-introspection" => :build
|
|
depends_on "pkg-config" => :build
|
|
depends_on "cairo"
|
|
depends_on "fontconfig"
|
|
depends_on "freetype"
|
|
depends_on "gettext"
|
|
depends_on "glib"
|
|
depends_on "jpeg"
|
|
depends_on "libpng"
|
|
depends_on "libtiff"
|
|
depends_on "little-cms2"
|
|
depends_on "nspr"
|
|
depends_on "nss"
|
|
depends_on "openjpeg"
|
|
depends_on "qt"
|
|
|
|
uses_from_macos "gperf" => :build
|
|
uses_from_macos "curl"
|
|
uses_from_macos "zlib"
|
|
|
|
on_linux do
|
|
depends_on "gcc"
|
|
end
|
|
|
|
conflicts_with "pdftohtml", "pdf2image", "xpdf",
|
|
because: "poppler, pdftohtml, pdf2image, and xpdf install conflicting executables"
|
|
|
|
fails_with gcc: "5"
|
|
|
|
resource "font-data" do
|
|
url "https://poppler.freedesktop.org/poppler-data-0.4.11.tar.gz"
|
|
sha256 "2cec05cd1bb03af98a8b06a1e22f6e6e1a65b1e2f3816cb3069bb0874825f08c"
|
|
end
|
|
|
|
def install
|
|
ENV.cxx11
|
|
|
|
args = std_cmake_args + %w[
|
|
-DBUILD_GTK_TESTS=OFF
|
|
-DENABLE_BOOST=OFF
|
|
-DENABLE_CMS=lcms2
|
|
-DENABLE_GLIB=ON
|
|
-DENABLE_QT5=OFF
|
|
-DENABLE_QT6=ON
|
|
-DENABLE_UNSTABLE_API_ABI_HEADERS=ON
|
|
-DWITH_GObjectIntrospection=ON
|
|
]
|
|
|
|
system "cmake", ".", *args
|
|
system "make", "install"
|
|
system "make", "clean"
|
|
system "cmake", ".", "-DBUILD_SHARED_LIBS=OFF", *args
|
|
system "make"
|
|
lib.install "libpoppler.a"
|
|
lib.install "cpp/libpoppler-cpp.a"
|
|
lib.install "glib/libpoppler-glib.a"
|
|
resource("font-data").stage do
|
|
system "make", "install", "prefix=#{prefix}"
|
|
end
|
|
|
|
if OS.mac?
|
|
libpoppler = (lib/"libpoppler.dylib").readlink
|
|
[
|
|
"#{lib}/libpoppler-cpp.dylib",
|
|
"#{lib}/libpoppler-glib.dylib",
|
|
"#{lib}/libpoppler-qt#{Formula["qt"].version.major}.dylib",
|
|
*Dir["#{bin}/*"],
|
|
].each do |f|
|
|
macho = MachO.open(f)
|
|
macho.change_dylib("@rpath/#{libpoppler}", "#{opt_lib}/#{libpoppler}")
|
|
macho.write!
|
|
end
|
|
end
|
|
end
|
|
|
|
test do
|
|
system "#{bin}/pdfinfo", test_fixtures("test.pdf")
|
|
end
|
|
end
|