Compare commits
13 Commits
Author | SHA256 | Date | |
---|---|---|---|
d1f0f1035b
|
|||
60b20c88fb
|
|||
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
|
||||
*.zip 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
|
||||
_scmsync.obsinfo
|
||||
_buildconfig-*
|
||||
_buildinfo-*.xml
|
||||
lua-macros-*-build/
|
||||
*.obscpio
|
||||
*.osc
|
||||
_build.*
|
||||
.pbuild
|
||||
|
@@ -1,5 +0,0 @@
|
||||
mtime: 1760224634
|
||||
commit: 984b4bf4f2aada9069ea10fd24cedbfd7304d1b1bc74d792201a56543a747683
|
||||
url: https://src.opensuse.org/lua/lua-macros.git
|
||||
revision: 984b4bf4f2aada9069ea10fd24cedbfd7304d1b1bc74d792201a56543a747683
|
||||
projectscmsync: https://src.opensuse.org/lua/_ObsPrj.git
|
@@ -1,3 +0,0 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:6f0dab0a704216725773db8af2af8e8f5bcdd83271b6ca6bb810062d99a0be44
|
||||
size 356
|
15
install-lua-rock.sh
Executable file
15
install-lua-rock.sh
Executable file
@@ -0,0 +1,15 @@
|
||||
#!/bin/bash
|
||||
set -ex
|
||||
|
||||
# 1. %{lua_version}
|
||||
# 2. %{buildroot}%{_prefix}
|
||||
# 3. %{buildroot}%{luarocks_treedir}/%{mod_name}
|
||||
|
||||
SOURCE_DIR="$3"
|
||||
luarocks --lua-version="$1" --tree="$2" install --deps-mode=none --no-manifest "${*:$#}"
|
||||
|
||||
if [ -d "${SOURCE_DIR}" ] && [ "$(find "${SOURCE_DIR}" -type f | wc -l)" -gt 0 ]
|
||||
then
|
||||
mkdir -p __rocktree
|
||||
mv -v "${SOURCE_DIR}"/*/* __rocktree
|
||||
fi
|
@@ -1,3 +1,24 @@
|
||||
-------------------------------------------------------------------
|
||||
Mon Oct 20 21:30:36 UTC 2025 - Matej Cepl <mcepl@cepl.eu>
|
||||
|
||||
- Rewrite %luarocks_install to use a shell script
|
||||
install-lua-rock.sh, which is packaged as well.
|
||||
|
||||
-------------------------------------------------------------------
|
||||
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>
|
||||
|
||||
|
@@ -27,6 +27,7 @@ License: MIT
|
||||
Group: Development/Languages/Other
|
||||
URL: https://www.lua.org
|
||||
Source0: macros.lua
|
||||
Source1: install-lua-rock.sh
|
||||
%if 0%{?suse_version} > 1600
|
||||
Requires: lua-interpreter
|
||||
%elif 0%{?suse_version} >= 1500
|
||||
@@ -46,9 +47,11 @@ cp -p %{SOURCE0} .
|
||||
:
|
||||
|
||||
%install
|
||||
install -Dm644 macros.lua %{buildroot}%{_rpmmacrodir}/macros.lua
|
||||
install -Dm644 %{SOURCE0} %{buildroot}%{_rpmmacrodir}/macros.lua
|
||||
install -Dm755 %{SOURCE1} %{buildroot}%{_rpmconfigdir}/install-lua-rock.sh
|
||||
|
||||
%files
|
||||
%{_rpmmacrodir}/macros.lua
|
||||
%{_rpmconfigdir}/install-lua-rock.sh
|
||||
|
||||
%changelog
|
||||
|
88
macros.lua
88
macros.lua
@@ -13,31 +13,36 @@ print(ver)
|
||||
local nodots = ver:gsub("%.", "")
|
||||
print(nodots)
|
||||
}
|
||||
|
||||
# compiled modules should go here
|
||||
%lua_archdir %(pkgconf --variable=INSTALL_CMOD lua)
|
||||
|
||||
%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
|
||||
%lua_noarchdir %{lua:
|
||||
local output = ""
|
||||
local f = io.popen("pkgconf --variable=INSTALL_LMOD lua")
|
||||
|
||||
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_incdir %(pkgconf --variable=includedir lua)
|
||||
|
||||
%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:
|
||||
local result = 5.4
|
||||
local ver = rpm.expand("%{?suse_version}")
|
||||
@@ -45,46 +50,51 @@ if #ver > 0 then
|
||||
ver = tonumber(ver)
|
||||
if ver < 1500 then
|
||||
result = 5.1
|
||||
elseif ver == 1500 then
|
||||
elseif ver < 1600 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}
|
||||
|
||||
# Define a conditional that evaluates true when building for the default Lua version
|
||||
%lua_version_default_nodots %{lua:
|
||||
local ver = rpm.expand("%{lua_version_default}")
|
||||
local nodots = ver:gsub("%.", "")
|
||||
print(nodots)
|
||||
}
|
||||
# Lua default version
|
||||
# This REQUIRES macro %{mod_name} to be defined.
|
||||
# -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}
|
||||
%lua_provides(en:) %{lua:
|
||||
local mod_name = rpm.expand("%{?mod_name}")
|
||||
if mod_name == "" then
|
||||
print("-- Error: %{mod_name} is not defined!")
|
||||
return
|
||||
end
|
||||
print([[
|
||||
%if "%{lua_version_nodots}" == "%{lua_version_default_nodots}"
|
||||
%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
|
||||
]])
|
||||
}
|
||||
|
||||
# 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 --lua-version "%{lua_version}" make --deps-mode none --pack-binary-rock
|
||||
|
||||
%luarocks_treedir %{_prefix}/lib/luarocks/rocks-%{lua_version}
|
||||
|
||||
%luarocks_install \
|
||||
%{_rpmconfigdir}/install-lua-rock.sh "%{lua_version}" "%{buildroot}%{_prefix}" "%{buildroot}%{luarocks_treedir}/%{mod_name}"
|
||||
|
Reference in New Issue
Block a user