From 1bde33074efa11fa2edcf71032d2e634f852f349 Mon Sep 17 00:00:00 2001 From: Nikolay Amiantov Date: Thu, 18 Aug 2016 15:22:33 +0300 Subject: [PATCH] poppler_data: embed into poppler, make an option Previously we relied on an environment variable POPPLER_DATADIR which practically noone used and everyone was expected to set. This is a good candidate for a feature option because noone really _noticed_ that this data is not available. Disabled by default because of this and size of the data (22M). --- pkgs/applications/graphics/xournal/default.nix | 6 +++--- .../development/libraries/poppler/datadir_env.patch | 13 ------------- pkgs/development/libraries/poppler/default.nix | 9 +++++---- pkgs/tools/typesetting/pdfgrep/default.nix | 10 ++-------- 4 files changed, 10 insertions(+), 28 deletions(-) delete mode 100644 pkgs/development/libraries/poppler/datadir_env.patch diff --git a/pkgs/applications/graphics/xournal/default.nix b/pkgs/applications/graphics/xournal/default.nix index 9c93b9d7317b..53d0473638a8 100644 --- a/pkgs/applications/graphics/xournal/default.nix +++ b/pkgs/applications/graphics/xournal/default.nix @@ -1,7 +1,7 @@ { stdenv, fetchurl , ghostscript, atk, gtk, glib, fontconfig, freetype , libgnomecanvas, libgnomeprint, libgnomeprintui -, pango, libX11, xproto, zlib, poppler, poppler_data +, pango, libX11, xproto, zlib, poppler , autoconf, automake, libtool, pkgconfig}: stdenv.mkDerivation rec { version = "0.4.8"; @@ -14,12 +14,12 @@ stdenv.mkDerivation rec { buildInputs = [ ghostscript atk gtk glib fontconfig freetype libgnomecanvas libgnomeprint libgnomeprintui - pango libX11 xproto zlib poppler poppler_data + pango libX11 xproto zlib poppler ]; nativeBuildInputs = [ autoconf automake libtool pkgconfig ]; - NIX_LDFLAGS="-lX11 -lz"; + NIX_LDFLAGS = [ "-lX11" "-lz" ]; meta = { homepage = http://xournal.sourceforge.net/; diff --git a/pkgs/development/libraries/poppler/datadir_env.patch b/pkgs/development/libraries/poppler/datadir_env.patch deleted file mode 100644 index fd111d713552..000000000000 --- a/pkgs/development/libraries/poppler/datadir_env.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/poppler/GlobalParams.cc b/poppler/GlobalParams.cc -index 2e11bb0..a277ab9 100644 ---- a/poppler/GlobalParams.cc -+++ b/poppler/GlobalParams.cc -@@ -748,7 +748,7 @@ GlobalParams::GlobalParams(const char *customPopplerDataDir) - void GlobalParams::scanEncodingDirs() { - GDir *dir; - GDirEntry *entry; -- const char *dataRoot = popplerDataDir ? popplerDataDir : POPPLER_DATADIR; -+ const char *dataRoot = popplerDataDir ? popplerDataDir : ( getenv("POPPLER_DATADIR") ? getenv("POPPLER_DATADIR") : POPPLER_DATADIR ); - - // allocate buffer large enough to append "/nameToUnicode" - size_t bufSize = strlen(dataRoot) + strlen("/nameToUnicode") + 1; diff --git a/pkgs/development/libraries/poppler/default.nix b/pkgs/development/libraries/poppler/default.nix index 9e8817c6ea7f..097031d54f13 100644 --- a/pkgs/development/libraries/poppler/default.nix +++ b/pkgs/development/libraries/poppler/default.nix @@ -1,9 +1,10 @@ { stdenv, lib, fetchurl, fetchpatch, pkgconfig, libiconv, libintlOrEmpty , zlib, curl, cairo, freetype, fontconfig, lcms, libjpeg, openjpeg -, minimal ? false +, withData ? false, poppler_data , qt4Support ? false, qt4 ? null , qt5Support ? false, qtbase ? null -, utils ? false, suffix ? "glib" +, utils ? false +, minimal ? false, suffix ? "glib" }: let # beware: updates often break cups_filters build @@ -20,7 +21,7 @@ stdenv.mkDerivation rec { outputs = [ "dev" "out" ]; - patches = [ ./datadir_env.patch ]; + buildInputs = [ libiconv ] ++ libintlOrEmpty ++ lib.optional withData poppler_data; # TODO: reduce propagation to necessary libs propagatedBuildInputs = with lib; @@ -29,7 +30,7 @@ stdenv.mkDerivation rec { ++ optional qt4Support qt4 ++ optional qt5Support qtbase; - nativeBuildInputs = [ pkgconfig libiconv ] ++ libintlOrEmpty; + nativeBuildInputs = [ pkgconfig ]; NIX_CFLAGS_COMPILE = [ "-DQT_NO_DEBUG" ]; diff --git a/pkgs/tools/typesetting/pdfgrep/default.nix b/pkgs/tools/typesetting/pdfgrep/default.nix index cef212b2a134..6e5f98d4a717 100644 --- a/pkgs/tools/typesetting/pdfgrep/default.nix +++ b/pkgs/tools/typesetting/pdfgrep/default.nix @@ -1,4 +1,4 @@ -{ fetchurl, stdenv, pkgconfig, poppler, poppler_data, makeWrapper }: +{ fetchurl, stdenv, pkgconfig, poppler, makeWrapper }: stdenv.mkDerivation rec { name = "pdfgrep-${version}"; @@ -9,19 +9,13 @@ stdenv.mkDerivation rec { sha256 = "6e8bcaf8b219e1ad733c97257a97286a94124694958c27506b2ea7fc8e532437"; }; - buildInputs = [ pkgconfig poppler poppler_data makeWrapper ]; + buildInputs = [ pkgconfig poppler makeWrapper ]; patchPhase = '' sed -i -e "s%cpp/poppler-document.h%poppler/cpp/poppler-document.h%" pdfgrep.cc sed -i -e "s%cpp/poppler-page.h%poppler/cpp/poppler-page.h%" pdfgrep.cc ''; - # workarround since it can't be hardcoded in pdfgrep - preFixup = '' - wrapProgram "$out/bin/pdfgrep" \ - --set POPPLER_DATADIR "${poppler_data}/share/poppler" - ''; - meta = { description = "A tool to search text in PDF files"; homepage = http://pdfgrep.sourceforge.net/;