changeset 2423:1ef908a16c3d

New package: poppler
author Stefan Löffler <st.loeffler@gmail.com>
date Tue, 17 Apr 2012 21:07:25 +0200
parents 051a0bfd6400
children 9fadee4a9a23
files src/poppler-application-fonts-dir.patch src/poppler-no-dll-export.patch src/poppler-path-check.patch src/poppler-qt4-globalparams.patch src/poppler-test.cxx src/poppler-zapf-dingbats.patch src/poppler.mk
diffstat 7 files changed, 256 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/poppler-application-fonts-dir.patch	Tue Apr 17 21:07:25 2012 +0200
@@ -0,0 +1,22 @@
+diff --git a/poppler/GlobalParamsWin.cc b/poppler/GlobalParamsWin.cc
+index f989fb8..7ec1b8f 100644
+--- a/poppler/GlobalParamsWin.cc
++++ b/poppler/GlobalParamsWin.cc
+@@ -274,10 +280,15 @@ DisplayFontParam *GlobalParams::getDisplayFont(GfxFont *font) {
+     DisplayFontParam *  dfp;
+     GooString *         fontName = font->getName();
+     char *              substFontName = NULL;
++    char                appDir[MAX_PATH];
+ 
+     if (!fontName) return NULL;
+     lockGlobalParams;
+-    setupBaseFonts(NULL);
++    if (::GetModuleFileName(0, appDir, MAX_PATH) > 0)
++        setupBaseFonts(appendToPath(grabPath(appDir), "fonts")->getCString());
++    else
++        setupBaseFonts(NULL);
++    
+     dfp = (DisplayFontParam *)displayFonts->lookup(fontName);
+     if (!dfp) {
+         substFontName = findSubstituteName(fontName->getCString());
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/poppler-no-dll-export.patch	Tue Apr 17 21:07:25 2012 +0200
@@ -0,0 +1,77 @@
+--- a/qt4/src/poppler-export.h	2010-06-24 18:36:48.918858971 +0200
++++ b/qt4/src/poppler-export.h	2010-06-24 18:37:05.658857764 +0200
+@@ -2,13 +2,8 @@
+ * This file is used to set the poppler_qt4_EXPORT macros right.
+ * This is needed for setting the visibility on windows, it will have no effect on other platforms.
+ */
+-#if defined(_WIN32)
+-# define LIB_EXPORT __declspec(dllexport)
+-# define LIB_IMPORT __declspec(dllimport)
+-#else
+ # define LIB_EXPORT
+ # define LIB_IMPORT
+-#endif
+ 
+ #ifdef poppler_qt4_EXPORTS
+ # define POPPLER_QT4_EXPORT LIB_EXPORT
+--- a/cpp/poppler-global.h	2012-04-16 08:02:52.946380873 +0200
++++ b/cpp/poppler-global.h	2012-04-16 08:03:23.882534269 +0200
+@@ -20,13 +20,8 @@
+ #ifndef POPPLER_GLOBAL_H
+ #define POPPLER_GLOBAL_H
+ 
+-#if defined(_WIN32)
+-#  define LIB_EXPORT __declspec(dllexport)
+-#  define LIB_IMPORT __declspec(dllimport)
+-#else
+ #  define LIB_EXPORT
+ #  define LIB_IMPORT
+-#endif
+ 
+ #if defined(poppler_cpp_EXPORTS)
+ #  define POPPLER_CPP_EXPORT LIB_EXPORT
+--- a/poppler/XpdfPluginAPI.h	2012-04-16 08:05:16.523092822 +0200
++++ b/poppler/XpdfPluginAPI.h	2012-04-16 08:05:49.019253960 +0200
+@@ -28,19 +28,11 @@
+  */
+ #define xpdfPluginAPIVersion 1
+ 
+-#ifdef _WIN32
+-#  ifdef __cplusplus
+-#    define PLUGINFUNC(retType) extern "C" __declspec(dllexport) retType
+-#  else
+-#    define PLUGINFUNC(retType) extern __declspec(dllexport) retType
+-#  endif
+-#else
+ #  ifdef __cplusplus
+ #    define PLUGINFUNC(retType) extern "C" retType
+ #  else
+ #    define PLUGINFUNC(retType) extern retType
+ #  endif
+-#endif
+ 
+ /*------------------------------------------------------------------------
+  * Plugin setup/cleanup
+@@ -285,22 +277,12 @@
+ 
+ } XpdfPluginVecTable;
+ 
+-#ifdef _WIN32
+-
+-extern __declspec(dllexport) XpdfPluginVecTable xpdfPluginVecTable;
+-
+-#define xpdfPluginSetup \
+-  extern __declspec(dllexport) \
+-  XpdfPluginVecTable xpdfPluginVecTable = {xpdfPluginAPIVersion};
+-
+-#else
+ 
+ extern XpdfPluginVecTable xpdfPluginVecTable;
+ 
+ #define xpdfPluginSetup \
+   XpdfPluginVecTable xpdfPluginVecTable = {xpdfPluginAPIVersion};
+ 
+-#endif
+ 
+ #define xpdfGetInfoDict (*xpdfPluginVecTable._xpdfGetInfoDict)
+ #define xpdfGetCatalog (*xpdfPluginVecTable._xpdfGetCatalog)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/poppler-path-check.patch	Tue Apr 17 21:07:25 2012 +0200
@@ -0,0 +1,14 @@
+diff --git a/poppler/GlobalParamsWin.cc b/poppler/GlobalParamsWin.cc
+index f989fb8..7ec1b8f 100644
+--- a/poppler/GlobalParamsWin.cc
++++ b/poppler/GlobalParamsWin.cc
+@@ -239,7 +245,7 @@ void GlobalParams::setupBaseFonts(char * dir)
+         if (displayFonts->lookup(fontName))
+             continue;
+ 
+-        if (dir) {
++        if (dir && displayFontTab[i].t1FileName) {
+             GooString *fontPath = appendToPath(new GooString(dir), displayFontTab[i].t1FileName);
+             if (FileExists(fontPath->getCString())) {
+                 AddFont(displayFonts, fontName, fontPath, displayFontT1);
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/poppler-qt4-globalparams.patch	Tue Apr 17 21:07:25 2012 +0200
@@ -0,0 +1,59 @@
+diff --git a/qt4/src/poppler-document.cc b/qt4/src/poppler-document.cc
+index 04c56c6..d1d45d9 100644
+--- a/qt4/src/poppler-document.cc
++++ b/qt4/src/poppler-document.cc
+@@ -46,6 +46,7 @@
+ namespace Poppler {
+ 
+   int DocumentData::count = 0;
++  GBool DocumentData::ownGlobalParams = gFalse;
+ 
+   Document *Document::load(const QString &filePath, const QByteArray &ownerPassword,
+ 			   const QByteArray &userPassword)
+diff --git a/qt4/src/poppler-private.cc b/qt4/src/poppler-private.cc
+index d6e3265..075b3fd 100644
+--- a/qt4/src/poppler-private.cc
++++ b/qt4/src/poppler-private.cc
+@@ -234,8 +234,13 @@ namespace Debug {
+         count --;
+         if ( count == 0 )
+         {
+-            utf8Map = 0;
+-            delete globalParams;
++            if ( ownGlobalParams )
++            {
++                utf8Map = 0;
++                delete globalParams;
++                globalParams = NULL;
++                ownGlobalParams = gFalse;
++            }
+         }
+       }
+     
+@@ -250,8 +255,12 @@ namespace Debug {
+       
+         if ( count == 0 )
+         {
+-            utf8Map = 0;
+-            globalParams = new GlobalParams();
++            if ( !globalParams )
++            {
++                utf8Map = 0;
++                globalParams = new GlobalParams();
++                ownGlobalParams = gTrue;
++            }
+             setErrorFunction(qt4ErrorFunction);
+         }
+         count ++;
+diff --git a/qt4/src/poppler-private.h b/qt4/src/poppler-private.h
+index 7d0b1a3..9614e38 100644
+--- a/qt4/src/poppler-private.h
++++ b/qt4/src/poppler-private.h
+@@ -197,6 +197,7 @@ namespace Poppler {
+ 	QColor paperColor;
+ 	int m_hints;
+ 	static int count;
++	static GBool ownGlobalParams;
+     };
+ 
+     class FontInfoData
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/poppler-test.cxx	Tue Apr 17 21:07:25 2012 +0200
@@ -0,0 +1,12 @@
+#include <iostream>
+#include <cpp/poppler-version.h>
+
+int main(int argc, char *argv[])
+{
+    (void)argc;
+    (void)argv;
+
+    std::cout << "Poppler version: " << poppler::version_string() << std::endl;
+    
+    return 0;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/poppler-zapf-dingbats.patch	Tue Apr 17 21:07:25 2012 +0200
@@ -0,0 +1,14 @@
+diff --git a/poppler/GlobalParamsWin.cc b/poppler/GlobalParamsWin.cc
+index f989fb8..7ec1b8f 100644
+--- a/poppler/GlobalParamsWin.cc
++++ b/poppler/GlobalParamsWin.cc
+@@ -79,7 +79,8 @@ static struct {
+     {"Times-Italic",          "n021023l.pfb", "timesi.ttf"},
+     {"Times-Roman",           "n021003l.pfb", "times.ttf"},
+     // TODO: not sure if "wingding.ttf" is right
+-    {"ZapfDingbats",          "d050000l.pfb", "wingding.ttf"},
++    // no, the symbol sets are quite different
++    {"ZapfDingbats",          "d050000l.pfb", NULL},
+ 
+     // those seem to be frequently accessed by PDF files and I kind of guess
+     // which font file do the refer to
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/poppler.mk	Tue Apr 17 21:07:25 2012 +0200
@@ -0,0 +1,58 @@
+# This file is part of MXE.
+# See index.html for further information.
+
+PKG             := poppler
+$(PKG)_IGNORE   :=
+$(PKG)_CHECKSUM := 3753caecba71afaf29f097e0b9c52e0f83a10a59
+$(PKG)_SUBDIR   := poppler-$($(PKG)_VERSION)
+$(PKG)_FILE     := poppler-$($(PKG)_VERSION).tar.gz
+$(PKG)_URL      := http://poppler.freedesktop.org/$($(PKG)_FILE)
+$(PKG)_DEPS     := gcc glib cairo libpng lcms jpeg tiff freetype zlib curl qt
+
+define $(PKG)_UPDATE
+    wget -q -O- 'http://poppler.freedesktop.org/' | \
+    $(SED) -n 's,.*"poppler-\([0-9.]\+\)\.tar\.gz".*,\1,p' | \
+    head -1
+endef
+
+define $(PKG)_BUILD
+    # Note: Specifying LIBS explicitly is necessary for configure to properly
+    #       pick up libtiff (otherwise linking a minimal test program fails not
+    #       because libtiff is not found, but because some references are
+    #       undefined)
+    cd '$(1)' && ./configure \
+        --host='$(TARGET)' \
+        --prefix='$(PREFIX)/$(TARGET)' \
+        --disable-silent-rules \
+        --disable-shared \
+        --enable-static \
+        --enable-xpdf-headers \
+        --enable-poppler-qt4 \
+        --enable-zlib \
+        --enable-libcurl \
+        --enable-libtiff \
+        --enable-libjpeg \
+        --enable-libpng \
+        --enable-poppler-glib \
+        --enable-poppler-cpp \
+        --enable-cairo-output \
+        --enable-splash-output \
+        --enable-compile-warnings=yes \
+        --enable-introspection=auto \
+        --disable-libopenjpeg \
+        --disable-gtk-test \
+        --disable-utils \
+        --disable-gtk-doc \
+        --disable-gtk-doc-html \
+        --disable-gtk-doc-pdf \
+        --with-font-configuration=win32 \
+        LIBS="`'$(TARGET)-pkg-config' zlib liblzma --libs` -ljpeg"
+    $(MAKE) -C '$(1)' -j '$(JOBS)' install bin_PROGRAMS= sbin_PROGRAMS= noinst_PROGRAMS=
+
+    # Test program
+    '$(TARGET)-g++' \
+        -W -Wall -Werror -ansi -pedantic \
+        '$(2).cxx' -o '$(PREFIX)/$(TARGET)/bin/test-poppler.exe' \
+        `'$(TARGET)-pkg-config' poppler poppler-cpp --cflags --libs`
+endef
+