public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] proj/hardened-dev:musl commit in: dev-tex/luatex/, dev-tex/luatex/files/
@ 2014-03-04 14:23 Anthony G. Basile
  0 siblings, 0 replies; only message in thread
From: Anthony G. Basile @ 2014-03-04 14:23 UTC (permalink / raw
  To: gentoo-commits

commit:     5e15ee4801b09afee1f48d7f52d26e1a34b8fbd1
Author:     Felix Janda <felix.janda <AT> posteo <DOT> de>
AuthorDate: Sun Mar  2 09:41:52 2014 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Tue Mar  4 14:24:06 2014 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/hardened-dev.git;a=commit;h=5e15ee48

dev-tex/luatex: add to tree

---
 dev-tex/luatex/files/jmpbuf.patch                  |  21 ++
 dev-tex/luatex/files/kpathsea2012.patch            |  28 ++
 dev-tex/luatex/files/poppler018.patch              | 160 +++++++++
 dev-tex/luatex/files/poppler020.patch              |  75 ++++
 dev-tex/luatex/files/poppler022.patch              | 388 +++++++++++++++++++++
 .../luatex/files/remove-zlib-version-check.patch   |  23 ++
 dev-tex/luatex/luatex-0.70.1-r99.ebuild            | 121 +++++++
 dev-tex/luatex/metadata.xml                        |  10 +
 8 files changed, 826 insertions(+)

diff --git a/dev-tex/luatex/files/jmpbuf.patch b/dev-tex/luatex/files/jmpbuf.patch
new file mode 100644
index 0000000..ec8a41b
--- /dev/null
+++ b/dev-tex/luatex/files/jmpbuf.patch
@@ -0,0 +1,21 @@
+--- a/luatex-beta-0.70.1/source/texk/web2c/luatexdir/lua51/lcoco.c
++++ b/luatex-beta-0.70.1/source/texk/web2c/luatexdir/lua51/lcoco.c
+@@ -340,14 +340,14 @@
+ 
+ #elif defined(__arm__) || defined(__ARM__)
+ 
+-#if __GLIBC__ == 2 || defined(__UCLIBC__)	/* arm-linux-glibc2 */
++#if 1
+ #ifndef __JMP_BUF_SP
+ #define __JMP_BUF_SP	((sizeof(__jmp_buf)/sizeof(int))-2)
+ #endif
+ #define COCO_PATCHCTX(coco, buf, func, stack, a0) \
+-  buf->__jmpbuf[__JMP_BUF_SP+1] = (int)(func); /* pc */ \
+-  buf->__jmpbuf[__JMP_BUF_SP] = (int)(stack); /* sp */ \
+-  buf->__jmpbuf[__JMP_BUF_SP-1] = 0; /* fp */ \
++  ((__jmp_buf *)buf)[__JMP_BUF_SP+1] = (int)(func); /* pc */ \
++  ((__jmp_buf *)buf)[__JMP_BUF_SP] = (int)(stack); /* sp */ \
++  ((__jmp_buf *)buf)[__JMP_BUF_SP-1] = 0; /* fp */ \
+   stack[0] = (size_t)(a0);
+ #define COCO_STACKADJUST	2
+ #define COCO_MAIN_PARAM		int _a, int _b, int _c, int _d, lua_State *L

diff --git a/dev-tex/luatex/files/kpathsea2012.patch b/dev-tex/luatex/files/kpathsea2012.patch
new file mode 100644
index 0000000..80c356d
--- /dev/null
+++ b/dev-tex/luatex/files/kpathsea2012.patch
@@ -0,0 +1,28 @@
+From TeX Live svn rev 23421.
+Remove unnecessary headers. Fixes build with kpathsea from TeX Live 2012.
+
+
+Index: source/texk/web2c/luatexdir/luatex.c
+===================================================================
+--- source/texk/web2c/luatexdir/luatex.c	(revision 23420)
++++ source/texk/web2c/luatexdir/luatex.c	(revision 23421)
+@@ -32,7 +32,6 @@
+ #include <kpathsea/readable.h>
+ #include <kpathsea/variable.h>
+ #include <kpathsea/absolute.h>
+-#include <kpathsea/recorder.h>
+ #ifdef WIN32
+ #include <kpathsea/concatn.h>
+ #endif
+Index: source/texk/web2c/lib/texmfmp.c
+===================================================================
+--- source/texk/web2c/lib/texmfmp.c	(revision 23420)
++++ source/texk/web2c/lib/texmfmp.c	(revision 23421)
+@@ -17,7 +17,6 @@
+ #include <kpathsea/readable.h>
+ #include <kpathsea/variable.h>
+ #include <kpathsea/absolute.h>
+-#include <kpathsea/recorder.h>
+ #ifdef WIN32
+ #include <kpathsea/concatn.h>
+ #endif

diff --git a/dev-tex/luatex/files/poppler018.patch b/dev-tex/luatex/files/poppler018.patch
new file mode 100644
index 0000000..d212538
--- /dev/null
+++ b/dev-tex/luatex/files/poppler018.patch
@@ -0,0 +1,160 @@
+by Martin von Gagern
+https://bugs.gentoo.org/show_bug.cgi?id=384875
+http://thread.gmane.org/gmane.comp.tex.luatex/2630
+
+--- luatex-beta-0.70.1/source/texk/web2c/luatexdir/lua/lepdflib.cc	
++++ luatex-beta-0.70.1/source/texk/web2c/luatexdir/lua/lepdflib.cc	
+@@ -89,7 +89,6 @@ new_poppler_userdata(AnnotBorder);
+ new_poppler_userdata(Annots);
+ new_poppler_userdata(Array);
+ new_poppler_userdata(Catalog);
+-new_poppler_userdata(EmbFile);
+ new_poppler_userdata(Dict);
+ //new_poppler_userdata(GooString);
+ new_poppler_userdata(LinkDest);
+@@ -393,7 +392,7 @@ static int m_Annot__gc(lua_State * L)
+     printf("\n===== Annot GC ===== uin=<%p>\n", uin);
+ #endif
+     if (uin->atype == ALLOC_LEPDF)
+-        delete(Annot *) uin->d;
++        ((Annot *) uin->d)->decRefCnt();
+     return 0;
+ }
+ 
+@@ -408,34 +407,6 @@ static const struct luaL_Reg Annot_m[] =
+ };
+ 
+ //**********************************************************************
+-// AnnotBorderStyle
+-
+-m_poppler_get_DOUBLE(AnnotBorderStyle, getWidth);
+-
+-m_poppler__tostring(AnnotBorderStyle);
+-
+-static int m_Annots__gc(lua_State * L)
+-{
+-    udstruct *uin;
+-    uin = (udstruct *) luaL_checkudata(L, 1, M_Annots);
+-    if (uin->pd != NULL && uin->pd->pc != uin->pc)
+-        pdfdoc_changed_error(L);
+-#ifdef DEBUG
+-    printf("\n===== Annots GC ===== uin=<%p>\n", uin);
+-#endif
+-    if (uin->atype == ALLOC_LEPDF)
+-        delete(Annots *) uin->d;
+-    return 0;
+-}
+-
+-static const struct luaL_Reg AnnotBorderStyle_m[] = {
+-    {"getWidth", m_AnnotBorderStyle_getWidth},
+-    {"__tostring", m_AnnotBorderStyle__tostring},
+-    {"__gc", m_Annots__gc},
+-    {NULL, NULL}                // sentinel
+-};
+-
+-//**********************************************************************
+ // Annots
+ 
+ m_poppler_get_INT(Annots, getNumAnnots);
+@@ -683,31 +654,6 @@ static int m_Catalog_findDest(lua_State
+ 
+ m_poppler_get_poppler(Catalog, Object, getDests);
+ m_poppler_get_INT(Catalog, numEmbeddedFiles);
+-
+-static int m_Catalog_embeddedFile(lua_State * L)
+-{
+-    EmbFile *ef;
+-    int i, len;
+-    udstruct *uin, *uout;
+-    uin = (udstruct *) luaL_checkudata(L, 1, M_Catalog);
+-    if (uin->pd != NULL && uin->pd->pc != uin->pc)
+-        pdfdoc_changed_error(L);
+-    i = luaL_checkint(L, 2);
+-    len = ((Catalog *) uin->d)->numEmbeddedFiles();
+-    if (i > 0 && i <= len) {
+-        ef = ((Catalog *) uin->d)->embeddedFile(i - 1);
+-        if (ef != NULL) {
+-            uout = new_EmbFile_userdata(L);
+-            uout->d = ef;
+-            uout->pc = uin->pc;
+-            uout->pd = uin->pd;
+-        } else
+-            lua_pushnil(L);
+-    } else
+-        lua_pushnil(L);
+-    return 1;
+-}
+-
+ m_poppler_get_INT(Catalog, numJS);
+ 
+ static int m_Catalog_getJS(lua_State * L)
+@@ -749,7 +695,6 @@ static const struct luaL_Reg Catalog_m[]
+     {"findDest", m_Catalog_findDest},
+     {"getDests", m_Catalog_getDests},
+     {"numEmbeddedFiles", m_Catalog_numEmbeddedFiles},
+-    {"embeddedFile", m_Catalog_embeddedFile},
+     {"numJS", m_Catalog_numJS},
+     {"getJS", m_Catalog_getJS},
+     {"getOutline", m_Catalog_getOutline},
+@@ -759,49 +704,6 @@ static const struct luaL_Reg Catalog_m[]
+ };
+ 
+ //**********************************************************************
+-// EmbFile
+-
+-m_poppler_get_GOOSTRING(EmbFile, name);
+-m_poppler_get_GOOSTRING(EmbFile, description);
+-m_poppler_get_INT(EmbFile, size);
+-m_poppler_get_GOOSTRING(EmbFile, modDate);
+-m_poppler_get_GOOSTRING(EmbFile, createDate);
+-m_poppler_get_GOOSTRING(EmbFile, checksum);
+-m_poppler_get_GOOSTRING(EmbFile, mimeType);
+-
+-static int m_EmbFile_streamObject(lua_State * L)
+-{
+-    udstruct *uin, *uout;
+-    uin = (udstruct *) luaL_checkudata(L, 1, M_EmbFile);
+-    if (uin->pd != NULL && uin->pd->pc != uin->pc)
+-        pdfdoc_changed_error(L);
+-    uout = new_Object_userdata(L);
+-    uout->d = new Object();     // automatic init to type "none"
+-    ((EmbFile *) uin->d)->streamObject().copy((Object *) uout->d);
+-    uout->pc = uin->pc;
+-    uout->pd = uin->pd;
+-    return 1;
+-}
+-
+-m_poppler_get_BOOL(EmbFile, isOk);
+-
+-m_poppler__tostring(EmbFile);
+-
+-static const struct luaL_Reg EmbFile_m[] = {
+-    {"name", m_EmbFile_name},
+-    {"description", m_EmbFile_description},
+-    {"size", m_EmbFile_size},
+-    {"modDate", m_EmbFile_modDate},
+-    {"createDate", m_EmbFile_createDate},
+-    {"checksum", m_EmbFile_checksum},
+-    {"mimeType", m_EmbFile_mimeType},
+-    {"streamObject", m_EmbFile_streamObject},
+-    {"isOk", m_EmbFile_isOk},
+-    {"__tostring", m_EmbFile__tostring},
+-    {NULL, NULL}                // sentinel
+-};
+-
+-//**********************************************************************
+ // Dict
+ 
+ static int m_Dict_incRef(lua_State * L)
+@@ -2683,11 +2585,9 @@ int luaopen_epdf(lua_State * L)
+ {
+     register_meta(Annot);
+     // TODO register_meta(AnnotBorder);
+-    register_meta(AnnotBorderStyle);
+     register_meta(Annots);
+     register_meta(Array);
+     register_meta(Catalog);
+-    register_meta(EmbFile);
+     register_meta(Dict);
+     register_meta(GooString);
+     register_meta(LinkDest);

diff --git a/dev-tex/luatex/files/poppler020.patch b/dev-tex/luatex/files/poppler020.patch
new file mode 100644
index 0000000..d3db830
--- /dev/null
+++ b/dev-tex/luatex/files/poppler020.patch
@@ -0,0 +1,75 @@
+https://bugs.gentoo.org/show_bug.cgi?id=416545
+build with poppler-0.20 by Rafał Mużyło
+
+--- source/texk/web2c/luatexdir/lua/lepdflib.cc	2012-05-18 16:23:53.000000000 +0200
++++ source/texk/web2c/luatexdir/lua/lepdflib.cc	2012-05-18 17:43:12.959843483 +0200
+@@ -151,7 +151,7 @@ static int l_new_Annot(lua_State * L)
+         pdfdoc_changed_error(L);
+     uout = new_Annot_userdata(L);
+     uout->d =
+-        new Annot((XRef *) uxref->d, (Dict *) udict->d, (Catalog *) ucatalog->d,
++        new Annot(udict->pd->doc, (Dict *) udict->d,
+                   (Object *) uref->d);
+     uout->atype = ALLOC_LEPDF;
+     uout->pc = uxref->pc;
+@@ -173,7 +173,7 @@ static int l_new_Annots(lua_State * L)
+         pdfdoc_changed_error(L);
+     uout = new_Annots_userdata(L);
+     uout->d =
+-        new Annots((XRef *) uxref->d, (Catalog *) ucatalog->d,
++        new Annots(uannotsobj->pd->doc,
+                    (Object *) uannotsobj->d);
+     uout->atype = ALLOC_LEPDF;
+     uout->pc = uxref->pc;
+@@ -363,7 +363,7 @@ static int m_##type##__tostring(lua_Stat
+ // Annot
+ 
+ m_poppler_get_BOOL(Annot, isOk);
+-m_poppler_get_OBJECT(Annot, getAppearance);
++m_poppler_get_OBJECT(Annot, getAppearanceResDict);
+ m_poppler_get_poppler(Annot, AnnotBorder, getBorder);
+ 
+ static int m_Annot_match(lua_State * L)
+@@ -398,7 +398,7 @@ static int m_Annot__gc(lua_State * L)
+ 
+ static const struct luaL_Reg Annot_m[] = {
+     {"isOk", m_Annot_isOk},
+-    {"getAppearance", m_Annot_getAppearance},
++    {"getAppearanceResDict", m_Annot_getAppearanceResDict},
+     {"getBorder", m_Annot_getBorder},
+     {"match", m_Annot_match},
+     {"__tostring", m_Annot__tostring},
+@@ -1249,7 +1249,7 @@ static int m_Object_getType(lua_State *
+ 
+ static int m_Object_getTypeName(lua_State * L)
+ {
+-    char *s;
++    const char *s;
+     udstruct *uin;
+     uin = (udstruct *) luaL_checkudata(L, 1, M_Object);
+     if (uin->pd != NULL && uin->pd->pc != uin->pc)
+@@ -1936,7 +1936,7 @@ static int m_Page_getLinks(lua_State * L
+     if ((uin->pd != NULL && uin->pd->pc != uin->pc)
+         || (ucat->pd != NULL && ucat->pd->pc != ucat->pd->pc))
+         pdfdoc_changed_error(L);
+-    links = ((Page *) uin->d)->getLinks((Catalog *) ucat->d);
++    links = ((Page *) uin->d)->getLinks();
+     if (links != NULL) {
+         uout = new_Links_userdata(L);
+         uout->d = links;
+@@ -2531,7 +2531,6 @@ m_poppler_get_INT(XRef, getNumObjects);
+ m_poppler_get_INT(XRef, getRootNum);
+ m_poppler_get_INT(XRef, getRootGen);
+ // getStreamEnd
+-m_poppler_get_INT(XRef, getSize);
+ // getEntry
+ m_poppler_get_poppler(XRef, Object, getTrailerDict);
+ 
+@@ -2558,7 +2557,6 @@ static const struct luaL_Reg XRef_m[] =
+     {"getRootNum", m_XRef_getRootNum},
+     {"getRootGen", m_XRef_getRootGen},
+     //
+-    {"getSize", m_XRef_getSize},
+     {"getTrailerDict", m_XRef_getTrailerDict},
+     {"__tostring", m_XRef__tostring},
+     {NULL, NULL}                // sentinel

diff --git a/dev-tex/luatex/files/poppler022.patch b/dev-tex/luatex/files/poppler022.patch
new file mode 100644
index 0000000..223cbcb
--- /dev/null
+++ b/dev-tex/luatex/files/poppler022.patch
@@ -0,0 +1,388 @@
+Patch updating lepdflib.cc to upstream revision 4415, which basically removes 
+part of the exported interface and thereby circumvents the changes in 
+poppler-0.20 -> 0.22. Experimental, rebased on our existing Gentoo patches 
+poppler-0.18.patch and poppler-0.20.patch. Here to solve bug 449538.
+
+diff -ruN luatex-beta-0.70.1.gentoo/source/texk/web2c/luatexdir/lua/lepdflib.cc 
+luatex-beta-0.70.1/source/texk/web2c/luatexdir/lua/lepdflib.cc
+--- luatex-beta-0.70.1.gentoo/source/texk/web2c/luatexdir/lua/lepdflib.cc	2013-03-10 13:31:22.000000000 +0100
++++ luatex-beta-0.70.1/source/texk/web2c/luatexdir/lua/lepdflib.cc	2013-03-10 13:47:24.000000000 +0100
+@@ -1,7 +1,7 @@
+ /* lepdflib.cc
+ 
+-   Copyright 2009-2011 Taco Hoekwater <taco@luatex.org>
+-   Copyright 2009-2011 Hartmut Henkel <hartmut@luatex.org>
++   Copyright 2009-2012 Taco Hoekwater <taco@luatex.org>
++   Copyright 2009-2012 Hartmut Henkel <hartmut@luatex.org>
+ 
+    This file is part of LuaTeX.
+ 
+@@ -49,15 +49,13 @@
+ //**********************************************************************
+ 
+ #define M_Annot            "Annot"
+-#define M_AnnotBorder      "AnnotBorder"
+-#define M_AnnotBorderStyle "AnnotBorderStyle"
+ #define M_Annots           "Annots"
+ #define M_Array            "Array"
+ #define M_Catalog          "Catalog"
+-#define M_EmbFile          "EmbFile"
+ #define M_Dict             "Dict"
+ #define M_GooString        "GooString"
+ #define M_LinkDest         "LinkDest"
++#define M_Link             "Link"
+ #define M_Links            "Links"
+ #define M_Object           "Object"
+ #define M_Page             "Page"
+@@ -65,8 +63,8 @@
+ #define M_PDFRectangle     "PDFRectangle"
+ #define M_Ref              "Ref"
+ #define M_Stream           "Stream"
+-#define M_XRef             "XRef"
+ #define M_XRefEntry        "XRefEntry"
++#define M_XRef             "XRef"
+ 
+ //**********************************************************************
+ 
+@@ -84,13 +82,9 @@
+ new_poppler_userdata(PDFDoc);
+ 
+ new_poppler_userdata(Annot);
+-new_poppler_userdata(AnnotBorder);
+-//new_poppler_userdata(AnnotBorderStyle);
+-new_poppler_userdata(Annots);
+ new_poppler_userdata(Array);
+ new_poppler_userdata(Catalog);
+ new_poppler_userdata(Dict);
+-//new_poppler_userdata(GooString);
+ new_poppler_userdata(LinkDest);
+ new_poppler_userdata(Links);
+ new_poppler_userdata(Object);
+@@ -99,7 +93,6 @@
+ new_poppler_userdata(Ref);
+ new_poppler_userdata(Stream);
+ new_poppler_userdata(XRef);
+-//new_poppler_userdata(XRefEntry);
+ 
+ //**********************************************************************
+ 
+@@ -134,53 +127,6 @@
+     return 1;                   // doc path
+ }
+ 
+-static int l_new_Annot(lua_State * L)
+-{
+-    udstruct *uxref, *udict, *ucatalog, *uref, *uout;
+-    uxref = (udstruct *) luaL_checkudata(L, 1, M_XRef);
+-    udict = (udstruct *) luaL_checkudata(L, 2, M_Dict);
+-    ucatalog = (udstruct *) luaL_checkudata(L, 3, M_Catalog);
+-    uref = (udstruct *) luaL_checkudata(L, 4, M_Ref);
+-    if (uxref->pd != ucatalog->pd || uxref->pd != udict->pd
+-        || uxref->pd != uref->pd)
+-        pdfdoc_differs_error(L);
+-    if ((uxref->pd != NULL && uxref->pd->pc != uxref->pc) ||
+-        (ucatalog->pd != NULL && ucatalog->pd->pc != ucatalog->pc) ||
+-        (udict->pd != NULL && udict->pd->pc != udict->pc) ||
+-        (uref->pd != NULL && uref->pd->pc != uref->pc))
+-        pdfdoc_changed_error(L);
+-    uout = new_Annot_userdata(L);
+-    uout->d =
+-        new Annot(udict->pd->doc, (Dict *) udict->d,
+-                  (Object *) uref->d);
+-    uout->atype = ALLOC_LEPDF;
+-    uout->pc = uxref->pc;
+-    uout->pd = uxref->pd;
+-    return 1;
+-}
+-
+-static int l_new_Annots(lua_State * L)
+-{
+-    udstruct *uxref, *ucatalog, *uannotsobj, *uout;
+-    uxref = (udstruct *) luaL_checkudata(L, 1, M_XRef);
+-    ucatalog = (udstruct *) luaL_checkudata(L, 2, M_Catalog);
+-    uannotsobj = (udstruct *) luaL_checkudata(L, 3, M_Object);
+-    if (uxref->pd != ucatalog->pd || uxref->pd != uannotsobj->pd)
+-        pdfdoc_differs_error(L);
+-    if ((uxref->pd != NULL && uxref->pd->pc != uxref->pc)
+-        || (ucatalog->pd != NULL && ucatalog->pd->pc != ucatalog->pc)
+-        || (uannotsobj->pd != NULL && uannotsobj->pd->pc != uannotsobj->pc))
+-        pdfdoc_changed_error(L);
+-    uout = new_Annots_userdata(L);
+-    uout->d =
+-        new Annots(uannotsobj->pd->doc,
+-                   (Object *) uannotsobj->d);
+-    uout->atype = ALLOC_LEPDF;
+-    uout->pc = uxref->pc;
+-    uout->pd = uxref->pd;
+-    return 1;
+-}
+-
+ static int l_new_Array(lua_State * L)
+ {
+     udstruct *uxref, *uout;
+@@ -235,8 +181,6 @@
+ 
+ static const struct luaL_Reg epdflib[] = {
+     {"open", l_open_PDFDoc},
+-    {"Annot", l_new_Annot},
+-    {"Annots", l_new_Annots},
+     {"Array", l_new_Array},
+     {"Dict", l_new_Dict},
+     {"Object", l_new_Object},
+@@ -359,12 +303,26 @@
+     return 1;                                                  \
+ }
+ 
++#define m_poppler_check_string(in, function)                   \
++static int m_##in##_##function(lua_State * L)                  \
++{                                                              \
++    const char *s;                                             \
++    udstruct *uin;                                             \
++    uin = (udstruct *) luaL_checkudata(L, 1, M_##in);          \
++    if (uin->pd != NULL && uin->pd->pc != uin->pc)             \
++        pdfdoc_changed_error(L);                               \
++    s = luaL_checkstring(L, 2);                                \
++    if (((in *) uin->d)->function((char *) s))                 \
++        lua_pushboolean(L, 1);                                 \
++    else                                                       \
++        lua_pushboolean(L, 0);                                 \
++    return 1;                                                  \
++}
++
+ //**********************************************************************
+ // Annot
+ 
+ m_poppler_get_BOOL(Annot, isOk);
+-m_poppler_get_OBJECT(Annot, getAppearanceResDict);
+-m_poppler_get_poppler(Annot, AnnotBorder, getBorder);
+ 
+ static int m_Annot_match(lua_State * L)
+ {
+@@ -398,8 +356,6 @@
+ 
+ static const struct luaL_Reg Annot_m[] = {
+     {"isOk", m_Annot_isOk},
+-    {"getAppearanceResDict", m_Annot_getAppearanceResDict},
+-    {"getBorder", m_Annot_getBorder},
+     {"match", m_Annot_match},
+     {"__tostring", m_Annot__tostring},
+     {"__gc", m_Annot__gc},
+@@ -654,6 +610,7 @@
+ 
+ m_poppler_get_poppler(Catalog, Object, getDests);
+ m_poppler_get_INT(Catalog, numEmbeddedFiles);
++
+ m_poppler_get_INT(Catalog, numJS);
+ 
+ static int m_Catalog_getJS(lua_State * L)
+@@ -770,20 +727,7 @@
+     return 0;
+ }
+ 
+-static int m_Dict_is(lua_State * L)
+-{
+-    const char *s;
+-    udstruct *uin;
+-    uin = (udstruct *) luaL_checkudata(L, 1, M_Dict);
+-    if (uin->pd != NULL && uin->pd->pc != uin->pc)
+-        pdfdoc_changed_error(L);
+-    s = luaL_checkstring(L, 2);
+-    if (((Dict *) uin->d)->is((char *) s))
+-        lua_pushboolean(L, 1);
+-    else
+-        lua_pushboolean(L, 0);
+-    return 1;
+-}
++m_poppler_check_string(Dict, is);
+ 
+ static int m_Dict_lookup(lua_State * L)
+ {
+@@ -894,6 +838,8 @@
+     return 1;
+ }
+ 
++m_poppler_check_string(Dict, hasKey);
++
+ m_poppler__tostring(Dict);
+ 
+ static const struct luaL_Reg Dict_m[] = {
+@@ -910,6 +856,7 @@
+     {"getKey", m_Dict_getKey},
+     {"getVal", m_Dict_getVal},
+     {"getValNF", m_Dict_getValNF},
++    {"hasKey", m_Dict_hasKey},
+     {"__tostring", m_Dict__tostring},
+     {NULL, NULL}                // sentinel
+ };
+@@ -1017,9 +964,13 @@
+ //**********************************************************************
+ // Links
+ 
++m_poppler_get_INT(Links, getNumLinks);
++
+ m_poppler__tostring(Links);
+ 
+ static const struct luaL_Reg Links_m[] = {
++    {"getNumLinks", m_Links_getNumLinks},
++    //{"getLink", m_Links_getLink},
+     {"__tostring", m_Links__tostring},
+     {NULL, NULL}                // sentinel
+ };
+@@ -1925,28 +1876,6 @@
+ m_poppler_get_poppler(Page, Dict, getResourceDict);
+ m_poppler_get_OBJECT(Page, getAnnots);
+ 
+-static int m_Page_getLinks(lua_State * L)
+-{
+-    Links *links;
+-    udstruct *uin, *ucat, *uout;
+-    uin = (udstruct *) luaL_checkudata(L, 1, M_Page);
+-    ucat = (udstruct *) luaL_checkudata(L, 2, M_Catalog);
+-    if (uin->pd != NULL && ucat->pd != NULL && uin->pd != ucat->pd)
+-        pdfdoc_differs_error(L);
+-    if ((uin->pd != NULL && uin->pd->pc != uin->pc)
+-        || (ucat->pd != NULL && ucat->pd->pc != ucat->pd->pc))
+-        pdfdoc_changed_error(L);
+-    links = ((Page *) uin->d)->getLinks();
+-    if (links != NULL) {
+-        uout = new_Links_userdata(L);
+-        uout->d = links;
+-        uout->pc = uin->pc;
+-        uout->pd = uin->pd;
+-    } else
+-        lua_pushnil(L);
+-    return 1;
+-}
+-
+ m_poppler_get_OBJECT(Page, getContents);
+ 
+ m_poppler__tostring(Page);
+@@ -1973,7 +1902,6 @@
+     {"getSeparationInfo", m_Page_getSeparationInfo},
+     {"getResourceDict", m_Page_getResourceDict},
+     {"getAnnots", m_Page_getAnnots},
+-    {"getLinks", m_Page_getLinks},
+     {"getContents", m_Page_getContents},
+     {"__tostring", m_Page__tostring},
+     {NULL, NULL}                // sentinel
+@@ -2158,19 +2086,23 @@
+ 
+ static int m_PDFDoc_getLinks(lua_State * L)
+ {
+-    int i;
++    int i, pages;
+     Links *links;
+     udstruct *uin, *uout;
+     uin = (udstruct *) luaL_checkudata(L, 1, M_PDFDoc);
+     if (uin->pd != NULL && uin->pd->pc != uin->pc)
+         pdfdoc_changed_error(L);
+     i = luaL_checkint(L, 2);
+-    links = ((PdfDocument *) uin->d)->doc->getLinks(i);
+-    if (links != NULL) {
+-        uout = new_Links_userdata(L);
+-        uout->d = links;
+-        uout->pc = uin->pc;
+-        uout->pd = uin->pd;
++    pages = ((PdfDocument *) uin->d)->doc->getNumPages();
++    if (i > 0 && i <= pages) {
++        links = ((PdfDocument *) uin->d)->doc->getLinks(i);
++        if (links != NULL) {
++            uout = new_Links_userdata(L);
++            uout->d = links;
++            uout->pc = uin->pc;
++            uout->pd = uin->pd;
++        } else
++            lua_pushnil(L);
+     } else
+         lua_pushnil(L);
+     return 1;
+@@ -2249,6 +2181,8 @@
+ m_PDFDoc_INT(getPDFMajorVersion);
+ m_PDFDoc_INT(getPDFMinorVersion);
+ 
++m_poppler__tostring(PDFDoc);
++
+ static int m_PDFDoc__gc(lua_State * L)
+ {
+     udstruct *uin;
+@@ -2292,6 +2226,7 @@
+     {"getDocInfoNF", m_PDFDoc_getDocInfoNF},
+     {"getPDFMajorVersion", m_PDFDoc_getPDFMajorVersion},
+     {"getPDFMinorVersion", m_PDFDoc_getPDFMinorVersion},
++    {"__tostring", m_PDFDoc__tostring},
+     {"__gc", m_PDFDoc__gc},     // finalizer
+     {NULL, NULL}                // sentinel
+ };
+@@ -2437,11 +2372,6 @@
+     "Flate", "JBIG2", "JPX", "Weird", NULL
+ };
+ 
+-#if 0
+-static const char *StreamColorSpaceModeNames[] =
+-    { "CSNone", "CSDeviceGray", "CSDeviceRGB", "CSDeviceCMYK", NULL };
+-#endif
+-
+ m_poppler_get_INT(Stream, getKind);
+ 
+ static int m_Stream_getKindName(lua_State * L)
+@@ -2527,11 +2457,26 @@
+ m_poppler_get_OBJECT(XRef, getDocInfo);
+ m_poppler_get_OBJECT(XRef, getDocInfoNF);
+ m_poppler_get_INT(XRef, getNumObjects);
+-// getLastXRefPos
+ m_poppler_get_INT(XRef, getRootNum);
+ m_poppler_get_INT(XRef, getRootGen);
+ // getStreamEnd
+-// getEntry
++
++static int m_XRef_getNumEntry(lua_State * L)
++{
++    int i, offset;
++    udstruct *uin;
++    uin = (udstruct *) luaL_checkudata(L, 1, M_XRef);
++    if (uin->pd != NULL && uin->pd->pc != uin->pc)
++        pdfdoc_changed_error(L);
++    offset = luaL_checkint(L, 2);
++    i = ((XRef *) uin->d)->getNumEntry(offset);
++    if (i >= 0)
++        lua_pushinteger(L, i);
++    else
++        lua_pushnil(L);
++    return 1;
++}
++
+ m_poppler_get_poppler(XRef, Object, getTrailerDict);
+ 
+ m_poppler__tostring(XRef);
+@@ -2553,10 +2498,10 @@
+     {"getDocInfo", m_XRef_getDocInfo},
+     {"getDocInfoNF", m_XRef_getDocInfoNF},
+     {"getNumObjects", m_XRef_getNumObjects},
+-    //
+     {"getRootNum", m_XRef_getRootNum},
+     {"getRootGen", m_XRef_getRootGen},
+-    //
++    // {"getStreamEnd", m_XRef_getStreamEnd},
++    {"getNumEntry", m_XRef_getNumEntry},
+     {"getTrailerDict", m_XRef_getTrailerDict},
+     {"__tostring", m_XRef__tostring},
+     {NULL, NULL}                // sentinel
+@@ -2565,7 +2510,10 @@
+ //**********************************************************************
+ // XRefEntry
+ 
++m_poppler__tostring(XRefEntry);
++
+ static const struct luaL_Reg XRefEntry_m[] = {
++    {"__tostring", m_XRefEntry__tostring},
+     {NULL, NULL}                // sentinel
+ };
+ 
+@@ -2582,7 +2530,6 @@
+ int luaopen_epdf(lua_State * L)
+ {
+     register_meta(Annot);
+-    // TODO register_meta(AnnotBorder);
+     register_meta(Annots);
+     register_meta(Array);
+     register_meta(Catalog);

diff --git a/dev-tex/luatex/files/remove-zlib-version-check.patch b/dev-tex/luatex/files/remove-zlib-version-check.patch
new file mode 100644
index 0000000..9850850
--- /dev/null
+++ b/dev-tex/luatex/files/remove-zlib-version-check.patch
@@ -0,0 +1,23 @@
+Let soname dictate the ABI and do not check for minor/micro which requires
+needless rebuilds after every zlib update. By Ulrich Müller.
+
+https://bugs.gentoo.org/show_bug.cgi?id=310487
+http://www.ntg.nl/pipermail/dev-luatex/2012-July/004534.html
+
+--- luatex-beta-0.70.1-orig/source/texk/web2c/luatexdir/luazlib/lzlib.c
++++ luatex-beta-0.70.1/source/texk/web2c/luatexdir/luazlib/lzlib.c
+@@ -549,14 +549,6 @@
+ 
+     /* ====================================================================== */
+ 
+-    /* make sure header and library version are consistent */
+-    const char* version = zlibVersion();
+-    if (strncmp(version, ZLIB_VERSION, 5))
+-    {
+-        lua_pushfstring(L, "zlib library version does not match - header: %s, library: %s", ZLIB_VERSION, version);
+-        lua_error(L);
+-    }
+-
+     /* create new metatable for zlib compression structures */
+     luaL_newmetatable(L, ZSTREAMMETA);
+     lua_pushliteral(L, "__index");

diff --git a/dev-tex/luatex/luatex-0.70.1-r99.ebuild b/dev-tex/luatex/luatex-0.70.1-r99.ebuild
new file mode 100644
index 0000000..f27733e
--- /dev/null
+++ b/dev-tex/luatex/luatex-0.70.1-r99.ebuild
@@ -0,0 +1,121 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/dev-tex/luatex/luatex-0.70.1-r2.ebuild,v 1.12 2013/08/14 11:24:49 patrick Exp $
+
+EAPI=5
+
+inherit libtool eutils texlive-common
+
+DESCRIPTION="An extended version of pdfTeX using Lua as an embedded scripting language."
+HOMEPAGE="http://www.luatex.org/"
+SRC_URI="http://foundry.supelec.fr/gf/download/frsrelease/392/1730/${PN}-beta-${PV}.tar.bz2
+	http://foundry.supelec.fr/gf/download/frsrelease/392/1732/${PN}-beta-${PV}-doc.tar.bz2"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="amd64 arm ~mips x86"
+IUSE="doc"
+
+RDEPEND="dev-libs/zziplib
+	>=media-libs/libpng-1.4
+	app-text/poppler:=[xpdf-headers(+)]
+	sys-libs/zlib
+	>=dev-libs/kpathsea-6.0.1_p20110627"
+DEPEND="${RDEPEND}
+	virtual/pkgconfig"
+
+S="${WORKDIR}/${PN}-beta-${PV}/source"
+PRELIBS="libs/obsdcompat"
+#texk/kpathsea"
+#kpathsea_extraconf="--disable-shared --disable-largefile"
+
+src_prepare() {
+	has_version '>=app-text/poppler-0.18.0:0' && epatch "${FILESDIR}/poppler018.patch"
+	has_version '>=app-text/poppler-0.20.0:0' && epatch "${FILESDIR}/poppler020.patch"
+	has_version '>=app-text/poppler-0.22.0:0' && epatch "${FILESDIR}/poppler022.patch"
+	epatch "${FILESDIR}/kpathsea2012.patch" \
+		"${FILESDIR}/remove-zlib-version-check.patch" \
+		"${FILESDIR}/jmpbuf.patch"
+	S="${S}/build-aux" elibtoolize --shallow
+}
+
+src_configure() {
+	# Too many regexps use A-Z a-z constructs, what causes problems with locales
+	# that don't have the same alphabetical order than ascii. Bug #244619
+	# So we set LC_ALL to C in order to avoid problems.
+	export LC_ALL=C
+
+	local myconf
+	myconf=""
+	#has_version '>=app-text/texlive-core-2009' && myconf="--with-system-kpathsea"
+
+	cd "${S}/texk/web2c"
+	econf \
+		--disable-cxx-runtime-hack \
+		--disable-all-pkgs	\
+		--disable-mp		\
+		--disable-ptex		\
+		--disable-tex		\
+		--disable-mf		\
+	    --disable-largefile \
+		--disable-ipc		\
+		--disable-shared	\
+		--enable-luatex		\
+		--enable-dump-share	\
+		--without-mf-x-toolkit \
+		--without-x			\
+	    --with-system-kpathsea	\
+	    --with-kpathsea-includes="${EPREFIX}"/usr/include \
+	    --with-system-gd	\
+	    --with-system-libpng	\
+	    --with-system-teckit \
+	    --with-system-zlib \
+	    --with-system-t1lib \
+		--with-system-xpdf \
+		--with-system-poppler \
+		--with-system-zziplib \
+	    --disable-multiplatform
+
+	for i in ${PRELIBS} ; do
+		einfo "Configuring $i"
+		local j=$(basename $i)_extraconf
+		local myconf
+		eval myconf=\${$j}
+		cd "${S}/${i}"
+		econf ${myconf}
+	done
+}
+
+src_compile() {
+	texk/web2c/luatexdir/getluatexsvnversion.sh || die
+	for i in ${PRELIBS} ; do
+		cd "${S}/${i}"
+		emake || die "failed to build ${i}"
+	done
+	cd "${WORKDIR}/${PN}-beta-${PV}/source/texk/web2c"
+	emake luatex || die "failed to build luatex"
+}
+
+src_install() {
+	cd "${WORKDIR}/${PN}-beta-${PV}/source/texk/web2c"
+	emake DESTDIR="${D}" bin_PROGRAMS="luatex" SUBDIRS="" nodist_man_MANS="" \
+		install-exec-am || die
+
+	dodoc "${WORKDIR}/${PN}-beta-${PV}/README" || die
+	doman "${WORKDIR}/texmf/doc/man/man1/"*.1 || die
+	if use doc ; then
+		dodoc "${WORKDIR}/${PN}-beta-${PV}/manual/"*.pdf || die
+		dodoc "${WORKDIR}/texmf/doc/man/man1/"*.pdf || die
+	fi
+}
+
+pkg_postinst() {
+	if ! has_version '>=dev-texlive/texlive-basic-2008' ; then
+		elog "Note that this package does not install many files, mainly just the"
+		elog "${PN} executable, which needs other files in order to be"
+		elog "useful. Please consider installing a recent TeX distribution such as"
+		elog "TeX Live 2008 or later to take advantage of the full power of"
+		elog "${PN} ."
+	fi
+	efmtutil-sys
+}

diff --git a/dev-tex/luatex/metadata.xml b/dev-tex/luatex/metadata.xml
new file mode 100644
index 0000000..1d2fc95
--- /dev/null
+++ b/dev-tex/luatex/metadata.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<herd>tex</herd>
+<longdescription lang="en">
+An experimental pdfTeX extension that is to eventually
+become its successor. It is developed by a subset of the
+current pdfTeX team.
+</longdescription>
+</pkgmetadata>


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2014-03-04 14:23 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-04 14:23 [gentoo-commits] proj/hardened-dev:musl commit in: dev-tex/luatex/, dev-tex/luatex/files/ Anthony G. Basile

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox