From c0d5cd0ff90cac2e04f6b436991baa4c4471150f Mon Sep 17 00:00:00 2001 From: Thomas Tuegel Date: Thu, 2 Apr 2015 09:50:37 -0500 Subject: [PATCH] poppler: fix build of Qt 4 and Qt 5 wrappers The autoconf build system for poppler does not support building the wrappers separately, so this slightly enlarges the size of closures. To compensate, the command-line utilities have been separated into their own package. --- .../editors/texstudio/default.nix | 6 +- pkgs/applications/kde-apps-14.12/default.nix | 2 +- pkgs/applications/misc/qpdfview/default.nix | 4 +- pkgs/applications/office/calligra/default.nix | 4 +- pkgs/applications/office/kbibtex/default.nix | 4 +- pkgs/desktops/kde-4.14/kdegraphics/okular.nix | 4 +- .../kde-4.14/kdelibs/kfilemetadata.nix | 4 +- .../kde-4.14/kdelibs/nepomuk-core.nix | 4 +- pkgs/desktops/plasma-5.2/default.nix | 2 +- .../development/libraries/poppler/default.nix | 87 +++++++------------ .../libraries/poppler/poppler-glib.patch | 19 ---- pkgs/top-level/all-packages.nix | 18 +++- pkgs/top-level/python-packages.nix | 4 +- 13 files changed, 63 insertions(+), 99 deletions(-) delete mode 100644 pkgs/development/libraries/poppler/poppler-glib.patch diff --git a/pkgs/applications/editors/texstudio/default.nix b/pkgs/applications/editors/texstudio/default.nix index cd7f0b78c235..5cb31af797d5 100644 --- a/pkgs/applications/editors/texstudio/default.nix +++ b/pkgs/applications/editors/texstudio/default.nix @@ -1,4 +1,4 @@ -{ stdenv, fetchurl, qt4, popplerQt4, zlib}: +{ stdenv, fetchurl, qt4, poppler_qt4, zlib}: stdenv.mkDerivation rec { pname = "texstudio"; @@ -11,10 +11,10 @@ stdenv.mkDerivation rec { sha256 = "167d78nfk265jjvl129nr70v8ladb2rav2qyhw7ngr6m54gak831"; }; - buildInputs = [ qt4 popplerQt4 zlib ]; + buildInputs = [ qt4 poppler_qt4 zlib ]; preConfigure = '' - export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -I$(echo ${popplerQt4}/include/poppler/qt4) " + export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -I$(echo ${poppler_qt4}/include/poppler/qt4) " qmake PREFIX=$out texstudio.pro ''; diff --git a/pkgs/applications/kde-apps-14.12/default.nix b/pkgs/applications/kde-apps-14.12/default.nix index 00f84896a0bf..96f1aea68753 100644 --- a/pkgs/applications/kde-apps-14.12/default.nix +++ b/pkgs/applications/kde-apps-14.12/default.nix @@ -107,7 +107,7 @@ let OggVorbis = libvorbis; OpenAL = openal; OpenEXR = openexr; - Poppler = poppler.poppler_qt4; + Poppler = poppler_qt4; Prison = prison; PulseAudio = pulseaudio; PythonLibrary = python; diff --git a/pkgs/applications/misc/qpdfview/default.nix b/pkgs/applications/misc/qpdfview/default.nix index 0845a379685e..1cf6d76b8920 100644 --- a/pkgs/applications/misc/qpdfview/default.nix +++ b/pkgs/applications/misc/qpdfview/default.nix @@ -1,4 +1,4 @@ -{stdenv, fetchurl, qt4, pkgconfig, popplerQt4, djvulibre, libspectre, cups +{stdenv, fetchurl, qt4, pkgconfig, poppler_qt4, djvulibre, libspectre, cups , file, ghostscript }: let @@ -11,7 +11,7 @@ let sha256 = "15d88xzqvrcp9szmz8d1lj65yrdx90j6fp78gia5c8kra2z8bik9"; }; buildInputs = [ - qt4 popplerQt4 pkgconfig djvulibre libspectre cups file ghostscript + qt4 poppler_qt4 pkgconfig djvulibre libspectre cups file ghostscript ]; in stdenv.mkDerivation { diff --git a/pkgs/applications/office/calligra/default.nix b/pkgs/applications/office/calligra/default.nix index 89bc4ecb4c8d..00f27bfc93c8 100644 --- a/pkgs/applications/office/calligra/default.nix +++ b/pkgs/applications/office/calligra/default.nix @@ -1,6 +1,6 @@ { stdenv, fetchurl, cmake, kdelibs, attica, perl, zlib, libpng, boost, mesa , kdepimlibs, createresources ? null, eigen, qca2, exiv2, soprano, marble, lcms2 -, fontconfig, freetype, sqlite, icu, libwpd, libwpg, pkgconfig, popplerQt4 +, fontconfig, freetype, sqlite, icu, libwpd, libwpg, pkgconfig, poppler_qt4 , libkdcraw, libxslt, fftw, glew, gsl, shared_desktop_ontologies, okular , libvisio, kactivities, mysql, postgresql, freetds, xbase, openexr, ilmbase , libodfgen, opencolorio, openjpeg, pstoedit, librevenge @@ -21,7 +21,7 @@ stdenv.mkDerivation rec { buildInputs = [ kdelibs attica zlib libpng boost mesa kdepimlibs createresources eigen qca2 exiv2 soprano marble lcms2 fontconfig freetype - sqlite icu libwpd libwpg popplerQt4 libkdcraw libxslt fftw glew gsl + sqlite icu libwpd libwpg poppler_qt4 libkdcraw libxslt fftw glew gsl shared_desktop_ontologies okular libodfgen opencolorio openjpeg libvisio kactivities mysql.lib postgresql freetds xbase openexr pstoedit librevenge diff --git a/pkgs/applications/office/kbibtex/default.nix b/pkgs/applications/office/kbibtex/default.nix index ba0d719a049d..b3e62b8e0511 100644 --- a/pkgs/applications/office/kbibtex/default.nix +++ b/pkgs/applications/office/kbibtex/default.nix @@ -1,4 +1,4 @@ -{ stdenv, fetchurl, kdelibs, libxslt, popplerQt4 }: +{ stdenv, fetchurl, kdelibs, libxslt, poppler_qt4 }: stdenv.mkDerivation rec { pname = "kbibtex"; @@ -14,5 +14,5 @@ stdenv.mkDerivation rec { sed -e '25i#include ' -i src/gui/preferences/settingsabstractwidget.h ''; - buildInputs = [ kdelibs libxslt popplerQt4 ]; + buildInputs = [ kdelibs libxslt poppler_qt4 ]; } diff --git a/pkgs/desktops/kde-4.14/kdegraphics/okular.nix b/pkgs/desktops/kde-4.14/kdegraphics/okular.nix index 092833388a78..de7b77999936 100644 --- a/pkgs/desktops/kde-4.14/kdegraphics/okular.nix +++ b/pkgs/desktops/kde-4.14/kdegraphics/okular.nix @@ -1,11 +1,11 @@ -{ stdenv, chmlib, djvulibre, ebook_tools, kde, kdelibs, libspectre, popplerQt4, qca2 +{ stdenv, chmlib, djvulibre, ebook_tools, kde, kdelibs, libspectre, poppler_qt4, qca2 , qimageblitz, libtiff, kactivities, pkgconfig, libkexiv2 }: kde { # TODO: package activeapp, qmobipocket - buildInputs = [ kdelibs chmlib djvulibre ebook_tools libspectre popplerQt4 + buildInputs = [ kdelibs chmlib djvulibre ebook_tools libspectre poppler_qt4 qca2 qimageblitz libtiff kactivities libkexiv2 ]; nativeBuildInputs = [ pkgconfig ]; diff --git a/pkgs/desktops/kde-4.14/kdelibs/kfilemetadata.nix b/pkgs/desktops/kde-4.14/kdelibs/kfilemetadata.nix index 48f535549ce9..6068516ba2b2 100644 --- a/pkgs/desktops/kde-4.14/kdelibs/kfilemetadata.nix +++ b/pkgs/desktops/kde-4.14/kdelibs/kfilemetadata.nix @@ -1,8 +1,8 @@ -{ stdenv, kde, kdelibs, pkgconfig, doxygen, popplerQt4, taglib, exiv2, ffmpeg }: +{ stdenv, kde, kdelibs, pkgconfig, doxygen, poppler_qt4, taglib, exiv2, ffmpeg }: kde { buildInputs = [ - kdelibs popplerQt4 taglib exiv2 ffmpeg + kdelibs poppler_qt4 taglib exiv2 ffmpeg ]; nativeBuildInputs = [ pkgconfig doxygen ]; diff --git a/pkgs/desktops/kde-4.14/kdelibs/nepomuk-core.nix b/pkgs/desktops/kde-4.14/kdelibs/nepomuk-core.nix index d90e1455ce99..526ac069e619 100644 --- a/pkgs/desktops/kde-4.14/kdelibs/nepomuk-core.nix +++ b/pkgs/desktops/kde-4.14/kdelibs/nepomuk-core.nix @@ -1,4 +1,4 @@ -{ stdenv, kde, kdelibs, soprano, shared_desktop_ontologies, exiv2, ffmpeg, taglib, popplerQt4 +{ stdenv, kde, kdelibs, soprano, shared_desktop_ontologies, exiv2, ffmpeg, taglib, poppler_qt4 , pkgconfig, doxygen, ebook_tools }: @@ -8,7 +8,7 @@ kde { buildInputs = [ kdelibs soprano shared_desktop_ontologies taglib exiv2 ffmpeg - popplerQt4 ebook_tools + poppler_qt4 ebook_tools ]; nativeBuildInputs = [ pkgconfig doxygen ]; diff --git a/pkgs/desktops/plasma-5.2/default.nix b/pkgs/desktops/plasma-5.2/default.nix index dfaafa06a77a..8a7733299b5d 100644 --- a/pkgs/desktops/plasma-5.2/default.nix +++ b/pkgs/desktops/plasma-5.2/default.nix @@ -38,7 +38,7 @@ let { LibBlueDevil = pkgs.libbluedevil; PolkitQt5-1 = pkgs.polkit_qt5.override { inherit qt5; }; - PopplerQt5 = (pkgs.poppler.override { inherit qt5; }).poppler_qt5; + PopplerQt5 = pkgs.poppler_qt.override { inherit qt5; }; } // # packages from nixpkgs (with pkgs; diff --git a/pkgs/development/libraries/poppler/default.nix b/pkgs/development/libraries/poppler/default.nix index bec779e221a3..c79cdfd44665 100644 --- a/pkgs/development/libraries/poppler/default.nix +++ b/pkgs/development/libraries/poppler/default.nix @@ -1,79 +1,50 @@ { stdenv, fetchurl, fetchpatch, pkgconfig, libiconv, libintlOrEmpty , zlib, curl, cairo, freetype, fontconfig, lcms, libjpeg, openjpeg -, qt4Support ? false, qt4 ? null, qt5 +, qt4Support ? false, qt4 ? null, qt5Support ? false, qt5 ? null +, utils ? false, suffix ? "glib" }: let version = "0.32.0"; # even major numbers are stable sha256 = "162vfbvbz0frvqyk00ldsbl49h4bj8i8wn0ngfl30xg1lldy6qs9"; +in +stdenv.mkDerivation rec { + name = "poppler-${suffix}-${version}"; - poppler_drv = nameSuff: merge: stdenv.mkDerivation (stdenv.lib.mergeAttrsByFuncDefaultsClean [ - rec { - name = "poppler-${nameSuff}-${version}"; + src = fetchurl { + url = "${meta.homepage}/poppler-${version}.tar.xz"; + inherit sha256; + }; - src = fetchurl { - url = "${meta.homepage}/poppler-${version}.tar.xz"; - inherit sha256; - }; + patches = [ ./datadir_env.patch ]; - propagatedBuildInputs = [ zlib cairo freetype fontconfig libjpeg lcms curl openjpeg ]; + propagatedBuildInputs = with stdenv.lib; + [ zlib cairo freetype fontconfig libjpeg lcms curl openjpeg ] + ++ optional qt4Support qt4 + ++ optional qt5Support qt5.base; - nativeBuildInputs = [ pkgconfig libiconv ] ++ libintlOrEmpty; + nativeBuildInputs = [ pkgconfig libiconv ] ++ libintlOrEmpty; - configureFlags = [ + configureFlags = + [ "--enable-xpdf-headers" "--enable-libcurl" "--enable-zlib" - ]; + ] + ++ stdenv.lib.optional (!utils) "--disable-utils"; - patches = [ ./datadir_env.patch ./poppler-glib.patch ]; + enableParallelBuilding = true; - # XXX: The Poppler/Qt4 test suite refers to non-existent PDF files - # such as `../../../test/unittestcases/UseNone.pdf'. - #doCheck = !qt4Support; - checkTarget = "test"; + meta = { + homepage = http://poppler.freedesktop.org/; + description = "A PDF rendering library"; - enableParallelBuilding = true; - - meta = { - homepage = http://poppler.freedesktop.org/; - description = "A PDF rendering library"; - - longDescription = '' - Poppler is a PDF rendering library based on the xpdf-3.0 code base. - ''; - - license = stdenv.lib.licenses.gpl2; - platforms = stdenv.lib.platforms.all; - }; - } merge ]); # poppler_drv - - /* We always use cairo in poppler, so we always depend on glib, - so we always build the glib wrapper (~350kB). - We also always build the cpp wrapper (<100kB). - ToDo: around half the size could be saved by splitting out headers and tools (1.5 + 0.5 MB). - */ - - poppler_glib = poppler_drv "glib" { }; - - poppler_qt4 = poppler_drv "qt4" { - #patches = [ qtcairo_patch ]; # text rendering artifacts in recent versions - propagatedBuildInputs = [ qt4 poppler_glib ]; - NIX_LDFLAGS = "-lpoppler"; - postConfigure = '' - mkdir -p "$out/lib/pkgconfig" - install -c -m 644 poppler-qt4.pc "$out/lib/pkgconfig" - cd qt4 + longDescription = '' + Poppler is a PDF rendering library based on the xpdf-3.0 code base. ''; - }; - poppler_qt5 = poppler_drv "qt5" { - propagatedBuildInputs = [ qt5.base poppler_glib ]; - postConfigure = '' - mkdir -p "$out/lib/pkgconfig" - install -c -m 644 poppler-qt5.pc "$out/lib/pkgconfig" - cd qt5 - ''; + license = stdenv.lib.licenses.gpl2; + platforms = stdenv.lib.platforms.all; + maintainers = with stdenv.lib.maintainers; [ ttuegel ]; }; - -in { inherit poppler_glib poppler_qt4 poppler_qt5; } // poppler_glib +} diff --git a/pkgs/development/libraries/poppler/poppler-glib.patch b/pkgs/development/libraries/poppler/poppler-glib.patch deleted file mode 100644 index 09f5a145b847..000000000000 --- a/pkgs/development/libraries/poppler/poppler-glib.patch +++ /dev/null @@ -1,19 +0,0 @@ -diff -rupN a/poppler-glib.pc.cmake b/poppler-glib.pc.cmake ---- a/poppler-glib.pc.cmake 2013-08-17 01:20:41.000000001 +0200 -+++ b/poppler-glib.pc.cmake 2014-01-01 09:30:50.000000001 +0100 -@@ -10,4 +10,4 @@ Requires: glib-2.0 >= @GLIB_REQUIRED@ go - @PC_REQUIRES_PRIVATE@ - - Libs: -L${libdir} -lpoppler-glib --Cflags: -I${includedir}/poppler/glib -+Cflags: -I${includedir}/poppler/glib -I${includedir}/poppler -diff -rupN a/poppler-glib.pc.in b/poppler-glib.pc.in ---- a/poppler-glib.pc.in 2013-08-17 01:20:41.000000001 +0200 -+++ b/poppler-glib.pc.in 2014-01-01 09:27:17.000000001 +0100 -@@ -10,4 +10,5 @@ Requires: glib-2.0 >= @GLIB_REQUIRED@ go - @PC_REQUIRES_PRIVATE@ - - Libs: -L${libdir} -lpoppler-glib --Cflags: -I${includedir}/poppler/glib -+Cflags: -I${includedir}/poppler/glib -I${includedir}/poppler -+ diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 39d1a5bdbc02..bd111fac26af 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -7230,9 +7230,21 @@ let policykit = callPackage ../development/libraries/policykit { }; - poppler = callPackage ../development/libraries/poppler { lcms = lcms2; qt5 = qt54; }; - popplerQt4 = poppler.poppler_qt4; - poppler_qt5 = poppler.poppler_qt5; + poppler = callPackage ../development/libraries/poppler { lcms = lcms2; }; + + poppler_qt4 = poppler.override { + inherit qt4; + qt4Support = true; + suffix = "qt4"; + }; + + poppler_qt5 = poppler.override { + qt5 = qt54; + qt5Support = true; + suffix = "qt5"; + }; + + poppler_utils = poppler.override { suffix = "utils"; utils = true; }; popt = callPackage ../development/libraries/popt { }; diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 5c1c6b927a84..6eb259f245d2 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -3361,10 +3361,10 @@ let md5 = "9c4c5a59b878aed78e96a6ae58c6c185"; }; - propagatedBuildInputs = [ pkgs.pyqt4 pkgs.pkgconfig pkgs.popplerQt4 ]; + propagatedBuildInputs = [ pkgs.pyqt4 pkgs.pkgconfig pkgs.poppler_qt4 ]; preBuild = "${python}/bin/${python.executable} setup.py build_ext" + - " --include-dirs=${pkgs.popplerQt4}/include/poppler/"; + " --include-dirs=${pkgs.poppler_qt4}/include/poppler/"; meta = with stdenv.lib; { description = "A Python binding to Poppler-Qt4";