[tldistro] libxpdf vs poppler
Patrice Dumas
pertusus at free.fr
Wed Apr 16 09:39:01 CEST 2008
On Mon, Apr 14, 2008 at 11:57:59PM +0200, Alexis Ballier wrote:
> Hi,
>
> I've seen some other distros patching texlive to use poppler. I can
> easily see the pros (code sharing, less security issues, etc.) but also
> see some cons: api changes in poppler, differing from what the texlive
> team has been working with, possible subtle differences between the
> two...
We use also libpoppler in fedora. I attach the patch. It is not the
cleanest patch ever for the part relating with building against an
external poppler, but it works.
> problems than it may cause ? Do different poppler releases require
> code/patches adjustments ?
It is a bit young in fedora, but unless I am wrong there was a recent
libpoppler ABI incompatible change, but it didn't required to change
the texlive patch.
--
Pat
-------------- next part --------------
diff -up texlive-2007/texk/web2c/pdftexdir/pdftex.mk.poppler texlive-2007/texk/web2c/pdftexdir/pdftex.mk
--- texlive-2007/texk/web2c/pdftexdir/pdftex.mk.poppler 2006-12-27 00:37:34.000000000 +0100
+++ texlive-2007/texk/web2c/pdftexdir/pdftex.mk 2007-11-28 11:53:15.000000000 +0100
@@ -2,6 +2,9 @@
# This fragment contains the parts of the makefile that are most likely to
# differ between releases of pdfeTeX.
+# use libpoppler instead of included xpdf code
+ADDLDFLAGS = -lpoppler
+
# We build pdftex
pdftex = @PETEX@ pdftex
pdftexdir = pdftexdir
@@ -29,7 +32,7 @@ pdftex_o = pdftexini.o pdftex0.o pdftex1
# 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
@@ -156,7 +159,7 @@ ttf2afm-clean:
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
diff -up texlive-2007/texk/web2c/pdftexdir/pdftoepdf.cc.poppler texlive-2007/texk/web2c/pdftexdir/pdftoepdf.cc
--- texlive-2007/texk/web2c/pdftexdir/pdftoepdf.cc.poppler 2006-12-27 00:37:34.000000000 +0100
+++ texlive-2007/texk/web2c/pdftexdir/pdftoepdf.cc 2007-11-28 11:53:15.000000000 +0100
@@ -26,25 +26,24 @@ $Id: pdftoepdf.cc,v 1.9 2006/09/01 18:06
#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"
// This file is mostly C and not very much C++; it's just used to interface
@@ -169,7 +168,7 @@ static PdfDocument *find_add_document(ch
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");
@@ -511,7 +510,7 @@ static void copyObject(Object * obj)
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()) {
@@ -703,7 +702,7 @@ read_pdf_info(char *image_name, char *pa
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);
diff -up texlive-2007/texk/web2c/pdftexdir/pdftexextra.in.poppler texlive-2007/texk/web2c/pdftexdir/pdftexextra.in
--- texlive-2007/texk/web2c/pdftexdir/pdftexextra.in.poppler 2006-12-27 00:37:34.000000000 +0100
+++ texlive-2007/texk/web2c/pdftexdir/pdftexextra.in 2007-11-28 11:53:15.000000000 +0100
@@ -26,7 +26,7 @@ $Id: pdftexextra.in,v 1.4 2004/08/26 18:
(generated from ../lib/texmfmp.c).
*/
-#define BANNER "This is pdfTeX, Version 3.141592-PDFTEX-VERSION-ETEX-VERSION"
+#define BANNER "This is pdfTeX using libpoppler, Version 3.141592-PDFTEX-VERSION-ETEX-VERSION"
#define COPYRIGHT_HOLDER "Peter Breitenlohner (eTeX)/Han The Thanh (pdfTeX)"
#define AUTHOR NULL
#define PROGRAM_HELP PDFTEXHELP
diff -up texlive-2007/texk/web2c/pdftexdir/pdftosrc.cc.poppler texlive-2007/texk/web2c/pdftexdir/pdftosrc.cc
--- texlive-2007/texk/web2c/pdftexdir/pdftosrc.cc.poppler 2006-12-27 00:37:34.000000000 +0100
+++ texlive-2007/texk/web2c/pdftexdir/pdftosrc.cc 2007-11-28 12:03:48.000000000 +0100
@@ -25,22 +25,23 @@ $Id: //depot/Build/source.development/Te
#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 XRef *xref = 0;
@@ -48,7 +49,7 @@ int main(int argc, char *argv[])
{
char *p, buf[1024];
PDFDoc *doc;
- GString *fileName;
+ GooString *fileName;
Stream *s;
Object srcStream, srcName, catalogDict;
FILE *outfile;
@@ -62,7 +63,7 @@ int main(int argc, char *argv[])
"Usage: pdftosrc <PDF-file> [<stream-object-number>]\n");
exit(1);
}
- fileName = new GString(argv[1]);
+ fileName = new GooString(argv[1]);
globalParams = new GlobalParams();
doc = new PDFDoc(fileName);
if (!doc->isOk()) {
diff -up texlive-2007/texk/web2c/pdftexdir/utils.c.poppler texlive-2007/texk/web2c/pdftexdir/utils.c
--- texlive-2007/texk/web2c/pdftexdir/utils.c.poppler 2007-01-01 18:20:03.000000000 +0100
+++ texlive-2007/texk/web2c/pdftexdir/utils.c 2007-11-28 11:53:15.000000000 +0100
@@ -37,7 +39,7 @@ $Id: //depot/Build/source.development/Te
#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 */
#define check_nprintf(size_get, size_want) \
if ((unsigned)(size_get) >= (unsigned)(size_want)) \
@@ -1261,7 +1263,7 @@ void initversionstring(char **versions)
(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);
}
diff -up texlive-2007/texk/web2c/xetexdir/pdfimage.cpp.poppler texlive-2007/texk/web2c/xetexdir/pdfimage.cpp
--- texlive-2007/texk/web2c/xetexdir/pdfimage.cpp.poppler 2006-12-09 11:29:12.000000000 +0100
+++ texlive-2007/texk/web2c/xetexdir/pdfimage.cpp 2007-11-28 11:53:15.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"
@@ -28,7 +42,7 @@ my_fmin(double x, double y)
int
pdf_get_rect(char* filename, int page_num, int pdf_box, realrect* box)
{
- GString* name = new GString(filename);
+ GooString* name = new GooString(filename);
PDFDoc* doc = new PDFDoc(name);
if (!doc) {
diff -up texlive-2007/texk/web2c/xetexdir/XeTeX_ext.c.poppler texlive-2007/texk/web2c/xetexdir/XeTeX_ext.c
--- texlive-2007/texk/web2c/xetexdir/XeTeX_ext.c.poppler 2007-01-15 14:04:36.000000000 +0100
+++ texlive-2007/texk/web2c/xetexdir/XeTeX_ext.c 2007-11-28 11:53:15.000000000 +0100
@@ -33,7 +33,7 @@ authorization from SIL International.
*/
#ifdef XETEX_OTHER
-#include "xpdf/config.h"
+#include "poppler/poppler-config.h"
#include "png.h"
#endif
@@ -194,7 +194,7 @@ void initversionstring(char **versions)
#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
;
diff -up texlive-2007/texk/web2c/xetexdir/xetex.mk.poppler texlive-2007/texk/web2c/xetexdir/xetex.mk
--- texlive-2007/texk/web2c/xetexdir/xetex.mk.poppler 2007-11-28 11:53:15.000000000 +0100
+++ texlive-2007/texk/web2c/xetexdir/xetex.mk 2007-11-28 11:53:15.000000000 +0100
@@ -4,6 +4,10 @@
Makefile: $(srcdir)/xetexdir/xetex.mk
+# use libpoppler instead of included xpdf code
+ADDLDFLAGS = -lpoppler
+
+
# We build xetex unless configure decides to skip it
xetex = @XETEX@ xetex
@@ -29,7 +33,7 @@ xetex = @XETEX@ xetex
@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@
@@ -144,7 +148,7 @@ pngimage.o: $(srcdir)/xetexdir/pngimage.
$(compile) $(ALL_CFLAGS) $(LIBPNGCPPFLAGS) $(ZLIBCPPFLAGS) -c $< -o $@
pdfimage.o: $(srcdir)/xetexdir/pdfimage.cpp $(srcdir)/xetexdir/pdfimage.h
- $(CXX) $(ALL_CFLAGS) $(LIBXPDFCPPFLAGS) -c $< -o $@
+ $(CXX) $(ALL_CFLAGS) $(LIBXPDFCPPFLAGS) -I/usr/include/poppler -c $< -o $@
XeTeX_pic.o: $(srcdir)/xetexdir/XeTeX_pic.c $(srcdir)/xetexdir/XeTeX_ext.h $(XeTeXImageHdrs)
$(compile) $(TECKITFLAGS) $(ALL_CFLAGS) $(XETEX_DEFINES) -c $< -o $@
@@ -187,7 +191,7 @@ XeTeXOTMath.o: $(srcdir)/xetexdir/XeTeXO
# 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) -c $< -o $@
+ $(compile) $(ICUCFLAGS) $(FTFLAGS) $(TECKITFLAGS) $(LIBPNGCPPFLAGS) $(LIBXPDFCPPFLAGS) $(ZLIBCPPFLAGS) $(ALL_CFLAGS) $(XETEX_DEFINES) -I/usr/include/poppler -c $< -o $@
XeTeX_mac.o: $(srcdir)/xetexdir/XeTeX_mac.c xetexd.h
$(compile) $(ICUCFLAGS) $(TECKITFLAGS) $(ALL_CFLAGS) $(XETEX_DEFINES) -c $< -o $@
diff -up texlive-2007/configure.poppler texlive-2007/configure
--- texlive-2007/configure.poppler 2007-01-09 15:16:26.000000000 +0100
+++ texlive-2007/configure 2007-11-28 11:53:15.000000000 +0100
@@ -3442,9 +3442,9 @@ export needs_zlib
# 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
diff -up texlive-2007/configure.in.poppler texlive-2007/configure.in
--- texlive-2007/configure.in.poppler 2007-01-09 02:17:11.000000000 +0100
+++ texlive-2007/configure.in 2007-11-28 11:53:15.000000000 +0100
@@ -157,9 +157,9 @@ export needs_zlib
# 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
@@ -207,7 +207,7 @@ dnl We cannot use variables (e.g. $LIBPN
sinclude(libs/libpng/libpng.ac)
sinclude(libs/zlib/zlib.ac)
sinclude(libs/ncurses/ncurses.ac)
-sinclude(libs/xpdf/libxpdf.ac)
+#sinclude(libs/xpdf/libxpdf.ac)
sinclude(libs/t1lib/t1lib.ac)
sinclude(libs/gd/gd.ac)
sinclude(libs/freetype/freetype.ac)
More information about the tldistro
mailing list