summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAzamat H. Hackimov <azamat.hackimov@gmail.com>2020-10-06 01:05:59 +0300
committerConrad Kostecki <conikost@gentoo.org>2020-10-08 21:13:41 +0200
commitf8051ee00cc653d5e43febbf00b05dc24959ee8c (patch)
tree1d8f17aa96ccdba9c28ae82f3b1e6348ebf60a31 /dev-lua/luaexpat
parentdev-libs/libotf: Stabilize 0.9.16 amd64, #747349 (diff)
downloadgentoo-f8051ee00cc653d5e43febbf00b05dc24959ee8c.tar.gz
gentoo-f8051ee00cc653d5e43febbf00b05dc24959ee8c.tar.bz2
gentoo-f8051ee00cc653d5e43febbf00b05dc24959ee8c.zip
dev-lua/luaexpat: restore more functionality
Restore more features that sill missed in forked 1.3.3 See: https://github.com/tomasguisasola/luaexpat/pull/5 Closes: https://github.com/gentoo/gentoo/pull/17813 Package-Manager: Portage-3.0.4, Repoman-3.0.1 Signed-off-by: Azamat H. Hackimov <azamat.hackimov@gmail.com> Signed-off-by: Conrad Kostecki <conikost@gentoo.org>
Diffstat (limited to 'dev-lua/luaexpat')
-rw-r--r--dev-lua/luaexpat/files/luaexpat-1.3.3_makefile.patch10
-rw-r--r--dev-lua/luaexpat/files/luaexpat-1.3.3_restore_functionality.patch109
-rw-r--r--dev-lua/luaexpat/luaexpat-1.3.3-r2.ebuild49
3 files changed, 167 insertions, 1 deletions
diff --git a/dev-lua/luaexpat/files/luaexpat-1.3.3_makefile.patch b/dev-lua/luaexpat/files/luaexpat-1.3.3_makefile.patch
index 95de7be60690..a780dddea838 100644
--- a/dev-lua/luaexpat/files/luaexpat-1.3.3_makefile.patch
+++ b/dev-lua/luaexpat/files/luaexpat-1.3.3_makefile.patch
@@ -1,5 +1,5 @@
diff --git a/makefile b/makefile
-index 1a5a145..df09239 100644
+index 1a5a145..50912f0 100644
--- a/makefile
+++ b/makefile
@@ -45,7 +45,7 @@ OBJS= src/lxplib.o
@@ -11,3 +11,11 @@ index 1a5a145..df09239 100644
install:
mkdir -p $(LUA_LIBDIR)
+@@ -53,6 +53,7 @@ install:
+ cd $(LUA_LIBDIR); ln -f -s $(LIBNAME) $T.so
+ mkdir -p $(LUA_DIR)/$T
+ cp src/$T/lom.lua $(LUA_DIR)/$T
++ cp src/$T/totable.lua $(LUA_DIR)/$T
+
+ clean:
+ rm -f src/$(LIBNAME) $(OBJS)
diff --git a/dev-lua/luaexpat/files/luaexpat-1.3.3_restore_functionality.patch b/dev-lua/luaexpat/files/luaexpat-1.3.3_restore_functionality.patch
new file mode 100644
index 000000000000..c0bc8c1a7b41
--- /dev/null
+++ b/dev-lua/luaexpat/files/luaexpat-1.3.3_restore_functionality.patch
@@ -0,0 +1,109 @@
+From 4ef48128bd9a725daca1d5a4aabe0c1665d78742 Mon Sep 17 00:00:00 2001
+From: Matthew Wild <mwild1@gmail.com>
+Date: Wed, 2 Apr 2014 21:02:29 +0100
+Subject: [PATCH] Make merging of CharacterData events optional, controlled by
+ the 3rd parameter of lxp.new()
+
+---
+ src/lxplib.c | 12 ++++++++++--
+ 1 file changed, 10 insertions(+), 2 deletions(-)
+
+diff --git a/src/lxplib.c b/src/lxplib.c
+index a7d6c42..794f6e3 100644
+--- a/src/lxplib.c
++++ b/src/lxplib.c
+@@ -57,6 +57,7 @@ struct lxp_userdata {
+ int tableref; /* table with callbacks for this parser */
+ enum XPState state;
+ luaL_Buffer *b; /* to concatenate sequences of cdata pieces */
++ int bufferCharData; /* whether to buffer cdata pieces */
+ };
+
+ typedef struct lxp_userdata lxp_userdata;
+@@ -171,8 +172,13 @@ static void f_CharData (void *ud, const char *s, int len) {
+ lxp_userdata *xpu = (lxp_userdata *)ud;
+ if (xpu->state == XPSok) {
+ if (getHandle(xpu, CharDataKey) == 0) return; /* no handle */
+- xpu->state = XPSstring;
+- luaL_buffinit(xpu->L, xpu->b);
++ if(xpu->bufferCharData != 0) {
++ xpu->state = XPSstring;
++ luaL_buffinit(xpu->L, xpu->b);
++ } else {
++ lua_pushlstring(xpu->L, s, len);
++ docall(xpu, 1, 0);
++ }
+ }
+ if (xpu->state == XPSstring)
+ luaL_addlstring(xpu->b, s, len);
+@@ -393,8 +399,10 @@ static void checkcallbacks (lua_State *L) {
+
+ static int lxp_make_parser (lua_State *L) {
+ XML_Parser p;
++ int bufferCharData = (lua_type(L, 3) != LUA_TBOOLEAN) || (lua_toboolean(L, 3) != 0);
+ char sep = *luaL_optstring(L, 2, "");
+ lxp_userdata *xpu = createlxp(L);
++ xpu->bufferCharData = bufferCharData;
+ p = xpu->parser = (sep == '\0') ? XML_ParserCreate(NULL) :
+ XML_ParserCreateNS(NULL, sep);
+ if (!p)
+From cbaf85740f6032cfc025c7bde3f9861d15825928 Mon Sep 17 00:00:00 2001
+From: Matthew Wild <mwild1@gmail.com>
+Date: Wed, 2 Apr 2014 20:56:58 +0100
+Subject: [PATCH] Add support for XmlDecl handlers
+
+---
+ src/lxplib.c | 14 +++++++++++++-
+ src/lxplib.h | 1 +
+ 2 files changed, 14 insertions(+), 1 deletion(-)
+
+diff --git a/src/lxplib.c b/src/lxplib.c
+index 35bec3c..a7d6c42 100644
+--- a/src/lxplib.c
++++ b/src/lxplib.c
+@@ -345,6 +345,16 @@ static void f_StartDoctypeDecl (void *ud, const XML_Char *doctypeName,
+ docall(xpu, 4, 0);
+ }
+
++static void f_XmlDecl (void *ud, const XML_Char *version,
++ const XML_Char *encoding,
++ int standalone) {
++ lxp_userdata *xpu = (lxp_userdata *)ud;
++ if (getHandle(xpu, XmlDeclKey) == 0) return; /* no handle */
++ lua_pushstring(xpu->L, version);
++ lua_pushstring(xpu->L, encoding);
++ lua_pushboolean(xpu->L, standalone);
++ docall(xpu, 3, 0);
++}
+ /* }====================================================== */
+
+
+@@ -365,7 +375,7 @@ static void checkcallbacks (lua_State *L) {
+ "Default", "DefaultExpand", "StartElement", "EndElement",
+ "ExternalEntityRef", "StartNamespaceDecl", "EndNamespaceDecl",
+ "NotationDecl", "NotStandalone", "ProcessingInstruction",
+- "UnparsedEntityDecl", "StartDoctypeDecl", NULL};
++ "UnparsedEntityDecl", "StartDoctypeDecl", "XmlDecl", NULL};
+ if (hasfield(L, "_nonstrict")) return;
+ lua_pushnil(L);
+ while (lua_next(L, 1)) {
+@@ -420,6 +430,8 @@ static int lxp_make_parser (lua_State *L) {
+ XML_SetUnparsedEntityDeclHandler(p, f_UnparsedEntityDecl);
+ if (hasfield(L, StartDoctypeDeclKey))
+ XML_SetStartDoctypeDeclHandler(p, f_StartDoctypeDecl);
++ if (hasfield(L, XmlDeclKey))
++ XML_SetXmlDeclHandler(p, f_XmlDecl);
+ return 1;
+ }
+
+diff --git a/src/lxplib.h b/src/lxplib.h
+index 9c0be4f..4c7084c 100644
+--- a/src/lxplib.h
++++ b/src/lxplib.h
+@@ -20,5 +20,6 @@
+ #define ProcessingInstructionKey "ProcessingInstruction"
+ #define UnparsedEntityDeclKey "UnparsedEntityDecl"
+ #define StartDoctypeDeclKey "StartDoctypeDecl"
++#define XmlDeclKey "XmlDecl"
+
+ int luaopen_lxp (lua_State *L);
diff --git a/dev-lua/luaexpat/luaexpat-1.3.3-r2.ebuild b/dev-lua/luaexpat/luaexpat-1.3.3-r2.ebuild
new file mode 100644
index 000000000000..5b99b5d96bac
--- /dev/null
+++ b/dev-lua/luaexpat/luaexpat-1.3.3-r2.ebuild
@@ -0,0 +1,49 @@
+# Copyright 1999-2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+inherit multilib-minimal toolchain-funcs
+
+DESCRIPTION="LuaExpat is a SAX XML parser based on the Expat library"
+HOMEPAGE="https://matthewwild.co.uk/projects/luaexpat/ https://github.com/tomasguisasola/luaexpat"
+SRC_URI="https://github.com/tomasguisasola/luaexpat/archive/v${PV}.tar.gz -> ${P}.tar.gz"
+
+LICENSE="MIT"
+SLOT="0"
+KEYWORDS="~amd64 ~arm ~arm64 ~hppa ~mips ~ppc ~ppc64 ~sparc ~x86"
+
+RDEPEND=">=dev-lang/lua-5.1.5-r2:0[${MULTILIB_USEDEP}]
+ >=dev-libs/expat-2.1.0-r3[${MULTILIB_USEDEP}]"
+DEPEND="${RDEPEND}"
+BDEPEND="virtual/pkgconfig"
+
+PATCHES=(
+ "${FILESDIR}/${P}_makefile.patch"
+ "${FILESDIR}/${P}_getcurrentbytecount.patch"
+ "${FILESDIR}/${P}_restore_functionality.patch"
+)
+
+src_prepare() {
+ default
+ multilib_copy_sources
+}
+
+multilib_src_compile() {
+ emake \
+ CFLAGS="${CFLAGS}" \
+ LDFLAGS="${LDFLAGS}" \
+ CC="$(tc-getCC)" \
+ LUA_INC="$($(tc-getPKG_CONFIG) --variable INSTALL_INC lua)"
+}
+
+multilib_src_install() {
+ emake \
+ LUA_DIR="${D}/$($(tc-getPKG_CONFIG) --variable INSTALL_LMOD lua)" \
+ LUA_LIBDIR="${D}/$($(tc-getPKG_CONFIG) --variable INSTALL_CMOD lua)" \
+ install
+}
+
+multilib_src_install_all() {
+ dodoc -r README.md doc/*
+}