3
0
Fork 0
forked from mirrors/nixpkgs

Let poppler use ${POPPLER_DATADIR}

Also upgrade poppler-data

svn path=/nixpkgs/trunk/; revision=29342
This commit is contained in:
Yury G. Kudryashov 2011-09-19 08:35:30 +00:00
parent de2105b740
commit 63959f2a5a
4 changed files with 24 additions and 62 deletions

View file

@ -1,20 +1,23 @@
{ fetchurl, stdenv, cmake }:
stdenv.mkDerivation rec {
name = "poppler-data-0.4.3";
name = "poppler-data-0.4.5";
src = fetchurl {
url = "http://poppler.freedesktop.org/${name}.tar.gz";
sha256 = "19jq5miinzzrzlv6696j82hr60ga2r4msk6a34s9537vid410q22";
sha256 = "1zbh1zd083wfwrcw7vxc2bn32h42y6iyh24syxcb3r5ggd2vr41i";
};
buildInputs = [ cmake ];
postInstall = ''
ensureDir ''${out}/etc/profile.d
echo "export POPPLER_DATADIR=''${out}/share/poppler" > \
''${out}/etc/profile.d/60-poppler.sh
'';
# TODO: actually use $prefix/etc/profile.d in NixOS
postInstall =
''
mkdir -pv ''${out}/etc/profile.d
echo "export POPPLER_DATADIR=''${out}/share/poppler" |
tee ''${out}/etc/profile.d/60-poppler.sh
chmod -c +x ''${out}/etc/profile.d/60-poppler.sh
'';
meta = {
homepage = http://poppler.freedesktop.org/;

View file

@ -1,56 +1,13 @@
diff -ur poppler-0.6.1/poppler/GlobalParams.cc poppler-0.6.1-patched/poppler/GlobalParams.cc
--- poppler-0.6.1/poppler/GlobalParams.cc 2007-09-17 20:37:58.000000000 +0200
+++ poppler-0.6.1-patched/poppler/GlobalParams.cc 2007-11-06 16:11:55.995595933 +0100
@@ -654,27 +654,39 @@
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;
- dir = new GDir(POPPLER_DATADIR "/nameToUnicode", gFalse);
+ GooString *real_datadir = new GooString (getenv("POPPLER_DATADIR"));
+ if (!real_datadir->getCString())
+ real_datadir->Set(POPPLER_DATADIR);
+ GooString *dirname;
+
+ dirname = real_datadir->copy();
+ dir = new GDir(dirname->append("/nameToUnicode")->getCString(), gFalse);
while (entry = dir->getNextEntry(), entry != NULL) {
parseNameToUnicode(entry->getFullPath());
delete entry;
}
delete dir;
+ delete dirname;
- dir = new GDir(POPPLER_DATADIR "/cidToUnicode", gFalse);
+ dirname = real_datadir->copy();
+ dir = new GDir(dirname->append("/cidToUnicode")->getCString(), gFalse);
while (entry = dir->getNextEntry(), entry != NULL) {
addCIDToUnicode(entry->getName(), entry->getFullPath());
delete entry;
}
delete dir;
+ delete dirname;
- dir = new GDir(POPPLER_DATADIR "/unicodeMap", gFalse);
+ dirname = real_datadir->copy();
+ dir = new GDir(dirname->append("/unicodeMap")->getCString(), gFalse);
while (entry = dir->getNextEntry(), entry != NULL) {
addUnicodeMap(entry->getName(), entry->getFullPath());
delete entry;
}
delete dir;
+ delete dirname;
+ dirname = real_datadir->copy();
dir = new GDir(POPPLER_DATADIR "/cMap", gFalse);
while (entry = dir->getNextEntry(), entry != NULL) {
addCMapDir(entry->getName(), entry->getFullPath());
@@ -682,6 +694,9 @@
delete entry;
}
delete dir;
+ delete dirname;
+
+ delete real_datadir;
}
void GlobalParams::parseNameToUnicode(GooString *name) {
- 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

@ -24,6 +24,8 @@ stdenv.mkDerivation rec {
cmakeFlags = "-DENABLE_XPDF_HEADERS=ON -DENABLE_LIBCURL=ON -DENABLE_ZLIB=ON";
patches = [ ./datadir_env.patch ];
# XXX: The Poppler/Qt4 test suite refers to non-existent PDF files
# such as `../../../test/unittestcases/UseNone.pdf'.
#doCheck = !qt4Support;

View file

@ -6080,7 +6080,7 @@ let
iana_etc = callPackage ../data/misc/iana-etc { };
popplerData = callPackage ../data/misc/poppler-data { };
poppler_data = callPackage ../data/misc/poppler-data { };
r3rs = callPackage ../data/documentation/rnrs/r3rs.nix { };