Skip to content
This repository has been archived by the owner on Jul 4, 2023. It is now read-only.

poppler 0.29 with qt5 support #40131

Closed
DrunkenMonkey85 opened this issue May 27, 2015 · 7 comments
Closed

poppler 0.29 with qt5 support #40131

DrunkenMonkey85 opened this issue May 27, 2015 · 7 comments

Comments

@DrunkenMonkey85
Copy link

Hi guys!

Last year i was able to build libpoppler (version 0.24.) with qt5 support by modifying the recipe with a few lines.
now these modification do not work, since the complete recipe structure has been changed.

could you guys pass me a hint how to modify the recipe poppler to get qt5 support?

thanks

Flo

P.S. i can attach the working recipe from last year if needed..

@bfontaine
Copy link
Contributor

P.S. i can attach the working recipe from last year if needed..

Please do 😃

@DrunkenMonkey85
Copy link
Author

Here you are :)
As you can see this recipe used poppler 0.26 so i will be glad if we can figure out how to get the new version working...

btw. the chages were really simple ;-)

require 'formula'

class Poppler < Formula
  homepage 'http://poppler.freedesktop.org'
  url 'http://poppler.freedesktop.org/poppler-0.26.0.tar.xz'
  sha1 '1f5d08ee01683c309688f17116d18bf47b13f001'

  option 'with-qt4', 'Build Qt backend'
  option 'with-qt5', 'Build Qt5 backend'
  option 'with-glib', 'Build Glib backend' # requires cairo
  option 'with-lcms2', 'Use color management system'

  depends_on 'pkg-config' => :build

  depends_on 'libpng'
  depends_on 'fontconfig'
  depends_on 'openjpeg'

  depends_on 'qt' if build.with? 'qt4'
  depends_on 'qt5' if build.with? 'qt5'
  depends_on 'glib' => :optional
  depends_on 'little-cms2' if build.with? 'lcms2'
  depends_on 'cairo' if build.with? 'glib'

  conflicts_with 'pdftohtml', :because => 'both install `pdftohtml` binaries'

  conflicts_with 'pdf2image', 'xpdf',
    :because => 'poppler, pdf2image, and xpdf install conflicting executables'

  resource 'font-data' do
    url 'http://poppler.freedesktop.org/poppler-data-0.4.6.tar.gz'
    sha1 'f030563eed9f93912b1a546e6d87936d07d7f27d'
  end

  def install
    if build.with? 'qt4'
      ENV['POPPLER_QT4_CFLAGS'] = `#{HOMEBREW_PREFIX}/bin/pkg-config QtCore QtGui --libs`.chomp
      ENV.append 'LDFLAGS', "-Wl,-F#{HOMEBREW_PREFIX}/lib"
    end

    if build.with? 'qt5'
      ENV['POPPLER_QT5_CFLAGS'] = `#{HOMEBREW_PREFIX}/bin/pkg-config QtCore QtGui --libs`.chomp
      ENV.append 'LDFLAGS', "-Wl,-F#{HOMEBREW_PREFIX}/lib"
    end
    args = ["--disable-dependency-tracking", "--prefix=#{prefix}", "--enable-xpdf-headers"]
    # Explicitly disable Qt if not requested because `POPPLER_QT4_CFLAGS` won't
    # be set and the build will fail.
    #
    # Also, explicitly disable Glib as Poppler will find it and set up to
    # build, but Superenv will have stripped the Glib utilities out of the
    # PATH.
    args << ( build.with?('qt4') ? '--enable-poppler-qt4' : '--disable-poppler-qt4' )
    args << ( build.with?('qt5') ? '--enable-poppler-qt5' : '--disable-poppler-qt5' )
    args << ( build.with?('glib') ? '--enable-poppler-glib' : '--disable-poppler-glib' )
    args << ( build.with?('glib') ? '' : '--disable-cairo-output' )
    args << ( build.with?('lcms2') ? '--enable-cms=lcms2' : '' )

    system "./configure", *args
    system "make install"
    resource('font-data').stage { system "make", "install", "prefix=#{prefix}" }
  end
end

@DrunkenMonkey85
Copy link
Author

Hi guys...
if we want to use qt 5 with poppler, we need to add the pkg-config folder of qt 5 to the pkg_config_path.
but the configure script seems still to fail..

require 'formula'

class Poppler < Formula
  homepage 'http://poppler.freedesktop.org'
  url 'http://poppler.freedesktop.org/poppler-0.29.0.tar.xz'
  sha1 'ba3330ab884e6a139ca63dd84d0c1c676f545b5e'

  bottle do
    sha1 "b83e3b7fe032d69343367ceb481a0387e447e565" => :yosemite
    sha1 "c1693c4f5dddc088b6ea53640610918416d7e08c" => :mavericks
    sha1 "36ca1676e824fe8532ad6c6e826685c0e39ac808" => :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 "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'
    sha1 '556a5bebd0eb743e0d91819ba11fd79947d8c674'
  end

  def install
    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"
      ENV.append_path "PKG_CONFIG_PATH" , "#{HOMEBREW_PREFIX}/opt/qt5/lib/pkgconfig"
    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 { system "make", "install", "prefix=#{prefix}" }
  end
end

checking for POPPLER_QT4... no
checking for POPPLER_QT5... yes
checking for POPPLER_QT5_TEST... yes
checking for moc... no
checking for Qt5 moc... no
checking for moc-qt5... no
checking for Qt5 moc-qt5... checking for qtchooser... no
checking for qtchooser... ./configure: line 23489: qtchooser: command not found

results in:
Building poppler with support for:
font configuration: fontconfig
splash output: yes
cairo output: yes
qt4 wrapper: no
qt5 wrapper: no
glib wrapper: yes
introspection: yes
cpp wrapper: yes
use gtk-doc: no
use libjpeg: yes
use libpng: yes
use libtiff: yes
use zlib: no
use libcurl: no
use libopenjpeg: yes

@DrunkenMonkey85
Copy link
Author

Any suggestions?

@DrunkenMonkey85
Copy link
Author

Hi guys!

Good news: it's working again! i'll be glad if you can add these changes to your upstream so everybody can take advantage of qt5 with poppler.

thank you

require 'formula'

class Poppler < Formula
  homepage 'http://poppler.freedesktop.org'
  url 'http://poppler.freedesktop.org/poppler-0.29.0.tar.xz'
  sha1 'ba3330ab884e6a139ca63dd84d0c1c676f545b5e'

  bottle do
    sha1 "b83e3b7fe032d69343367ceb481a0387e447e565" => :yosemite
    sha1 "c1693c4f5dddc088b6ea53640610918416d7e08c" => :mavericks
    sha1 "36ca1676e824fe8532ad6c6e826685c0e39ac808" => :mountain_lion
  end

  option "with-qt", "Build Qt backend"
  option "with-qt5", "Build Qt5 backend" #added to support qt5
  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         #added to support qt5
  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'
    sha1 '556a5bebd0eb743e0d91819ba11fd79947d8c674'
  end

  def install
    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"
    #edded to support qt5
    elsif build.with? "qt5"
      args << "--enable-poppler-qt5"
      ENV.append_path "PKG_CONFIG_PATH" , "#{HOMEBREW_PREFIX}/opt/qt5/lib/pkgconfig"
    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 { system "make", "install", "prefix=#{prefix}" }
  end
end

@MikeMcQuaid
Copy link
Member

@skalee
Copy link

skalee commented Sep 19, 2015

If anyone looks for follow-up, it's here: #40279.

@Homebrew Homebrew locked and limited conversation to collaborators Sep 20, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants