On Sun, Jul 13, 2008 at 10:11:16PM +0200, Matthias Kramm wrote:
> On Sun, Jul 13, 2008 at 06:05:07PM +0200, Patrice Dumas <[EMAIL PROTECTED]>
> wrote:
> > I have added the possibility to link against poppler instead of xpdf.
> > Of course it doesn't work because there are many functions that are
> > private in the original xpdf and are public after applying
> > xpdf-changes.patch, and other API changes.
> >
> > The patch is merged with a rebased patch for external libart.
>
> Ok, I'll have a look at the patch. (It might be a bit fiddly it
> apply, because the libart changes are already merged. I'll let
> you know if I need you to rebase it)
I've done it, if you want to have a look.
Also I forgot to say that I commented out the rules for programs that are
part of xpdf since they seemed not to be really maintained.
--
Pat
? aclocal.m4
? autom4te.cache
? config.h.in-autoheader
? config.h.in-autoheader2
? xpdf_to_poppler.h
? lib/xpdf-changes.patch
? lib/pdf/Makefile
? lib/pdf/xpdf-3.02
? lib/pdf/xpdf-3.02.tar.gz
? lib/readers/Makefile
? pdf2swf/fonts/Makefile
Index: config.h.in
===================================================================
RCS file: /cvsroot/swftools/swftools/config.h.in,v
retrieving revision 1.39
diff -u -3 -p -r1.39 config.h.in
--- config.h.in 13 Jul 2008 18:53:39 -0000 1.39
+++ config.h.in 13 Jul 2008 19:09:33 -0000
@@ -146,6 +146,15 @@
/* Define if OpenGL seems to work */
#undef HAVE_OPENGL
+/* Define if you use poppler */
+#undef HAVE_POPPLER
+
+/* Define to 1 if you have the `poppler' library (-lpoppler). */
+#undef HAVE_LIBPOPPLER
+
+/* Define to 1 if you have the <OutputDev.h> header file. */
+#undef HAVE_OUTPUTDEV_H
+
/* Define if you have the jpeg library (-ljpeg). */
/* Define if you have the jpeg library (-ljpeg). */
#undef HAVE_LIBJPEG
@@ -238,5 +247,6 @@
#endif
#endif
+#include "xpdf_to_poppler.h"
#endif
Index: configure.in
===================================================================
RCS file: /cvsroot/swftools/swftools/configure.in,v
retrieving revision 1.130
diff -u -3 -p -r1.130 configure.in
--- configure.in 13 Jul 2008 18:55:05 -0000 1.130
+++ configure.in 13 Jul 2008 19:09:33 -0000
@@ -21,6 +21,8 @@ AC_ARG_ENABLE(lame,
[ --disable-lame don't compile any L.A.M.E. mp3 encoding code in],
DISABLE_LAME=true)
AC_ARG_WITH([external-libart],
[ --with-external-libart use external libart library (at your own risk)],
[EXTERNAL_LIBART=true])
+AC_ARG_WITH([poppler],
+[ --with-poppler use poppler instead of xpdf (at your own risk)],
[USE_POPPLER=true])
PACKAGE=swftools
VERSION=2008-06-23-2005
@@ -135,6 +137,8 @@ fi
AC_PROG_LN_S
AC_CHECK_PROGS(UNCOMPRESS, gzip uncompress compress, )
+PKG_PROG_PKG_CONFIG
+
dnl Checks for system services
OBJEXT="o"
AREXT=".a"
@@ -314,6 +318,29 @@ if test "x$EXTERNAL_LIBART" = "xtrue"; t
fi
AC_SUBST([art_in_source])
+xpdf_in_source='$(xpdf_objects)'
+splash_in_source='$(splash_objects)'
+
+if test "x$USE_POPPLER" = "xtrue"; then
+ xpdf_in_source=
+ splash_in_source=
+ AC_DEFINE([HAVE_POPPLER],[1],[use poppler])
+ PKG_CHECK_MODULES([POPPLER],[poppler
poppler-splash],,[poppler_pkgconfig=no])
+ if test "x$poppler_pkgconfig" = "xno"; then
+ AC_LANG_PUSH([C++])
+ AC_CHECK_HEADERS([OutputDev.h],[
+ AC_CHECK_LIB([poppler],[main],,[])
+ ],[AC_MSG_ERROR([No poppler library found. This library is
required.])])
+ AC_LANG_POP
+ else
+ CPPFLAGS="$CPPFLAGS $POPPLER_CFLAGS"
+ AC_DEFINE([HAVE_POPPLER], [1])
+ LIBS="$LIBS $POPPLER_LIBS"
+ fi
+fi
+AC_SUBST([xpdf_in_source])
+AC_SUBST([splash_in_source])
+
# ------------------------------------------------------------------
RFX_CHECK_AVI2SWF
@@ -506,6 +533,8 @@ AH_BOTTOM([
#endif
#endif
+#include "xpdf_to_poppler.h"
+
#endif // __config_h__
])
Index: lib/Makefile.in
===================================================================
RCS file: /cvsroot/swftools/swftools/lib/Makefile.in,v
retrieving revision 1.84
diff -u -3 -p -r1.84 Makefile.in
--- lib/Makefile.in 13 Jul 2008 18:46:27 -0000 1.84
+++ lib/Makefile.in 13 Jul 2008 19:09:33 -0000
@@ -13,6 +13,7 @@ lame_in_source = @lame_in_source@
h263_objects = h.263/dct.$(O) h.263/h263tables.$(O) h.263/swfvideo.$(O)
actioncompiler_objects = action/assembler.$(O) action/compile.$(O)
action/lex.swf4.$(O) action/lex.swf5.$(O) action/libming.$(O)
action/swf4compiler.tab.$(O) action/swf5compiler.tab.$(O)
action/actioncompiler.$(O)
+
actioncompiler_in_source = $(actioncompiler_objects)
rfxswf_modules = modules/swfbits.c modules/swfaction.c modules/swfdump.c
modules/swfcgi.c modules/swfbutton.c modules/swftext.c modules/swffont.c
modules/swftools.c modules/swfsound.c modules/swfshape.c modules/swfobject.c
modules/swfdraw.c modules/swffilter.c modules/swfrender.c h.263/swfvideo.c
Index: lib/pdf/GFXOutputDev.cc
===================================================================
RCS file: /cvsroot/swftools/swftools/lib/pdf/GFXOutputDev.cc,v
retrieving revision 1.66
diff -u -3 -p -r1.66 GFXOutputDev.cc
--- lib/pdf/GFXOutputDev.cc 19 Jun 2008 20:30:33 -0000 1.66
+++ lib/pdf/GFXOutputDev.cc 13 Jul 2008 19:09:34 -0000
@@ -38,9 +38,13 @@
#endif
//xpdf header files
#include "config.h"
+#ifdef HAVE_POPPLER
+#include <goo/GooString.h>
+#include <goo/gfile.h>
+#else
#include "gfile.h"
#include "GString.h"
-#include "gmem.h"
+#endif
#include "Object.h"
#include "Stream.h"
#include "Array.h"
@@ -54,12 +58,8 @@
#include "OutputDev.h"
#include "GfxFont.h"
#include "GfxState.h"
-#include "CharCodeToUnicode.h"
#include "NameToUnicodeTable.h"
#include "GlobalParams.h"
-#include "FoFiType1C.h"
-#include "FoFiTrueType.h"
-#include "GHash.h"
#include "GFXOutputDev.h"
// swftools header files
@@ -123,6 +123,39 @@ struct fontentry {
{"Symbol", "s050000l", s050000l_afm, s050000l_afm_len,
s050000l_pfb, s050000l_pfb_len},
{"ZapfDingbats", "d050000l", d050000l_afm, d050000l_afm_len,
d050000l_pfb, d050000l_pfb_len}};
+#ifdef HAVE_POPLER
+char* mktmpname(char*ptr) {
+ static char tmpbuf[128];
+ char*dir = getTempDir();
+ int l = strlen(dir);
+ char*sep = "";
+ if(!ptr)
+ ptr = tmpbuf;
+ if(l && dir[l-1]!='/' && dir[l-1]!='\\') {
+#ifdef WIN32
+ sep = "\\";
+#else
+ sep = "/";
+#endif
+ }
+
+ // used to be mktemp. This does remove the warnings, but
+ // It's not exactly an improvement.
+#ifdef HAVE_LRAND48
+ sprintf(ptr, "%s%s%08x%08x",dir,sep,lrand48(),lrand48());
+#else
+# ifdef HAVE_RAND
+ sprintf(ptr, "%s%s%08x%08x",dir,sep,rand(),rand());
+# else
+ static int count = 1;
+ sprintf(ptr, "%s%s%08x%04x%04x",dir,sep,time(0),(unsigned
int)tmpbuf^((un
+signed int)tmpbuf)>>16,count);
+ count ++;
+# endif
+#endif
+ return ptr;
+}
+#endif
static int verbose = 0;
static int dbgindent = 0;
Index: lib/pdf/GFXOutputDev.h
===================================================================
RCS file: /cvsroot/swftools/swftools/lib/pdf/GFXOutputDev.h,v
retrieving revision 1.23
diff -u -3 -p -r1.23 GFXOutputDev.h
--- lib/pdf/GFXOutputDev.h 8 Jul 2008 09:26:48 -0000 1.23
+++ lib/pdf/GFXOutputDev.h 13 Jul 2008 19:09:34 -0000
@@ -207,7 +207,7 @@ public:
int width, int height,
GfxImageColorMap*colorMap, GBool invert,
GBool inlineImg, int mask, int *maskColors,
Stream *maskStr, int maskWidth, int
maskHeight, GBool maskInvert, GfxImageColorMap*maskColorMap);
- int setGfxFont(char*id, char*name, char*filename, double maxSize,
CharCodeToUnicode*ctu);
+// int setGfxFont(char*id, char*name, char*filename, double maxSize,
CharCodeToUnicode*ctu);
void strokeGfxline(GfxState *state, gfxline_t*line, int flags);
void clipToGfxLine(GfxState *state, gfxline_t*line);
void fillGfxLine(GfxState *state, gfxline_t*line);
Index: lib/pdf/InfoOutputDev.cc
===================================================================
RCS file: /cvsroot/swftools/swftools/lib/pdf/InfoOutputDev.cc,v
retrieving revision 1.12
diff -u -3 -p -r1.12 InfoOutputDev.cc
--- lib/pdf/InfoOutputDev.cc 8 Jul 2008 09:26:37 -0000 1.12
+++ lib/pdf/InfoOutputDev.cc 13 Jul 2008 19:09:34 -0000
@@ -1,9 +1,18 @@
+#include "config.h"
#include "Object.h"
-#include "SplashTypes.h"
+#include "InfoOutputDev.h"
#include "SplashOutputDev.h"
+#ifdef HAVE_POPPLER
+#include <splash/SplashTypes.h>
+#include <splash/SplashPath.h>
+#include <splash/SplashFont.h>
+#include <splash/SplashFontFile.h>
+#else
+#include "SplashTypes.h"
#include "SplashPath.h"
+#include "SplashFont.h"
#include "SplashFontFile.h"
-#include "InfoOutputDev.h"
+#endif
#include "GfxState.h"
#include "../log.h"
#include <math.h>
Index: lib/pdf/InfoOutputDev.h
===================================================================
RCS file: /cvsroot/swftools/swftools/lib/pdf/InfoOutputDev.h,v
retrieving revision 1.8
diff -u -3 -p -r1.8 InfoOutputDev.h
--- lib/pdf/InfoOutputDev.h 8 Jul 2008 09:26:25 -0000 1.8
+++ lib/pdf/InfoOutputDev.h 13 Jul 2008 19:09:34 -0000
@@ -23,11 +23,24 @@
#include "GfxFont.h"
#include "OutputDev.h"
-#include "SplashFont.h"
#include "SplashOutputDev.h"
+#ifdef HAVE_POPPLER
+#include <splash/SplashTypes.h>
+#include <splash/SplashPath.h>
+#include <splash/SplashFont.h>
+#include <splash/SplashFontFile.h>
+#else
+#include "SplashTypes.h"
#include "SplashPath.h"
+#include "SplashFont.h"
#include "SplashFontFile.h"
+#endif
+
+#ifdef HAVE_POPPLER
+#include <goo/GooHash.h>
+#else
#include "GHash.h"
+#endif
struct GlyphInfo
{
Index: lib/pdf/Makefile.in
===================================================================
RCS file: /cvsroot/swftools/swftools/lib/pdf/Makefile.in,v
retrieving revision 1.23
diff -u -3 -p -r1.23 Makefile.in
--- lib/pdf/Makefile.in 5 Apr 2008 07:24:20 -0000 1.23
+++ lib/pdf/Makefile.in 13 Jul 2008 19:09:34 -0000
@@ -1,7 +1,7 @@
# Generated automatically from Makefile.in by configure.
top_builddir = ../..
-srcdir = .
-top_srcdir = ../..
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
include ../../Makefile.common
all: ../libpdf$(A) pdf2swf$(E)
@@ -10,6 +10,8 @@ libpdf: ../libpdf$(A)
libpdf_objects = GFXOutputDev.$(O) InfoOutputDev.$(O) BitmapOutputDev.$(O)
FullBitmapOutputDev.$(O) pdf.$(O) fonts.$(O)
+xpdf_in_source = @xpdf_in_source@
+
xpdf_objects = xpdf/GHash.$(O) xpdf/GList.$(O) xpdf/GString.$(O)
xpdf/gmem.$(O) xpdf/gfile.$(O) \
xpdf/FoFiTrueType.$(O) xpdf/FoFiType1.$(O)
xpdf/FoFiType1C.$(O) xpdf/FoFiBase.$(O) xpdf/FoFiEncodings.$(O) \
xpdf/OutputDev.$(O) xpdf/PDFDoc.$(O) xpdf/Error.$(O)
xpdf/Stream.$(O) xpdf/Object.$(O) \
@@ -20,6 +22,8 @@ xpdf_objects = xpdf/GHash.$(O) xpdf/GLi
xpdf/PSTokenizer.$(O) xpdf/FontEncodingTables.$(O)
xpdf/BuiltinFont.$(O) xpdf/BuiltinFontTables.$(O) \
xpdf/GfxState.$(O) xpdf/Function.$(O) xpdf/Annot.$(O)
xpdf/NameToCharCode.$(O) xpdf/UnicodeMap.$(O) \
xpdf/SecurityHandler.$(O)
+
+splash_in_source = @splash_in_source@
splash_objects = xpdf/SplashOutputDev.$(O) xpdf/SplashFont.$(O)
xpdf/SplashState.$(O) xpdf/Splash.$(O) \
xpdf/SplashBitmap.$(O) xpdf/SplashClip.$(O)
xpdf/SplashPattern.$(O) \
xpdf/SplashFontEngine.$(O) xpdf/SplashFontFile.$(O)
xpdf/SplashFontFileID.$(O) \
@@ -27,7 +31,7 @@ splash_objects = xpdf/SplashOutputDev.$(
xpdf/SplashFTFontEngine.$(O) xpdf/SplashFTFontFile.$(O)
xpdf/SplashFTFont.$(O)
fonts.$(O): fonts.c
- $(C) -I ./ -I xpdf fonts.c -o $@
+ $(C) fonts.c -o $@
cmyk.$(O): cmyk.cc
$(CC) -I ./ -I xpdf cmyk.cc -o $@
GFXOutputDev.$(O): GFXOutputDev.cc GFXOutputDev.h CommonOutputDev.h
../gfxpoly.h
@@ -136,26 +140,26 @@ xpdf/%.$(O): xpdf/%.cc
$(CC) -I ./ -I xpdf $< -o $@
-../libpdf$(A): $(libpdf_objects) $(xpdf_objects) $(splash_objects)
- $(AR) r ../libpdf$(A) $(libpdf_objects) $(xpdf_objects)
$(splash_objects)
+../libpdf$(A): $(libpdf_objects) $(xpdf_in_source) $(splash_in_source)
+ $(AR) r ../libpdf$(A) $(libpdf_objects) $(xpdf_in_source)
$(splash_in_source)
$(RANLIB) ../libpdf$(A)
-xpdfapp_objects=xpdf/XPDF*.cc xpdf/PDFCore.cc xpdf/TextOutputDev.cc
xpdf/xpdf.cc xpdf/CoreOutputDev.cc xpdf/UnicodeTypeTable.cc xpdf/PSOutputDev.cc
-xxpdf$(E): $(xpdf_objects) xpdf/Splash*.cc
- $(LL) $(CPPFLAGS) -DXPDFEXE -g -I xpdf -I . $(xpdfapp_objects)
$(xpdf_objects) xpdf/Splash*.cc xpdf/parseargs.c -o xxpdf$(E) $(LIBS) -lXm -lX11
-
-pdftoppm$(E): $(xpdf_objects) xpdf/Splash*.cc
- $(LL) $(CPPFLAGS) -DXPDFEXE -g -I xpdf -I . xpdf/pdftoppm.cc
$(xpdf_objects) xpdf/Splash*.cc xpdf/parseargs.c -o pdftoppm$(E) $(LIBS)
-pdftotext$(E): $(xpdf_objects) $(splash_objects)
- $(LL) $(CPPFLAGS) -DXPDFEXE -g -I xpdf -I . xpdf/pdftotext.cc
$(xpdf_objects) xpdf/TextOutput*.cc xpdf/UnicodeType*.cc xpdf/parseargs.c -o
pdftotext$(E) $(LIBS)
+#xpdfapp_objects=xpdf/XPDF*.cc xpdf/PDFCore.cc xpdf/TextOutputDev.cc
xpdf/xpdf.cc xpdf/CoreOutputDev.cc xpdf/UnicodeTypeTable.cc xpdf/PSOutputDev.cc
+#xxpdf$(E): $(xpdf_objects) xpdf/Splash*.cc
+# $(LL) $(CPPFLAGS) -DXPDFEXE -g -I xpdf -I . $(xpdfapp_objects)
$(xpdf_objects) xpdf/Splash*.cc xpdf/parseargs.c -o xxpdf$(E) $(LIBS) -lXm -lX11
+
+#pdftoppm$(E): $(xpdf_objects) xpdf/Splash*.cc
+# $(LL) $(CPPFLAGS) -DXPDFEXE -g -I xpdf -I . xpdf/pdftoppm.cc
$(xpdf_objects) xpdf/Splash*.cc xpdf/parseargs.c -o pdftoppm$(E) $(LIBS)
+#pdftotext$(E): $(xpdf_objects) $(splash_objects)
+# $(LL) $(CPPFLAGS) -DXPDFEXE -g -I xpdf -I . xpdf/pdftotext.cc
$(xpdf_objects) xpdf/TextOutput*.cc xpdf/UnicodeType*.cc xpdf/parseargs.c -o
pdftotext$(E) $(LIBS)
gfx_objects = ../libgfxswf$(A) ../libgfx$(A) ../librfxswf$(A) ../libbase$(A)
gfx_objects2 = $(gfx_objects) ../devices/lrf.$(O) ../libocr$(A)
-pdf2swf$(E): ../../src/pdf2swf.c $(libpdf_objects) $(xpdf_objects)
$(splash_objects) $(gfx_objects)
- $(LL) $(CPPFLAGS) -g ../../src/pdf2swf.c $(libpdf_objects)
$(xpdf_objects) $(splash_objects) $(gfx_objects) -o pdf2swf$(E) $(LIBS)
-gfx2gfx$(E): ../../src/gfx2gfx.c $(libpdf_objects) $(xpdf_objects)
$(splash_objects) $(gfx_objects2)
- $(LL) $(CPPFLAGS) -g ../../src/gfx2gfx.c $(libpdf_objects)
$(xpdf_objects) $(splash_objects) $(gfx_objects2) -o gfx2gfx$(E) $(LIBS)
+pdf2swf$(E): ../../src/pdf2swf.c $(libpdf_objects) $(xpdf_in_source)
$(splash_in_source) $(gfx_objects)
+ $(LL) $(CPPFLAGS) -g ../../src/pdf2swf.c $(libpdf_objects)
$(xpdf_in_source) $(splash_in_source) $(gfx_objects) -o pdf2swf$(E) $(LIBS)
+gfx2gfx$(E): ../../src/gfx2gfx.c $(libpdf_objects) $(xpdf_in_source)
$(splash_in_source) $(gfx_objects2)
+ $(LL) $(CPPFLAGS) -g ../../src/gfx2gfx.c $(libpdf_objects)
$(xpdf_in_source) $(splash_in_source) $(gfx_objects2) -o gfx2gfx$(E) $(LIBS)
install:
uninstall: