class Poppler < Formula desc "PDF rendering library (based on the xpdf-3.0 code base)" homepage "http://poppler.freedesktop.org" url "http://poppler.freedesktop.org/poppler-0.34.0.tar.xz" sha256 "1ba4ba9a2f9eb1e62ee6d736f4d82be4fc5f6dd177dc2b03febbe2ef2e515cb0" revision 1 bottle do sha256 "aff18157ab1769ba425cdce67c77c86e244ffd237f069188ffba73c44ab812c1" => :yosemite sha256 "77eb4e8ccbd344d9ee3318082adeda8e81fbb67e37205a54d1eab7b281955925" => :mavericks sha256 "dc6bbbb825357abbc0903c7cd41f77bfd578e40e4e0db977628c0877ec4bd4f9" => :mountain_lion end option "with-qt", "Build Qt backend" option "with-qt5", "Build Qt5 backend" option "with-little-cms2", "Use color management system" deprecated_option "with-qt4" => "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 "qt5" => :optional depends_on "little-cms2" => :optional conflicts_with "pdftohtml", :because => "both install `pdftohtml` binaries" resource "font-data" do url "http://poppler.freedesktop.org/poppler-data-0.4.7.tar.gz" sha256 "e752b0d88a7aba54574152143e7bf76436a7ef51977c55d6bd9a48dccde3a7de" end def install ENV["LIBOPENJPEG_CFLAGS"] = "-I#{Formula["openjpeg"].opt_include}/openjpeg-1.5" args = %W[ --disable-dependency-tracking --prefix=#{prefix} --enable-xpdf-headers --enable-poppler-glib --disable-gtk-test --enable-introspection=yes ] if build.with? "qt" args << "--enable-poppler-qt4" elsif build.with? "qt5" args << "--enable-poppler-qt5" else args << "--disable-poppler-qt4" << "--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