Compare commits

...

5 Commits

Author SHA256 Message Date
6cb7ba6fe4 this package also provides devel symlink directly and conflicts other -devel packages
Also, cleanup the test condition.
2025-07-25 22:26:00 +02:00
7f2ae822e9 We need two libalt conf files, one per each binary. 2025-07-22 14:08:42 +02:00
2a20c909ef Switch from update-alternatives to libalternatives
* add dependency on lua-interpreter
* improve .gitignore and overall improve the packaging
2025-07-19 14:15:20 +02:00
411bb03abb convert the package from update-alternatives to libalternatives
And overall improve the packaging.
2025-07-16 11:46:22 +02:00
817bcac62a improve .gitignore 2025-07-16 11:46:22 +02:00
4 changed files with 53 additions and 63 deletions

1
.gitignore vendored
View File

@@ -3,3 +3,4 @@ _scmsync.obsinfo
.assets/
_buildconfig-*
_buildinfo-*.xml
lua55-*-build/

View File

@@ -10,8 +10,8 @@ Subject: build system
Index: lua-5.5.0-beta/Makefile
===================================================================
--- lua-5.5.0-beta.orig/Makefile 2025-07-11 12:05:58.289205384 +0200
+++ lua-5.5.0-beta/Makefile 2025-07-11 12:06:00.906212327 +0200
--- lua-5.5.0-beta.orig/Makefile 2025-06-26 15:04:37.000000000 +0200
+++ lua-5.5.0-beta/Makefile 2025-07-16 11:43:49.998066837 +0200
@@ -10,18 +10,18 @@
# so take care if INSTALL_TOP is not an absolute path. See the local target.
# You may want to make INSTALL_LMOD and INSTALL_CMOD consistent with
@@ -69,8 +69,8 @@ Index: lua-5.5.0-beta/Makefile
uninstall:
Index: lua-5.5.0-beta/src/Makefile
===================================================================
--- lua-5.5.0-beta.orig/src/Makefile 2025-07-11 12:05:58.289205384 +0200
+++ lua-5.5.0-beta/src/Makefile 2025-07-11 12:13:07.455546422 +0200
--- lua-5.5.0-beta.orig/src/Makefile 2025-06-26 14:57:29.000000000 +0200
+++ lua-5.5.0-beta/src/Makefile 2025-07-16 11:43:49.998317291 +0200
@@ -7,7 +7,7 @@
PLAT= guess
@@ -177,8 +177,8 @@ Index: lua-5.5.0-beta/src/Makefile
Index: lua-5.5.0-beta/src/luaconf.h
===================================================================
--- lua-5.5.0-beta.orig/src/luaconf.h 2025-07-11 12:05:58.289205384 +0200
+++ lua-5.5.0-beta/src/luaconf.h 2025-07-11 12:06:00.906620685 +0200
--- lua-5.5.0-beta.orig/src/luaconf.h 2025-06-28 12:06:32.000000000 +0200
+++ lua-5.5.0-beta/src/luaconf.h 2025-07-16 11:43:49.998518156 +0200
@@ -239,7 +239,7 @@
#else /* }{ */

View File

@@ -1,3 +1,12 @@
-------------------------------------------------------------------
Sat Jul 19 09:23:33 UTC 2025 - Matej Cepl <mcepl@cepl.eu>
- Switch from update-alternatives to libalternatives (and
dependency on lua-interpreter)
- improve .gitignore and overall improve the packaging.
- this package also provides devel symlink directly and conflicts
other -devel packages
-------------------------------------------------------------------
Fri Jul 11 09:09:28 UTC 2025 - Matej Cepl <mcepl@cepl.eu>

View File

@@ -18,9 +18,11 @@
%global flavor @BUILD_FLAVOR@%{nil}
%if "%{flavor}" == "test"
%bcond_without test
%define name_ext -test
%define debug_package %{nil}
%else
%bcond_with test
%define name_ext %{nil}
%endif
%define major_version 5.5
@@ -46,12 +48,14 @@ Patch3: main_test.patch
Patch6: shared_link.patch
# PATCH-FIX-UPSTREAM inspect errno only after failure
Patch8: execresult.patch
Requires(post): update-alternatives
Requires(postun):update-alternatives
BuildRequires: lua-interpreter
Requires: alts
Requires: lua-interpreter
Provides: lua = %{version}
Conflicts: lua
Obsoletes: lua < %{version}
Provides: Lua(API) = %{major_version}
%if "%{flavor}" == "test"
%if %{with test}
BuildRequires: lua55
BuildRequires: lua55-devel
%else
@@ -80,8 +84,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}
@@ -148,11 +151,13 @@ mv lua-5.5.0-tests testes
%autopatch -p1
# manpage
%if "%{flavor}" != "test"
%if %{without 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 %{without test}
sed -i -e "s@lib/lua/@%{_lib}/lua/@g" src/luaconf.h
%make_build linux -C src \
CC="cc" LIBDIR="%{_libdir}" \
@@ -160,8 +165,10 @@ sed -i -e "s@lib/lua/@%{_lib}/lua/@g" src/luaconf.h
MYCFLAGS="%{optflags} -std=gnu99 -D_GNU_SOURCE -fPIC -DLUA_COMPAT_MODULE" \
V=%{major_version} \
LIBTOOL="libtool --quiet"
%endif
%install
%if %{without test}
%make_install \
LIBTOOL="libtool --quiet" \
INSTALL_TOP="%{buildroot}%{_prefix}" \
@@ -185,65 +192,48 @@ 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/55.conf <<EOF
binary=%{_bindir}/lua5.5
man=lua5.5
EOF
mkdir -p %{buildroot}%{_datadir}/libalternatives/luac
cat > %{buildroot}%{_datadir}/libalternatives/luac/55.conf <<EOF
binary=%{_bindir}/luac5.5
man=luac5.5
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
# We dont create alternatives for -devel content, just conflict those
ln -s %{_libdir}/liblua%{major_version}.so %{buildroot}%{_libdir}/liblua.so
ln -s %{_libdir}/pkgconfig/lua%{major_version}.pc %{buildroot}%{_libdir}/pkgconfig/lua.pc
%endif
%check
%if %{with 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
%endif
%if "%{flavor}" != "test"
%if %{without 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} 55 \
--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 55 \
--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 %{without test}
%files
%doc README
%dir %{_libdir}/lua
%dir %{_libdir}/lua/%{major_version}
%dir %{_datadir}/lua
@@ -252,15 +242,8 @@ 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/55.conf
%{_datadir}/libalternatives/luac/55.conf
%files -n %{libname}
%{_libdir}/liblua%{major_version}.so.*
@@ -275,11 +258,8 @@ 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/*