From 5432f90a1fb21385bda69a27e3712546bd6d9053 Mon Sep 17 00:00:00 2001 From: Alexandru Ardelean Date: Mon, 5 Oct 2026 13:56:07 +0300 Subject: [PATCH] lua: drop the lua5.4 LUA_ROOT patch luaconf.h builds the module search paths out of LUA_ROOT, which upstream hardcodes to /usr/local, where nothing installs on OpenWrt. LUA_ROOT is defined unconditionally, but the two macros it feeds, LUA_PATH_DEFAULT and LUA_CPATH_DEFAULT, are both guarded with #if !defined and are the only users of it, so set them in TARGET_CFLAGS and drop the patch. The resulting paths are the ones the patch produced, so the interpreter behaves exactly as before. Signed-off-by: Alexandru Ardelean --- lang/lua/lua5.4/Makefile | 7 +++++- lang/lua/lua5.4/patches/200-lua-path.patch | 25 ---------------------- 2 files changed, 6 insertions(+), 26 deletions(-) delete mode 100644 lang/lua/lua5.4/patches/200-lua-path.patch diff --git a/lang/lua/lua5.4/Makefile b/lang/lua/lua5.4/Makefile index d01e758539..6e03261eaf 100644 --- a/lang/lua/lua5.4/Makefile +++ b/lang/lua/lua5.4/Makefile @@ -84,7 +84,12 @@ define Build/Prepare mv $(PKG_BUILD_DIR)/doc/luac.1 $(PKG_BUILD_DIR)/doc/luac5.4.1 endef -TARGET_CFLAGS += -DLUA_USE_LINUX $(FPIC) -std=gnu99 +LUA_LMOD_DIR:=/usr/share/lua/5.4 +LUA_CMOD_DIR:=/usr/lib/lua/5.4 + +TARGET_CFLAGS += -DLUA_USE_LINUX $(FPIC) -std=gnu99 \ + -DLUA_PATH_DEFAULT='\"$(LUA_LMOD_DIR)/?.lua;$(LUA_LMOD_DIR)/?/init.lua;$(LUA_CMOD_DIR)/?.lua;$(LUA_CMOD_DIR)/?/init.lua;./?.lua;./?/init.lua\"' \ + -DLUA_CPATH_DEFAULT='\"$(LUA_CMOD_DIR)/?.so;$(LUA_CMOD_DIR)/loadall.so;./?.so\"' define Build/Compile $(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \ diff --git a/lang/lua/lua5.4/patches/200-lua-path.patch b/lang/lua/lua5.4/patches/200-lua-path.patch deleted file mode 100644 index 1fa32cd85a..0000000000 --- a/lang/lua/lua5.4/patches/200-lua-path.patch +++ /dev/null @@ -1,25 +0,0 @@ -From dd82c673231224361dc9ec3cd2861418fd4ce731 Mon Sep 17 00:00:00 2001 -From: Alexandru Ardelean -Date: Wed, 22 Jul 2026 14:52:14 +0300 -Subject: [PATCH] lua5.4: point LUA_ROOT at /usr for OpenWrt module paths - -luaconf.h hardcodes LUA_ROOT to /usr/local/, where nothing installs on -OpenWrt; point it at /usr/ so modules under /usr/{share,lib}/lua/5.4/ -are found. - -Signed-off-by: Alexandru Ardelean ---- - src/luaconf.h | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/src/luaconf.h -+++ b/src/luaconf.h -@@ -223,7 +223,7 @@ - - #else /* }{ */ - --#define LUA_ROOT "/usr/local/" -+#define LUA_ROOT "/usr/" - #define LUA_LDIR LUA_ROOT "share/lua/" LUA_VDIR "/" - #define LUA_CDIR LUA_ROOT "lib/lua/" LUA_VDIR "/" -