Compare commits
12 Commits
| Author | SHA256 | Date | |
|---|---|---|---|
|
adf544bb37
|
|||
|
6e7d7d058f
|
|||
|
8ee4d34fad
|
|||
|
c1d442702b
|
|||
|
d4f21b0c0c
|
|||
|
984b4bf4f2
|
|||
|
21cfcf02e2
|
|||
|
22fe4289a4
|
|||
|
db9766d6bd
|
|||
|
df6ced835e
|
|||
|
efd19cb701
|
|||
|
91f3720965
|
1
.gitattributes
vendored
1
.gitattributes
vendored
@@ -21,3 +21,4 @@
|
|||||||
*.xz filter=lfs diff=lfs merge=lfs -text
|
*.xz filter=lfs diff=lfs merge=lfs -text
|
||||||
*.zip filter=lfs diff=lfs merge=lfs -text
|
*.zip filter=lfs diff=lfs merge=lfs -text
|
||||||
*.zst filter=lfs diff=lfs merge=lfs -text
|
*.zst filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.changes merge=merge-changes
|
||||||
|
|||||||
8
.gitignore
vendored
8
.gitignore
vendored
@@ -1 +1,9 @@
|
|||||||
.osc
|
.osc
|
||||||
|
_scmsync.obsinfo
|
||||||
|
_buildconfig-*
|
||||||
|
_buildinfo-*.xml
|
||||||
|
lua-macros-*-build/
|
||||||
|
*.obscpio
|
||||||
|
*.osc
|
||||||
|
_build.*
|
||||||
|
.pbuild
|
||||||
|
|||||||
18
Makefile
Normal file
18
Makefile
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
all:
|
||||||
|
mkdir -p build && cd build/ \
|
||||||
|
&& cmake .. \
|
||||||
|
'-GUnix Makefiles' \
|
||||||
|
-DCMAKE_INSTALL_PREFIX:PATH=/usr \
|
||||||
|
-DCMAKE_BUILD_TYPE=RelWithDebInfo '-DCMAKE_C_FLAGS=-O2 -Wall -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -Werror=return-type -flto=auto -g' \
|
||||||
|
'-DCMAKE_EXE_LINKER_FLAGS=-flto=auto -Wl,--as-needed -Wl,--no-undefined -Wl,-z,now' \
|
||||||
|
'-DCMAKE_MODULE_LINKER_FLAGS=-flto=auto -Wl,--as-needed' \
|
||||||
|
'-DCMAKE_SHARED_LINKER_FLAGS=-flto=auto -Wl,--as-needed -Wl,--no-undefined -Wl,-z,now' \
|
||||||
|
-DCMAKE_VERBOSE_MAKEFILE:BOOL=ON \
|
||||||
|
-DBUILD_SHARED_LIBS:BOOL=ON \
|
||||||
|
-DCMAKE_COLOR_MAKEFILE:BOOL=OFF \
|
||||||
|
-DCMAKE_POLICY_VERSION_MINIMUM=3.5 \
|
||||||
|
-DLUA_INCLUDE_DIR:PATH=$(shell pkgconf --variable=includedir lua) \
|
||||||
|
&& make
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -rf build CMakeCache.txt
|
||||||
@@ -1,3 +1,38 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Tue Oct 14 23:16:09 UTC 2025 - Matej Cepl <mcepl@cepl.eu>
|
||||||
|
|
||||||
|
- Fix %luarocks_* macros.
|
||||||
|
|
||||||
|
-------------------------------------------------------------------
|
||||||
|
Mon Oct 13 20:24:01 UTC 2025 - Matej Cepl <mcepl@cepl.eu>
|
||||||
|
|
||||||
|
- Fix %%lua_provides.
|
||||||
|
|
||||||
|
-------------------------------------------------------------------
|
||||||
|
Mon Oct 13 17:20:42 UTC 2025 - Matej Cepl <mcepl@cepl.eu>
|
||||||
|
|
||||||
|
- Quote %%lua_archdir macro.
|
||||||
|
|
||||||
|
-------------------------------------------------------------------
|
||||||
|
Sat Oct 11 16:45:06 UTC 2025 - Matej Cepl <mcepl@cepl.eu>
|
||||||
|
|
||||||
|
- Rework Lua version and path macros using RPM Lua blocks.
|
||||||
|
|
||||||
|
-------------------------------------------------------------------
|
||||||
|
Fri Oct 10 10:56:01 UTC 2025 - Matej Cepl <mcepl@cepl.eu>
|
||||||
|
|
||||||
|
- Make %{lua_noarchdir} work even without lua-devel installed.
|
||||||
|
|
||||||
|
-------------------------------------------------------------------
|
||||||
|
Thu Oct 9 22:44:04 UTC 2025 - Matej Cepl <mcepl@cepl.eu>
|
||||||
|
|
||||||
|
- Make definition of variables dynamic based on pkgconf output.
|
||||||
|
|
||||||
|
-------------------------------------------------------------------
|
||||||
|
Tue Aug 5 14:05:41 UTC 2025 - Matej Cepl <mcepl@cepl.eu>
|
||||||
|
|
||||||
|
- On Factory BR lua-interpreter.
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Fri Nov 25 19:15:41 UTC 2022 - Michal Suchanek <msuchanek@suse.com>
|
Fri Nov 25 19:15:41 UTC 2022 - Michal Suchanek <msuchanek@suse.com>
|
||||||
|
|
||||||
|
|||||||
@@ -27,10 +27,13 @@ License: MIT
|
|||||||
Group: Development/Languages/Other
|
Group: Development/Languages/Other
|
||||||
URL: https://www.lua.org
|
URL: https://www.lua.org
|
||||||
Source0: macros.lua
|
Source0: macros.lua
|
||||||
%if 0%{?suse_version} >= 1500
|
%if 0%{?suse_version} > 1600
|
||||||
|
Requires: lua-interpreter
|
||||||
|
%elif 0%{?suse_version} >= 1500
|
||||||
# on SLE 12 lua is lua5.2 unconditionally, avoid
|
# on SLE 12 lua is lua5.2 unconditionally, avoid
|
||||||
Requires: lua
|
Requires: lua
|
||||||
%endif
|
%endif
|
||||||
|
Requires: pkgconfig
|
||||||
BuildArch: noarch
|
BuildArch: noarch
|
||||||
|
|
||||||
%description
|
%description
|
||||||
@@ -38,9 +41,6 @@ RPM macros for lua packaging
|
|||||||
|
|
||||||
%prep
|
%prep
|
||||||
cp -p %{SOURCE0} .
|
cp -p %{SOURCE0} .
|
||||||
%if 0%{?rhel} || 0%{?fedora}
|
|
||||||
sed -i -e '/includedir/s!/lua!&-!' macros.lua
|
|
||||||
%endif
|
|
||||||
|
|
||||||
%build
|
%build
|
||||||
:
|
:
|
||||||
|
|||||||
136
macros.lua
136
macros.lua
@@ -1,18 +1,48 @@
|
|||||||
# RPM macros for Lua
|
# RPM macros for Lua
|
||||||
|
|
||||||
# The major.minor version of Lua
|
# The major.minor version of Lua
|
||||||
%lua_version %(lua -e 'print(_VERSION)' | cut -d ' ' -f 2)
|
%lua_version %{lua:
|
||||||
%lua_version_nodots %(lua -e 'print((string.gsub("%{lua_version}", "%.", "")))')
|
local f = io.popen("lua -e 'print(_VERSION)'")
|
||||||
|
local output = f:read("*a")
|
||||||
|
f:close()
|
||||||
|
local ver = output:match("Lua (%d%.%d)")
|
||||||
|
print(ver:gsub("^%s*(.-)%s*$", "%1"))
|
||||||
|
}
|
||||||
|
%lua_version_nodots %{lua:
|
||||||
|
local ver = rpm.expand("%{lua_version}")
|
||||||
|
local nodots = ver:gsub("%.", "")
|
||||||
|
print(nodots:gsub("^%s*(.-)%s*$", "%1"))
|
||||||
|
}
|
||||||
# compiled modules should go here
|
# compiled modules should go here
|
||||||
%lua_archdir %{_libdir}/lua/%{lua_version}
|
%lua_archdir %{lua:
|
||||||
|
local handle = io.popen("pkgconf --variable=INSTALL_CMOD lua 2>/dev/null")
|
||||||
|
local result = handle:read("*a")
|
||||||
|
handle:close()
|
||||||
|
result = result:gsub("^%s*(.-)%s*$", "%1")
|
||||||
|
print(result)
|
||||||
|
}
|
||||||
# pure Lua modules should go here
|
# pure Lua modules should go here
|
||||||
%lua_noarchdir %{_datadir}/lua/%{lua_version}
|
%lua_noarchdir %{lua:
|
||||||
|
local output = ""
|
||||||
|
local f = io.popen("pkgconf --variable=INSTALL_LMOD lua 2>/dev/null")
|
||||||
|
if f ~= nil then
|
||||||
|
output = f:read("*a"):gsub("^%s*(.-)%s*$", "%1")
|
||||||
|
f:close()
|
||||||
|
end
|
||||||
|
if output:len() > 0 then
|
||||||
|
print(output)
|
||||||
|
return
|
||||||
|
end
|
||||||
|
print(rpm.expand("%{_datadir}/lua/%{lua_version}"))
|
||||||
|
}
|
||||||
# lua includes folder
|
# lua includes folder
|
||||||
%lua_incdir %{_includedir}/lua%{lua_version}
|
%lua_incdir %{lua:
|
||||||
|
local handle = io.popen("pkgconf --variable=includedir lua 2>/dev/null")
|
||||||
|
local result = handle:read("*a")
|
||||||
|
handle:close()
|
||||||
|
result = result:gsub("^%s*(.-)%s*$", "%1")
|
||||||
|
print(result)
|
||||||
|
}
|
||||||
%lua_version_default %{lua:
|
%lua_version_default %{lua:
|
||||||
local result = 5.4
|
local result = 5.4
|
||||||
local ver = rpm.expand("%{?suse_version}")
|
local ver = rpm.expand("%{?suse_version}")
|
||||||
@@ -20,45 +50,71 @@ if #ver > 0 then
|
|||||||
ver = tonumber(ver)
|
ver = tonumber(ver)
|
||||||
if ver < 1500 then
|
if ver < 1500 then
|
||||||
result = 5.1
|
result = 5.1
|
||||||
elseif ver == 1500 then
|
elseif ver < 1600 then
|
||||||
result = 5.3
|
result = 5.3
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
print(result)
|
print(result)
|
||||||
}
|
}
|
||||||
%lua_version_default_nodots %(lua -e 'print((string.gsub("%{lua_version_default}", "%.", "")))')
|
# Define a conditional that evaluates true when building for the default Lua version
|
||||||
|
%lua_version_default_nodots %{lua:
|
||||||
%ifluadefault \
|
local ver = rpm.expand("%{lua_version_default}")
|
||||||
%if %{lua_version_nodots} == %{lua_version_default_nodots} \
|
local nodots = ver:gsub("%.", "")
|
||||||
%{nil}
|
print(nodots)
|
||||||
|
}
|
||||||
# Lua default version
|
# Lua default version
|
||||||
# -e: Exclude lua prefix
|
# This REQUIRES macro %{mod_name} to be defined.
|
||||||
# -n: Specify name
|
# Optionally you can define macro `lua_provides_type`, which can
|
||||||
%lua_provides(en:) \
|
# have two different values:
|
||||||
%ifluadefault \
|
# 'exclude-prefix' which excludes lua prefix, or
|
||||||
%if 0%{?-n:1} \
|
# anything else which is used as the provided symbol
|
||||||
Provides: %{-n*} = %{version}-%{release} \
|
%lua_provides %{lua:
|
||||||
Obsoletes: %{-n*} < %{version}-%{release} \
|
local mod_name = rpm.expand("%{?mod_name}")
|
||||||
%else \
|
if mod_name == "" then
|
||||||
%if 0%{?-e:1} \
|
print("-- Error: %{mod_name} is not defined!")
|
||||||
Provides: %{mod_name} = %{version}-%{release} \
|
return
|
||||||
Obsoletes: %{mod_name} < %{version}-%{release} \
|
end
|
||||||
%else \
|
|
||||||
Provides: lua-%{mod_name} = %{version}-%{release} \
|
local current_ver = rpm.expand("%{lua_version_nodots}"):gsub("^%s*(.-)%s*$", "%1")
|
||||||
Obsoletes: lua-%{mod_name} < %{version}-%{release} \
|
local default_ver = rpm.expand("%{lua_version_default_nodots}"):gsub("^%s*(.-)%s*$", "%1")
|
||||||
%endif \
|
|
||||||
%endif \
|
local output = ""
|
||||||
%endif \
|
|
||||||
%{nil}
|
-- Check if we are building for the default Lua version
|
||||||
|
if current_ver == default_ver then
|
||||||
|
|
||||||
|
local package_type = rpm.expand("%{?lua_provides_type}"):gsub("^%s*(.-)%s*$", "%1")
|
||||||
|
local package_name = mod_name
|
||||||
|
|
||||||
|
-- Check for type defined externally (e.g., via --define 'lua_provides_type package-name')
|
||||||
|
if package_type == "exclude-prefix" then
|
||||||
|
-- Use name without "lua-" prefix
|
||||||
|
package_name = mod_name
|
||||||
|
elseif package_type ~= "" then
|
||||||
|
-- Use custom name defined by package_type
|
||||||
|
package_name = package_type
|
||||||
|
else
|
||||||
|
-- Default: Use 'lua-' prefix
|
||||||
|
package_name = "lua-" .. mod_name
|
||||||
|
end
|
||||||
|
|
||||||
|
local version = rpm.expand("%{version}")
|
||||||
|
local release = rpm.expand("%{release}")
|
||||||
|
|
||||||
|
output = "Provides: " .. package_name .. " = " .. version .. "-" .. release .. " Obsoletes: " .. package_name .. " < " .. version .. "-" .. release
|
||||||
|
end
|
||||||
|
|
||||||
|
print(output)
|
||||||
|
}
|
||||||
|
|
||||||
# LuaRocks
|
# LuaRocks
|
||||||
%luarocks_build \
|
%luarocks_build \
|
||||||
luarocks --lua-version "%{lua_version}" \\\
|
luarocks --lua-version "%{lua_version}" make --deps-mode none --pack-binary-rock
|
||||||
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}
|
%luarocks_treedir %{_prefix}/lib/luarocks/rocks-%{lua_version}
|
||||||
|
|
||||||
|
%luarocks_install \
|
||||||
|
/bin/sh -c 'luarocks --lua-version="%{lua_version}" --tree="%{buildroot}%{_prefix}" install --deps-mode=none --no-manifest "$@" && \
|
||||||
|
source_dir="%{buildroot}%{luarocks_treedir}/%{mod_name}/%{rock_version}" && \
|
||||||
|
[ -d "${source_dir}" ] && [ "$(ls -A "${source_dir}" | wc -l)" -gt 0 ] && \
|
||||||
|
mv -v "${source_dir}" __rocktree' --
|
||||||
|
|||||||
Reference in New Issue
Block a user