From b1491214db020cc1306749bbbbfce825163a9e22 Mon Sep 17 00:00:00 2001 From: vanhofen Date: Sat, 28 May 2022 15:30:53 +0200 Subject: [PATCH] - luaexpat: rework build --- package/luaexpat/luaexpat.mk | 25 ++++++------ .../0001-restore-getcurrentbytecount.patch | 40 +++++++++++++++++++ .../luaexpat/patches/luaexpat-makefile.patch | 23 ----------- 3 files changed, 52 insertions(+), 36 deletions(-) create mode 100644 package/luaexpat/patches/0001-restore-getcurrentbytecount.patch delete mode 100644 package/luaexpat/patches/luaexpat-makefile.patch diff --git a/package/luaexpat/luaexpat.mk b/package/luaexpat/luaexpat.mk index cfb23517..32b956d9 100644 --- a/package/luaexpat/luaexpat.mk +++ b/package/luaexpat/luaexpat.mk @@ -7,10 +7,7 @@ LUAEXPAT_VERSION = 1.3.3 LUAEXPAT_DIR = luaexpat-$(LUAEXPAT_VERSION) LUAEXPAT_SOURCE = luaexpat-$(LUAEXPAT_VERSION).tar.gz -LUAEXPAT_SITE = https://github.com/tomasguisasola/luaexpat/archive - -$(DL_DIR)/$(LUAEXPAT_SOURCE): - $(download) $(LUAEXPAT_SITE)/v$(LUAEXPAT_VERSION).tar.gz -O $(@) +LUAEXPAT_SITE = $(call github,tomasguisasola,luaexpat,v$(LUAEXPAT_VERSION)) LUAEXPAT_DEPENDENCIES = expat lua @@ -21,14 +18,16 @@ LUAEXPAT_MAKE_OPTS = \ PREFIX=$(TARGET_prefix) \ LUA_SYS_VER=$(LUA_ABIVERSION) -luaexpat: $(LUAEXPAT_DEPENDENCIES) $(DL_DIR)/$(LUAEXPAT_SOURCE) | $(TARGET_DIR) - $(REMOVE)/$(PKG_DIR) - $(UNTAR)/$(PKG_SOURCE) - $(CHDIR)/$(PKG_DIR); \ - $(SED) 's|^EXPAT_INC=.*|EXPAT_INC= $(TARGET_includedir)|' makefile; \ - $(SED) 's|^CFLAGS =.*|& -L$(TARGET_libdir)|' makefile; \ - $(SED) 's|^CC =.*|CC = $(TARGET_CC)|' makefile; \ +define LUAEXPAT_PATCH_MAKEFILE + $(SED) 's|^EXPAT_INC=.*|EXPAT_INC= $(TARGET_includedir)|' $(PKG_BUILD_DIR)/makefile + $(SED) 's|^CFLAGS =.*|& -L$(TARGET_libdir)|' $(PKG_BUILD_DIR)/makefile + $(SED) 's|^CC =.*|CC = $(TARGET_CC)|' $(PKG_BUILD_DIR)/makefile +endef +LUAEXPAT_POST_PATCH_HOOKS += LUAEXPAT_PATCH_MAKEFILE + +luaexpat: | $(TARGET_DIR) + $(call PREPARE) + $(CHDIR)/$($(PKG)_DIR); \ $($(PKG)_MAKE_ENV) $(MAKE) $($(PKG)_MAKE_OPTS); \ $($(PKG)_MAKE_ENV) $(MAKE) $($(PKG)_MAKE_OPTS) install - $(REMOVE)/$(PKG_DIR) - $(TOUCH) + $(call TARGET_FOLLOWUP) diff --git a/package/luaexpat/patches/0001-restore-getcurrentbytecount.patch b/package/luaexpat/patches/0001-restore-getcurrentbytecount.patch new file mode 100644 index 00000000..62aad2a3 --- /dev/null +++ b/package/luaexpat/patches/0001-restore-getcurrentbytecount.patch @@ -0,0 +1,40 @@ +From 77cb691f781918908dfe34785f00a5ff75d5cc20 Mon Sep 17 00:00:00 2001 +From: Francois Perrad +Date: Sat, 16 Feb 2019 15:56:00 +0100 +Subject: [PATCH] restore getcurrentbytecount + +see https://github.com/tomasguisasola/luaexpat/issues/3 + +Fetch from: https://github.com/tomasguisasola/luaexpat/commit/0926f2d705109b7d35b721344264b39c1169e0de + +Signed-off-by: Francois Perrad +--- + src/lxplib.c | 7 +++++++ + 1 file changed, 7 insertions(+) + +diff --git a/luaexpat-1.3.3/src/lxplib.c b/luaexpat-1.3.3/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}, +-- +2.17.1 + diff --git a/package/luaexpat/patches/luaexpat-makefile.patch b/package/luaexpat/patches/luaexpat-makefile.patch deleted file mode 100644 index aa78e27c..00000000 --- a/package/luaexpat/patches/luaexpat-makefile.patch +++ /dev/null @@ -1,23 +0,0 @@ ---- a/Makefile -+++ b/Makefile -@@ -3,15 +3,15 @@ - 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) -+LUA_V ?= 5.2 -+LUA_LDIR ?= $(PREFIX)/share/lua/$(LUA_V) -+LUA_CDIR ?= $(PREFIX)/lib/lua/$(LUA_V) - T = lxp - LIBNAME = $(T).so - - COMMON_CFLAGS = -g -pedantic -Wall -O2 -fPIC -DPIC -ansi --LUA_INC ?= -I/usr/include/lua$(LUA_V) --EXPAT_INC ?= -I/usr/include -+LUA_INC ?= -I$(PREFIX)/include -+EXPAT_INC ?= -I$(PREFIX)/include - CF = $(LUA_INC) $(EXPAT_INC) $(COMMON_CFLAGS) $(CFLAGS) - - EXPAT_LIB = -lexpat