homebrew-core/Formula/poppler-qt5.rb

98 lines
2.9 KiB
Ruby

class PopplerQt5 < 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
formula "poppler"
end
bottle do
sha256 arm64_monterey: "5e7760ac4779c66600e014a0477d1f7571f27691d3ad4f58390507ac4d5ebe2e"
sha256 arm64_big_sur: "62bf056d997fa5d3ee8363eb76d860e61add4c9efb94d20bf2966855640d472e"
sha256 big_sur: "cbad439cb6109040157a700389ed9cb28da5bf1842c23b35838b41fe07f97a3e"
sha256 catalina: "7dfee6ecdcdd7fe7148fb672cf3a066713bc4804f70e29ae5ea4c8ad0dab3161"
sha256 cellar: :any_skip_relocation, x86_64_linux: "38253fa009bac07459160e50cc9816ff67efc2ef1760838bd7582ef46ad63ffd"
end
keg_only "it conflicts with poppler"
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 "nss"
depends_on "openjpeg"
depends_on "qt@5"
uses_from_macos "gperf" => :build
uses_from_macos "curl"
on_linux do
depends_on "gcc"
end
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=ON
-DENABLE_QT6=OFF
-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-qt5.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