homebrew-core/Formula/poppler.rb

95 lines
3.1 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.08.0.tar.xz"
sha256 "b493328721402f25cb7523f9cdc2f7d7c59f45ad999bde75c63c90604db0f20b"
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
rebuild 1
sha256 arm64_monterey: "7d082645e0272f32dce02ba14e538961daafbadc0506104c24aa8704e348caca"
sha256 arm64_big_sur: "eecb637cec87c66ac8ff95e2215a632e31e4ec1e8d797dbbddc6b016c341adcf"
sha256 monterey: "7677b6f6205b0cea6269c1dc8c5580e25b7183d64869b3c5493e0f4f2f89b717"
sha256 big_sur: "f27f2e75915739ca671a4c524527f80add251b44076ccd818a0225a7acc37207"
sha256 catalina: "4b7c11b5a1c1fb89435662a0761b1922250eac8727be6f3524a72fe67904ea2e"
sha256 x86_64_linux: "954439909c67a1f4f105040e267be6a58be9a20956e57a29bc7a1cc504a19bd9"
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-turbo"
depends_on "libpng"
depends_on "libtiff"
depends_on "little-cms2"
depends_on "nspr"
depends_on "nss"
depends_on "openjpeg"
uses_from_macos "gperf" => :build
uses_from_macos "curl", since: :catalina # 7.55.0 required by poppler
uses_from_macos "zlib"
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
# Fix for BSD sed. Reported upstream at:
# https://gitlab.freedesktop.org/poppler/poppler/-/issues/1290
inreplace "CMakeLists.txt", "${SED} -i", "\\0 -e"
# removes /usr/include from CFLAGS (not clear why)
ENV["PKG_CONFIG_SYSTEM_INCLUDE_PATH"] = "/usr/include" if MacOS.version < :mojave
args = std_cmake_args + %W[
-DBUILD_GTK_TESTS=OFF
-DENABLE_BOOST=OFF
-DENABLE_CMS=lcms2
-DENABLE_GLIB=ON
-DENABLE_QT5=OFF
-DENABLE_QT6=OFF
-DENABLE_UNSTABLE_API_ABI_HEADERS=ON
-DWITH_GObjectIntrospection=ON
-DCMAKE_INSTALL_RPATH=#{rpath}
]
system "cmake", "-S", ".", "-B", "build_shared", *args
system "cmake", "--build", "build_shared"
system "cmake", "--install", "build_shared"
system "cmake", "-S", ".", "-B", "build_static", *args, "-DBUILD_SHARED_LIBS=OFF"
system "cmake", "--build", "build_static"
lib.install "build_static/libpoppler.a"
lib.install "build_static/cpp/libpoppler-cpp.a"
lib.install "build_static/glib/libpoppler-glib.a"
resource("font-data").stage do
system "make", "install", "prefix=#{prefix}"
end
end
test do
system bin/"pdfinfo", test_fixtures("test.pdf")
end
end