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.56.0.tar.xz" sha256 "869dbadf99ed882e776acbdbc06689d8a81872a2963440b1e8516cd7a2577173" bottle do sha256 "183cfb95cb3f30ee45db2e6b6bef3a9b98bd001b6b03c209a6e3fdd62b15313d" => :sierra sha256 "9aa64b99728fbf5340da9333648492ff3cd868aa6c9a1bdb0f3b367dfa657926" => :el_capitan sha256 "2d64600d12dbe6e687c2a0499d5828aeb27d9963cec8bcaba62c5ea19381d598" => :yosemite 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 "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.7.tar.gz" sha256 "e752b0d88a7aba54574152143e7bf76436a7ef51977c55d6bd9a48dccde3a7de" end needs :cxx11 if build.with?("qt") || MacOS.version < :mavericks def install ENV.cxx11 if build.with?("qt") || MacOS.version < :mavericks ENV["LIBOPENJPEG_CFLAGS"] = "-I#{Formula["openjpeg"].opt_include}/openjpeg-2.1" args = %W[ --disable-dependency-tracking --prefix=#{prefix} --enable-xpdf-headers --enable-poppler-glib --disable-gtk-test --enable-introspection=yes --disable-poppler-qt4 ] if build.with? "qt" args << "--enable-poppler-qt5" else args << "--disable-poppler-qt5" end args << "--enable-cms=lcms2" if build.with? "little-cms2" system "./configure", *args system "make", "install" resource("font-data").stage do system "make", "install", "prefix=#{prefix}" end end test do system "#{bin}/pdfinfo", test_fixtures("test.pdf") end end