[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#651169: luatex: Patch for porting to poppler 0.18



found 651169 luatex/0.70.1-2
thanks

Alle venerdì 9 dicembre 2011, Hilmar Preuße ha scritto:
> Upstream has a better patch, which uses the features of 0.17 as long
> as 0.17 is available.
> 
> http://foundry.supelec.fr/gf/project/luatex/scmsvn/?action=browse&pat
> h=%2Ftrunk%2Fsource%2Ftexk%2Fweb2c%2Fluatexdir%2Flua%2Flepdflib.cc&r1
> =4343&r2=4346&view=patch
> 
> We should use that one.

Indeed, but an important part of r4346 (the change to epdf.h[1], in 
particular) has been missing, which causes the effects of the 
libpoppler-0.18 patch to not be used when compiling against poppler 
0.18.x. The only drawback of that is that it (ab)uses a poppler frontend 
(the cpp one) to know the poppler version, so you'll need to build 
depend on libpoppler-cpp-dev too (only used for few #defines, no linking 
nor runtime usage of poppler-cpp).

Attached there is an improved version of the existing libpoppler-0.18 
patch which also includes the file above; it (with the addition of the 
libpoppler-cpp-dev B-D) allowed me to build luatex with both poppler 
0.16.x and poppler 0.18.x.

[1] source/texk/web2c/luatexdir/image/epdf.h

Thanks,
-- 
Pino Toscano
--- a/source/texk/web2c/luatexdir/lua/lepdflib.cc
+++ b/source/texk/web2c/luatexdir/lua/lepdflib.cc
@@ -89,7 +89,10 @@
 new_poppler_userdata(Annots);
 new_poppler_userdata(Array);
 new_poppler_userdata(Catalog);
+#if POPPLER_VERSION_MAJOR == 0 && (POPPLER_VERSION_MINOR < 17 || \
+    ( POPPLER_VERSION_MINOR == 17 && POPPLER_VERSION_MICRO < 2))
 new_poppler_userdata(EmbFile);
+#endif
 new_poppler_userdata(Dict);
 //new_poppler_userdata(GooString);
 new_poppler_userdata(LinkDest);
@@ -393,7 +396,11 @@
     printf("\n===== Annot GC ===== uin=<%p>\n", uin);
 #endif
     if (uin->atype == ALLOC_LEPDF)
+#if POPPLER_VERSION_MAJOR == 0 && POPPLER_VERSION_MINOR < 17
         delete(Annot *) uin->d;
+#else
+        ((Annot *) uin->d)->decRefCnt();
+#endif
     return 0;
 }
 
@@ -410,6 +417,8 @@
 //**********************************************************************
 // AnnotBorderStyle
 
+#if POPPLER_VERSION_MAJOR == 0 && POPPLER_VERSION_MINOR < 17
+
 m_poppler_get_DOUBLE(AnnotBorderStyle, getWidth);
 
 m_poppler__tostring(AnnotBorderStyle);
@@ -420,9 +429,9 @@
     uin = (udstruct *) luaL_checkudata(L, 1, M_Annots);
     if (uin->pd != NULL && uin->pd->pc != uin->pc)
         pdfdoc_changed_error(L);
-#ifdef DEBUG
+#  ifdef DEBUG
     printf("\n===== Annots GC ===== uin=<%p>\n", uin);
-#endif
+#  endif
     if (uin->atype == ALLOC_LEPDF)
         delete(Annots *) uin->d;
     return 0;
@@ -435,6 +444,8 @@
     {NULL, NULL}                // sentinel
 };
 
+#endif
+
 //**********************************************************************
 // Annots
 
@@ -684,6 +695,8 @@
 m_poppler_get_poppler(Catalog, Object, getDests);
 m_poppler_get_INT(Catalog, numEmbeddedFiles);
 
+#if POPPLER_VERSION_MAJOR == 0 && (POPPLER_VERSION_MINOR < 17 || \
+    ( POPPLER_VERSION_MINOR == 17 && POPPLER_VERSION_MICRO < 2))
 static int m_Catalog_embeddedFile(lua_State * L)
 {
     EmbFile *ef;
@@ -707,6 +720,7 @@
         lua_pushnil(L);
     return 1;
 }
+#endif
 
 m_poppler_get_INT(Catalog, numJS);
 
@@ -749,7 +763,9 @@
     {"findDest", m_Catalog_findDest},
     {"getDests", m_Catalog_getDests},
     {"numEmbeddedFiles", m_Catalog_numEmbeddedFiles},
+#if POPPLER_VERSION_MAJOR == 0 && POPPLER_VERSION_MINOR < 17
     {"embeddedFile", m_Catalog_embeddedFile},
+#endif
     {"numJS", m_Catalog_numJS},
     {"getJS", m_Catalog_getJS},
     {"getOutline", m_Catalog_getOutline},
@@ -761,6 +777,9 @@
 //**********************************************************************
 // EmbFile
 
+#if POPPLER_VERSION_MAJOR == 0 && (POPPLER_VERSION_MINOR < 17 || \
+    ( POPPLER_VERSION_MINOR == 17 && POPPLER_VERSION_MICRO < 2))
+
 m_poppler_get_GOOSTRING(EmbFile, name);
 m_poppler_get_GOOSTRING(EmbFile, description);
 m_poppler_get_INT(EmbFile, size);
@@ -801,6 +820,8 @@
     {NULL, NULL}                // sentinel
 };
 
+#endif
+
 //**********************************************************************
 // Dict
 
@@ -2683,11 +2704,16 @@
 {
     register_meta(Annot);
     // TODO register_meta(AnnotBorder);
+#if POPPLER_VERSION_MAJOR == 0 && POPPLER_VERSION_MINOR < 17
     register_meta(AnnotBorderStyle);
+#endif
     register_meta(Annots);
     register_meta(Array);
     register_meta(Catalog);
+#if POPPLER_VERSION_MAJOR == 0 && (POPPLER_VERSION_MINOR < 17 || \
+    ( POPPLER_VERSION_MINOR == 17 && POPPLER_VERSION_MICRO < 2))
     register_meta(EmbFile);
+#endif
     register_meta(Dict);
     register_meta(GooString);
     register_meta(LinkDest);
--- a/source/texk/web2c/luatexdir/image/epdf.h
+++ b/source/texk/web2c/luatexdir/image/epdf.h
@@ -33,6 +33,7 @@
 #  include <sys/stat.h>
 #  include <dirent.h>
 #  include <poppler-config.h>
+#  include <cpp/poppler-version.h>
 #  include <goo/GooString.h>
 #  include <goo/gmem.h>
 #  include <goo/gfile.h>

Attachment: signature.asc
Description: This is a digitally signed message part.


Reply to: