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).
This commit is contained in:
Nikolay Amiantov 2016-08-18 15:22:33 +03:00
parent 7ce717a56c
commit 1bde33074e
4 changed files with 10 additions and 28 deletions

View File

@ -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/;

View File

@ -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;

View File

@ -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" ];

View File

@ -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/;