2017-07-10 13:32:00 +02:00
|
|
|
# RPM macros for Lua
|
|
|
|
|
|
|
|
# The major.minor version of Lua
|
|
|
|
%lua_version %(lua -e 'print(_VERSION)' | cut -d ' ' -f 2)
|
2021-08-28 12:37:37 +02:00
|
|
|
%lua_version_nodots %(lua -e 'print((string.gsub("%{lua_version}", "%.", "")))')
|
2017-07-10 13:32:00 +02:00
|
|
|
|
|
|
|
# compiled modules should go here
|
|
|
|
%lua_archdir %{_libdir}/lua/%{lua_version}
|
|
|
|
|
|
|
|
# pure Lua modules should go here
|
|
|
|
%lua_noarchdir %{_datadir}/lua/%{lua_version}
|
2017-07-11 10:24:39 +02:00
|
|
|
|
|
|
|
# lua includes folder
|
|
|
|
%lua_incdir %{_includedir}/lua%{lua_version}
|
2021-01-28 15:21:31 +01:00
|
|
|
|
2022-11-30 14:46:45 +01:00
|
|
|
%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)
|
|
|
|
}
|
2021-08-28 12:37:37 +02:00
|
|
|
%lua_version_default_nodots %(lua -e 'print((string.gsub("%{lua_version_default}", "%.", "")))')
|
2021-08-27 12:11:08 +02:00
|
|
|
|
|
|
|
%ifluadefault \
|
|
|
|
%if %{lua_version_nodots} == %{lua_version_default_nodots} \
|
|
|
|
%{nil}
|
|
|
|
|
2021-01-28 15:21:31 +01:00
|
|
|
# Lua default version
|
2021-02-26 15:30:52 +01:00
|
|
|
# -e: Exclude lua prefix
|
2021-06-11 12:24:56 +02:00
|
|
|
# -n: Specify name
|
|
|
|
%lua_provides(en:) \
|
2021-08-27 12:11:08 +02:00
|
|
|
%ifluadefault \
|
2021-06-11 12:24:56 +02:00
|
|
|
%if 0%{?-n:1} \
|
|
|
|
Provides: %{-n*} = %{version}-%{release} \
|
|
|
|
Obsoletes: %{-n*} < %{version}-%{release} \
|
|
|
|
%else \
|
2021-02-26 15:30:52 +01:00
|
|
|
%if 0%{?-e:1} \
|
|
|
|
Provides: %{mod_name} = %{version}-%{release} \
|
|
|
|
Obsoletes: %{mod_name} < %{version}-%{release} \
|
|
|
|
%else \
|
2021-01-28 15:21:31 +01:00
|
|
|
Provides: lua-%{mod_name} = %{version}-%{release} \
|
|
|
|
Obsoletes: lua-%{mod_name} < %{version}-%{release} \
|
|
|
|
%endif \
|
2021-02-26 15:30:52 +01:00
|
|
|
%endif \
|
2021-06-11 12:24:56 +02:00
|
|
|
%endif \
|
2021-01-28 15:21:31 +01:00
|
|
|
%{nil}
|
2022-09-02 17:13:59 +02:00
|
|
|
|
|
|
|
# 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}
|