89 lines
2.7 KiB
Ruby
89 lines
2.7 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-0.62.0.tar.xz"
|
|
sha256 "5b9a73dfd4d6f61d165ada1e4f0abd2d420494bf9d0b1c15d0db3f7b83a729c6"
|
|
head "https://anongit.freedesktop.org/git/poppler/poppler.git"
|
|
|
|
bottle do
|
|
sha256 "e7ef8133d2a55b7b9d060e1bb39e85daa421805315b78cdaac2eb74e6ee7e50b" => :high_sierra
|
|
sha256 "67553e08dc541aa5db51e480b768a289095cf236279fe46defb4061783967bf8" => :sierra
|
|
sha256 "3797b24ecd422d96b7418c942c26937dd14af4e4e0b135c15cb1164a109ab5af" => :el_capitan
|
|
end
|
|
|
|
option "with-qt", "Build Qt5 backend"
|
|
option "with-little-cms2", "Use color management system"
|
|
option "with-nss", "Use NSS library for PDF signature validation"
|
|
|
|
deprecated_option "with-qt4" => "with-qt"
|
|
deprecated_option "with-qt5" => "with-qt"
|
|
deprecated_option "with-lcms2" => "with-little-cms2"
|
|
|
|
depends_on "cmake" => :build
|
|
depends_on "pkg-config" => :build
|
|
depends_on "cairo"
|
|
depends_on "fontconfig"
|
|
depends_on "freetype"
|
|
depends_on "gettext"
|
|
depends_on "glib"
|
|
depends_on "gobject-introspection"
|
|
depends_on "jpeg"
|
|
depends_on "libpng"
|
|
depends_on "libtiff"
|
|
depends_on "openjpeg"
|
|
depends_on "qt" => :optional
|
|
depends_on "little-cms2" => :optional
|
|
depends_on "nss" => :optional
|
|
|
|
conflicts_with "pdftohtml", "pdf2image", "xpdf",
|
|
:because => "poppler, pdftohtml, pdf2image, and xpdf install conflicting executables"
|
|
|
|
resource "font-data" do
|
|
url "https://poppler.freedesktop.org/poppler-data-0.4.8.tar.gz"
|
|
sha256 "1096a18161f263cccdc6d8a2eb5548c41ff8fcf9a3609243f1b6296abdf72872"
|
|
end
|
|
|
|
needs :cxx11 if build.with?("qt") || MacOS.version < :mavericks
|
|
|
|
def install
|
|
ENV.cxx11 if build.with?("qt") || MacOS.version < :mavericks
|
|
|
|
args = std_cmake_args + %w[
|
|
-DENABLE_XPDF_HEADERS=ON
|
|
-DENABLE_GLIB=ON
|
|
-DBUILD_GTK_TESTS=OFF
|
|
-DWITH_GObjectIntrospection=ON
|
|
-DENABLE_QT4=OFF
|
|
]
|
|
|
|
if build.with? "qt"
|
|
args << "-DENABLE_QT5=ON"
|
|
else
|
|
args << "-DENABLE_QT5=OFF"
|
|
end
|
|
|
|
if build.with? "little-cms2"
|
|
args << "-DENABLE_CMS=lcms2"
|
|
else
|
|
args << "-DENABLE_CMS=none"
|
|
end
|
|
|
|
system "cmake", ".", *args
|
|
system "make", "install"
|
|
resource("font-data").stage do
|
|
system "make", "install", "prefix=#{prefix}"
|
|
end
|
|
|
|
libpoppler = (lib/"libpoppler.dylib").readlink
|
|
["#{lib}/libpoppler-cpp.dylib", "#{lib}/libpoppler-glib.dylib",
|
|
*Dir["#{bin}/*"]].each do |f|
|
|
macho = MachO.open(f)
|
|
macho.change_dylib("@rpath/#{libpoppler}", "#{lib}/#{libpoppler}")
|
|
macho.write!
|
|
end
|
|
end
|
|
|
|
test do
|
|
system "#{bin}/pdfinfo", test_fixtures("test.pdf")
|
|
end
|
|
end
|