Refactor macros to a more common syntax

Use rpm's build-in lua for macros
This commit is contained in:
Björn Esser 2017-05-28 10:42:58 +02:00
parent 9774218a76
commit 62bbfe64a1
3 changed files with 20 additions and 18 deletions

View File

@ -12,7 +12,7 @@
Name: lua
Version: %{major_version}.4
Release: 2%{?dist}
Release: 3%{?dist}
Summary: Powerful light-weight programming language
Group: Development/Languages
License: MIT
@ -27,7 +27,7 @@ Source3: http://www.lua.org/tests/lua-%{version}-tests.tar.gz
# multilib
Source4: luaconf.h
# rpm-macro
Source1000: macros.lua.in
Source1000: macros.lua
Patch0: %{name}-5.3.0-autotoolize.patch
Patch1: %{name}-5.3.0-idsize.patch
#Patch2: %%{name}-5.3.0-luac-shared-link-fix.patch
@ -174,8 +174,7 @@ popd
%endif
# Install rpm-macro
mkdir -p $RPM_BUILD_ROOT/%{macrosdir}
sed -e 's!@major_version@!%{major_version}!g' < %{SOURCE1000} > $RPM_BUILD_ROOT/%{macrosdir}/macros.lua
install -Dpm 0644 %{SOURCE1000} $RPM_BUILD_ROOT/%{macrosdir}/macros.lua
%files
%{!?_licensedir:%global license %%doc}
@ -212,6 +211,10 @@ sed -e 's!@major_version@!%{major_version}!g' < %{SOURCE1000} > $RPM_BUILD_ROOT/
%changelog
* Sun May 28 2017 Björn Esser <besser82@fedoraproject.org> - 5.3.4-3
- Refactor macros to a more common syntax
- Use rpm's build-in lua for macros
* Wed May 24 2017 Björn Esser <besser82@fedoraproject.org> - 5.3.4-2
- Add rpm-macros file, providing packaging macros for lua add-ons (#1447324)

13
macros.lua Normal file
View File

@ -0,0 +1,13 @@
%lua_version %{lua: print(string.sub(_VERSION, 5))}
%lua_libdir %{_libdir}/lua/%{lua_version}
%lua_pkgdir %{_datadir}/lua/%{lua_version}
%lua_requires \
%if 0%{?fedora} >= 16 || 0%{?rhel} >= 7 \
Requires: lua(abi) = %{lua_version} \
%else \
Requires: lua >= %{lua_version} \
Requires: lua < %{lua: os.setlocale('C'); print(string.sub(_VERSION, 5) + 0.1)} \
%endif \
%{nil}

View File

@ -1,14 +0,0 @@
%luaver @major_version@
%luanext %(echo '%{luaver}' | %{__awk} '{ sum = $1 + 0.1; print sum }')
%lualibdir %{_libdir}/lua/%{luaver}
%luapkgdir %{_datadir}/lua/%{luaver}
%lua_requires \
%if 0%{?fedora} || 0%{?rhel} >= 7 \
Requires: lua(abi) = %{luaver} \
%else \
Requires: lua >= %{luaver} \
Requires: lua < %{luanext} \
%endif \
%{nil}