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 <alex@shruggie.ro>
This commit is contained in:
Alexandru Ardelean authored and Alexandru Ardelean committed 2026-10-06 10:40:22 +03:00
1 parent 6c5a3c4d78
commit 5432f90a1f
2 files changed
+6 -26

No files matched your search

+6 -1
View File
@@ -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) \
@@ -1,25 +0,0 @@
From dd82c673231224361dc9ec3cd2861418fd4ce731 Mon Sep 17 00:00:00 2001
From: Alexandru Ardelean <alex@shruggie.ro>
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 <alex@shruggie.ro>
---
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 "/"