SHA256
10
0
forked from pool/lua54

Compare commits

...

2 Commits

Author SHA256 Message Date
595733ab8e improve .gitignore 2025-07-16 11:30:12 +02:00
6957aee288 convert the package from update-alternatives to libalternatives
And overall improve the packaging.
2025-07-16 11:29:48 +02:00
5 changed files with 50 additions and 72 deletions

1
.gitignore vendored
View File

@@ -2,3 +2,4 @@
_scmsync.obsinfo
_buildconfig-*
_buildinfo-*.xml
lua54-*-build/

View File

@@ -1,10 +1,14 @@
Inspect errno only after failure
Index: lua-5.4.6/src/lauxlib.c
---
src/lauxlib.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Index: lua-5.4.8/src/lauxlib.c
===================================================================
--- lua-5.4.6.orig/src/lauxlib.c
+++ lua-5.4.6/src/lauxlib.c
@@ -283,7 +283,7 @@ LUALIB_API int luaL_fileresult (lua_Stat
--- lua-5.4.8.orig/src/lauxlib.c 2025-07-15 22:59:14.411309750 +0200
+++ lua-5.4.8/src/lauxlib.c 2025-07-15 22:59:24.858384379 +0200
@@ -286,7 +286,7 @@
LUALIB_API int luaL_execresult (lua_State *L, int stat) {

View File

@@ -46,9 +46,10 @@ Patch6: shared_link.patch
# PATCH-FIX-UPSTREAM inspect errno only after failure
Patch8: execresult.patch
Patch100: upstream1.patch
Requires(post): update-alternatives
Requires(postun):update-alternatives
BuildRequires: lua-interpreter
Requires: alts
Provides: lua = %{version}
Conflicts: lua
Obsoletes: lua < %{version}
Provides: Lua(API) = %{major_version}
%if "%{flavor}" == "test"
@@ -80,8 +81,7 @@ Group: Development/Libraries/C and C++
Requires: %{libname} = %{version}
Requires: %{name} = %{version}
Requires: lua-macros
Requires(post): update-alternatives
Requires(postun):update-alternatives
Conflicts: lua-devel
Provides: lua-devel = %{version}
Provides: Lua(devel) = %{major_version}
Provides: pkgconfig(lua) = %{version}
@@ -151,8 +151,10 @@ mv lua-%{version}-tests testes
%if "%{flavor}" != "test"
cat doc/lua.1 | sed 's/TH LUA 1/TH LUA%{major_version} 1/' > doc/lua%{major_version}.1
cat doc/luac.1 | sed 's/TH LUAC 1/TH LUAC%{major_version} 1/' > doc/luac%{major_version}.1
%endif
%build
%if "%{flavor}" != "test"
sed -i -e "s@lib/lua/@%{_lib}/lua/@g" src/luaconf.h
%make_build linux-readline -C src \
CC="cc" LIBDIR="%{_libdir}" \
@@ -184,33 +186,28 @@ Version: %{version}
Libs: -llua%{major_version} -lm
Cflags: -I\${includedir}
EOF
install -D -m 644 lua%{major_version}.pc %{buildroot}%{_libdir}/pkgconfig/lua%{major_version}.pc
# update-alternatives
mkdir -p %{buildroot}%{_sysconfdir}/alternatives
for file in lua luac ; do
touch "%{buildroot}%{_sysconfdir}/alternatives/${file}"
ln -sf "%{_sysconfdir}/alternatives/${file}" "%{buildroot}%{_bindir}/${file}"
touch "%{buildroot}%{_sysconfdir}/alternatives/${file}.1%{ext_man}"
ln -sf "%{_sysconfdir}/alternatives/${file}.1%{ext_man}" "%{buildroot}%{_mandir}/man1/${file}.1%{ext_man}"
done
# alternatives - create configuration file
mkdir -p %{buildroot}%{_datadir}/libalternatives/lua
cat > %{buildroot}%{_datadir}/libalternatives/lua/54.conf <<EOF
binary=%{_bindir}/lua5.4
binary=%{_bindir}/luac5.4
man=lua5.4
man=luac5.4
EOF
# Compat link with older unprefixed library and with soname 0 from deb/etc
ln -s %{_libdir}/liblua%{major_version}.so.%{major_version}.0 %{buildroot}%{_libdir}/liblua%{major_version}.so.%{major_version}
ln -s %{_libdir}/liblua%{major_version}.so.%{major_version}.0 %{buildroot}%{_libdir}/liblua%{major_version}.so.0
ln -s %{_libdir}/liblua%{major_version}.so.%{major_version}.0 %{buildroot}%{_libdir}/liblua.so.%{major_version}
# Library devel alternatives
touch %{buildroot}%{_sysconfdir}/alternatives/liblua.so
ln -sf %{_sysconfdir}/alternatives/liblua.so %{buildroot}%{_libdir}/liblua.so
touch %{buildroot}%{_sysconfdir}/alternatives/lua.pc
ln -sf %{_sysconfdir}/alternatives/lua.pc %{buildroot}%{_libdir}/pkgconfig/lua.pc
%else
%endif
%check
%if "%{flavor}" == "test"
cd testes
pushd libs
make all LUA_DIR=%{_includedir}/lua%{major_version}
%make_build all LUA_DIR=%{_includedir}/lua%{major_version}
cp *.so ..
popd
LD_LIBRARY_PATH=%{_libdir} %{_bindir}/lua%{major_version} all.lua
@@ -219,30 +216,11 @@ LD_LIBRARY_PATH=%{_libdir} %{_bindir}/lua%{major_version} all.lua
%if "%{flavor}" != "test"
%post -n %{libname} -p /sbin/ldconfig
%postun -n %{libname} -p /sbin/ldconfig
%endif
%post
%{_sbindir}/update-alternatives --install \
%{_bindir}/lua lua %{_bindir}/lua%{major_version} 54 \
--slave %{_bindir}/luac luac %{_bindir}/luac%{major_version} \
--slave %{_mandir}/man1/lua.1%{ext_man} lua.1%{ext_man} %{_mandir}/man1/lua%{major_version}.1%{ext_man} \
--slave %{_mandir}/man1/luac.1%{ext_man} luac.1%{ext_man} %{_mandir}/man1/luac%{major_version}.1%{ext_man}
%postun
if [ "$1" = 0 ] ; then
%{_sbindir}/update-alternatives --remove lua %{_bindir}/lua%{major_version}
fi
%post devel
%{_sbindir}/update-alternatives --install \
%{_libdir}/liblua.so liblua.so %{_libdir}/liblua%{major_version}.so 54 \
--slave %{_libdir}/pkgconfig/lua.pc lua.pc %{_libdir}/pkgconfig/lua%{major_version}.pc
%postun devel
if [ "$1" = 0 ] ; then
%{_sbindir}/update-alternatives --remove liblua.so %{_libdir}/liblua%{major_version}.so
fi
%if "%{flavor}" != "test"
%files
%doc README
%dir %{_libdir}/lua
%dir %{_libdir}/lua/%{major_version}
%dir %{_datadir}/lua
@@ -251,15 +229,7 @@ fi
%{_bindir}/luac%{major_version}
%{_mandir}/man1/lua%{major_version}.1%{?ext_man}
%{_mandir}/man1/luac%{major_version}.1%{?ext_man}
# alternatives
%{_bindir}/lua
%{_bindir}/luac
%{_mandir}/man1/lua.1%{?ext_man}
%{_mandir}/man1/luac.1%{?ext_man}
%ghost %{_sysconfdir}/alternatives/lua
%ghost %{_sysconfdir}/alternatives/luac
%ghost %{_sysconfdir}/alternatives/lua.1%{ext_man}
%ghost %{_sysconfdir}/alternatives/luac.1%{ext_man}
%{_datadir}/libalternatives/lua/54.conf
%files -n %{libname}
%{_libdir}/liblua%{major_version}.so.*
@@ -274,11 +244,6 @@ fi
%{_includedir}/lua%{major_version}/lualib.h
%{_libdir}/liblua%{major_version}.so
%{_libdir}/pkgconfig/lua%{major_version}.pc
# alternatives
%{_libdir}/liblua.so
%{_libdir}/pkgconfig/lua.pc
%ghost %{_sysconfdir}/alternatives/liblua.so
%ghost %{_sysconfdir}/alternatives/lua.pc
%files doc
%doc doc/*

View File

@@ -2,9 +2,11 @@
testes/main.lua | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
--- a/testes/main.lua
+++ b/testes/main.lua
@@ -47,7 +47,7 @@ local function checkprogout (s)
Index: lua-5.4.8/testes/main.lua
===================================================================
--- lua-5.4.8.orig/testes/main.lua 2025-07-15 22:59:14.472309613 +0200
+++ lua-5.4.8/testes/main.lua 2025-07-15 22:59:20.829403778 +0200
@@ -49,7 +49,7 @@
assert(string.sub(s, -1) == "\n")
local t = getoutput()
for line in string.gmatch(s, ".-\n") do
@@ -13,7 +15,7 @@
end
end
@@ -367,11 +367,11 @@ a = 2
@@ -382,11 +382,11 @@
]]
RUN([[lua -e "%s" -i < %s > %s]], prompt, prog, out)
local t = getoutput()

View File

@@ -4,8 +4,10 @@
src/lundump.h | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
--- a/src/ldebug.h
+++ b/src/ldebug.h
Index: lua-5.4.8/src/ldebug.h
===================================================================
--- lua-5.4.8.orig/src/ldebug.h 2025-07-15 22:59:14.442309680 +0200
+++ lua-5.4.8/src/ldebug.h 2025-07-15 22:59:22.983017316 +0200
@@ -36,7 +36,7 @@
#endif
@@ -15,9 +17,11 @@
LUAI_FUNC const char *luaG_findlocal (lua_State *L, CallInfo *ci, int n,
StkId *pos);
LUAI_FUNC l_noret luaG_typeerror (lua_State *L, const TValue *o,
--- a/src/lmem.h
+++ b/src/lmem.h
@@ -81,7 +81,7 @@ LUAI_FUNC void *luaM_realloc_ (lua_State
Index: lua-5.4.8/src/lmem.h
===================================================================
--- lua-5.4.8.orig/src/lmem.h 2025-07-15 22:59:14.442309680 +0200
+++ lua-5.4.8/src/lmem.h 2025-07-15 22:59:22.983203934 +0200
@@ -81,7 +81,7 @@
size_t size);
LUAI_FUNC void *luaM_saferealloc_ (lua_State *L, void *block, size_t oldsize,
size_t size);
@@ -26,9 +30,11 @@
LUAI_FUNC void *luaM_growaux_ (lua_State *L, void *block, int nelems,
int *size, int size_elem, int limit,
const char *what);
--- a/src/lundump.h
+++ b/src/lundump.h
@@ -30,7 +30,7 @@
Index: lua-5.4.8/src/lundump.h
===================================================================
--- lua-5.4.8.orig/src/lundump.h 2025-07-15 22:59:14.442309680 +0200
+++ lua-5.4.8/src/lundump.h 2025-07-15 22:59:22.983321338 +0200
@@ -29,7 +29,7 @@
LUAI_FUNC LClosure* luaU_undump (lua_State* L, ZIO* Z, const char* name);
/* dump one chunk; from ldump.c */