[packages/lua50] - provide lua{,-devel,-static} only when built as default_lua; unify suffixes to "5.0"

qboosh qboosh at pld-linux.org
Fri Oct 30 06:24:40 CET 2020


commit 994beb9319b5ec6cd2dc14a041fe3bf8200df731
Author: Jakub Bogusz <qboosh at pld-linux.org>
Date:   Fri Oct 30 06:24:31 2020 +0100

    - provide lua{,-devel,-static} only when built as default_lua; unify suffixes to "5.0"

 lua50-Makefile.patch |   4 +-
 lua50.spec           | 112 +++++++++++++++++++++++++++++++++++++--------------
 2 files changed, 84 insertions(+), 32 deletions(-)
---
diff --git a/lua50.spec b/lua50.spec
index 5053979..c4e82aa 100644
--- a/lua50.spec
+++ b/lua50.spec
@@ -1,26 +1,29 @@
 #
 # Conditional build:
-%bcond_with	luastatic        # build dietlibc-based static lua version
+%bcond_with	luastatic	# build dietlibc-based static lua version
+%bcond_with	default_lua	# build as default lua (symlinks to nil suffix)
 #
 Summary:	A simple lightweight powerful embeddable programming language
 Summary(pl.UTF-8):	Prosty, lekki ale potężny, osadzalny język programowania
 Name:		lua50
 Version:	5.0.3
+%define	refman_ver	5.0
 Release:	5
 License:	MIT
 Group:		Development/Languages
 Source0:	http://www.lua.org/ftp/lua-%{version}.tar.gz
 # Source0-md5:	feee27132056de2949ce499b0ef4c480
-%define		_refman_version	5.0
-Source1:	http://www.lua.org/ftp/refman-%{_refman_version}.ps.gz
+Source1:	http://www.lua.org/ftp/refman-%{refman_ver}.ps.gz
 # Source1-md5:	4b0cedef4880bf925da9537520d93b57
 Patch0:		lua5-link.patch
 Patch1:		%{name}-Makefile.patch
 URL:		http://www.lua.org/
 %{?with_luastatic:BuildRequires:       dietlibc-static}
 Requires:	%{name}-libs = %{version}-%{release}
+%if %{with default_lua}
 Provides:	lua = %{version}
-Obsoletes:	lua < 4.0.1
+Obsoletes:	lua < %{version}
+%endif
 BuildRoot:	%{tmpdir}/%{name}-%{version}-root-%(id -u -n)
 
 %description
@@ -63,7 +66,10 @@ Summary:	Header files for Lua
 Summary(pl.UTF-8):	Pliki nagłówkowe dla Lua
 Group:		Development/Languages
 Requires:	%{name}-libs = %{version}-%{release}
+%if %{with default_lua}
 Provides:	lua-devel = %{version}
+Obsoletes:	lua-devel < %{version}
+%endif
 
 %description devel
 Header files needed to embed Lua in C/C++ programs and docs for the
@@ -78,7 +84,10 @@ Summary:	Static Lua libraries
 Summary(pl.UTF-8):	Biblioteki statyczne Lua
 Group:		Development/Languages
 Requires:	%{name}-devel = %{version}-%{release}
+%if %{with default_lua}
 Provides:	lua-static = %{version}
+Obsoletes:	lua-static < %{version}
+%endif
 
 %description static
 Static Lua libraries.
@@ -90,6 +99,10 @@ Biblioteki statyczne Lua.
 Summary:	Static Lua interpreter
 Summary(pl.UTF-8):	Statycznie skonsolidowany interpreter lua
 Group:		Development/Languages
+%if %{with default_lua}
+Provides:	lua-luastatic = %{version}
+Obsoletes:	lua-luastatic < %{version}
+%endif
 
 %description luastatic
 Static lua interpreter.
@@ -109,7 +122,9 @@ cp -f %{SOURCE1} refman.ps.gz
 	CC="diet %{__cc}" \
 	MYCFLAGS="%{rpmcflags} -fPIC -Os" \
 	EXTRA_DEFS="-DPIC -D_GNU_SOURCE"
+
 %{__mv} bin bin.static
+
 %{__make} clean
 %endif
 
@@ -127,41 +142,58 @@ install -d $RPM_BUILD_ROOT%{_libdir}
 %{__make} soinstall install \
 	INSTALL_ROOT=$RPM_BUILD_ROOT%{_prefix} \
 	INSTALL_BIN=$RPM_BUILD_ROOT%{_bindir} \
-	INSTALL_INC=$RPM_BUILD_ROOT%{_includedir}/lua50 \
+	INSTALL_INC=$RPM_BUILD_ROOT%{_includedir}/lua5.0 \
 	INSTALL_LIB=$RPM_BUILD_ROOT%{_libdir} \
 	INSTALL_MAN=$RPM_BUILD_ROOT%{_mandir}/man1
 
-# change name from lua to lua50
-for i in $RPM_BUILD_ROOT%{_bindir}/* ; do %{__mv} ${i}{,50} ; done
-%{__mv} $RPM_BUILD_ROOT%{_libdir}/liblua{,50}.a
-%{__mv} $RPM_BUILD_ROOT%{_libdir}/liblualib{,50}.a
+# change name from lua to lua5.0
+for i in $RPM_BUILD_ROOT%{_bindir}/lua* ; do
+	%{__mv} ${i}{,5.0}
+done
+%{__mv} $RPM_BUILD_ROOT%{_libdir}/liblua{,5.0}.a
+%{__mv} $RPM_BUILD_ROOT%{_libdir}/liblualib{,5.0}.a
 
-%{__rm} $RPM_BUILD_ROOT%{_libdir}/lib*.so
-ln -sf liblua.so.5.0 $RPM_BUILD_ROOT%{_libdir}/liblua50.so
-ln -sf liblualib.so.5.0 $RPM_BUILD_ROOT%{_libdir}/liblualib50.so
+ln -sf liblua.so.5.0 $RPM_BUILD_ROOT%{_libdir}/liblua5.0.so
+ln -sf liblualib.so.5.0 $RPM_BUILD_ROOT%{_libdir}/liblualib5.0.so
 
 %if %{with luastatic}
-install bin.static/lua $RPM_BUILD_ROOT%{_bindir}/lua50.static
-install bin.static/luac $RPM_BUILD_ROOT%{_bindir}/luac50.static
+install bin.static/lua $RPM_BUILD_ROOT%{_bindir}/lua5.0.static
+install bin.static/luac $RPM_BUILD_ROOT%{_bindir}/luac5.0.static
 %endif
 
 # create pkgconfig file
 install -d $RPM_BUILD_ROOT%{_pkgconfigdir}
-cat > $RPM_BUILD_ROOT%{_pkgconfigdir}/lua50.pc <<'EOF'
+cat > $RPM_BUILD_ROOT%{_pkgconfigdir}/lua5.0.pc <<'EOF'
 prefix=%{_prefix}
 exec_prefix=%{_exec_prefix}
-includedir=%{_includedir}/%{name}
+includedir=%{_includedir}/lua5.0
 libdir=%{_libdir}
-interpreter=%{_bindir}/%{name}
-compiler=%{_bindir}/luac50
+interpreter=%{_bindir}/lua5.0
+compiler=%{_bindir}/luac5.0
 
 Name: Lua
 Description: An extension programming language
 Version: %{version}
-Cflags: -I%{_includedir}/%{name}
-Libs: -L%{_libdir} -llua50 -llualib50 -ldl -lm
+Cflags: -I%{_includedir}
+Libs: -L%{_libdir} -llua5.0 -llualib5.0 -ldl -lm
 EOF
 
+%if %{with default_lua}
+for f in lua luac ; do
+	ln -sf ${f}5.0 $RPM_BUILD_ROOT%{_bindir}/${f}
+	echo ".so ${f}5.0.1" >$RPM_BUILD_ROOT%{_mandir}/man1/${f}.1
+%if %{with luastatic}
+	ln -sf ${f}5.0.static $RPM_BUILD_ROOT%{_bindir}/${f}.static
+%endif
+done
+ln -sf liblua5.1.a $RPM_BUILD_ROOT%{_libdir}/liblua.a
+ln -sf liblualib5.1.a $RPM_BUILD_ROOT%{_libdir}/liblualib.a
+ln -sf lua5.1 $RPM_BUILD_ROOT%{_includedir}/lua
+ln -sf lua5.1.pc $RPM_BUILD_ROOT%{_pkgconfigdir}/lua.pc
+%else
+%{__rm} $RPM_BUILD_ROOT%{_libdir}/lib{lua,lualib}.so
+%endif
+
 %clean
 rm -rf $RPM_BUILD_ROOT
 
@@ -170,10 +202,16 @@ rm -rf $RPM_BUILD_ROOT
 
 %files
 %defattr(644,root,root,755)
-%attr(755,root,root) %{_bindir}/lua50
-%attr(755,root,root) %{_bindir}/luac50
-%{_mandir}/man1/lua50.1*
-%{_mandir}/man1/luac50.1*
+%attr(755,root,root) %{_bindir}/lua5.0
+%attr(755,root,root) %{_bindir}/luac5.0
+%{_mandir}/man1/lua5.0.1*
+%{_mandir}/man1/luac5.0.1*
+%if %{with default_lua}
+%attr(755,root,root) %{_bindir}/lua
+%attr(755,root,root) %{_bindir}/luac
+%{_mandir}/man1/lua.1*
+%{_mandir}/man1/luac.1*
+%endif
 
 %files libs
 %defattr(644,root,root,755)
@@ -184,19 +222,33 @@ rm -rf $RPM_BUILD_ROOT
 %files devel
 %defattr(644,root,root,755)
 %doc refman.ps.gz doc test
-%attr(755,root,root) %{_libdir}/liblua50.so
-%attr(755,root,root) %{_libdir}/liblualib50.so
-%{_includedir}/lua50
-%{_pkgconfigdir}/lua50.pc
+%attr(755,root,root) %{_libdir}/liblua5.0.so
+%attr(755,root,root) %{_libdir}/liblualib5.0.so
+%{_includedir}/lua5.0
+%{_pkgconfigdir}/lua5.0.pc
+%if %{with default_lua}
+%attr(755,root,root) %{_libdir}/liblua.so
+%attr(755,root,root) %{_libdir}/liblualib.so
+%{_includedir}/lua
+%{_pkgconfigdir}/lua.pc
+%endif
 
 %files static
 %defattr(644,root,root,755)
-%{_libdir}/liblua50.a
-%{_libdir}/liblualib50.a
+%{_libdir}/liblua5.0.a
+%{_libdir}/liblualib5.0.a
+%if %{with default_lua}
+%{_libdir}/liblua.a
+%{_libdir}/liblualib.a
+%endif
 
 %if %{with luastatic}
 %files luastatic
 %defattr(644,root,root,755)
+%attr(755,root,root) %{_bindir}/lua5.0.static
+%attr(755,root,root) %{_bindir}/luac5.0.static
+%if %{with default_lua}
 %attr(755,root,root) %{_bindir}/lua.static
 %attr(755,root,root) %{_bindir}/luac.static
 %endif
+%endif
diff --git a/lua50-Makefile.patch b/lua50-Makefile.patch
index d8a806f..f088193 100644
--- a/lua50-Makefile.patch
+++ b/lua50-Makefile.patch
@@ -16,8 +16,8 @@
  	$(INSTALL_DATA) include/*.h $(INSTALL_INC)
  	$(INSTALL_DATA) lib/*.a $(INSTALL_LIB)
 -	$(INSTALL_DATA) doc/*.1 $(INSTALL_MAN)
-+	$(INSTALL_DATA) doc/lua.1 $(INSTALL_MAN)/lua50.1
-+	$(INSTALL_DATA) doc/luac.1 $(INSTALL_MAN)/luac50.1
++	$(INSTALL_DATA) doc/lua.1 $(INSTALL_MAN)/lua5.0.1
++	$(INSTALL_DATA) doc/luac.1 $(INSTALL_MAN)/luac5.0.1
  
  # shared libraries (for Linux)
  so:
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/lua50.git/commitdiff/994beb9319b5ec6cd2dc14a041fe3bf8200df731



More information about the pld-cvs-commit mailing list