3
0
Fork 0
forked from mirrors/nixpkgs

Added poppler and poppler-data

svn path=/nixpkgs/trunk/; revision=9633
This commit is contained in:
Yury G. Kudryashov 2007-11-11 16:00:51 +00:00
parent 17b0f144f7
commit 6203fa41f7
7 changed files with 187 additions and 0 deletions

View file

@ -0,0 +1,19 @@
args: with args;
stdenv.mkDerivation rec {
name = "poppler-data-0.1.1";
src = fetchurl {
url = http://poppler.freedesktop.org/poppler-data-0.1.1.tar.gz;
sha256 = "1hnfanqbhkjyjq0j8yfadgbcai9mggz09lzxnia2bbk4lhy9722a";
};
installFlags = "prefix=\${out}";
config_tool_name = "poppler-data-dir";
config_tool = ./poppler-data-dir;
postInstall = "
ensureDir \${out}/bin
substituteAll ${config_tool} \${out}/bin/${config_tool_name}
chmod +x \${out}/bin/${config_tool_name}
";
}

View file

@ -0,0 +1,2 @@
#!/bin/sh
echo -n export POPPLER_DATADIR=@out@/share/poppler

View file

@ -0,0 +1,24 @@
diff -ur poppler-0.6.1/goo/gfile.cc poppler-0.6.1-patched/goo/gfile.cc
--- poppler-0.6.1/goo/gfile.cc 2007-09-17 20:37:39.000000000 +0200
+++ poppler-0.6.1-patched/goo/gfile.cc 2007-11-06 12:07:50.325498138 +0100
@@ -634,7 +634,7 @@
delete name;
}
-GDir::GDir(char *name, GBool doStatA) {
+GDir::GDir(const char *name, GBool doStatA) {
path = new GooString(name);
doStat = doStatA;
#if defined(WIN32)
diff -ur poppler-0.6.1/goo/gfile.h poppler-0.6.1-patched/goo/gfile.h
--- poppler-0.6.1/goo/gfile.h 2007-09-17 20:37:39.000000000 +0200
+++ poppler-0.6.1-patched/goo/gfile.h 2007-11-06 12:07:39.212878631 +0100
@@ -117,7 +117,7 @@
class GDir {
public:
- GDir(char *name, GBool doStatA = gTrue);
+ GDir(const char *name, GBool doStatA = gTrue);
~GDir();
GDirEntry *getNextEntry();
void rewind();

View file

@ -0,0 +1,56 @@
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 @@
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) {

View file

@ -0,0 +1,17 @@
args: with args;
stdenv.mkDerivation {
name = "poppler-0.6.1";
src = fetchurl {
url = http://poppler.freedesktop.org/poppler-0.6.1.tar.gz;
sha256 = "1wiz7m36wr4l0ihnawl7ww2ai0cx81ly5ych9wmyh348py4jgyyl";
};
propagatedBuildInputs = [qt4 zlib glib cairo freetype fontconfig libjpeg gtk];
configureFlags = "--enable-shared --disable-static --enable-exceptions
--enable-cairo --enable-splash --enable-poppler-glib --enable-zlib";
patches = [ ./GDir-const.patch ./datadir_env.patch ./use_exceptions.patch ];
preConfigure = "sed -e '/jpeg_incdirs/s@/usr@${libjpeg}@' -i configure";
}

View file

@ -0,0 +1,60 @@
diff -ur poppler-0.6.1/goo/gmem.cc poppler-0.6.1-patched/goo/gmem.cc
--- poppler-0.6.1/goo/gmem.cc 2007-10-12 13:34:49.000000000 +0200
+++ poppler-0.6.1-patched/goo/gmem.cc 2007-11-06 16:17:41.290632269 +0100
@@ -60,7 +60,7 @@
}
size1 = gMemDataSize(size);
if (!(mem = (char *)malloc(size1 + gMemHdrSize + gMemTrlSize))) {
-#if USE_EXCEPTIONS
+#ifdef USE_EXCEPTIONS
throw GMemException();
#else
fprintf(stderr, "Out of memory\n");
@@ -95,7 +95,7 @@
return NULL;
}
if (!(p = malloc(size))) {
-#if USE_EXCEPTIONS
+#ifdef USE_EXCEPTIONS
throw GMemException();
#else
fprintf(stderr, "Out of memory\n");
@@ -143,7 +143,7 @@
q = malloc(size);
}
if (!q) {
-#if USE_EXCEPTIONS
+#ifdef USE_EXCEPTIONS
throw GMemException();
#else
fprintf(stderr, "Out of memory\n");
@@ -162,7 +162,7 @@
}
n = nObjs * objSize;
if (objSize <= 0 || nObjs < 0 || nObjs >= INT_MAX / objSize) {
-#if USE_EXCEPTIONS
+#ifdef USE_EXCEPTIONS
throw GMemException();
#else
fprintf(stderr, "Bogus memory allocation size\n");
@@ -183,7 +183,7 @@
}
n = nObjs * objSize;
if (objSize <= 0 || nObjs < 0 || nObjs >= INT_MAX / objSize) {
-#if USE_EXCEPTIONS
+#ifdef USE_EXCEPTIONS
throw GMemException();
#else
fprintf(stderr, "Bogus memory allocation size\n");
diff -ur poppler-0.6.1/goo/gmem.h poppler-0.6.1-patched/goo/gmem.h
--- poppler-0.6.1/goo/gmem.h 2007-09-17 20:37:39.000000000 +0200
+++ poppler-0.6.1-patched/goo/gmem.h 2007-11-06 16:17:46.606925527 +0100
@@ -12,7 +12,7 @@
#include <stdio.h>
#include <poppler/poppler-config.h>
-#if USE_EXCEPTIONS
+#ifdef USE_EXCEPTIONS
class GMemException {
public:

View file

@ -2141,6 +2141,11 @@ rec {
unicodeSupport = getFlag "unicode" "pcre" false; unicodeSupport = getFlag "unicode" "pcre" false;
}; };
poppler = import ../development/libraries/poppler {
inherit fetchurl stdenv qt4 cairo freetype fontconfig zlib libjpeg;
inherit (gtkLibs) glib gtk;
};
popt = import ../development/libraries/popt { popt = import ../development/libraries/popt {
inherit fetchurl stdenv gettext; inherit fetchurl stdenv gettext;
}; };
@ -3349,6 +3354,10 @@ rec {
inherit fetchurl stdenv; inherit fetchurl stdenv;
}; };
poppler_data = import ../data/misc/poppler-data {
inherit fetchurl stdenv;
};
ttf_bitstream_vera = import ../data/fonts/ttf-bitstream-vera { ttf_bitstream_vera = import ../data/fonts/ttf-bitstream-vera {
inherit fetchurl stdenv; inherit fetchurl stdenv;
}; };