87 lines
2.5 KiB
Ruby
87 lines
2.5 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.60.1.tar.xz"
|
|
sha256 "19f185e05c3b59b4a1de2cec8ef39f5446035493d17bbed41d02fb9a77c8a93c"
|
|
|
|
bottle do
|
|
rebuild 2
|
|
sha256 "13f8ff3f6eb14776b732a7cfa5e25195695fd966956afa9df9c4bbe92a83bf78" => :high_sierra
|
|
sha256 "95b3beb2df01043bc3db58179016ca6f8f3b553a9ae9ac663ab4bdcb2c6656d2" => :sierra
|
|
sha256 "4efb01d72131c21530168b4a545a1ebb5eb21cb4cedf9d2a80ac12a49b32421e" => :el_capitan
|
|
end
|
|
|
|
option "with-qt", "Build Qt5 backend"
|
|
option "with-little-cms2", "Use color management system"
|
|
|
|
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
|
|
|
|
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=OFF"
|
|
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
|