]> git.99rst.org Git - openwrt-packages.git/commitdiff
lua: look for lua5.4 modules under /usr instead of /usr/local
authorAlexandru Ardelean <redacted>
Wed, 22 Jul 2026 11:52:14 +0000 (14:52 +0300)
committerAlexandru Ardelean <redacted>
Fri, 31 Jul 2026 06:46:08 +0000 (09:46 +0300)
luaconf.h hardcodes LUA_ROOT to "/usr/local/", and nothing in this
package overrides it for the target build, so the interpreter only ever
searches /usr/local/{share,lib}/lua/5.4. Nothing installs there on
OpenWrt, which leaves every Lua 5.4 module package unreachable:

  # lua5.4 -e 'require "lfs"'
  lua5.4: module 'lfs' not found:
          no file '/usr/local/share/lua/5.4/lfs.lua'
          no file '/usr/local/lib/lua/5.4/lfs.so'
          [...]
  # find / -name lfs.so
  /usr/lib/lua/5.4/lfs.so

Point LUA_ROOT at /usr. LUA_LDIR and LUA_CDIR are derived from it and
keep the version suffix, so the search paths become /usr/share/lua/5.4
and /usr/lib/lua/5.4 - exactly where the Lua 5.4 module packages
install. The core lua (5.1) package carries an equivalent patch.

Signed-off-by: Alexandru Ardelean <redacted>
lang/lua/lua5.4/Makefile
lang/lua/lua5.4/patches/200-lua-path.patch [new file with mode: 0644]

index 3db0e300fa2f16236fdebd56120a4b48026e0007..d01e758539a86ce2ef57b18203f38235ac283bfe 100644 (file)
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=lua
 PKG_VERSION:=5.4.7
-PKG_RELEASE:=1
+PKG_RELEASE:=2
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
 PKG_SOURCE_URL:=https://www.lua.org/ftp/ \
diff --git a/lang/lua/lua5.4/patches/200-lua-path.patch b/lang/lua/lua5.4/patches/200-lua-path.patch
new file mode 100644 (file)
index 0000000..1fa32cd
--- /dev/null
@@ -0,0 +1,25 @@
+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 "/"
git clone https://git.99rst.org/PROJECT