108 lines
3.4 KiB
Ruby
108 lines
3.4 KiB
Ruby
class Poppler < Formula
|
|
desc "PDF rendering library (based on the xpdf-3.0 code base)"
|
|
homepage "https://poppler.freedesktop.org/"
|
|
head "https://anongit.freedesktop.org/git/poppler/poppler.git"
|
|
|
|
stable do
|
|
url "https://poppler.freedesktop.org/poppler-0.68.0.tar.xz"
|
|
sha256 "f90d04f0fb8df6923ecb0f106ae866cf9f8761bb537ddac64dfb5322763d0e58"
|
|
|
|
# https://gitlab.freedesktop.org/poppler/poppler/merge_requests/18
|
|
# Should be safe to remove on next release but check if merged.
|
|
patch do
|
|
url "https://gitlab.freedesktop.org/poppler/poppler/merge_requests/18.diff"
|
|
sha256 "ef7d7b7fed6799911b7ef925395b8de552aadaf3754d7b02fe3505649518808c"
|
|
end
|
|
end
|
|
|
|
bottle do
|
|
sha256 "bc1012f84c9fb5188560f90fecf555b97609df433f4b55585697f3d1731c68c6" => :mojave
|
|
sha256 "5669b0631c862647c4d47f7efb410593d3d1207f0795ba23b8e30dd1d4d96d26" => :high_sierra
|
|
sha256 "9b54804d8b9378a64477b1da9c022ee1557387a3a3dc17b10a582b982eed072d" => :sierra
|
|
sha256 "424693d9dd27b19b4da42e8847d056e968720b5c52f3acddf3a07954c4e0936a" => :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 "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 "openjpeg"
|
|
depends_on "little-cms2" => :optional
|
|
depends_on "nss" => :optional
|
|
depends_on "qt" => :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.9.tar.gz"
|
|
sha256 "1f9c7e7de9ecd0db6ab287349e31bf815ca108a5a175cf906a90163bdbe32012"
|
|
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"
|
|
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
|
|
|
|
libpoppler = (lib/"libpoppler.dylib").readlink
|
|
to_fix = ["#{lib}/libpoppler-cpp.dylib", "#{lib}/libpoppler-glib.dylib",
|
|
*Dir["#{bin}/*"]]
|
|
to_fix << "#{lib}/libpoppler-qt5.dylib" if build.with?("qt")
|
|
to_fix.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
|