Sync from SUSE:SLFO:Main lua-macros revision aff0a1e64b510c90ee41be871724315b

This commit is contained in:
Adrian Schröter 2024-05-03 16:25:43 +02:00
commit cb675fa113
4 changed files with 208 additions and 0 deletions

23
.gitattributes vendored Normal file
View File

@ -0,0 +1,23 @@
## Default LFS
*.7z filter=lfs diff=lfs merge=lfs -text
*.bsp filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.gem filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.jar filter=lfs diff=lfs merge=lfs -text
*.lz filter=lfs diff=lfs merge=lfs -text
*.lzma filter=lfs diff=lfs merge=lfs -text
*.obscpio filter=lfs diff=lfs merge=lfs -text
*.oxt filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.rpm filter=lfs diff=lfs merge=lfs -text
*.tbz filter=lfs diff=lfs merge=lfs -text
*.tbz2 filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.ttf filter=lfs diff=lfs merge=lfs -text
*.txz filter=lfs diff=lfs merge=lfs -text
*.whl filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text

67
lua-macros.changes Normal file
View File

@ -0,0 +1,67 @@
-------------------------------------------------------------------
Fri Nov 25 19:15:41 UTC 2022 - Michal Suchanek <msuchanek@suse.com>
- Make macros usable with older releases (boo#1205611).
-------------------------------------------------------------------
Fri Sep 2 15:13:06 UTC 2022 - Callum Farmer <gmbr3@opensuse.org>
- Add LuaRocks macros:
* %luarocks_build
* %luarocks_install
* %luarocks_treedir
-------------------------------------------------------------------
Sat Aug 28 09:42:55 UTC 2021 - Callum Farmer <gmbr3@opensuse.org>
- Change usage of math to string.gsub to prevent extra decimal
places causing issues
-------------------------------------------------------------------
Fri Aug 27 10:07:01 UTC 2021 - Callum Farmer <gmbr3@opensuse.org>
- Add %lua_version_default, %lua_version_default_nodots
and %ifluadefault: to allow to separate what flavour builds
the documentation
- Bump version to 20210827
-------------------------------------------------------------------
Thu Jun 10 16:58:39 UTC 2021 - Callum Farmer <gmbr3@opensuse.org>
- Add -n (name) option to %lua_provides
- Use lua instead of perl for %lua_version_nodots
-------------------------------------------------------------------
Fri Apr 9 10:03:41 UTC 2021 - Callum Farmer <gmbr3@opensuse.org>
- Add %lua_version_nodots to equal package naming
-------------------------------------------------------------------
Fri Feb 26 15:54:56 UTC 2021 - Callum Farmer <gmbr3@opensuse.org>
- Add -e (exclude) option to %lua_provides
-------------------------------------------------------------------
Wed Jan 27 15:51:37 UTC 2021 - Callum Farmer <gmbr3@opensuse.org>
- Add lua_provides macro for default lua naming
-------------------------------------------------------------------
Sun Apr 12 13:22:39 UTC 2020 - Matej Cepl <mcepl@suse.com>
- Modify lua_incdir to work even on Fedora/RHEL
-------------------------------------------------------------------
Sun Apr 12 13:14:02 UTC 2020 - Matej Cepl <mcepl@suse.com>
- Install into /usr/lib/ not libexec
-------------------------------------------------------------------
Tue Jul 11 08:24:18 UTC 2017 - tchvatal@suse.com
- Add lua_incdir macro to declare the lua includedir
-------------------------------------------------------------------
Mon Jul 10 11:26:37 UTC 2017 - tchvatal@suse.com
- Split out from main lua packages to keep just one version for all

54
lua-macros.spec Normal file
View File

@ -0,0 +1,54 @@
#
# spec file for package lua-macros
#
# Copyright (c) 2022 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
%if %{undefined _rpmmacrodir}
%define _rpmmacrodir %{_rpmconfigdir}/macros.d
%endif
Name: lua-macros
Version: 20210827
Release: 0
Summary: Macros for lua language
License: MIT
Group: Development/Languages/Other
URL: https://www.lua.org
Source0: macros.lua
%if 0%{?suse_version} >= 1500
# on SLE 12 lua is lua5.2 unconditionally, avoid
Requires: lua
%endif
BuildArch: noarch
%description
RPM macros for lua packaging
%prep
cp -p %{SOURCE0} .
%if 0%{?rhel} || 0%{?fedora}
sed -i -e '/includedir/s!/lua!&-!' macros.lua
%endif
%build
:
%install
install -Dm644 macros.lua %{buildroot}%{_rpmmacrodir}/macros.lua
%files
%{_rpmmacrodir}/macros.lua
%changelog

64
macros.lua Normal file
View File

@ -0,0 +1,64 @@
# RPM macros for Lua
# The major.minor version of Lua
%lua_version %(lua -e 'print(_VERSION)' | cut -d ' ' -f 2)
%lua_version_nodots %(lua -e 'print((string.gsub("%{lua_version}", "%.", "")))')
# compiled modules should go here
%lua_archdir %{_libdir}/lua/%{lua_version}
# pure Lua modules should go here
%lua_noarchdir %{_datadir}/lua/%{lua_version}
# lua includes folder
%lua_incdir %{_includedir}/lua%{lua_version}
%lua_version_default %{lua:
local result = 5.4
local ver = rpm.expand("%{?suse_version}")
if #ver > 0 then
ver = tonumber(ver)
if ver < 1500 then
result = 5.1
elseif ver == 1500 then
result = 5.3
end
end
print(result)
}
%lua_version_default_nodots %(lua -e 'print((string.gsub("%{lua_version_default}", "%.", "")))')
%ifluadefault \
%if %{lua_version_nodots} == %{lua_version_default_nodots} \
%{nil}
# Lua default version
# -e: Exclude lua prefix
# -n: Specify name
%lua_provides(en:) \
%ifluadefault \
%if 0%{?-n:1} \
Provides: %{-n*} = %{version}-%{release} \
Obsoletes: %{-n*} < %{version}-%{release} \
%else \
%if 0%{?-e:1} \
Provides: %{mod_name} = %{version}-%{release} \
Obsoletes: %{mod_name} < %{version}-%{release} \
%else \
Provides: lua-%{mod_name} = %{version}-%{release} \
Obsoletes: lua-%{mod_name} < %{version}-%{release} \
%endif \
%endif \
%endif \
%{nil}
# LuaRocks
%luarocks_build \
luarocks --lua-version "%{lua_version}" \\\
make --pack-binary-rock --deps-mode none
%luarocks_install \
luarocks --lua-version="%{lua_version}" --tree="%{buildroot}%{_prefix}" \\\
install --deps-mode=none --no-manifest
%luarocks_treedir %{_prefix}/lib/luarocks/rocks-%{lua_version}