From aa81f8ffa9d99f6bd8e0bf0d9cfb70a2ae77106a Mon Sep 17 00:00:00 2001 From: Silvan Calarco Date: Mon, 13 May 2024 23:29:25 +0200 Subject: [PATCH] liblua51: added legacy provides for soname liblua.so.5.1 [release 5.1.5-5mamba;Mon May 13 2024] --- lua-5.1.2-dynlib.patch | 53 ----------------- lua-5.1.2-luapc.patch | 11 ---- lua-5.1.4-cross_compile.patch | 12 ---- lua51-5.1.5-cflags.patch | 13 +++++ lua51-5.1.5-coinstallability.patch | 66 ++++++++++++++++++++++ lua51-5.1.5-cve-2014-5461.patch | 21 +++++++ lua51.spec | 91 +++++++++++++++--------------- 7 files changed, 147 insertions(+), 120 deletions(-) delete mode 100644 lua-5.1.2-dynlib.patch delete mode 100644 lua-5.1.2-luapc.patch delete mode 100644 lua-5.1.4-cross_compile.patch create mode 100644 lua51-5.1.5-cflags.patch create mode 100644 lua51-5.1.5-coinstallability.patch create mode 100644 lua51-5.1.5-cve-2014-5461.patch diff --git a/lua-5.1.2-dynlib.patch b/lua-5.1.2-dynlib.patch deleted file mode 100644 index f715ab1..0000000 --- a/lua-5.1.2-dynlib.patch +++ /dev/null @@ -1,53 +0,0 @@ -diff -ru lua-5.1.2/Makefile lua-5.1.2-om/Makefile ---- lua-5.1.2/Makefile 2007-10-24 10:12:17.000000000 +0200 -+++ lua-5.1.2-om/Makefile 2007-10-24 10:16:22.000000000 +0200 -@@ -53,7 +53,7 @@ - all: $(PLAT) - - $(PLATS) clean: -- cd src && $(MAKE) $@ -+ cd src && $(MAKE) V=$(V) $@ - - test: dummy - src/lua test/hello.lua -diff -ru lua-5.1.2/src/Makefile lua-5.1.2-om/src/Makefile ---- lua-5.1.2/src/Makefile 2007-03-25 16:49:23.000000000 +0200 -+++ lua-5.1.2-om/src/Makefile 2007-10-24 10:15:52.000000000 +0200 -@@ -8,7 +8,7 @@ - PLAT= none - - CC= gcc --CFLAGS= -O2 -Wall $(MYCFLAGS) -+CFLAGS= -O2 -Wall -fPIC $(MYCFLAGS) $(RPM_OPT_FLAGS) - AR= ar rcu - RANLIB= ranlib - RM= rm -f -@@ -22,6 +22,7 @@ - - PLATS= aix ansi bsd freebsd generic linux macosx mingw posix solaris - -+LUA_SO= liblua.so.$(V) - LUA_A= liblua.a - CORE_O= lapi.o lcode.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 \ -@@ -36,7 +37,7 @@ - LUAC_O= luac.o print.o - - ALL_O= $(CORE_O) $(LIB_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) - - default: $(PLAT) -@@ -51,6 +52,11 @@ - $(AR) $@ $? - $(RANLIB) $@ - -+$(LUA_SO): $(CORE_O) $(LIB_O) -+ gcc -Wl,-soname=liblua.so.$(V) -shared -o $@ $(MYLDFLAGS) $? $(LIBS) $(LUA_O) -+ rm -f liblua.so -+ ln -s $@ liblua.so -+ - $(LUA_T): $(LUA_O) $(LUA_A) - $(CC) -o $@ $(MYLDFLAGS) $(LUA_O) $(LUA_A) $(LIBS) - diff --git a/lua-5.1.2-luapc.patch b/lua-5.1.2-luapc.patch deleted file mode 100644 index 0d258d3..0000000 --- a/lua-5.1.2-luapc.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- lua-5.1.2/etc/lua.pc 2007-03-23 20:58:49.000000000 +0100 -+++ lua-5.1.2/etc/lua.pc.prefix 2007-10-25 11:47:35.000000000 +0200 -@@ -8,7 +8,7 @@ - R= 5.1.2 - - # grep '^INSTALL_.*=' ../Makefile | sed 's/INSTALL_TOP/prefix/' --prefix= /usr/local -+prefix= /usr - INSTALL_BIN= ${prefix}/bin - INSTALL_INC= ${prefix}/include - INSTALL_LIB= ${prefix}/lib diff --git a/lua-5.1.4-cross_compile.patch b/lua-5.1.4-cross_compile.patch deleted file mode 100644 index cac5d58..0000000 --- a/lua-5.1.4-cross_compile.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff -Nru lua-5.1.4.orig//src/Makefile lua-5.1.4/src/Makefile ---- lua-5.1.4.orig//src/Makefile 2010-06-16 20:13:28.242643022 +0200 -+++ lua-5.1.4/src/Makefile 2010-06-16 20:14:12.930892707 +0200 -@@ -53,7 +53,7 @@ - $(RANLIB) $@ - - $(LUA_SO): $(CORE_O) $(LIB_O) -- gcc -Wl,-soname=liblua.so.$(V) -shared -o $@ $(MYLDFLAGS) $? $(LIBS) $(LUA_O) -+ $(CC) -Wl,-soname=liblua.so.$(V) -shared -o $@ $(MYLDFLAGS) $? $(LIBS) $(LUA_O) - rm -f liblua.so - ln -s $@ liblua.so - diff --git a/lua51-5.1.5-cflags.patch b/lua51-5.1.5-cflags.patch new file mode 100644 index 0000000..db658ae --- /dev/null +++ b/lua51-5.1.5-cflags.patch @@ -0,0 +1,13 @@ +diff -Naur lua-5.1.orig/src/Makefile lua-5.1/src/Makefile +--- lua-5.1.orig/src/Makefile 2006-02-16 16:45:09.000000000 +0100 ++++ lua-5.1/src/Makefile 2006-03-01 14:55:29.000000000 +0100 +@@ -8,7 +8,8 @@ + PLAT= none + + CC= gcc +-CFLAGS= -O2 -Wall $(MYCFLAGS) ++CFLAGS ?= -O2 -Wall ++CFLAGS += $(MYCFLAGS) + AR= ar rcu + RANLIB= ranlib + RM= rm -f diff --git a/lua51-5.1.5-coinstallability.patch b/lua51-5.1.5-coinstallability.patch new file mode 100644 index 0000000..d8650c3 --- /dev/null +++ b/lua51-5.1.5-coinstallability.patch @@ -0,0 +1,66 @@ +diff -ur lua-5.1.4/etc/lua.pc lua-5.1.4-new/etc/lua.pc +--- lua-5.1.4/etc/lua.pc 2008-08-08 14:46:11.000000000 +0200 ++++ lua-5.1.4-new/etc/lua.pc 2012-02-23 18:25:34.000000000 +0100 +@@ -8,6 +8,6 @@ + + # grep '^INSTALL_.*=' ../Makefile | sed 's/INSTALL_TOP/prefix/' +-prefix= /usr/local ++prefix= /usr + INSTALL_BIN= ${prefix}/bin + INSTALL_INC= ${prefix}/include + INSTALL_LIB= ${prefix}/lib +diff -ur lua-5.1.4/src/luaconf.h lua-5.1.4-new/src/luaconf.h +--- lua-5.1.4/src/luaconf.h 2008-02-11 17:25:08.000000000 +0100 ++++ lua-5.1.4-new/src/luaconf.h 2012-02-23 18:25:34.000000000 +0100 +@@ -94,7 +94,7 @@ + ".\\?.dll;" LUA_CDIR"?.dll;" LUA_CDIR"loadall.dll" + + #else +-#define LUA_ROOT "/usr/local/" ++#define LUA_ROOT "/usr/" + #define LUA_LDIR LUA_ROOT "share/lua/5.1/" + #define LUA_CDIR LUA_ROOT "lib/lua/5.1/" + #define LUA_PATH_DEFAULT \ +diff -ur lua-5.1.4/src/Makefile lua-5.1.4-new/src/Makefile +--- lua-5.1.4/src/Makefile 2008-01-19 20:37:58.000000000 +0100 ++++ lua-5.1.4-new/src/Makefile 2012-02-23 18:26:43.000000000 +0100 +@@ -23,6 +23,7 @@ + PLATS= aix ansi bsd freebsd generic linux macosx mingw posix solaris + + LUA_A= liblua.a ++LUA_SO= liblua.so + CORE_O= lapi.o lcode.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 +@@ -36,7 +37,7 @@ + LUAC_O= luac.o print.o + + ALL_O= $(CORE_O) $(LIB_O) $(LUA_O) $(LUAC_O) +-ALL_T= $(LUA_A) $(LUA_T) $(LUAC_T) ++ALL_T= $(LUA_A) $(LUA_SO) $(LUA_T) $(LUAC_T) + ALL_A= $(LUA_A) + + default: $(PLAT) +@@ -51,6 +52,11 @@ + $(AR) $@ $? + $(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 $@ $(MYLDFLAGS) $(LUA_O) $(LUA_A) $(LIBS) + +--- lua-5.1.4/Makefile 2008-08-12 02:40:48.000000000 +0200 ++++ lua-5.1.4-new/Makefile 2012-02-23 19:06:32.000000000 +0100 +@@ -53,7 +53,7 @@ + all: $(PLAT) + + $(PLATS) clean: +- cd src && $(MAKE) $@ ++ cd src && $(MAKE) $@ V=$(V) R=$(R) + + test: dummy + src/lua test/hello.lua diff --git a/lua51-5.1.5-cve-2014-5461.patch b/lua51-5.1.5-cve-2014-5461.patch new file mode 100644 index 0000000..31d3b8b --- /dev/null +++ b/lua51-5.1.5-cve-2014-5461.patch @@ -0,0 +1,21 @@ +From: Enrico Tassi +Date: Tue, 26 Aug 2014 16:20:55 +0200 +Subject: Fix stack overflow in vararg functions + +--- + src/ldo.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/ldo.c b/src/ldo.c +index d1bf786..30333bf 100644 +--- a/src/ldo.c ++++ b/src/ldo.c +@@ -274,7 +274,7 @@ int luaD_precall (lua_State *L, StkId func, int nresults) { + CallInfo *ci; + StkId st, base; + Proto *p = cl->p; +- luaD_checkstack(L, p->maxstacksize); ++ luaD_checkstack(L, p->maxstacksize + p->numparams); + func = restorestack(L, funcr); + if (!p->is_vararg) { /* no varargs? */ + base = func + 1; diff --git a/lua51.spec b/lua51.spec index 447afa1..b47dd48 100644 --- a/lua51.spec +++ b/lua51.spec @@ -3,24 +3,23 @@ Name: lua51 Version: 5.1.5 -Release: 3mamba +Release: 5mamba Summary: A powerful light-weight and embeddable programming language Group: Applications/Development Vendor: openmamba Distribution: openmamba -Packager: Aleph0 -URL: http://www.lua.org -Source: http://www.lua.org/ftp/lua-%{version}.tar.gz -Patch0: lua-5.1.2-dynlib.patch -Patch1: lua-5.1.2-luapc.patch -Patch2: lua-5.1.4-cross_compile.patch +Packager: Silvan Calarco +URL: https://lua.org/ +Source: https://lua.org/ftp/lua-%{version}.tar.gz +Patch1: lua51-5.1.5-cve-2014-5461.patch +Patch2: lua51-5.1.5-coinstallability.patch +Patch3: lua51-5.1.5-cflags.patch License: MIT ## AUTOBUILDREQ-BEGIN BuildRequires: glibc-devel BuildRequires: libncurses-devel BuildRequires: libreadline-devel ## AUTOBUILDREQ-END -BuildRoot: %{_tmppath}/%{name}-%{version}-root %description Lua is a powerful light-weight programming language designed for extending applications. @@ -40,12 +39,16 @@ Requires: %{name} = %{?epoch:%epoch:}%{version}-%{release} %description devel Lua is a powerful light-weight programming language designed for extending applications. Lua is also frequently used as a general-purpose, stand-alone language. - This package contains files needed for embedding lua into your application. %package -n %{libname} Summary: Lua is a powerful, light-weight programming language Group: System/Libraries +%ifarch x86_64 aarch64 +Provides: liblua.so.5.1()(64bit) +%else +Provides: liblua.so.5.1 +%endif %description -n %{libname} Lua is a powerful light-weight programming language designed for extending applications. @@ -55,6 +58,7 @@ This package contains the dynamic libraries provided by lua scripting language. Summary: Static libraries and headers for lua Group: Development/Libraries Requires: %{libname} = %{?epoch:%epoch:}%{version}-%{release} +Requires: %{name} = %{?epoch:%epoch:}%{version}-%{release} %description -n %{libname}-devel Lua is a powerful light-weight programming language designed for extending applications. @@ -64,50 +68,43 @@ This package contains static libraries and header files need for development. %prep %setup -q -n lua-%{version} -%patch0 -p1 -b .dynlib -#%patch1 -p1 -b .luapc -#%patch2 -p1 +# Taken from Arch Linux +%patch 1 -p1 -b .cve-2014-5461 +%patch 2 -p1 -b .coinstallability +%patch 3 -p1 -b .cflags + +sed -e 's:llua:llua5.1:' -e 's:/include:/include/lua5.1:' -i etc/lua.pc +sed -r -e '/^LUA_(SO|A|T)=/ s/lua/lua5.1/' -e '/^LUAC_T=/ s/luac/luac5.1/' -i src/Makefile %build ##% make linux -%make -j1 -C src \ +%make -j1 \ CC=%{_host}-gcc \ - MYCFLAGS="$RPM_OPT_FLAGS -fPIC -DLUA_USE_LINUX" \ - MYLIBS="-Wl,-E -ldl -lreadline -lhistory -lncurses" V=%{majver} all + MYCFLAGS="%{optflags} -fPIC -DLUA_USE_LINUX" \ + MYLDFLAGS="-Wl,-E -ldl -lreadline -lhistory -lncurses" \ + linux %install [ "%{buildroot}" != / ] && rm -rf %{buildroot} %makeinstall \ + TO_BIN='lua5.1 luac5.1' \ + TO_LIB="liblua5.1.so liblua5.1.so.5.1 liblua5.1.so.%{version}" \ + INSTALL_DATA='cp -d' \ INSTALL_TOP=%{buildroot}%{_prefix} \ INSTALL_INC=%{buildroot}%{_includedir}/lua%{majver} \ INSTALL_LIB=%{buildroot}%{_libdir} \ INSTALL_MAN=%{buildroot}%{_mandir}/man1 -install -d %{buildroot}%{_datadir}/lua -install -m 644 test/*.lua %{buildroot}%{_datadir}/lua +install -Dm644 etc/lua.pc %{buildroot}%{_libdir}/pkgconfig/lua51.pc +ln -sf lua51.pc %{buildroot}%{_libdir}/pkgconfig/lua5.1.pc +ln -sf lua51.pc %{buildroot}%{_libdir}/pkgconfig/lua-5.1.pc -install -d %{buildroot}%{_libdir} -install -m 755 src/liblua.so.%{majver} %{buildroot}%{_libdir} -ln -s liblua.so.%{majver} %{buildroot}%{_libdir}/liblua%{majver}.so -ln -s liblua.so.%{majver} %{buildroot}%{_libdir}/liblua%{majver}.so.%{majver} +ln -s liblua5.1.so %{buildroot}%{_libdir}/liblua.so.5.1 +ln -s liblua5.1.so %{buildroot}%{_libdir}/liblua.so.%{version} -install -d %{buildroot}%{_libdir}/pkgconfig/ -cat > %{buildroot}%{_libdir}/pkgconfig/lua%{majver}.pc << _EOF -prefix=%{_prefix} -exec_prefix=%{_exec_prefix} -libdir=%{_libdir} -includedir=%{_includedir}/lua%{majver} - -Name: Lua -Description: An Extensible Extension Language -Version: 5.1.5 -Requires: -Libs: -L%{_libdir} -llua%{majver} -lm -lreadline -Cflags: -I%{_includedir}/lua%{majver} -_EOF - -rm -f %{buildroot}%{_libdir}/liblua.a -rm -f %{buildroot}%{_libdir}/liblua.so +cd %{buildroot}%{_mandir}/man1 +mv %{buildroot}%{_mandir}/man1/{lua.1,lua5.1.1} +mv %{buildroot}%{_mandir}/man1/{luac.1,luac5.1.1} %clean [ "%{buildroot}" != / ] && rm -rf %{buildroot} @@ -117,12 +114,10 @@ rm -f %{buildroot}%{_libdir}/liblua.so %files %defattr(-,root,root) -%{_bindir}/lua -%{_bindir}/luac -%dir %{_datadir}/lua -%{_datadir}/lua/*.lua -%{_mandir}/man1/lua.* -%{_mandir}/man1/luac.* +%{_bindir}/lua5.1 +%{_bindir}/luac5.1 +%{_mandir}/man1/lua5.1.* +%{_mandir}/man1/luac5.1.* %files -n %{libname} %defattr(-,root,root) @@ -137,9 +132,17 @@ rm -f %{buildroot}%{_libdir}/liblua.so %{_includedir}/lua%{majver}/*.hpp %{_libdir}/liblua%{majver}.so %{_libdir}/pkgconfig/lua%{majver}.pc +%{_libdir}/pkgconfig/lua-5.1.pc +%{_libdir}/pkgconfig/lua51.pc %doc HISTORY README doc/*.html doc/*.css doc/*.gif doc/*.png %changelog +* Mon May 13 2024 Silvan Calarco 5.1.5-5mamba +- liblua51: added legacy provides for soname liblua.so.5.1 + +* Sat May 11 2024 Silvan Calarco 5.1.5-4mamba +- rebuilt with coinstallability with more recent versions + * Sat Jul 20 2013 Silvan Calarco 5.1.5-3mamba - provide liblua5.1.so* using symlinks