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/ .assets/
_buildconfig-* _buildconfig-*
_buildinfo-*.xml _buildinfo-*.xml
lua55-*-build/

View File

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

View File

@@ -18,9 +18,11 @@
%global flavor @BUILD_FLAVOR@%{nil} %global flavor @BUILD_FLAVOR@%{nil}
%if "%{flavor}" == "test" %if "%{flavor}" == "test"
%bcond_without test
%define name_ext -test %define name_ext -test
%define debug_package %{nil} %define debug_package %{nil}
%else %else
%bcond_with test
%define name_ext %{nil} %define name_ext %{nil}
%endif %endif
%define major_version 5.5 %define major_version 5.5
@@ -46,12 +48,14 @@ Patch3: main_test.patch
Patch6: shared_link.patch Patch6: shared_link.patch
# PATCH-FIX-UPSTREAM inspect errno only after failure # PATCH-FIX-UPSTREAM inspect errno only after failure
Patch8: execresult.patch Patch8: execresult.patch
Requires(post): update-alternatives BuildRequires: lua-interpreter
Requires(postun):update-alternatives Requires: alts
Requires: lua-interpreter
Provides: lua = %{version} Provides: lua = %{version}
Conflicts: lua
Obsoletes: lua < %{version} Obsoletes: lua < %{version}
Provides: Lua(API) = %{major_version} Provides: Lua(API) = %{major_version}
%if "%{flavor}" == "test" %if %{with test}
BuildRequires: lua55 BuildRequires: lua55
BuildRequires: lua55-devel BuildRequires: lua55-devel
%else %else
@@ -80,8 +84,7 @@ Group: Development/Libraries/C and C++
Requires: %{libname} = %{version} Requires: %{libname} = %{version}
Requires: %{name} = %{version} Requires: %{name} = %{version}
Requires: lua-macros Requires: lua-macros
Requires(post): update-alternatives Conflicts: lua-devel
Requires(postun):update-alternatives
Provides: lua-devel = %{version} Provides: lua-devel = %{version}
Provides: Lua(devel) = %{major_version} Provides: Lua(devel) = %{major_version}
Provides: pkgconfig(lua) = %{version} Provides: pkgconfig(lua) = %{version}
@@ -148,11 +151,13 @@ mv lua-5.5.0-tests testes
%autopatch -p1 %autopatch -p1
# manpage # 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/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 cat doc/luac.1 | sed 's/TH LUAC 1/TH LUAC%{major_version} 1/' > doc/luac%{major_version}.1
%endif
%build %build
%if %{without test}
sed -i -e "s@lib/lua/@%{_lib}/lua/@g" src/luaconf.h sed -i -e "s@lib/lua/@%{_lib}/lua/@g" src/luaconf.h
%make_build linux -C src \ %make_build linux -C src \
CC="cc" LIBDIR="%{_libdir}" \ 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" \ MYCFLAGS="%{optflags} -std=gnu99 -D_GNU_SOURCE -fPIC -DLUA_COMPAT_MODULE" \
V=%{major_version} \ V=%{major_version} \
LIBTOOL="libtool --quiet" LIBTOOL="libtool --quiet"
%endif
%install %install
%if %{without test}
%make_install \ %make_install \
LIBTOOL="libtool --quiet" \ LIBTOOL="libtool --quiet" \
INSTALL_TOP="%{buildroot}%{_prefix}" \ INSTALL_TOP="%{buildroot}%{_prefix}" \
@@ -185,65 +192,48 @@ Version: %{version}
Libs: -llua%{major_version} -lm Libs: -llua%{major_version} -lm
Cflags: -I\${includedir} Cflags: -I\${includedir}
EOF EOF
install -D -m 644 lua%{major_version}.pc %{buildroot}%{_libdir}/pkgconfig/lua%{major_version}.pc install -D -m 644 lua%{major_version}.pc %{buildroot}%{_libdir}/pkgconfig/lua%{major_version}.pc
# update-alternatives # alternatives - create configuration file
mkdir -p %{buildroot}%{_sysconfdir}/alternatives mkdir -p %{buildroot}%{_datadir}/libalternatives/lua
for file in lua luac ; do cat > %{buildroot}%{_datadir}/libalternatives/lua/55.conf <<EOF
touch "%{buildroot}%{_sysconfdir}/alternatives/${file}" binary=%{_bindir}/lua5.5
ln -sf "%{_sysconfdir}/alternatives/${file}" "%{buildroot}%{_bindir}/${file}" man=lua5.5
touch "%{buildroot}%{_sysconfdir}/alternatives/${file}.1%{ext_man}" EOF
ln -sf "%{_sysconfdir}/alternatives/${file}.1%{ext_man}" "%{buildroot}%{_mandir}/man1/${file}.1%{ext_man}" mkdir -p %{buildroot}%{_datadir}/libalternatives/luac
done 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 # 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.%{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%{major_version}.so.0
ln -s %{_libdir}/liblua%{major_version}.so.%{major_version}.0 %{buildroot}%{_libdir}/liblua.so.%{major_version} 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 # We dont create alternatives for -devel content, just conflict those
ln -sf %{_sysconfdir}/alternatives/liblua.so %{buildroot}%{_libdir}/liblua.so ln -s %{_libdir}/liblua%{major_version}.so %{buildroot}%{_libdir}/liblua.so
touch %{buildroot}%{_sysconfdir}/alternatives/lua.pc ln -s %{_libdir}/pkgconfig/lua%{major_version}.pc %{buildroot}%{_libdir}/pkgconfig/lua.pc
ln -sf %{_sysconfdir}/alternatives/lua.pc %{buildroot}%{_libdir}/pkgconfig/lua.pc %endif
%else
%check %check
%if %{with test}
cd testes cd testes
pushd libs pushd libs
make all LUA_DIR=%{_includedir}/lua%{major_version} %make_build all LUA_DIR=%{_includedir}/lua%{major_version}
cp *.so .. cp *.so ..
popd popd
LD_LIBRARY_PATH=%{_libdir} %{_bindir}/lua%{major_version} all.lua LD_LIBRARY_PATH=%{_libdir} %{_bindir}/lua%{major_version} all.lua
%endif %endif
%if "%{flavor}" != "test" %if %{without test}
%post -n %{libname} -p /sbin/ldconfig %post -n %{libname} -p /sbin/ldconfig
%postun -n %{libname} -p /sbin/ldconfig %postun -n %{libname} -p /sbin/ldconfig
%endif
%post %if %{without test}
%{_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
%files %files
%doc README
%dir %{_libdir}/lua %dir %{_libdir}/lua
%dir %{_libdir}/lua/%{major_version} %dir %{_libdir}/lua/%{major_version}
%dir %{_datadir}/lua %dir %{_datadir}/lua
@@ -252,15 +242,8 @@ fi
%{_bindir}/luac%{major_version} %{_bindir}/luac%{major_version}
%{_mandir}/man1/lua%{major_version}.1%{?ext_man} %{_mandir}/man1/lua%{major_version}.1%{?ext_man}
%{_mandir}/man1/luac%{major_version}.1%{?ext_man} %{_mandir}/man1/luac%{major_version}.1%{?ext_man}
# alternatives %{_datadir}/libalternatives/lua/55.conf
%{_bindir}/lua %{_datadir}/libalternatives/luac/55.conf
%{_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}
%files -n %{libname} %files -n %{libname}
%{_libdir}/liblua%{major_version}.so.* %{_libdir}/liblua%{major_version}.so.*
@@ -275,11 +258,8 @@ fi
%{_includedir}/lua%{major_version}/lualib.h %{_includedir}/lua%{major_version}/lualib.h
%{_libdir}/liblua%{major_version}.so %{_libdir}/liblua%{major_version}.so
%{_libdir}/pkgconfig/lua%{major_version}.pc %{_libdir}/pkgconfig/lua%{major_version}.pc
# alternatives
%{_libdir}/liblua.so %{_libdir}/liblua.so
%{_libdir}/pkgconfig/lua.pc %{_libdir}/pkgconfig/lua.pc
%ghost %{_sysconfdir}/alternatives/liblua.so
%ghost %{_sysconfdir}/alternatives/lua.pc
%files doc %files doc
%doc doc/* %doc doc/*