re-add lua 5.2.4
cover re-add lua 5.2.4
I'm caught a bit between a rock and a hard place,
I want to use the simplefb (https://codeberg.org/gnarz/simplefb) library with mpv, however simplefb needs lua 5.2 (or later with slight modification) and cannot be easily backported to 5.1.
mpv of course only supports 5.2, 5.1 or luajit.
Porting mpv to lua 5.3 or newer would be pretty unwise, the mpv maintainers have made it very clear it would break stuff (internally & externally) and they are very uninterested in changing it, see:
https://github.com/mpv-player/mpv/wiki/FAQ#why-does-mpv-not-support-lua-53-or-newer
https://github.com/mpv-player/mpv/issues/9225
The least painful solution to my problem I can think of is re-adding lua 5.2 support to buildroot, basically entirely for the benefit of mpv. It's very unlikely mpv will *ever* support a newer version of lua.
Any objections? It seems like we are still supporting lua 5.1 for legacy reasons, and I am happy to maintain this.
Sen Hastings (1):
package/lua: re-add lua 5.2.4
Config.in.legacy | 10 +-- package/lua/5.2.4/0001-root-path.patch | 17 ++++ .../lua/5.2.4/0002-shared-libs-for-lua.patch | 78 +++++++++++++++++++ package/lua/5.2.4/0011-linenoise.patch | 26 +++++++ package/lua/5.2.4/lua.hash | 2 + package/lua/Config.in | 7 +- package/lua/lua.mk | 6 +- package/luainterpreter/Config.in | 4 + package/mpv/mpv.mk | 2 +- 9 files changed, 144 insertions(+), 8 deletions(-) create mode 100644 package/lua/5.2.4/0001-root-path.patch create mode 100644 package/lua/5.2.4/0002-shared-libs-for-lua.patch create mode 100644 package/lua/5.2.4/0011-linenoise.patch create mode 100644 package/lua/5.2.4/lua.hash
Signature · 6 lines
2.43.0 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH 1/1 package/lua: re-add lua 5.2.4
This patch basically reverts
https://lore.kernel.org/buildroot/[email protected]/
while adopting the slight changes made to buildroots lua build infrastructure since 2018.
--- Config.in.legacy | 10 +-- package/lua/5.2.4/0001-root-path.patch | 17 ++++ .../lua/5.2.4/0002-shared-libs-for-lua.patch | 78 +++++++++++++++++++ package/lua/5.2.4/0011-linenoise.patch | 26 +++++++ package/lua/5.2.4/lua.hash | 2 + package/lua/Config.in | 7 +- package/lua/lua.mk | 6 +- package/luainterpreter/Config.in | 4 + package/mpv/mpv.mk | 2 +- 9 files changed, 144 insertions(+), 8 deletions(-) create mode 100644 package/lua/5.2.4/0001-root-path.patch create mode 100644 package/lua/5.2.4/0002-shared-libs-for-lua.patch create mode 100644 package/lua/5.2.4/0011-linenoise.patch create mode 100644 package/lua/5.2.4/lua.hash
Config.in.legacy +5 -5
@@ -4201,11 +4201,11 @@ config BR2_PACKAGE_FFTW_PRECISION_QUAD This option has been removed in favor of BR2_PACKAGE_FFTW_QUAD. -config BR2_PACKAGE_LUA_5_2 - bool "Lua 5.2.x version removed" - select BR2_LEGACY - help - The Lua 5.2.x version was removed. +#config BR2_PACKAGE_LUA_5_2 +# bool "Lua 5.2.x version removed" +# select BR2_LEGACY +# help +# The Lua 5.2.x version was removed. # Note: BR2_PACKAGE_LUA_5_2 is still referenced from package/lua/Config.in config BR2_TARGET_GENERIC_PASSWD_MD5
package/lua/5.2.4/0001-root-path.patch new file +17 -0
@@ -0,0 +1,17 @@ +Adjust installation location to /usr. + +Signed-off-by: Francois Perrad <[email protected]> + +Index: b/src/luaconf.h +=================================================================== +--- a/src/luaconf.h ++++ b/src/luaconf.h +@@ -100,7 +100,7 @@ + #else /* }{ */ + + #define LUA_VDIR LUA_VERSION_MAJOR "." LUA_VERSION_MINOR "/" +-#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 + #define LUA_PATH_DEFAULT \
package/lua/5.2.4/0002-shared-libs-for-lua.patch new file +78 -0
78 lines not on this page · raw message
package/lua/5.2.4/0011-linenoise.patch new file +26 -0
@@ -0,0 +1,26 @@ +Add support of linenoise (replace readline) + +see discussion, http://lua-users.org/lists/lua-l/2010-03/msg00879.html + +Signed-off-by: Francois Perrad <[email protected]> + +Index: b/src/lua.c +=================================================================== +--- a/src/lua.c ++++ b/src/lua.c +@@ -72,6 +72,15 @@ + add_history(lua_tostring(L, idx)); /* add it to history */ + #define lua_freeline(L,b) ((void)L, free(b)) + ++#elif defined(LUA_USE_LINENOISE) ++ ++#include <linenoise.h> ++#define lua_readline(L,b,p) ((void)L, ((b)=linenoise(p)) != NULL) ++#define lua_saveline(L,idx) \ ++ if (lua_rawlen(L,idx) > 0) /* non-empty line? */ \ ++ linenoiseHistoryAdd(lua_tostring(L, idx)); /* add it to history */ ++#define lua_freeline(L,b) ((void)L, free(b)) ++ + #elif !defined(lua_readline) + + #define lua_readline(L,b,p) \
package/lua/5.2.4/lua.hash new file +2 -0
@@ -0,0 +1,2 @@ +md5 913fdb32207046b273fdb17aad70be13 lua-5.2.4.tar.gz +sha1 ef15259421197e3d85b7d6e4871b8c26fd82c1cf lua-5.2.4.tar.gz
package/lua/Config.in +6 -1
@@ -14,7 +14,8 @@ config BR2_PACKAGE_PROVIDES_LUAINTERPRETER choice prompt "Lua Version" - default BR2_PACKAGE_LUA_5_3 if BR2_PACKAGE_LUA_5_2 # legacy + default BR2_PACKAGE_LUA_5_2 + default BR2_PACKAGE_LUA_5_3 default BR2_PACKAGE_LUA_5_4 help Select the version of Lua API/ABI you wish to use.
@@ -25,6 +26,10 @@ config BR2_PACKAGE_LUA_5_1 select BR2_PACKAGE_LUA_CVT_N2S select BR2_PACKAGE_LUA_CVT_S2N +config BR2_PACKAGE_LUA_5_2 + bool "Lua 5.2.x" + select BR2_PACKAGE_LUAINTERPRETER_ABI_VERSION_5_2 + config BR2_PACKAGE_LUA_5_3 bool "Lua 5.3.x" select BR2_PACKAGE_LUAINTERPRETER_ABI_VERSION_5_3
package/lua/lua.mk +5 -1
@@ -8,13 +8,15 @@ ifeq ($(BR2_PACKAGE_LUA_5_4),y) LUA_VERSION = 5.4.8 else ifeq ($(BR2_PACKAGE_LUA_5_3),y) LUA_VERSION = 5.3.6 +else ifeq ($(BR2_PACKAGE_LUA_5_2),y) +LUA_VERSION = 5.2.4 else LUA_VERSION = 5.1.5 endif LUA_SITE = https://www.lua.org/ftp LUA_INSTALL_STAGING = YES LUA_LICENSE = MIT -ifeq ($(BR2_PACKAGE_LUA_5_3)$(BR2_PACKAGE_LUA_5_4),y) +ifeq ($(BR2_PACKAGE_LUA_5_2)$(BR2_PACKAGE_LUA_5_3)$(BR2_PACKAGE_LUA_5_4),y) LUA_LICENSE_FILES = doc/readme.html else LUA_LICENSE_FILES = COPYRIGHT
@@ -35,6 +37,8 @@ ifeq ($(BR2_PACKAGE_LUA_5_4),y) LUA_CFLAGS += -DLUA_COMPAT_5_3 else ifeq ($(BR2_PACKAGE_LUA_5_3),y) LUA_CFLAGS += -DLUA_COMPAT_5_2 +else ifeq ($(BR2_PACKAGE_LUA_5_2),y) +LUA_CFLAGS += -DLUA_COMPAT_ALL endif ifeq ($(BR2_PACKAGE_LUA_CVT_N2S),)
package/luainterpreter/Config.in +4 -0
@@ -8,12 +8,16 @@ config BR2_PACKAGE_PROVIDES_LUAINTERPRETER config BR2_PACKAGE_LUAINTERPRETER_ABI_VERSION string default "5.1" if BR2_PACKAGE_LUAINTERPRETER_ABI_VERSION_5_1 + default "5.2" if BR2_PACKAGE_LUAINTERPRETER_ABI_VERSION_5_2 default "5.3" if BR2_PACKAGE_LUAINTERPRETER_ABI_VERSION_5_3 default "5.4" if BR2_PACKAGE_LUAINTERPRETER_ABI_VERSION_5_4 config BR2_PACKAGE_LUAINTERPRETER_ABI_VERSION_5_1 bool +config BR2_PACKAGE_LUAINTERPRETER_ABI_VERSION_5_2 + bool + config BR2_PACKAGE_LUAINTERPRETER_ABI_VERSION_5_3 bool
package/mpv/mpv.mk +1 -1
@@ -128,7 +128,7 @@ endif # LUA support, only for lua51/lua52/luajit # This enables the controller (OSD) together with libass -ifeq ($(BR2_PACKAGE_LUA_5_1)$(BR2_PACKAGE_LUAJIT),y) +ifeq ($(BR2_PACKAGE_LUA_5_1)$(BR2_PACKAGE_LUA_5_2)$(BR2_PACKAGE_LUAJIT),y) MPV_CONF_OPTS += -Dlua=enabled MPV_DEPENDENCIES += luainterpreter else
Signature · 6 lines
2.43.0 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Quoted 6 lines · Sen Hastings
I'm caught a bit between a rock and a hard place,
I want to use the simplefb (https://codeberg.org/gnarz/simplefb) library with mpv, however simplefb needs lua 5.2 (or later with slight modification)
and cannot be easily backported to 5.1.
There are few incompatibility between C/API Lua versions. It is easy to write a compatible code for simplefb.
The following patch does the job, compatible from Lua 5.1 to Lua 5.5.
So, Lua 5.2 is not needed.
François
--- lsimplefb.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
lsimplefb.c +14 -0
@@ -11,6 +11,16 @@#include "lua.h" #include "lauxlib.h" +#if LUA_VERSION_NUM <502 +#define luaL_setfuncs (L ,l,n) luaL_register(L, NULL, (l)) +#endif + +#if LUA_VERSION_NUM !=502 +#define luaL_checkunsigned luaL_checkinteger +#define luaL_optunsigned luaL_optinteger +#define lua_pushunsigned lua_pushinteger +#endif +#include "simplefb.h" #define VERSION 0.1
@@ -533,7 +543,11 @@ static const struct luaL_Reg fbL_functions [] ={*/ int luaopen_simplefb (lua_State *L ) { +#if LUA_VERSION_NUM >=502 luaL_newlib (L , fbL_functions); +#else +luaL_register (L ,"simplefb" , fbL_functions); +#endif lua_pushliteral (L ,"_VERSION" );lua_pushnumber (L ,VERSION );
Signature · 1 line
2.48.1
Quoted 35 lines
mpv of course only supports 5.2, 5.1 or luajit.
Porting mpv to lua 5.3 or newer would be pretty unwise, the mpv maintainers have made it very clear it would break stuff (internally & externally) and they are very uninterested in changing it, see:https://github.com/mpv-player/mpv/wiki/FAQ#why-does-mpv-not-support-lua-53-or-newer
https://github.com/mpv-player/mpv/issues/9225The least painful solution to my problem I can think of is re-adding lua 5.2
support to buildroot, basically entirely for the benefit of mpv. It's very unlikely mpv will *ever* support a newer version of lua.Any objections? It seems like we are still supporting lua 5.1 for legacy reasons,
and I am happy to maintain this.Sen Hastings (1):
package/lua: re-add lua 5.2.4Config.in.legacy | 10 +-- package/lua/5.2.4/0001-root-path.patch | 17 ++++ .../lua/5.2.4/0002-shared-libs-for-lua.patch | 78 +++++++++++++++++++ package/lua/5.2.4/0011-linenoise.patch | 26 +++++++ package/lua/5.2.4/lua.hash | 2 + package/lua/Config.in | 7 +- package/lua/lua.mk | 6 +- package/luainterpreter/Config.in | 4 + package/mpv/mpv.mk | 2 +- 9 files changed, 144 insertions(+), 8 deletions(-) create mode 100644 package/lua/5.2.4/0001-root-path.patch create mode 100644 package/lua/5.2.4/0002-shared-libs-for-lua.patch create mode 100644 package/lua/5.2.4/0011-linenoise.patch create mode 100644 package/lua/5.2.4/lua.hash
Quoted 4 lines
--
2.43.0
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot