commit:     e446a4d2f404914db7caaeb99c9b8f6879ad9e4c
Author:     Azamat H. Hackimov <azamat.hackimov <AT> gmail <DOT> com>
AuthorDate: Sun Oct  4 20:14:52 2020 +0000
Commit:     Conrad Kostecki <conikost <AT> gentoo <DOT> org>
CommitDate: Mon Oct  5 21:30:39 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e446a4d2

dev-lua/luaexpat: add getcurrentbytecount() func

Restore missed getcurrentbytecount() from upstream, required by net-im/prosody.
See:
* https://github.com/tomasguisasola/luaexpat/issues/3
* https://issues.prosody.im/1375

Closes: https://github.com/gentoo/gentoo/pull/17770
Package-Manager: Portage-3.0.4, Repoman-3.0.1
Signed-off-by: Azamat H. Hackimov <azamat.hackimov <AT> gmail.com>
Signed-off-by: Conrad Kostecki <conikost <AT> gentoo.org>

 .../files/luaexpat-1.3.3_getcurrentbytecount.patch | 33 +++++++++++++++
 dev-lua/luaexpat/luaexpat-1.3.3-r1.ebuild          | 48 ++++++++++++++++++++++
 2 files changed, 81 insertions(+)

diff --git a/dev-lua/luaexpat/files/luaexpat-1.3.3_getcurrentbytecount.patch 
b/dev-lua/luaexpat/files/luaexpat-1.3.3_getcurrentbytecount.patch
new file mode 100644
index 00000000000..7366163d9d8
--- /dev/null
+++ b/dev-lua/luaexpat/files/luaexpat-1.3.3_getcurrentbytecount.patch
@@ -0,0 +1,33 @@
+From 0926f2d705109b7d35b721344264b39c1169e0de Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Fran=C3=A7ois=20Perrad?= <francois.per...@gadz.org>
+Date: Sat, 16 Feb 2019 16:08:25 +0100
+Subject: [PATCH] restore method getcurrentbytecount
+
+fix #3
+---
+ src/lxplib.c | 7 +++++++
+ 1 file changed, 7 insertions(+)
+
+diff --git a/src/lxplib.c b/src/lxplib.c
+index 7726913..35bec3c 100644
+--- a/src/lxplib.c
++++ b/src/lxplib.c
+@@ -538,11 +538,18 @@ static int lxp_stop (lua_State *L) {
+   return 1;
+ }
+ 
++static int lxp_getcurrentbytecount (lua_State* L) {
++  lxp_userdata *xpu = checkparser(L, 1);
++  lua_pushinteger(L, XML_GetCurrentByteCount(xpu->parser));
++  return 1;
++}
++
+ static const luaL_Reg lxp_meths[] = {
+   {"parse", lxp_parse},
+   {"close", lxp_close},
+   {"__gc", parser_gc},
+   {"pos", lxp_pos},
++  {"getcurrentbytecount", lxp_getcurrentbytecount},
+   {"setencoding", lxp_setencoding},
+   {"getcallbacks", getcallbacks},
+   {"getbase", getbase},

diff --git a/dev-lua/luaexpat/luaexpat-1.3.3-r1.ebuild 
b/dev-lua/luaexpat/luaexpat-1.3.3-r1.ebuild
new file mode 100644
index 00000000000..72168a4d532
--- /dev/null
+++ b/dev-lua/luaexpat/luaexpat-1.3.3-r1.ebuild
@@ -0,0 +1,48 @@
+# 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"
+)
+
+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/*
+}

Reply via email to