homebrew-core/Formula/poppler.rb

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-22.05.0.tar.xz"
sha256 "a969ced458e050d6202367bd7427054e2bd19bae39e8f969910d3b9151abf958"
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: "6a9a03ef00b96147cb7dd8f1d55d318ac98577255d21b24b3556514426372127"
sha256 arm64_big_sur: "580dc54efe7f80a7696c3d5a52b3435b6b909d1d34eb334e68fe8d9af7d8a179"
sha256 monterey: "347cea91f23b1c28233e33b891de63326627f20f4b6e2c451f67e7fe11ab7d81"
sha256 big_sur: "c2c904b91a1a56af30804ab486371693daabe5d32d0b82a4e916ac1d551e28ac"
sha256 catalina: "5bb6da938581b58c4c396a988c1cce2c7b0d21196889bf81fc614c36670706f0"
sha256 x86_64_linux: "34b88907d8a4ec05ae6f5a1935593aa605850d3cddce4e9405348bf77c1fd22a"
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