From 8977cdc8ff8da83a150ab1e0491e36dd082aff7d Mon Sep 17 00:00:00 2001 From: Adolf Belka Date: Sat, 24 Apr 2021 13:24:11 +0200 Subject: [PATCH] lua: Update to 5.4.3 - v2 patch version has required libraries not commented - v2 patch version has lua.pc file commented out in the rootfile pkgconfig file is only required for build or development and not for normal running of IPFire - v2 patch version has make linux changed to make all INSTALL_TOP is required - default is /usr/local INSTALL_DATA is required - default results in an empty rootfile TO_LIB is required - default results in only lua.a in rootfile - v2 patch version includes PAK_VER updates for dnsdist and haproxy due to sobump. These packages showed up as dependencies to the old lua library ncat was also linked but already had a PAK_VER change due to a package upgrade and so no longer showed up in the find-dependencies scan - Update from 5.3.5 to 5.4.3 - Autotoolize patch not update since 5.3 series Based on input from Michael Tremer implemented build approach from BLFS. This approach also used by Arch Linux. Updated lfs in line with approach. Added pkgconfig file lua.pc as used in BLFS. - Update of shared_library patch obtained from BLFS - Update of rootfile - Removal of old lua-5.3.5 patches - Changelog Main changes new generational mode for garbage collection to-be-closed variables const variables userdata can have multiple user values new implementation for math.random warning system debug information about function arguments and returns new semantics for the integer 'for' loop optional 'init' argument to 'string.gmatch' new functions 'lua_resetthread' and 'coroutine.close' string-to-number coercions moved to the string library allocation function allowed to fail when shrinking a memory block new format '%p' in 'string.format' utf8 library accepts codepoints up to 2^31 Signed-off-by: Adolf Belka Signed-off-by: Michael Tremer --- config/lua/lua.pc | 20 ++ config/rootfiles/common/lua | 11 +- lfs/lua | 23 ++- src/patches/lua-5.4.3-shared_library-1.patch | 78 +++++++ src/patches/lua/lua-5.3.5-autotoolize.patch | 192 ------------------ .../lua/lua-5.3.5-shared_library-1.patch | 61 ------ 6 files changed, 117 insertions(+), 268 deletions(-) create mode 100644 config/lua/lua.pc create mode 100644 src/patches/lua-5.4.3-shared_library-1.patch delete mode 100644 src/patches/lua/lua-5.3.5-autotoolize.patch delete mode 100644 src/patches/lua/lua-5.3.5-shared_library-1.patch diff --git a/config/lua/lua.pc b/config/lua/lua.pc new file mode 100644 index 0000000000..f6d25ec33d --- /dev/null +++ b/config/lua/lua.pc @@ -0,0 +1,20 @@ +V=5.4 +R=5.4.3 + +prefix=/usr +INSTALL_BIN=${prefix}/bin +INSTALL_INC=${prefix}/include +INSTALL_LIB=${prefix}/lib +INSTALL_MAN=${prefix}/share/man/man1 +INSTALL_LMOD=${prefix}/share/lua/${V} +INSTALL_CMOD=${prefix}/lib/lua/${V} +exec_prefix=${prefix} +libdir=${exec_prefix}/lib +includedir=${prefix}/include + +Name: Lua +Description: An Extensible Extension Language +Version: ${R} +Requires: +Libs: -L${libdir} -llua -lm -ldl +Cflags: -I${includedir} diff --git a/config/rootfiles/common/lua b/config/rootfiles/common/lua index 15d5995b37..1839f7e1bc 100644 --- a/config/rootfiles/common/lua +++ b/config/rootfiles/common/lua @@ -5,10 +5,13 @@ usr/bin/luac #usr/include/lua.hpp #usr/include/luaconf.h #usr/include/lualib.h -usr/lib/liblua-5.3.so -#usr/lib/liblua.a -#usr/lib/liblua.la -usr/lib/liblua.so +#usr/lib/liblua.so +usr/lib/liblua.so.5.4 +usr/lib/liblua.so.5.4.3 +#usr/lib/lua +#usr/lib/lua/5.4 #usr/lib/pkgconfig/lua.pc +#usr/share/lua +#usr/share/lua/5.4 #usr/share/man/man1/lua.1 #usr/share/man/man1/luac.1 diff --git a/lfs/lua b/lfs/lua index e70b9cd002..8fffba704a 100644 --- a/lfs/lua +++ b/lfs/lua @@ -24,7 +24,7 @@ include Config -VER = 5.3.5 +VER = 5.4.3 THISAPP = lua-$(VER) DL_FILE = $(THISAPP).tar.gz @@ -40,7 +40,7 @@ objects = $(DL_FILE) $(DL_FILE) = $(DL_FROM)/$(DL_FILE) -$(DL_FILE)_MD5 = 4f4b4f323fd3514a68e0ab3da8ce3455 +$(DL_FILE)_MD5 = ef63ed2ecfb713646a7fcc583cf5f352 install : $(TARGET) @@ -70,14 +70,15 @@ $(subst %,%_MD5,$(objects)) : $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects)) @$(PREBUILD) @rm -rf $(DIR_APP) && cd $(DIR_SRC) && tar axf $(DIR_DL)/$(DL_FILE) - cd $(DIR_APP) && cp -v src/luaconf.h src/luaconf.h.template.in - - cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/lua/lua-5.3.5-autotoolize.patch - cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/lua/lua-5.3.5-shared_library-1.patch - - cd $(DIR_APP) && autoreconf -vfi - cd $(DIR_APP) && ./configure --prefix=/usr - cd $(DIR_APP) && make $(MAKETUNING) - cd $(DIR_APP) && make install + cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/lua-5.4.3-shared_library-1.patch + # install lua pkgconfig file + install -v -m 644 ${DIR_SRC}/config/lua/lua.pc \ + /usr/lib/pkgconfig/lua.pc + cd $(DIR_APP) && make all $(MAKETUNING) + cd $(DIR_APP) && make INSTALL_TOP=/usr \ + INSTALL_DATA="cp -d" \ + INSTALL_MAN=/usr/share/man/man1 \ + TO_LIB="liblua.so liblua.so.5.4 liblua.so.5.4.3" \ + install @rm -rf $(DIR_APP) @$(POSTBUILD) diff --git a/src/patches/lua-5.4.3-shared_library-1.patch b/src/patches/lua-5.4.3-shared_library-1.patch new file mode 100644 index 0000000000..f1dfad9ca4 --- /dev/null +++ b/src/patches/lua-5.4.3-shared_library-1.patch @@ -0,0 +1,78 @@ +Submitted By: Douglas R. Reno +Date: 2020-06-30 +Initial Package Version: 5.4.0 +Upstream Status: Rejected +Origin: Arch Linux, with some modifications +Description: Creates a shared liblua library, as well as + removes optimization since it causes SIGBUS errors, + and sets the search path to /usr from /usr/local. + The initial version of this patch was created by + Igor Zivkovic, before being rediffed for 5.4.0 by + myself with some modifications made. + +diff -Naurp lua-5.4.0.orig/Makefile lua-5.4.0/Makefile +--- lua-5.4.0.orig/Makefile 2020-04-15 07:55:07.000000000 -0500 ++++ lua-5.4.0/Makefile 2020-06-30 13:22:00.997938585 -0500 +@@ -52,7 +52,7 @@ R= $V.0 + all: $(PLAT) + + $(PLATS) help test clean: +- @cd src && $(MAKE) $@ ++ @cd src && $(MAKE) $@ V=$(V) R=$(R) + + install: dummy + cd src && $(MKDIR) $(INSTALL_BIN) $(INSTALL_INC) $(INSTALL_LIB) $(INSTALL_MAN) $(INSTALL_LMOD) $(INSTALL_CMOD) +diff -Naurp lua-5.4.0.orig/src/luaconf.h lua-5.4.0/src/luaconf.h +--- lua-5.4.0.orig/src/luaconf.h 2020-06-18 09:25:54.000000000 -0500 ++++ lua-5.4.0/src/luaconf.h 2020-06-30 13:24:59.294932289 -0500 +@@ -227,7 +227,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 "/" + +diff -Naurp lua-5.4.0.orig/src/Makefile lua-5.4.0/src/Makefile +--- lua-5.4.0.orig/src/Makefile 2020-04-15 08:00:29.000000000 -0500 ++++ lua-5.4.0/src/Makefile 2020-06-30 13:24:15.746933827 -0500 +@@ -7,7 +7,7 @@ + PLAT= guess + + CC= gcc -std=gnu99 +-CFLAGS= -O2 -Wall -Wextra -DLUA_COMPAT_5_3 $(SYSCFLAGS) $(MYCFLAGS) ++CFLAGS= -fPIC -O0 -Wall -Wextra -DLUA_COMPAT_5_3 -DLUA_COMPAT_5_2 -DLUA_COMPAT_5_1 $(SYSCFLAGS) $(MYCFLAGS) + LDFLAGS= $(SYSLDFLAGS) $(MYLDFLAGS) + LIBS= -lm $(SYSLIBS) $(MYLIBS) + +@@ -33,6 +33,7 @@ CMCFLAGS= -Os + PLATS= guess aix bsd c89 freebsd generic linux linux-readline macosx mingw posix solaris + + LUA_A= liblua.a ++LUA_SO= liblua.so + CORE_O= lapi.o lcode.o lctype.o ldebug.o ldo.o ldump.o lfunc.o lgc.o llex.o lmem.o lobject.o lopcodes.o lparser.o lstate.o lstring.o ltable.o ltm.o lundump.o lvm.o lzio.o + LIB_O= lauxlib.o lbaselib.o lcorolib.o ldblib.o liolib.o lmathlib.o loadlib.o loslib.o lstrlib.o ltablib.o lutf8lib.o linit.o + BASE_O= $(CORE_O) $(LIB_O) $(MYOBJS) +@@ -44,7 +45,7 @@ LUAC_T= luac + LUAC_O= luac.o + + ALL_O= $(BASE_O) $(LUA_O) $(LUAC_O) +-ALL_T= $(LUA_A) $(LUA_T) $(LUAC_T) ++ALL_T= $(LUA_A) $(LUA_T) $(LUAC_T) $(LUA_SO) + ALL_A= $(LUA_A) + + # Targets start here. +@@ -60,6 +61,12 @@ $(LUA_A): $(BASE_O) + $(AR) $@ $(BASE_O) + $(RANLIB) $@ + ++$(LUA_SO): $(CORE_O) $(LIB_O) ++ $(CC) -shared -ldl -Wl,--soname,$(LUA_SO).$(V) -o $@.$(R) $? -lm ++ $(MYLDFLAGS) ++ ln -sf $(LUA_SO).$(R) $(LUA_SO).$(V) ++ ln -sf $(LUA_SO).$(R) $(LUA_SO) ++ + $(LUA_T): $(LUA_O) $(LUA_A) + $(CC) -o $@ $(LDFLAGS) $(LUA_O) $(LUA_A) $(LIBS) + diff --git a/src/patches/lua/lua-5.3.5-autotoolize.patch b/src/patches/lua/lua-5.3.5-autotoolize.patch deleted file mode 100644 index 76747923a2..0000000000 --- a/src/patches/lua/lua-5.3.5-autotoolize.patch +++ /dev/null @@ -1,192 +0,0 @@ -diff -up lua-5.3.0/configure.ac.autoxxx lua-5.3.0/configure.ac ---- lua-5.3.0/configure.ac.autoxxx 2015-01-15 10:20:03.826889574 -0500 -+++ lua-5.3.0/configure.ac 2015-01-15 10:20:03.826889574 -0500 -@@ -0,0 +1,69 @@ -+AC_PREREQ(2.59) -+AC_INIT([lua], [5.3.0], [https://bugzilla.redhat.com/], [lua-at], [http://www.lua.org]) -+AC_SUBST([MAJOR_VERSION], [5.3]) -+ -+AC_CONFIG_HEADERS([config.h]) -+AC_CONFIG_SRCDIR([src/lapi.c]) -+ -+AM_INIT_AUTOMAKE([1.9 foreign]) -+ -+AC_PROG_CC -+AC_PROG_LIBTOOL -+ -+AC_ARG_WITH( -+ [readline], -+ [AC_HELP_STRING([--with-readline], [Use readline for interpreter input [default=yes]])], -+ [use_readline=$withval], -+ [use_readline=yes] -+) -+ -+LUA_LIBS="-lm" -+ -+# Check for readline -+READLINE_DEFS="#undef LUA_USE_READLINE" -+if test "x$use_readline" == "xyes"; then -+ AC_CHECK_LIB([readline], [readline], [:], [use_readline=no], [-lncurses]) -+ AC_CHECK_HEADERS([readline/readline.h readline/history.h], [], [use_readline=no]) -+ if test "x$use_readline" == "xno"; then -+ AC_MSG_WARN([readline headers could not be found, disabling readline support]) -+ else -+ READLINE_DEFS="#define LUA_USE_READLINE" -+ READLINE_LIBS="-lreadline -lncurses" -+ fi -+fi -+AC_SUBST(READLINE_DEFS) -+AC_SUBST(READLINE_LIBS) -+ -+case "$host" in -+ *-mingw*) use_os=win32 ;; -+ *-darwin*) use_os=macosx ;; -+ *) use_os=posix ;; -+esac -+ -+POSIX_DEFS="#undef LUA_USE_POSIX" -+LUA_DL_DEFS="#undef LUA_USE_DLOPEN" -+LUA_BUILD_AS_DLL_DEFS="#undef LUA_BUILD_AS_DLL" -+ -+if test "x$use_os" == "xwin32"; then -+ LUA_BUILD_AS_DLL_DEFS="#define LUA_BUILD_AS_DLL" -+elif test "x$use_os" == "xmacosx"; then -+ POSIX_DEFS="#define LUA_USE_POSIX" -+ LUA_DL_DEFS="#define LUA_DL_DYLD" -+elif test "x$use_os" == "xposix"; then -+ POSIX_DEFS="#define LUA_USE_POSIX" -+ LUA_DL_DEFS="#define LUA_DL_DLOPEN" -+ LUA_LIBS="$LUA_LIBS -ldl" -+fi -+AC_SUBST(POSIX_DEFS) -+AC_SUBST(LUA_DL_DEFS) -+AC_SUBST(LUA_BUILD_AS_DLL_DEFS) -+ -+AC_SUBST(LUA_LIBS) -+ -+AC_CONFIG_FILES([Makefile -+ src/Makefile -+ src/lua.pc -+ src/luaconf.h.template -+ doc/Makefile -+]) -+AC_OUTPUT -diff -up lua-5.3.0/doc/Makefile.am.autoxxx lua-5.3.0/doc/Makefile.am ---- lua-5.3.0/doc/Makefile.am.autoxxx 2015-01-15 10:20:03.826889574 -0500 -+++ lua-5.3.0/doc/Makefile.am 2015-01-15 10:20:03.826889574 -0500 -@@ -0,0 +1,4 @@ -+man1_MANS = lua.1 luac.1 -+ -+EXTRA_DIST = \ -+ contents.html logo.gif lua.1 luac.1 lua.css manual.css manual.html osi-certified-72x60.png readme.html -diff -up lua-5.3.0/Makefile.am.autoxxx lua-5.3.0/Makefile.am ---- lua-5.3.0/Makefile.am.autoxxx 2015-01-15 10:20:03.826889574 -0500 -+++ lua-5.3.0/Makefile.am 2015-01-15 10:20:03.826889574 -0500 -@@ -0,0 +1,3 @@ -+SUBDIRS = src doc -+ -+EXTRA_DIST = README -diff -up lua-5.3.0/src/.gitignore.autoxxx lua-5.3.0/src/.gitignore ---- lua-5.3.0/src/.gitignore.autoxxx 2015-01-15 10:20:03.826889574 -0500 -+++ lua-5.3.0/src/.gitignore 2015-01-15 10:20:03.826889574 -0500 -@@ -0,0 +1,5 @@ -+lua -+lua.pc -+luac -+luaconf.h -+luaconf.h.template -diff -up lua-5.3.0/src/luaconf.h.template.in.autoxxx lua-5.3.0/src/luaconf.h.template.in ---- lua-5.3.0/src/luaconf.h.template.in.autoxxx 2015-01-15 10:20:03.828889562 -0500 -+++ lua-5.3.0/src/luaconf.h.template.in 2015-01-15 10:22:37.420027778 -0500 -@@ -11,6 +11,11 @@ - #include - #include - -+@POSIX_DEFS@ -+@LUA_DL_DEFS@ -+@LUA_BUILD_AS_DLL_DEFS@ -+@READLINE_DEFS@ -+ - - /* - ** =================================================================== -@@ -200,9 +205,9 @@ - - #else /* }{ */ - --#define LUA_ROOT "/usr/local/" --#define LUA_LDIR LUA_ROOT "share/lua/" LUA_VDIR "/" --#define LUA_CDIR LUA_ROOT "lib/lua/" LUA_VDIR "/" -+#define LUA_ROOT "@prefix@/" -+#define LUA_LDIR "@pkgdatadir@/lua/" LUA_VDIR "/" -+#define LUA_CDIR "@libdir@/lua/" LUA_VDIR "/" - #define LUA_PATH_DEFAULT \ - LUA_LDIR"?.lua;" LUA_LDIR"?/init.lua;" \ - LUA_CDIR"?.lua;" LUA_CDIR"?/init.lua;" \ -diff -up lua-5.3.0/src/lua.pc.in.autoxxx lua-5.3.0/src/lua.pc.in ---- lua-5.3.0/src/lua.pc.in.autoxxx 2015-01-15 10:20:03.827889568 -0500 -+++ lua-5.3.0/src/lua.pc.in 2015-01-15 10:20:03.827889568 -0500 -@@ -0,0 +1,13 @@ -+V= @MAJOR_VERSION@ -+R= @VERSION@ -+prefix= @prefix@ -+exec_prefix=${prefix} -+libdir= @libdir@ -+includedir=${prefix}/include -+ -+Name: Lua -+Description: An Extensible Extension Language -+Version: ${R} -+Requires: -+Libs: -llua @LUA_LIBS@ -+Cflags: -I${includedir} -diff -up lua-5.3.0/src/Makefile.am.autoxxx lua-5.3.0/src/Makefile.am ---- lua-5.3.0/src/Makefile.am.autoxxx 2015-01-15 10:20:03.826889574 -0500 -+++ lua-5.3.0/src/Makefile.am 2015-01-15 10:20:03.826889574 -0500 -@@ -0,0 +1,46 @@ -+AM_CFLAGS = -Wall -+ -+include_HEADERS = lua.h lualib.h lauxlib.h lua.hpp -+ -+nodist_include_HEADERS = luaconf.h -+ -+lib_LTLIBRARIES = liblua.la -+liblua_la_LDFLAGS = -release @MAJOR_VERSION@ -+liblua_la_SOURCES = \ -+ lapi.c lauxlib.c lbaselib.c lbitlib.c lcode.c lcorolib.c lctype.c ldblib.c \ -+ ldebug.c ldo.c ldump.c lfunc.c lgc.c linit.c liolib.c llex.c lmathlib.c lmem.c \ -+ loadlib.c lobject.c lopcodes.c loslib.c lparser.c lstate.c lstring.c lstrlib.c \ -+ ltable.c ltablib.c ltm.c lundump.c lutf8lib.c lvm.c lzio.c \ -+ lapi.h lcode.h lctype.h ldebug.h ldo.h lfunc.h lgc.h llex.h llimits.h \ -+ lmem.h lobject.h lopcodes.h lparser.h lstate.h lstring.h ltable.h ltm.h \ -+ lundump.h lvm.h lzio.h -+ -+pkgconfigdir = $(libdir)/pkgconfig -+pkgconfig_DATA = lua.pc -+ -+bin_PROGRAMS = lua luac -+ -+lua_SOURCES = lua.c -+lua_LDADD = liblua.la @LUA_LIBS@ @READLINE_LIBS@ -+lua_DEPENDENCIES = liblua.la -+ -+luac_SOURCES = luac.c -+# Statically link liblua against luac since luac uses symbols not exported in liblua -+luac_LDADD = .libs/liblua.a @LUA_LIBS@ -+luac_DEPENDENCIES = liblua.la -+ -+EXTRA_DIST = luaconf.h.template -+BUILT_SOURCES = luaconf.h -+CLEANFILES = luaconf.h luaconf.h.template -+ -+readline_defs = @READLINE_DEFS@ -+ -+edit = sed \ -+ -e 's,%prefix%,$(prefix),g' \ -+ -e 's,%lua_datadir%,$(datadir),g' \ -+ -e 's,%lua_libdir%,$(libdir),g' -+ -+luaconf.h : luaconf.h.template -+ rm -f $@ $@.tmp -+ $(edit) $< >$@.tmp -+ mv $@.tmp $@ diff --git a/src/patches/lua/lua-5.3.5-shared_library-1.patch b/src/patches/lua/lua-5.3.5-shared_library-1.patch deleted file mode 100644 index 857fddc6cb..0000000000 --- a/src/patches/lua/lua-5.3.5-shared_library-1.patch +++ /dev/null @@ -1,61 +0,0 @@ -Submitted By: Igor Živković -Date: 2013-06-19 -Initial Package Version: 5.2.2 -Upstream Status: Rejected -Origin: Arch Linux packages repository -Description: Adds the compilation of a shared library. - -diff -Naur lua-5.3.0.orig/Makefile lua-5.3.0/Makefile ---- lua-5.3.0.orig/Makefile 2014-10-30 00:14:41.000000000 +0100 -+++ lua-5.3.0/Makefile 2015-01-19 22:14:09.822290828 +0100 -@@ -52,7 +52,7 @@ - all: $(PLAT) - - $(PLATS) clean: -- cd src && $(MAKE) $@ -+ cd src && $(MAKE) $@ V=$(V) R=$(R) - - test: dummy - src/lua -v -diff -Naur lua-5.3.0.orig/src/Makefile lua-5.3.0/src/Makefile ---- lua-5.3.0.orig/src/Makefile 2015-01-05 17:04:52.000000000 +0100 -+++ lua-5.3.0/src/Makefile 2015-01-19 22:14:52.559378543 +0100 -@@ -7,7 +7,7 @@ - PLAT= none - - CC= gcc -std=gnu99 --CFLAGS= -O2 -Wall -Wextra -DLUA_COMPAT_5_2 $(SYSCFLAGS) $(MYCFLAGS) -+CFLAGS= -fPIC -O2 -Wall -Wextra -DLUA_COMPAT_5_2 $(SYSCFLAGS) $(MYCFLAGS) - LDFLAGS= $(SYSLDFLAGS) $(MYLDFLAGS) - LIBS= -lm $(SYSLIBS) $(MYLIBS) - -@@ -29,6 +29,7 @@ - PLATS= aix bsd c89 freebsd generic linux macosx mingw posix solaris - - LUA_A= liblua.a -+LUA_SO= liblua.so - CORE_O= lapi.o lcode.o lctype.o ldebug.o ldo.o ldump.o lfunc.o lgc.o llex.o \ - lmem.o lobject.o lopcodes.o lparser.o lstate.o lstring.o ltable.o \ - ltm.o lundump.o lvm.o lzio.o -@@ -43,7 +44,7 @@ - LUAC_O= luac.o - - ALL_O= $(BASE_O) $(LUA_O) $(LUAC_O) --ALL_T= $(LUA_A) $(LUA_T) $(LUAC_T) -+ALL_T= $(LUA_A) $(LUA_T) $(LUAC_T) $(LUA_SO) - ALL_A= $(LUA_A) - - # Targets start here. -@@ -59,6 +60,12 @@ - $(AR) $@ $(BASE_O) - $(RANLIB) $@ - -+$(LUA_SO): $(CORE_O) $(LIB_O) -+ $(CC) -shared -ldl -Wl,-soname,$(LUA_SO).$(V) -o $@.$(R) $? -lm $(MYLDFLAGS) -+ ln -sf $(LUA_SO).$(R) $(LUA_SO).$(V) -+ ln -sf $(LUA_SO).$(R) $(LUA_SO) -+ -+ - $(LUA_T): $(LUA_O) $(LUA_A) - $(CC) -o $@ $(LDFLAGS) $(LUA_O) $(LUA_A) $(LIBS) - -- 2.39.2