]> git.webhop.me Git - bs-cst-neutrino-hd.git/commitdiff
add targets libexpat, lua-expat
authorMarkham <markham001@gmx.de>
Wed, 18 Nov 2015 16:49:05 +0000 (17:49 +0100)
committerMarkham <markham001@gmx.de>
Wed, 18 Nov 2015 16:49:05 +0000 (17:49 +0100)
archive-patches/lua-expat-1.3.0-lua-5.2.patch [new file with mode: 0644]
archive-patches/lua-expat-lua-5.2-test-fix.patch [new file with mode: 0644]
archive-patches/lua-expat-makefile.diff [new file with mode: 0644]
make/archives.mk
make/libraries.mk
make/versions.mk

diff --git a/archive-patches/lua-expat-1.3.0-lua-5.2.patch b/archive-patches/lua-expat-1.3.0-lua-5.2.patch
new file mode 100644 (file)
index 0000000..d8fbba8
--- /dev/null
@@ -0,0 +1,200 @@
+
+# HG changeset patch
+# User Tom?s Guisasola Gorham <tomas@tecgraf.puc-rio.br>
+# Date 1343430908 -3600
+# Node ID e981a82571cf5c54d5e84f73fbcad7214f699c03
+# Parent  5dfed844930e6ccd981d44290fe51d20255388bc
+Add compatibility with Lua 5.2
+
+diff -r 5dfed844930e -r e981a82571cf src/lxp/lom.lua
+--- a/src/lxp/lom.lua  Fri Jul 27 22:03:24 2012 +0100
++++ b/src/lxp/lom.lua  Sat Jul 28 00:15:08 2012 +0100
+@@ -1,13 +1,11 @@
+ -- See Copyright Notice in license.html
+ -- $Id: lom.lua,v 1.6 2005/06/09 19:18:40 tuler Exp $
+
+-require "lxp"
++local lxp = require "lxp"
+
+-local tinsert, tremove, getn = table.insert, table.remove, table.getn
++local tinsert, tremove = table.insert, table.remove
+ local assert, type, print = assert, type, print
+-local lxp = lxp
+
+-module ("lxp.lom")
+
+ local function starttag (p, tag, attr)
+   local stack = p:getcallbacks().stack
+@@ -19,14 +17,14 @@
+   local stack = p:getcallbacks().stack
+   local element = tremove(stack)
+   assert(element.tag == tag)
+-  local level = getn(stack)
++  local level = #stack
+   tinsert(stack[level], element)
+ end
+
+ local function text (p, txt)
+   local stack = p:getcallbacks().stack
+-  local element = stack[getn(stack)]
+-  local n = getn(element)
++  local element = stack[#stack]
++  local n = #element
+   if type(element[n]) == "string" then
+     element[n] = element[n] .. txt
+   else
+@@ -34,7 +32,7 @@
+   end
+ end
+
+-function  parse (o)
++local function parse (o)
+   local c = { StartElement = starttag,
+               EndElement = endtag,
+               CharacterData = text,
+@@ -47,7 +45,7 @@
+     status, err = p:parse(o)
+     if not status then return nil, err end
+   else
+-    for l in o do
++    for l in pairs(o) do
+       status, err = p:parse(l)
+       if not status then return nil, err end
+     end
+@@ -58,3 +56,4 @@
+   return c.stack[1][1]
+ end
+
++return { parse = parse }
+diff -r 5dfed844930e -r e981a82571cf src/lxplib.c
+--- a/src/lxplib.c     Fri Jul 27 22:03:24 2012 +0100
++++ b/src/lxplib.c     Sat Jul 28 00:15:08 2012 +0100
+@@ -13,14 +13,16 @@
+
+ #include "lua.h"
+ #include "lauxlib.h"
+-#if ! defined (LUA_VERSION_NUM) || LUA_VERSION_NUM < 501
+-#include "compat-5.1.h"
+-#endif
+
+
+ #include "lxplib.h"
+
+
++#if !defined(lua_pushliteral)
++#define lua_pushliteral(L, s) \
++      lua_pushstring(L, "" s, (sizeof(s)/sizeof(char))-1)
++#endif
++
+
+ enum XPState {
+   XPSpre,  /* parser just initialized */
+@@ -66,7 +68,7 @@
+
+
+ static void lxpclose (lua_State *L, lxp_userdata *xpu) {
+-  lua_unref(L, xpu->tableref);
++  luaL_unref(L, LUA_REGISTRYINDEX, xpu->tableref);
+   xpu->tableref = LUA_REFNIL;
+   if (xpu->parser)
+     XML_ParserFree(xpu->parser);
+@@ -225,7 +227,7 @@
+   child->parser = XML_ExternalEntityParserCreate(p, context, NULL);
+   if (!child->parser)
+     luaL_error(L, "XML_ParserCreate failed");
+-  lua_getref(L, xpu->tableref);  /* child uses the same table of its father */
++  lua_rawgeti(L, LUA_REGISTRYINDEX, xpu->tableref); /*lua_getref(L, xpu->tableref); */ /* child uses the same table of its father */
+   child->tableref = luaL_ref(L, LUA_REGISTRYINDEX);
+   lua_pushstring(L, base);
+   lua_pushstring(L, systemId);
+@@ -449,7 +451,7 @@
+   xpu->state = XPSok;
+   xpu->b = &b;
+   lua_settop(L, 2);
+-  lua_getref(L, xpu->tableref);  /* to be used by handlers */
++  lua_rawgeti(L, LUA_REGISTRYINDEX, xpu->tableref); /*lua_getref(L, xpu->tableref);*/  /* to be used by handlers */
+   status = XML_Parse(xpu->parser, s, (int)len, s == NULL);
+   if (xpu->state == XPSstring) dischargestring(xpu);
+   if (xpu->state == XPSerror) {  /* callback error? */
+@@ -517,7 +519,12 @@
+   return 1;
+ }
+
+-static const struct luaL_reg lxp_meths[] = {
++#if !defined LUA_VERSION_NUM
++/* Lua 5.0 */
++#define luaL_Reg luaL_reg
++#endif
++
++static const struct luaL_Reg lxp_meths[] = {
+   {"parse", lxp_parse},
+   {"close", lxp_close},
+   {"__gc", parser_gc},
+@@ -530,7 +537,7 @@
+   {NULL, NULL}
+ };
+
+-static const struct luaL_reg lxp_funcs[] = {
++static const struct luaL_Reg lxp_funcs[] = {
+   {"new", lxp_make_parser},
+   {NULL, NULL}
+ };
+@@ -541,25 +548,48 @@
+ */
+ static void set_info (lua_State *L) {
+       lua_pushliteral (L, "_COPYRIGHT");
+-      lua_pushliteral (L, "Copyright (C) 2003-2007 Kepler Project");
++      lua_pushliteral (L, "Copyright (C) 2003-2012 Kepler Project");
+       lua_settable (L, -3);
+       lua_pushliteral (L, "_DESCRIPTION");
+       lua_pushliteral (L, "LuaExpat is a SAX XML parser based on the Expat library");
+       lua_settable (L, -3);
+       lua_pushliteral (L, "_VERSION");
+-      lua_pushliteral (L, "LuaExpat 1.2.0");
++      lua_pushliteral (L, "LuaExpat 1.3.0");
+       lua_settable (L, -3);
+ }
+
+
++#if !defined LUA_VERSION_NUM || LUA_VERSION_NUM==501
++/*
++** Adapted from Lua 5.2.0
++*/
++static void luaL_setfuncs (lua_State *L, const luaL_Reg *l, int nup) {
++  luaL_checkstack(L, nup, "too many upvalues");
++  for (; l->name != NULL; l++) {  /* fill the table with given functions */
++    int i;
++    for (i = 0; i < nup; i++)  /* copy upvalues to the top */
++      lua_pushvalue(L, -nup);
++    lua_pushstring(L, l->name);
++    lua_pushcclosure(L, l->func, nup);  /* closure with those upvalues */
++    lua_settable(L, -(nup + 3));
++  }
++  lua_pop(L, nup);  /* remove upvalues */
++}
++#endif
++
++
+ int luaopen_lxp (lua_State *L) {
+-  luaL_newmetatable(L, ParserType);
+-  lua_pushliteral(L, "__index");
+-  lua_pushvalue(L, -2);
+-  lua_rawset(L, -3);
+-  luaL_openlib (L, NULL, lxp_meths, 0);
+-  luaL_openlib (L, "lxp", lxp_funcs, 0);
+-  set_info (L);
++      luaL_newmetatable(L, ParserType);
+
+-  return 1;
++      lua_pushliteral(L, "__index");
++      lua_pushvalue(L, -2);
++      lua_rawset(L, -3);
++
++      luaL_setfuncs (L, lxp_meths, 0);
++      lua_pop (L, 1); /* remove metatable */
++
++      lua_newtable (L);
++      luaL_setfuncs (L, lxp_funcs, 0);
++      set_info (L);
++      return 1;
+ }
diff --git a/archive-patches/lua-expat-lua-5.2-test-fix.patch b/archive-patches/lua-expat-lua-5.2-test-fix.patch
new file mode 100644 (file)
index 0000000..33f568b
--- /dev/null
@@ -0,0 +1,116 @@
+
+# HG changeset patch
+# User Tom?s Guisasola Gorham <tomas@tecgraf.puc-rio.br>
+# Date 1343436760 -3600
+# Node ID b2a77ebe7aed73ef5318895dd8f34dcdece94114
+# Parent  e981a82571cf5c54d5e84f73fbcad7214f699c03
+test.lua: Expand tests and add compatibility with Lua 5.2
+
+diff -r e981a82571cf -r b2a77ebe7aed tests/test.lua
+--- a/tests/test.lua   Sat Jul 28 00:15:08 2012 +0100
++++ b/tests/test.lua   Sat Jul 28 01:52:40 2012 +0100
+@@ -2,8 +2,14 @@
+ -- See Copyright Notice in license.html
+ -- $Id: test.lua,v 1.6 2006/06/08 20:34:52 tomas Exp $
+
+-require"lxp"
++if string.find(_VERSION, " 5.0") then
++      lxp = assert(loadlib("./lxp.so", "luaopen_lxp"))()
++else
++      lxp = require"lxp"
++      gcinfo = function () return collectgarbage"count" end
++end
+ print (lxp._VERSION)
++assert(lxp.new, "Cannot find function lxp.new ("..tostring(lxp.new)..")")
+
+ -- basic test with no preamble
+ local p = lxp.new{}
+@@ -35,15 +41,44 @@
+ ]>
+ ]]
+
+-local X
+-function getargs (...) X = arg end
++X = {}
++if string.find(_VERSION, " 5.0") then
++      function getargs (...) X = arg end
++      function xgetargs (c)
++        return function (...)
++          table.insert(arg, 1, c)
++          table.insert(X, arg)
++        end
++      end
++else
++      (loadstring or load)[[
++      function getargs (...)
++              X = { ... }
++              X.n = select('#', ...)
++      end
++      function xgetargs (c)
++        return function (...)
++          local arg = { ... }
++          arg.n = select('#', ...) + 1
++          table.insert(arg, 1, c)
++          table.insert(X, arg)
++        end
++      end
++      table.getn = function (t)
++              if t.n then
++                      return t.n
++              else
++                      local n = 0
++                      for i in pairs(t) do
++                              if type(i) == "number" then
++                                      n = math.max(n, i)
++                              end
++                      end
++                      return n
++              end
++      end]]()
++end
+
+-function xgetargs (c)
+-  return function (...)
+-    table.insert(arg, 1, c)
+-    table.insert(X, arg)
+-  end
+-end
+
+
+ -------------------------------
+@@ -61,7 +96,7 @@
+ assert(X.n == 3 and X[1] == p and X[2] == "to")
+ x = X[3]
+ assert(x.priority=="10" and x.xu=="hi" and x.method=="POST")
+-assert(x[1] == "priority" and x[2] == "xu" and table.getn(x) == 2)
++assert(x[1] == "priority" and x[2] == "xu" and table.getn(x) == 2, "x[1] == "..tostring(x[1])..", x[2] == "..tostring(x[2])..", #x == "..tostring(table.getn(x)))
+ assert(p:parse("</to>"))
+ assert(p:parse())
+ p:close()
+@@ -95,7 +130,7 @@
+ assert(p:parse"<to>")
+ assert(p:parse"<![CDATA[hi]]>")
+ assert(table.getn(X) == 3)
+-assert(X[1][1] == "s" and X[1][2] == p)
++assert(X[1][1] == "s" and X[1][2] == p, "X[1][1] == "..tostring(X[1][1])..", X[1][2] == "..tostring(X[1][2])..", p == "..tostring(p))
+ assert(X[2][1] == "c" and X[2][2] == p and X[2][3] == "hi")
+ assert(X[3][1] == "e" and X[3][2] == p)
+ assert(p:parse"</to>")
+@@ -220,7 +255,7 @@
+ ]])
+ p:close()
+ x = X[1]
+-assert(x[1] == "sn" and x[3] == "space" and x[4] == "a/namespace" and table.getn(x) == 4)
++assert(x[1] == "sn" and x[3] == "space" and x[4] == "a/namespace" and table.getn(x) == 4, "x[1] == "..tostring(x[1])..", x[3] == "..tostring(x[3])..", x[4] == "..tostring(x[4])..", #x == "..tostring(table.getn(x)))
+ x = X[3]
+ assert(x[1] == "s" and x[3] == "a/namespace?a")
+ x = X[4]
+@@ -316,7 +351,7 @@
+ local x = gcinfo()
+ for i=1,100000 do
+   -- due to a small bug in Lua...
+-  if math.mod(i, 100) == 0 then collectgarbage() end
++  if (math.mod or math.fmod)(i, 100) == 0 then collectgarbage() end
+   lxp.new({})
+ end
+ collectgarbage(); collectgarbage()
diff --git a/archive-patches/lua-expat-makefile.diff b/archive-patches/lua-expat-makefile.diff
new file mode 100644 (file)
index 0000000..9cd85ad
--- /dev/null
@@ -0,0 +1,39 @@
+--- /dev/null  2014-02-16 10:23:32.271000394 +0100
++++ b/Makefile 2014-02-18 15:25:06.121294649 +0100
+@@ -0,0 +1,36 @@
++CC            ?= cc
++RM            ?= rm -rf
++INSTALL               ?= install
++INSTALL_PROGRAM       ?= $(INSTALL)
++INSTALL_DATA  ?= $(INSTALL) -m 644
++LUA_V         ?= 5.1
++LUA_LDIR      ?= /usr/share/lua/$(LUA_V)
++LUA_CDIR      ?= /usr/lib/lua/$(LUA_V)
++T             = lxp
++LIBNAME               = $(T).so
++
++COMMON_CFLAGS  = -g -pedantic -Wall -O2 -shared -fPIC -DPIC -ansi
++LUA_INC               ?= -I/usr/include/lua$(LUA_V)
++EXPAT_INC     ?= -I/usr/include
++CF             = $(LUA_INC) $(EXPAT_INC) $(COMMON_CFLAGS) $(CFLAGS)
++
++EXPAT_LIB      = -lexpat
++COMMON_LDFLAGS         = -shared
++LF             = $(COMMON_LDFLAGS) $(EXPAT_LIB) $(LDFLAGS)
++
++OBJS           = src/lxplib.o
++
++lib: src/$(LIBNAME)
++
++src/$(LIBNAME):
++      export MACOSX_DEPLOYMENT_TARGET="10.3";
++      $(CC) $(CF) $(LF) -o $@ src/$(T)lib.c
++
++install:
++      $(INSTALL_PROGRAM) -D src/$(LIBNAME) $(DESTDIR)$(LUA_CDIR)/$(LIBNAME)
++      $(INSTALL_PROGRAM) -D src/$T/lom.lua $(DESTDIR)$(LUA_LDIR)/$T/lom.lua
++      $(INSTALL_DATA) -D tests/test.lua $(DESTDIR)$(LUA_LDIR)/$T/tests/test.lua
++      $(INSTALL_DATA) -D tests/test-lom.lua $(DESTDIR)$(LUA_LDIR)/$T/tests/test-lom.lua
++
++clean:
++      $(RM) src/$(LIBNAME) $(OBJS)
index fe98bd96ec116bdffff816c3d988833c774ae140..27feffdbb21712e6219e1fe3a6d2e40f50d36889 100755 (executable)
@@ -165,6 +165,12 @@ $(ARCHIVE)/inadyn-1.99.3.tar.bz2:
 $(ARCHIVE)/flac-1.3.0.tar.gz:
        $(WGET) http://www.fhloston-paradise.de/flac-1.3.0.tar.gz
 
+$(ARCHIVE)/expat-$(EXPAT_VER).tar.gz:
+       $(WGET) http://downloads.sourceforge.net/expat/expat-$(EXPAT_VER).tar.gz
+
+$(ARCHIVE)/luaexpat-$(LUA_EXPAT_VER).tar.gz:
+       $(WGET) http://matthewwild.co.uk/projects/luaexpat/luaexpat-$(LUA_EXPAT_VER).tar.gz
+
 $(ARCHIVE)/lua-5.2.3.tar.gz:
        $(WGET) http://www.fhloston-paradise.de/lua-5.2.3.tar.gz
 
index 1adc12577b4c697aa9c13461b90c30d4a3e9e680..41c54298909c90fb621c81a3e1a4554575103f16 100755 (executable)
@@ -614,6 +614,39 @@ $(D)/libflac: $(ARCHIVE)/flac-1.3.0.tar.gz | $(TARGETPREFIX)
        $(REMOVE)/flac-1.3.0
        touch $@
 
+$(D)/expat: $(ARCHIVE)/expat-$(EXPAT_VER).tar.gz | $(TARGETPREFIX)
+       rm -fr $(BUILD_TMP)/expat-$(EXPAT_VER)
+       $(UNTAR)/expat-$(EXPAT_VER).tar.gz
+       set -e; cd $(BUILD_TMP)/expat-$(EXPAT_VER); \
+               $(CONFIGURE) \
+                       --prefix= \
+                       --mandir=/.remove \
+                       --bindir=/.remove \
+                       ; \
+               $(MAKE); \
+               make install DESTDIR=$(TARGETPREFIX)
+       rm -fr $(TARGETPREFIX)/.remove
+       $(REWRITE_PKGCONF) $(PKG_CONFIG_PATH)/expat.pc
+       $(REWRITE_LIBTOOL)/libexpat.la
+       rm -fr $(BUILD_TMP)/expat-$(EXPAT_VER) $(PKGPREFIX)
+       touch $@
+
+$(D)/lua-expat: $(ARCHIVE)/luaexpat-$(LUA_EXPAT_VER).tar.gz $(D)/expat | $(TARGETPREFIX)
+       rm -fr $(BUILD_TMP)/luaexpat-$(LUA_EXPAT_VER)
+       $(UNTAR)/luaexpat-$(LUA_EXPAT_VER).tar.gz
+       set -e; cd $(BUILD_TMP)/luaexpat-$(LUA_EXPAT_VER); \
+               rm makefile*; \
+               patch -p1 < $(PATCHES)/lua-expat-makefile.diff; \
+               patch -p1 < $(PATCHES)/lua-expat-1.3.0-lua-5.2.patch; \
+               patch -p1 < $(PATCHES)/lua-expat-lua-5.2-test-fix.patch; \
+               $(MAKE) \
+               CC=$(TARGET)-gcc LUA_V=$(LUA_ABIVER) LDFLAGS=-L$(TARGETPREFIX)/lib \
+               LUA_INC=-I$(TARGETPREFIX)/include EXPAT_INC=-I$(TARGETPREFIX)/include; \
+               $(MAKE) install LUA_LDIR=$(TARGETPREFIX)/share/lua/$(LUA_ABIVER) LUA_CDIR=$(TARGETPREFIX)/lib/lua/$(LUA_ABIVER)
+       rm -fr $(TARGETPREFIX)/share/lua/$(LUA_ABIVER)/lxp/tests
+       rm -fr $(BUILD_TMP)/luaexpat-$(LUA_EXPAT_VER)
+       touch $@
+
 $(D)/luacurl: $(D)/libcurl $(ARCHIVE)/Lua-cURL$(LUACURL_VER).tar.xz | $(TARGETPREFIX)
        $(UNTAR)/Lua-cURL$(LUACURL_VER).tar.xz
        set -e; cd $(BUILD_TMP)/Lua-cURL$(LUACURL_VER); \
index c6eda88ecd73124f561179e6f0c08624d6720dd7..d3cf415de825532e0e4acc7775b69f1f96d950f9 100644 (file)
@@ -5,6 +5,9 @@ GIFLIB_VER=5.1.1
 # curl; command line tool for transferring data with URL syntax
 CURL_VER = 7.45.0
 
+# C library for parsing XML
+EXPAT_VER = 2.1.0
+
 # libjpeg-turbo; a derivative of libjpeg for x86 and x86-64 processors which uses SIMD instructions (MMX, SSE2, etc.) to accelerate baseline JPEG compression and decompression
 JPEG_TURBO_VER = 1.4.2
 
@@ -21,6 +24,8 @@ LUA_VER=$(LUA_ABIVER).3
 
 LUACURL_VER=v3
 
+LUA_EXPAT_VER = 1.2.0
+
 # openssl; toolkit for the SSL v2/v3 and TLS v1 protocol
 ifeq ($(PLATFORM), nevis)
 OPENSSL_VER=0.9.8