diff --git a/lua-5.3.4-tests.tar.gz b/lua-5.3.4-tests.tar.gz deleted file mode 100644 index ffb79b6..0000000 Binary files a/lua-5.3.4-tests.tar.gz and /dev/null differ diff --git a/lua-5.3.5-luac-shared-link-fix.patch b/lua-5.3.5-luac-shared-link-fix.patch new file mode 100644 index 0000000..e508718 --- /dev/null +++ b/lua-5.3.5-luac-shared-link-fix.patch @@ -0,0 +1,54 @@ +diff -up lua-5.3.5/src/lopcodes.c.luac-shared lua-5.3.5/src/lopcodes.c +--- lua-5.3.5/src/lopcodes.c.luac-shared 2020-07-28 16:21:44.219960426 -0400 ++++ lua-5.3.5/src/lopcodes.c 2020-07-28 16:21:44.219960426 -0400 +@@ -17,7 +17,7 @@ + + /* ORDER OP */ + +-LUAI_DDEF const char *const luaP_opnames[NUM_OPCODES+1] = { ++LUA_API const char *const luaP_opnames[NUM_OPCODES+1] = { + "MOVE", + "LOADK", + "LOADKX", +@@ -71,7 +71,7 @@ LUAI_DDEF const char *const luaP_opnames + + #define opmode(t,a,b,c,m) (((t)<<7) | ((a)<<6) | ((b)<<4) | ((c)<<2) | (m)) + +-LUAI_DDEF const lu_byte luaP_opmodes[NUM_OPCODES] = { ++LUA_API const lu_byte luaP_opmodes[NUM_OPCODES] = { + /* T A B C mode opcode */ + opmode(0, 1, OpArgR, OpArgN, iABC) /* OP_MOVE */ + ,opmode(0, 1, OpArgK, OpArgN, iABx) /* OP_LOADK */ +diff -up lua-5.3.5/src/lopcodes.h.luac-shared lua-5.3.5/src/lopcodes.h +--- lua-5.3.5/src/lopcodes.h.luac-shared 2020-07-28 16:21:44.219960426 -0400 ++++ lua-5.3.5/src/lopcodes.h 2020-07-28 16:21:44.219960426 -0400 +@@ -278,7 +278,7 @@ enum OpArgMask { + OpArgK /* argument is a constant or register/constant */ + }; + +-LUAI_DDEC const lu_byte luaP_opmodes[NUM_OPCODES]; ++LUA_API const lu_byte luaP_opmodes[NUM_OPCODES]; + + #define getOpMode(m) (cast(enum OpMode, luaP_opmodes[m] & 3)) + #define getBMode(m) (cast(enum OpArgMask, (luaP_opmodes[m] >> 4) & 3)) +@@ -287,7 +287,7 @@ LUAI_DDEC const lu_byte luaP_opmodes[NUM + #define testTMode(m) (luaP_opmodes[m] & (1 << 7)) + + +-LUAI_DDEC const char *const luaP_opnames[NUM_OPCODES+1]; /* opcode names */ ++LUA_API const char *const luaP_opnames[NUM_OPCODES+1]; /* opcode names */ + + + /* number of list items to accumulate before a SETLIST instruction */ +diff -up lua-5.3.5/src/lundump.h.luac-shared lua-5.3.5/src/lundump.h +--- lua-5.3.5/src/lundump.h.luac-shared 2020-07-28 16:21:44.219960426 -0400 ++++ lua-5.3.5/src/lundump.h 2020-07-28 16:21:44.219960426 -0400 +@@ -26,7 +26,7 @@ + LUAI_FUNC LClosure* luaU_undump (lua_State* L, ZIO* Z, const char* name); + + /* dump one chunk; from ldump.c */ +-LUAI_FUNC int luaU_dump (lua_State* L, const Proto* f, lua_Writer w, ++LUA_API int luaU_dump (lua_State* L, const Proto* f, lua_Writer w, + void* data, int strip); + + #endif diff --git a/lua-5.4.0-beta-autotoolize.patch b/lua-5.4.0-beta-autotoolize.patch new file mode 100644 index 0000000..74e7d16 --- /dev/null +++ b/lua-5.4.0-beta-autotoolize.patch @@ -0,0 +1,192 @@ +diff -up lua-5.4.0-beta/configure.ac.autoxxx lua-5.4.0-beta/configure.ac +--- lua-5.4.0-beta/configure.ac.autoxxx 2020-07-28 16:10:13.316916421 -0400 ++++ lua-5.4.0-beta/configure.ac 2020-07-28 16:10:13.316916421 -0400 +@@ -0,0 +1,69 @@ ++AC_PREREQ(2.59) ++AC_INIT([lua], [5.4.0], [https://bugzilla.redhat.com/], [lua-at], [http://www.lua.org]) ++AC_SUBST([MAJOR_VERSION], [5.4]) ++ ++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.4.0-beta/doc/Makefile.am.autoxxx lua-5.4.0-beta/doc/Makefile.am +--- lua-5.4.0-beta/doc/Makefile.am.autoxxx 2020-07-28 16:10:13.316916421 -0400 ++++ lua-5.4.0-beta/doc/Makefile.am 2020-07-28 16:10:13.316916421 -0400 +@@ -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.4.0-beta/Makefile.am.autoxxx lua-5.4.0-beta/Makefile.am +--- lua-5.4.0-beta/Makefile.am.autoxxx 2020-07-28 16:10:13.316916421 -0400 ++++ lua-5.4.0-beta/Makefile.am 2020-07-28 16:10:13.316916421 -0400 +@@ -0,0 +1,3 @@ ++SUBDIRS = src doc ++ ++EXTRA_DIST = README +diff -up lua-5.4.0-beta/src/.gitignore.autoxxx lua-5.4.0-beta/src/.gitignore +--- lua-5.4.0-beta/src/.gitignore.autoxxx 2020-07-28 16:10:13.316916421 -0400 ++++ lua-5.4.0-beta/src/.gitignore 2020-07-28 16:10:13.316916421 -0400 +@@ -0,0 +1,5 @@ ++lua ++lua.pc ++luac ++luaconf.h ++luaconf.h.template +diff -up lua-5.4.0-beta/src/luaconf.h.template.in.autoxxx lua-5.4.0-beta/src/luaconf.h.template.in +--- lua-5.4.0-beta/src/luaconf.h.template.in.autoxxx 2020-07-28 16:10:13.316916421 -0400 ++++ lua-5.4.0-beta/src/luaconf.h.template.in 2020-07-28 16:10:13.316916421 -0400 +@@ -11,6 +11,11 @@ + #include + #include + ++@POSIX_DEFS@ ++@LUA_DL_DEFS@ ++@LUA_BUILD_AS_DLL_DEFS@ ++@READLINE_DEFS@ ++ + + /* + ** =================================================================== +@@ -227,9 +232,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 "/" + + #if !defined(LUA_PATH_DEFAULT) + #define LUA_PATH_DEFAULT \ +diff -up lua-5.4.0-beta/src/lua.pc.in.autoxxx lua-5.4.0-beta/src/lua.pc.in +--- lua-5.4.0-beta/src/lua.pc.in.autoxxx 2020-07-28 16:10:13.316916421 -0400 ++++ lua-5.4.0-beta/src/lua.pc.in 2020-07-28 16:10:13.316916421 -0400 +@@ -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.4.0-beta/src/Makefile.am.autoxxx lua-5.4.0-beta/src/Makefile.am +--- lua-5.4.0-beta/src/Makefile.am.autoxxx 2020-07-28 16:10:13.316916421 -0400 ++++ lua-5.4.0-beta/src/Makefile.am 2020-07-28 16:10:13.316916421 -0400 +@@ -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 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/lua-5.4.0-tests.tar.gz b/lua-5.4.0-tests.tar.gz new file mode 100644 index 0000000..e6bff24 Binary files /dev/null and b/lua-5.4.0-tests.tar.gz differ diff --git a/lua-5.4.0.tar.gz b/lua-5.4.0.tar.gz new file mode 100644 index 0000000..d99933c Binary files /dev/null and b/lua-5.4.0.tar.gz differ diff --git a/lua-CVE-2019-6706.patch b/lua-CVE-2019-6706.patch deleted file mode 100644 index cce9c73..0000000 --- a/lua-CVE-2019-6706.patch +++ /dev/null @@ -1,22 +0,0 @@ ---- a/src/lapi.c 2017-12-06 13:35:12.000000000 -0500 -+++ b/src/lapi_1.c 2019-06-24 07:48:06.289000000 -0400 -@@ -1286,14 +1286,14 @@ LUA_API void *lua_upvalueid (lua_State * - - LUA_API void lua_upvaluejoin (lua_State *L, int fidx1, int n1, - int fidx2, int n2) { -- LClosure *f1; -- UpVal **up1 = getupvalref(L, fidx1, n1, &f1); -+ UpVal **up1 = getupvalref(L, fidx1, n1, NULL); /* the last parameter not needed */ - UpVal **up2 = getupvalref(L, fidx2, n2, NULL); -+ if (*up1 == *up2) return; /* Already joined */ -+ (*up2)->refcount++; -+ if (upisopen(*up2)) (*up2)->u.open.touched = 1; -+ luaC_upvalbarrier(L, *up2); - luaC_upvdeccount(L, *up1); - *up1 = *up2; -- (*up1)->refcount++; -- if (upisopen(*up1)) (*up1)->u.open.touched = 1; -- luaC_upvalbarrier(L, *up1); - } - - diff --git a/lua.attr b/lua.attr new file mode 100644 index 0000000..a433266 --- /dev/null +++ b/lua.attr @@ -0,0 +1,19 @@ +%__lua_requires() %{lua: + -- Match buildroot paths of the form + -- /PATH/OF/BUILDROOT/usr/lib(64)/lua/MAJOR.MINOR/ and + -- /PATH/OF/BUILDROOT/usr/share/pythonMAJOR.MINOR/ + -- generating a line of the form: + -- lua(abi) = MAJOR.MINOR + local path = rpm.expand('%1') + local datadir = rpm.expand('%_datadir') + local libdir = rpm.expand('%_libdir') + for i, dir in ipairs({datadir, libdir}) do + if path:match(dir .. '/lua/%d+%.%d+/.*') then + local requires = path:gsub('.*' .. dir .. '/lua/(%d+%.%d+)/.*', 'lua(abi) = %1') + print(requires) + break + end + end +} + +%__lua_path ^(%{_datadir}|%{_libdir})/lua/[[:digit:]]+\\.[[:digit:]]+/.+ diff --git a/lua.spec b/lua.spec index 3eba84f..111481e 100644 --- a/lua.spec +++ b/lua.spec @@ -1,12 +1,12 @@ -%global major_version 5.3 -# test version is still 5.3.4 -%global test_version 5.3.4 +%global major_version 5.4 +# test version is still 5.4.0 +%global test_version 5.4.0 # Place rpm-macros into proper location. %global macrosdir %(d=%{_rpmconfigdir}/macros.d; [ -d $d ] || d=%{_sysconfdir}/rpm; echo $d) Name: lua -Version: 5.3.5 -Release: 4 +Version: 5.4.0 +Release: 1 Summary: A powerful, efficient, lightweight, embeddable scripting language License: MIT URL: http://www.lua.org/ @@ -17,20 +17,22 @@ Source1: http://www.lua.org/tests/lua-%{test_version}-tests.tar.gz Source2: luaconf.h # copied from doc/readme.html on 2019-09-11 Source3: mit.txt +Source4: http://www.lua.org/ftp/lua-5.3.5.tar.gz # rpm-macro Source1000: macros.lua -Patch0: lua-5.3.0-autotoolize.patch +Source1001: lua.attr +Patch0: lua-5.4.0-beta-autotoolize.patch Patch1: lua-5.3.0-idsize.patch Patch2: lua-5.2.2-configure-linux.patch Patch3: lua-5.3.0-configure-compat-module.patch - -#Patch for cves -Patch6000: lua-CVE-2019-6706.patch +Patch4: lua-5.3.0-autotoolize.patch +Patch5: lua-5.3.5-luac-shared-link-fix.patch BuildRequires: automake autoconf libtool readline-devel ncurses-devel Obsoletes: %{name}-libs < %{version}-%{release} -Provides: lua(abi) = %{major_version} +Provides: lua(abi) = 5.3 +Provides: lua(abi) = %{major_version} Provides: %{name}-libs = %{version}-%{release} %description @@ -51,7 +53,7 @@ This package contains development files for %{name}. %package_help %prep -%setup -q -a 1 +%setup -q -a 4 -a 1 -n %{name}-%{version} cp %{SOURCE3} . mv src/luaconf.h src/luaconf.h.template.in %patch0 -p1 -E -z .autoxxx @@ -62,7 +64,15 @@ mv src/luaconf.h src/luaconf.h.template.in sed -i 's|5.3.0|%{version}|g' configure.ac autoreconf -ifv -%patch6000 -p1 +cd lua-5.3.5/ +mv src/luaconf.h src/luaconf.h.template.in +%patch4 -p1 -b .autoxxx +%patch1 -p1 -b .idsize +%patch2 -p1 -z .configure-linux +%patch3 -p1 -z .configure-compat-all +%patch5 -p1 -b .luac-shared-link-fix +autoreconf -i +cd .. %build %configure --with-readline --with-compat-module @@ -75,6 +85,16 @@ sed -i 's|@pkgdatadir@|%{_datadir}|g' src/luaconf.h.template %make_build LIBS="-lm -ldl" # only /usr/bin/lua links with readline now #luac_LDADD="liblua.la -lm -ldl" +pushd lua-5.3.5 +%configure --with-readline --with-compat-module +sed -i 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' libtool +sed -i 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' libtool + +sed -i 's|@pkgdatadir@|%{_datadir}|g' src/luaconf.h.template + +make %{?_smp_mflags} LIBS="-lm -ldl" luac_LDADD="liblua.la -lm -ldl" +popd + %install %make_install rm $RPM_BUILD_ROOT%{_libdir}/*.la @@ -86,8 +106,18 @@ mkdir -p %{buildroot}/%{_datadir}/lua/%{major_version} mv %{buildroot}%{_includedir}/luaconf.h %{buildroot}%{_includedir}/luaconf-%{_arch}.h install -p -m 644 %{SOURCE2} %{buildroot}%{_includedir}/luaconf.h +pushd lua-5.3.5 +mkdir $RPM_BUILD_ROOT/installdir +make install DESTDIR=$RPM_BUILD_ROOT/installdir +cp -a $RPM_BUILD_ROOT/installdir/%{_libdir}/liblua-5.3.so $RPM_BUILD_ROOT%{_libdir}/ +mkdir -p $RPM_BUILD_ROOT%{_libdir}/lua/5.3 +mkdir -p $RPM_BUILD_ROOT%{_datadir}/lua/5.3 +rm -rf $RPM_BUILD_ROOT/installdir +popd + # Install rpm-macro install -Dpm 0644 %{SOURCE1000} $RPM_BUILD_ROOT/%{macrosdir}/macros.lua +install -Dpm 0644 %{SOURCE1001} $RPM_BUILD_ROOT/%{_fileattrsdir}/lua.attr %check cd ./lua-%{test_version}-tests/ @@ -119,13 +149,20 @@ LD_LIBRARY_PATH=$RPM_BUILD_ROOT/%{_libdir} $RPM_BUILD_ROOT/%{_bindir}/lua -e"_U= %{_libdir}/liblua-%{major_version}.so %{_libdir}/liblua.so +%dir %{_libdir}/lua/5.3 +%{_libdir}/liblua-5.3.so +%dir %{_datadir}/lua/5.3 + %files devel %defattr(-,root,root) %{_includedir}/l*.h %{_includedir}/l*.hpp %{_libdir}/pkgconfig/*.pc +%dir %{macrosdir} %{_libdir}/*.a %{macrosdir}/macros.lua +%dir %{_fileattrsdir} +%{_fileattrsdir}/lua.attr %files help %defattr(-,root,root) @@ -133,6 +170,9 @@ LD_LIBRARY_PATH=$RPM_BUILD_ROOT/%{_libdir} $RPM_BUILD_ROOT/%{_bindir}/lua -e"_U= %{_mandir}/man1/lua*.1* %changelog +* Sat Aug 1 2020 xinghe - 5.4.0-1 +- update version to 5.4.0 + * Fri Oct 11 2019 openEuler Buildteam - 5.3.5-4 - Package rebuild