[tex-k] libpoppler support in TeX Live source tree

Norbert Preining preining at logic.at
Wed Mar 18 11:18:16 CET 2009


Hi all,

now that Peter is so kind and is reworking our TeX Live build auto-magic
I would like to ask one thing: Do you think it is possible to implement
support for poppler as alternative library instead of xpdf?

Rationale: Some distributions use llibpoppler instead of xpdf to have a
shared library where sec fixes are only going into on package.

I have a patch for TeX Live that *unconditionally* turn on libpoppler
support, it is very crude because I have no idea about the auto* magic.
But actual changes to the code are quite small.

I attach the patch against the current sources *ON THE DVD*.

I am also willing to later on care for the poppler support, i.e., at
least check for compilability.

I had a bit of discussion with Martin Schröder and he wants to do
something similar for luatex, so it would be nice to unite the efforts a
bit.

Thanks for consideration and all the best

Norbert

-------------------------------------------------------------------------------
Dr. Norbert Preining <preining at logic.at>        Vienna University of Technology
Debian Developer <preining at debian.org>                         Debian TeX Group
gpg DSA: 0x09C5B094      fp: 14DF 2E6C 0307 BE6D AD76  A9C0 D2BF 4AA3 09C5 B094
-------------------------------------------------------------------------------
AIGBURTH (n.)
Any piece of readily identifiable anatomy found amongst cooked meat.
			--- Douglas Adams, The Meaning of Liff
-------------- next part --------------
# 30_libpoppler.dpatch
#
# use libpoppler instead of libxpdf in pdfetex and xetex
# don't build pdftosrc as it needs libpoppler from experimental 

@DPATCH@
 build/source/texlive-20080816-source/configure                           |    6 -
 build/source/texlive-20080816-source/configure.in                        |    8 -
 build/source/texlive-20080816-source/texk/web2c/pdftexdir/Makefile.in    |    7 +
 build/source/texlive-20080816-source/texk/web2c/pdftexdir/depend.mk      |   58 ----------
 build/source/texlive-20080816-source/texk/web2c/pdftexdir/pdftex.mk      |    9 +
 build/source/texlive-20080816-source/texk/web2c/pdftexdir/pdftexextra.in |    2 
 build/source/texlive-20080816-source/texk/web2c/pdftexdir/pdftoepdf.cc   |   41 +++----
 build/source/texlive-20080816-source/texk/web2c/pdftexdir/pdftosrc.cc    |   39 +++---
 build/source/texlive-20080816-source/texk/web2c/pdftexdir/utils.c        |    6 -
 build/source/texlive-20080816-source/texk/web2c/xetexdir/XeTeX_ext.c     |    8 -
 build/source/texlive-20080816-source/texk/web2c/xetexdir/pdfimage.cpp    |   26 +++-
 build/source/texlive-20080816-source/texk/web2c/xetexdir/xetex.mk        |   12 +-
 12 files changed, 100 insertions(+), 122 deletions(-)

Index: texlive-bin-2008.svn12198/build/source/texlive-20080816-source/texk/web2c/pdftexdir/depend.mk
===================================================================
--- texlive-bin-2008.svn12198.orig/build/source/texlive-20080816-source/texk/web2c/pdftexdir/depend.mk	2009-03-10 20:05:59.000000000 +0100
+++ texlive-bin-2008.svn12198/build/source/texlive-20080816-source/texk/web2c/pdftexdir/depend.mk	2009-03-10 20:06:13.000000000 +0100
@@ -1,55 +1,5 @@
-epdf.o: epdf.c ptexlib.h ../pdftexd.h ../texmfmp.h ../cpascal.h \
- ../config.h ../help.h ../texmfmem.h ../pdftexcoerce.h ptexmac.h
-mapfile.o: mapfile.c ptexlib.h ../pdftexd.h ../texmfmp.h ../cpascal.h \
- ../config.h ../help.h ../texmfmem.h ../pdftexcoerce.h ptexmac.h
-papersiz.o: papersiz.c ptexlib.h ../pdftexd.h ../texmfmp.h \
- ../cpascal.h ../config.h ../help.h ../texmfmem.h ../pdftexcoerce.h \
- ptexmac.h
-utils.o: utils.c ptexlib.h ../pdftexd.h ../texmfmp.h ../cpascal.h \
- ../config.h ../help.h ../texmfmem.h ../pdftexcoerce.h ptexmac.h \
- ../../../libs/zlib/zlib.h ../../../libs/zlib/zconf.h \
- ../../../libs/md5/md5.h pdftexextra.h \
- ../../../libs/obsdcompat/openbsd-compat.h
-vfpacket.o: vfpacket.c ptexlib.h ../pdftexd.h ../texmfmp.h \
- ../cpascal.h ../config.h ../help.h ../texmfmem.h ../pdftexcoerce.h \
- ptexmac.h
-pkin.o: pkin.c ptexlib.h ../pdftexd.h ../texmfmp.h ../cpascal.h \
- ../config.h ../help.h ../texmfmem.h ../pdftexcoerce.h ptexmac.h
-writefont.o: writefont.c ../../../libs/xpdf/goo/gmem.h ptexlib.h \
- ../pdftexd.h ../texmfmp.h ../cpascal.h ../config.h ../help.h \
- ../texmfmem.h ../pdftexcoerce.h ptexmac.h
-writet1.o: writet1.c ptexlib.h ../pdftexd.h ../texmfmp.h ../cpascal.h \
- ../config.h ../help.h ../texmfmem.h ../pdftexcoerce.h ptexmac.h
-writet3.o: writet3.c ptexlib.h ../pdftexd.h ../texmfmp.h ../cpascal.h \
- ../config.h ../help.h ../texmfmem.h ../pdftexcoerce.h ptexmac.h
-writezip.o: writezip.c ptexlib.h ../pdftexd.h ../texmfmp.h \
- ../cpascal.h ../config.h ../help.h ../texmfmem.h ../pdftexcoerce.h \
- ptexmac.h ../../../libs/zlib/zlib.h ../../../libs/zlib/zconf.h
-writeenc.o: writeenc.c ptexlib.h ../pdftexd.h ../texmfmp.h \
- ../cpascal.h ../config.h ../help.h ../texmfmem.h ../pdftexcoerce.h \
- ptexmac.h
-writettf.o: writettf.c ptexlib.h writettf.h ../pdftexd.h ../texmfmp.h \
- ../cpascal.h ../config.h ../help.h ../texmfmem.h ../pdftexcoerce.h \
- ptexmac.h macnames.c
-writejpg.o: writejpg.c ptexlib.h ../pdftexd.h ../texmfmp.h \
- ../cpascal.h ../config.h ../help.h ../texmfmem.h ../pdftexcoerce.h \
- ptexmac.h image.h
-writepng.o: writepng.c ptexlib.h ../pdftexd.h ../texmfmp.h \
- ../cpascal.h ../config.h ../help.h ../texmfmem.h ../pdftexcoerce.h \
- ptexmac.h image.h
-writeimg.o: writeimg.c ptexlib.h ../pdftexd.h ../texmfmp.h \
- ../cpascal.h ../config.h ../help.h ../texmfmem.h ../pdftexcoerce.h \
- ptexmac.h image.h
-pdftoepdf.o: pdftoepdf.cc ../../../libs/xpdf/xpdf/Object.h \
- ../../../libs/xpdf/goo/gmem.h ../../../libs/xpdf/xpdf/Array.h \
- ../../../libs/xpdf/xpdf/Dict.h ../../../libs/xpdf/xpdf/Stream.h \
- ../../../libs/xpdf/xpdf/XRef.h ../../../libs/xpdf/xpdf/Catalog.h \
- ../../../libs/xpdf/xpdf/Page.h ../../../libs/xpdf/xpdf/GfxFont.h \
- ../../../libs/xpdf/xpdf/Error.h epdf.h
+pdftoepdf.o: pdftoepdf.cc epdf.h ../../kpathsea/c-auto.h \
+  ../../kpathsea/c-proto.h ../../web2c/c-auto.h ../../web2c/config.h \
+  ../../kpathsea/c-fopen.h ../../web2c/pdftexdir/ptexmac.h
 ttf2afm.o: ttf2afm.c writettf.h macnames.c
-pdftosrc.o: pdftosrc.cc ../../../libs/xpdf/xpdf/Object.h \
- ../../../libs/xpdf/xpdf/Array.h ../../../libs/xpdf/xpdf/Dict.h \
- ../../../libs/xpdf/xpdf/Stream.h ../../../libs/xpdf/xpdf/XRef.h \
- ../../../libs/xpdf/xpdf/Catalog.h ../../../libs/xpdf/xpdf/Page.h \
- ../../../libs/xpdf/xpdf/PDFDoc.h ../../../libs/xpdf/xpdf/Link.h \
- ../../../libs/xpdf/xpdf/Error.h ../../../libs/xpdf/xpdf/config.h
+pdftosrc.o: pdftosrc.cc
Index: texlive-bin-2008.svn12198/build/source/texlive-20080816-source/texk/web2c/pdftexdir/pdftoepdf.cc
===================================================================
--- texlive-bin-2008.svn12198.orig/build/source/texlive-20080816-source/texk/web2c/pdftexdir/pdftoepdf.cc	2009-03-10 20:05:59.000000000 +0100
+++ texlive-bin-2008.svn12198/build/source/texlive-20080816-source/texk/web2c/pdftexdir/pdftoepdf.cc	2009-03-10 20:06:13.000000000 +0100
@@ -24,25 +24,24 @@
 #include <stdio.h>
 #include <string.h>
 #include <ctype.h>
-#include <aconf.h>
-#include <GString.h>
-#include <gmem.h>
-#include <gfile.h>
-#include <config.h>
 #include <assert.h>
-#include "Object.h"
-#include "Stream.h"
-#include "Array.h"
-#include "Dict.h"
-#include "XRef.h"
-#include "Catalog.h"
-#include "Link.h"
-#include "Page.h"
-#include "GfxFont.h"
-#include "PDFDoc.h"
-#include "GlobalParams.h"
-#include "Error.h"
-
+#include <dirent.h>
+#include <poppler/poppler-config.h>
+#include <poppler/goo/GooString.h>
+#include <poppler/goo/gmem.h>
+#include <poppler/goo/gfile.h>
+#include "poppler/Object.h"
+#include "poppler/Stream.h"
+#include "poppler/Array.h"
+#include "poppler/Dict.h"
+#include "poppler/XRef.h"
+#include "poppler/Link.h"
+#include "poppler/Catalog.h"
+#include "poppler/Page.h"
+#include "poppler/GfxFont.h"
+#include "poppler/PDFDoc.h"
+#include "poppler/GlobalParams.h"
+#include "poppler/Error.h"
 #include "epdf.h"
 
 static const char _svn_version[] =
@@ -159,7 +158,7 @@
     fprintf(stderr, "\npdfTeX Debug: Creating %s (%d)\n", p->file_name,
             p->occurences);
 #endif
-    GString *docName = new GString(p->file_name);
+    GooString *docName = new GooString(p->file_name);
     p->doc = new PDFDoc(docName);       // takes ownership of docName
     if (!p->doc->isOk() || !p->doc->okToPrint()) {
         pdftex_fail("xpdf: reading PDF image failed");
@@ -520,7 +519,7 @@
     int i, l, c;
     Ref ref;
     char *p;
-    GString *s;
+    GooString *s;
     if (obj->isBool()) {
         pdf_printf("%s", obj->getBool()? "true" : "false");
     } else if (obj->isInt()) {
@@ -713,7 +712,7 @@
     epdf_num_pages = pdf_doc->doc->getCatalog()->getNumPages();
     if (page_name) {
         // get page by name
-        GString name(page_name);
+        GooString name(page_name);
         LinkDest *link = pdf_doc->doc->findDest(&name);
         if (link == 0 || !link->isOk())
             pdftex_fail("PDF inclusion: invalid destination <%s>", page_name);
Index: texlive-bin-2008.svn12198/build/source/texlive-20080816-source/texk/web2c/pdftexdir/pdftosrc.cc
===================================================================
--- texlive-bin-2008.svn12198.orig/build/source/texlive-20080816-source/texk/web2c/pdftexdir/pdftosrc.cc	2009-03-10 20:05:59.000000000 +0100
+++ texlive-bin-2008.svn12198/build/source/texlive-20080816-source/texk/web2c/pdftexdir/pdftosrc.cc	2009-03-10 20:06:13.000000000 +0100
@@ -23,22 +23,23 @@
 #include <stdio.h>
 #include <string.h>
 #include <ctype.h>
-#include <aconf.h>
 #include <assert.h>
-#include <GString.h>
-#include <gmem.h>
-#include <gfile.h>
-#include "Object.h"
-#include "Stream.h"
-#include "Array.h"
-#include "Dict.h"
-#include "XRef.h"
-#include "Catalog.h"
-#include "Page.h"
-#include "GfxFont.h"
-#include "PDFDoc.h"
-#include "GlobalParams.h"
-#include "Error.h"
+
+#include <dirent.h>
+#include <poppler/goo/GooString.h>
+#include <poppler/goo/gmem.h>
+#include <poppler/goo/gfile.h>
+#include "poppler/Object.h"
+#include "poppler/Stream.h"
+#include "poppler/Array.h"
+#include "poppler/Dict.h"
+#include "poppler/XRef.h"
+#include "poppler/Catalog.h"
+#include "poppler/Page.h"
+#include "poppler/GfxFont.h"
+#include "poppler/PDFDoc.h"
+#include "poppler/GlobalParams.h"
+#include "poppler/Error.h"
 
 static const char _svn_version[] =
     "$Id: pdftosrc.cc 7945 2008-05-08 14:25:16Z martin $ $URL: http://scm.foundry.supelec.fr/svn/pdftex/branches/stable/source/src/texk/web2c/pdftexdir/pdftosrc.cc $";
@@ -49,7 +50,7 @@
 {
     char *p, buf[1024];
     PDFDoc *doc;
-    GString *fileName;
+    GooString *fileName;
     Stream *s;
     Object srcStream, srcName, catalogDict;
     FILE *outfile;
@@ -63,8 +64,8 @@
                 "Usage: pdftosrc <PDF-file> [<stream-object-number>]\n");
         exit(1);
     }
-    fileName = new GString(argv[1]);
-    globalParams = new GlobalParams();
+    fileName = new GooString(argv[1]);
+    globalParams = new GlobalParams(NULL);
     doc = new PDFDoc(fileName);
     if (!doc->isOk()) {
         fprintf(stderr, "Invalid PDF file\n");
@@ -84,7 +85,7 @@
     }
     srcStream.initNull();
     if (objnum == 0) {
-        catalogDict.dictLookup("SourceObject", &srcStream);
+        catalogDict.dictLookup(UGooString("SourceObject"), &srcStream);
         if (!srcStream.isStream("SourceFile")) {
             fprintf(stderr, "No SourceObject found\n");
             exit(1);
Index: texlive-bin-2008.svn12198/build/source/texlive-20080816-source/texk/web2c/pdftexdir/Makefile.in
===================================================================
--- texlive-bin-2008.svn12198.orig/build/source/texlive-20080816-source/texk/web2c/pdftexdir/Makefile.in	2009-03-10 20:05:59.000000000 +0100
+++ texlive-bin-2008.svn12198/build/source/texlive-20080816-source/texk/web2c/pdftexdir/Makefile.in	2009-03-10 20:06:13.000000000 +0100
@@ -11,6 +11,7 @@
 ALL_CXXFLAGS = @CXXFLAGS@ @DEFS@ $(XXCFLAGS) \
   -I. -I$(srcdir) \
   -I$(kpathsea_dir_parent) -I$(kpathsea_srcdir_parent) \
+  -I/usr/include/poppler \
   @LIBXPDFCPPFLAGS@ \
   -I$(LIBOBSDCOMPATDIR) -I$(LIBOBSDCOMPATDIR)/.. \
   -I$(LIBOBSDCOMPATSRCDIR) -I$(LIBOBSDCOMPATSRCDIR)/.. \
@@ -38,11 +39,15 @@
 LIBOBSDCOMPATDIR=../../../libs/obsdcompat
 LIBOBSDCOMPATSRCDIR=$(srcdir)/$(LIBOBSDCOMPATDIR)
 
+POPPLERVERSION=`pkg-config --modversion poppler`
+
 XCPPFLAGS=-I.. -I$(srcdir)/.. -I../.. -I$(srcdir)/../.. -I$(LIBMD5DIR) \
   -I$(LIBMD5SRCDIR) @LIBPNGCPPFLAGS@ @ZLIBCPPFLAGS@ \
   -I$(LIBXPDFDIR) -I$(LIBXPDFDIR)/.. -I$(LIBXPDFSRCDIR) -I$(LIBXPDFSRCDIR)/.. \
   -I$(LIBOBSDCOMPATDIR) -I$(LIBOBSDCOMPATDIR)/.. -I$(LIBOBSDCOMPATSRCDIR) \
-  -I$(LIBOBSDCOMPATSRCDIR)/.. -DpdfTeX
+  -I$(LIBOBSDCOMPATSRCDIR)/.. -DpdfTeX \
+  -DPOPPLERVERSION=\"$(POPPLERVERSION)\"
+
 
 OBJS = epdf.o mapfile.o utils.o vfpacket.o pkin.o \
 writefont.o writet1.o writet3.o writezip.o writeenc.o writettf.o \
Index: texlive-bin-2008.svn12198/build/source/texlive-20080816-source/texk/web2c/pdftexdir/pdftex.mk
===================================================================
--- texlive-bin-2008.svn12198.orig/build/source/texlive-20080816-source/texk/web2c/pdftexdir/pdftex.mk	2009-03-10 20:05:59.000000000 +0100
+++ texlive-bin-2008.svn12198/build/source/texlive-20080816-source/texk/web2c/pdftexdir/pdftex.mk	2009-03-10 20:06:13.000000000 +0100
@@ -3,6 +3,9 @@
 # differ between releases of pdfeTeX.
 # $Id: pdftex.mk 9446 2008-07-11 06:51:52Z thanh $
 
+# use libpoppler instead of included xpdf code
+ADDLDFLAGS = -lpoppler
+
 # We build pdftex
 pdftex = @PETEX@ pdftex
 pdftexdir = pdftexdir
@@ -30,7 +33,7 @@
 
 # Making pdftex
 pdftex: pdftexd.h $(pdftex_o) $(pdftexextra_o) $(pdftexlibsdep)
-	@CXXHACKLINK@ $(pdftex_o) $(pdftexextra_o) $(pdftexlibs) $(socketlibs) @CXXHACKLDLIBS@ @CXXLDEXTRA@
+	@CXXHACKLINK@ $(pdftex_o) $(pdftexextra_o) $(pdftexlibs) $(socketlibs) @CXXHACKLDLIBS@ @CXXLDEXTRA@ $(ADDLDFLAGS)
 
 # C file dependencies.
 $(pdftex_c) pdftexcoerce.h pdftexd.h: pdftex.p $(web2c_texmf) $(srcdir)/$(pdftexdir)/pdftex.defines $(srcdir)/$(pdftexdir)/pdftex.h
@@ -135,10 +138,10 @@
 	rm -f ttf2afm.c macnames.c
 # 
 # pdftosrc
-pdftosrc = pdftosrc
+pdftosrc = 
 
 pdftosrc: $(pdftexdir)/pdftosrc.o $(LIBXPDFDEP)
-	@CXXHACKLINK@ $(pdftexdir)/pdftosrc.o $(LDLIBXPDF) -lm @CXXLDEXTRA@
+	@CXXHACKLINK@ $(pdftexdir)/pdftosrc.o $(LDLIBXPDF) -lm @CXXLDEXTRA@  $(ADDLDFLAGS)
 $(pdftexdir)/pdftosrc.o:$(srcdir)/$(pdftexdir)/pdftosrc.cc
 	cd $(pdftexdir) && $(MAKE) pdftosrc.o
 check: pdftosrc-check
Index: texlive-bin-2008.svn12198/build/source/texlive-20080816-source/configure
===================================================================
--- texlive-bin-2008.svn12198.orig/build/source/texlive-20080816-source/configure	2009-03-10 20:06:05.000000000 +0100
+++ texlive-bin-2008.svn12198/build/source/texlive-20080816-source/configure	2009-03-10 20:06:13.000000000 +0100
@@ -6835,9 +6835,9 @@
 
 # we need libxpdf for pdf[ex]tex, xetex
 test ! -d $srcdir/$LIBXPDFDIR && : ${needs_libxpdf=no}
-test "$with_pdftex"  != no    && : ${needs_libxpdf=yes}
-test "$with_pdfetex" != no    && : ${needs_libxpdf=yes}
-test "$with_xetex"   != no    && : ${needs_libxpdf=yes}
+test "$with_pdftex"  != no    && : ${needs_libxpdf=no}
+test "$with_pdfetex" != no    && : ${needs_libxpdf=no}
+test "$with_xetex"   != no    && : ${needs_libxpdf=no}
 : ${needs_libxpdf=no}
 export needs_libxpdf
 
Index: texlive-bin-2008.svn12198/build/source/texlive-20080816-source/configure.in
===================================================================
--- texlive-bin-2008.svn12198.orig/build/source/texlive-20080816-source/configure.in	2009-03-10 20:06:05.000000000 +0100
+++ texlive-bin-2008.svn12198/build/source/texlive-20080816-source/configure.in	2009-03-10 20:06:13.000000000 +0100
@@ -163,9 +163,9 @@
 
 # we need libxpdf for pdf[ex]tex, xetex
 test ! -d $srcdir/$LIBXPDFDIR && : ${needs_libxpdf=no}
-test "$with_pdftex"  != no    && : ${needs_libxpdf=yes}
-test "$with_pdfetex" != no    && : ${needs_libxpdf=yes}
-test "$with_xetex"   != no    && : ${needs_libxpdf=yes}
+test "$with_pdftex"  != no    && : ${needs_libxpdf=no}
+test "$with_pdfetex" != no    && : ${needs_libxpdf=no}
+test "$with_xetex"   != no    && : ${needs_libxpdf=no}
 : ${needs_libxpdf=no}
 export needs_libxpdf
 
@@ -220,7 +220,7 @@
 sinclude(libs/ncurses/ncurses.ac)
 sinclude(libs/zlib/zlib.ac)
 sinclude(libs/libpng/libpng.ac)
-sinclude(libs/xpdf/libxpdf.ac)
+#sinclude(libs/xpdf/libxpdf.ac)
 sinclude(libs/t1lib/t1lib.ac)
 sinclude(libs/freetype/freetype.ac)
 sinclude(libs/freetype2/freetype2.ac)
Index: texlive-bin-2008.svn12198/build/source/texlive-20080816-source/texk/web2c/xetexdir/XeTeX_ext.c
===================================================================
--- texlive-bin-2008.svn12198.orig/build/source/texlive-20080816-source/texk/web2c/xetexdir/XeTeX_ext.c	2009-03-10 20:05:59.000000000 +0100
+++ texlive-bin-2008.svn12198/build/source/texlive-20080816-source/texk/web2c/xetexdir/XeTeX_ext.c	2009-03-10 20:06:13.000000000 +0100
@@ -33,7 +33,7 @@
  */
 
 #ifdef XETEX_OTHER
-#include "xpdf/config.h"
+#include "poppler/poppler-config.h"
 #include "png.h"
 #endif
 
@@ -190,7 +190,7 @@
 #else
 		"Compiled with fontconfig version %d.%d.%d; using %d.%d.%d\n"
 		"Compiled with libpng version %s; using %s\n"
-		"Compiled with xpdf version %s\n"
+		"Compiled with libpoppler version %s\n"
 #endif
 		;
 
@@ -201,7 +201,7 @@
 #ifdef XETEX_OTHER
 			+ strlen(PNG_LIBPNG_VER_STRING)
 			+ strlen(png_libpng_ver)
-			+ strlen(xpdfVersion)
+			+ strlen(POPPLERVERSION)
 			+ 6 * 3 /* for fontconfig version #s (won't really need 3 digits per field!) */
 #endif
 			+ 6 * 3; /* for freetype version #s (ditto) */
@@ -226,7 +226,7 @@
 		FC_VERSION / 10000, (FC_VERSION % 10000) / 100, FC_VERSION % 100,
 		fc_version / 10000, (fc_version % 10000) / 100, fc_version % 100,
 		PNG_LIBPNG_VER_STRING, png_libpng_ver,
-		xpdfVersion
+		POPPLERVERSION
 #endif
 		);
 }
Index: texlive-bin-2008.svn12198/build/source/texlive-20080816-source/texk/web2c/xetexdir/pdfimage.cpp
===================================================================
--- texlive-bin-2008.svn12198.orig/build/source/texlive-20080816-source/texk/web2c/xetexdir/pdfimage.cpp	2009-03-10 20:05:59.000000000 +0100
+++ texlive-bin-2008.svn12198/build/source/texlive-20080816-source/texk/web2c/xetexdir/pdfimage.cpp	2009-03-10 20:06:59.000000000 +0100
@@ -11,10 +11,24 @@
 
 #include "pdfimage.h"
 
-#include "PDFDoc.h"
-#include "Catalog.h"
-#include "Page.h"
-#include "GString.h"
+#include <dirent.h>
+#include <poppler/poppler-config.h>
+#include <poppler/goo/GooString.h>
+#include <poppler/goo/gmem.h>
+#include <poppler/goo/gfile.h>
+#include "poppler/Object.h"
+#include "poppler/Stream.h"
+#include "poppler/Array.h"
+#include "poppler/Dict.h"
+#include "poppler/XRef.h"
+#include "poppler/Link.h"
+#include "poppler/Catalog.h"
+#include "poppler/Page.h"
+#include "poppler/GfxFont.h"
+#include "poppler/PDFDoc.h"
+#include "poppler/GlobalParams.h"
+#include "poppler/Error.h"
+
 
 #include "XeTeX_ext.h"
 
@@ -29,7 +43,7 @@
 pdf_get_rect(char* filename, int page_num, int pdf_box, realrect* box)
 	/* return the box converted to TeX points */
 {
-	GString*	name = new GString(filename);
+	GooString*	name = new GooString(filename);
 	PDFDoc*		doc = new PDFDoc(name);
 	
 	if (!doc) {
@@ -88,7 +102,7 @@
 pdf_count_pages(char* filename)
 {
 	int			pages = 0;
-	GString*	name = new GString(filename);
+	GooString*	name = new GooString(filename);
 	PDFDoc*		doc = new PDFDoc(name);
 	
 	if (!doc) {
Index: texlive-bin-2008.svn12198/build/source/texlive-20080816-source/texk/web2c/xetexdir/xetex.mk
===================================================================
--- texlive-bin-2008.svn12198.orig/build/source/texlive-20080816-source/texk/web2c/xetexdir/xetex.mk	2009-03-10 20:05:59.000000000 +0100
+++ texlive-bin-2008.svn12198/build/source/texlive-20080816-source/texk/web2c/xetexdir/xetex.mk	2009-03-10 20:06:13.000000000 +0100
@@ -8,6 +8,10 @@
 # but need to check possible effect on other programs
 ALL_CXXFLAGS = @CXXFLAGS@
 
+# use libpoppler instead of included xpdf code
+ADDLDFLAGS = -lpoppler
+
+
 # We build xetex unless configure decides to skip it
 xetex = @XETEX@ xetex
 
@@ -33,7 +37,7 @@
 
 @XETEX_GENERIC@ XETEX_DEFINES = -DXETEX_OTHER
 
- at XETEX_GENERIC@ EXTRALIBS = @LDLIBXPDF@ @LDLIBPNG@ @LDFONTCONFIG@
+ at XETEX_GENERIC@ EXTRALIBS = @LDLIBXPDF@ @LDLIBPNG@ @LDFONTCONFIG@ $(ADDLDFLAGS)
 
 @XETEX_GENERIC@ EXTRADEPS = @LIBXPDFDEP@ @LIBPNGDEP@
 
@@ -168,7 +172,7 @@
 	$(compile) $(ALL_CFLAGS) $(FTFLAGS) $(LIBPNGCPPFLAGS) $(ZLIBCPPFLAGS) -c $< -o $@
 
 pdfimage.o: $(srcdir)/xetexdir/pdfimage.cpp $(srcdir)/xetexdir/pdfimage.h
-	$(CXX) $(ALL_CFLAGS) $(FTFLAGS) $(LIBXPDFCPPFLAGS) -c $< -o $@
+	$(CXX) $(ALL_CFLAGS) $(FTFLAGS) $(LIBXPDFCPPFLAGS) -I/usr/include/poppler -c $< -o $@
 
 XeTeX_pic.o: $(srcdir)/xetexdir/XeTeX_pic.c $(srcdir)/xetexdir/XeTeX_ext.h $(XeTeXImageHdrs)
 	$(compile) $(TECKITFLAGS) $(FTFLAGS) $(ALL_CFLAGS) $(XETEX_DEFINES) -c $< -o $@
@@ -214,9 +218,11 @@
 		$(XeTeXFontHdrs) $(GRAPHITESRCDIR)/include/graphite/Font.h
 	$(CXX) $(ICUCFLAGS) $(FTFLAGS) $(FONTCONFIGCPPFLAGS) $(GRAPHITEFLAGS) $(ALL_CXXFLAGS) $(XETEX_DEFINES) -c $< -o $@
 
+POPPLERVERSION=`pkg-config --modversion poppler`
+
 # special rules for files that need the TECkit headers as well
 XeTeX_ext.o: $(srcdir)/xetexdir/XeTeX_ext.c xetexd.h
-	$(compile) $(ICUCFLAGS) $(FTFLAGS) $(TECKITFLAGS) $(LIBPNGCPPFLAGS) $(LIBXPDFCPPFLAGS) $(ZLIBCPPFLAGS) $(ALL_CFLAGS) $(XETEX_DEFINES) $(XETEX_GRAPHITE) -c $< -o $@
+	$(compile) $(ICUCFLAGS) $(FTFLAGS) $(TECKITFLAGS) $(LIBPNGCPPFLAGS) $(LIBXPDFCPPFLAGS) $(ZLIBCPPFLAGS) $(ALL_CFLAGS) $(XETEX_DEFINES) $(XETEX_GRAPHITE) -DPOPPLERVERSION=\"$(POPPLERVERSION)\" -c $< -o $@
 XeTeX_mac.o: $(srcdir)/xetexdir/XeTeX_mac.c xetexd.h
 	$(compile) $(ICUCFLAGS) $(TECKITFLAGS) $(ALL_CFLAGS) $(XETEX_DEFINES) -c $< -o $@
 
Index: texlive-bin-2008.svn12198/build/source/texlive-20080816-source/texk/web2c/pdftexdir/utils.c
===================================================================
--- texlive-bin-2008.svn12198.orig/build/source/texlive-20080816-source/texk/web2c/pdftexdir/utils.c	2009-03-10 20:05:59.000000000 +0100
+++ texlive-bin-2008.svn12198/build/source/texlive-20080816-source/texk/web2c/pdftexdir/utils.c	2009-03-10 20:06:13.000000000 +0100
@@ -35,7 +35,7 @@
 #include "zlib.h"
 #include "ptexlib.h"
 #include "png.h"
-#include "xpdf/config.h"        /* just to get the xpdf version */
+#include "poppler/poppler-config.h"        /* just to get the xpdf version */
 
 static const char _svn_version[] =
     "$Id: utils.c 7945 2008-05-08 14:25:16Z martin $ $URL: http://scm.foundry.supelec.fr/svn/pdftex/branches/stable/source/src/texk/web2c/pdftexdir/utils.c $";
@@ -1267,9 +1267,9 @@
     (void) asprintf(versions,
                     "Compiled with libpng %s; using libpng %s\n"
                     "Compiled with zlib %s; using zlib %s\n"
-                    "Compiled with xpdf version %s\n",
+                    "Compiled with libpoppler version %s\n",
                     PNG_LIBPNG_VER_STRING, png_libpng_ver,
-                    ZLIB_VERSION, zlib_version, xpdfVersion);
+                    ZLIB_VERSION, zlib_version, POPPLERVERSION);
 }
 
 
Index: texlive-bin-2008.svn12198/build/source/texlive-20080816-source/texk/web2c/pdftexdir/pdftexextra.in
===================================================================
--- texlive-bin-2008.svn12198.orig/build/source/texlive-20080816-source/texk/web2c/pdftexdir/pdftexextra.in	2009-03-10 20:05:59.000000000 +0100
+++ texlive-bin-2008.svn12198/build/source/texlive-20080816-source/texk/web2c/pdftexdir/pdftexextra.in	2009-03-10 20:06:13.000000000 +0100
@@ -26,7 +26,7 @@
    (generated from ../lib/texmfmp.c).
 */
 
-#define BANNER "This is pdfTeX, Version 3.1415926-PDFTEX-VERSION-ETEX-VERSION"
+#define BANNER "This is pdfTeX using libpoppler, Version 3.1415926-PDFTEX-VERSION-ETEX-VERSION"
 #define COPYRIGHT_HOLDER "Peter Breitenlohner (eTeX)/Han The Thanh (pdfTeX)"
 #define AUTHOR NULL
 #define PROGRAM_HELP PDFTEXHELP


More information about the tex-k mailing list