forked from pool/lua-macros
Compare commits
5 Commits
| Author | SHA256 | Date | |
|---|---|---|---|
| 89a02f3b9c | |||
| 1f556cc5a6 | |||
| e0968c8b6d | |||
| 7525e0fc06 | |||
| accd1b4891 |
1
.gitattributes
vendored
1
.gitattributes
vendored
@@ -21,4 +21,3 @@
|
|||||||
*.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,9 +1 @@
|
|||||||
.osc
|
.osc
|
||||||
_scmsync.obsinfo
|
|
||||||
_buildconfig-*
|
|
||||||
_buildinfo-*.xml
|
|
||||||
lua-macros-*-build/
|
|
||||||
*.obscpio
|
|
||||||
*.osc
|
|
||||||
_build.*
|
|
||||||
.pbuild
|
|
||||||
|
|||||||
5
_scmsync.obsinfo
Normal file
5
_scmsync.obsinfo
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
mtime: 1760999899
|
||||||
|
commit: d1f0f1035bb04d30b4b3f2362fd2a8fa757179cdb184b24e5b6d27f1245ff673
|
||||||
|
url: https://src.opensuse.org/lua/lua-macros.git
|
||||||
|
revision: d1f0f1035bb04d30b4b3f2362fd2a8fa757179cdb184b24e5b6d27f1245ff673
|
||||||
|
projectscmsync: https://src.opensuse.org/lua/_ObsPrj.git
|
||||||
3
build.specials.obscpio
Normal file
3
build.specials.obscpio
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:9dabaf8e4bc02c3a8cc74d03d2b6f464921ef2f2f0e0b010379148c1485ac786
|
||||||
|
size 864
|
||||||
@@ -1,3 +1,9 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
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>
|
Tue Oct 14 23:16:09 UTC 2025 - Matej Cepl <mcepl@cepl.eu>
|
||||||
|
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ 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
|
||||||
|
Source1: install-lua-rock.sh
|
||||||
%if 0%{?suse_version} > 1600
|
%if 0%{?suse_version} > 1600
|
||||||
Requires: lua-interpreter
|
Requires: lua-interpreter
|
||||||
%elif 0%{?suse_version} >= 1500
|
%elif 0%{?suse_version} >= 1500
|
||||||
@@ -46,9 +47,11 @@ cp -p %{SOURCE0} .
|
|||||||
:
|
:
|
||||||
|
|
||||||
%install
|
%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
|
%files
|
||||||
%{_rpmmacrodir}/macros.lua
|
%{_rpmmacrodir}/macros.lua
|
||||||
|
%{_rpmconfigdir}/install-lua-rock.sh
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
|||||||
64
macros.lua
64
macros.lua
@@ -6,12 +6,12 @@ local f = io.popen("lua -e 'print(_VERSION)'")
|
|||||||
local output = f:read("*a")
|
local output = f:read("*a")
|
||||||
f:close()
|
f:close()
|
||||||
local ver = output:match("Lua (%d%.%d)")
|
local ver = output:match("Lua (%d%.%d)")
|
||||||
print(ver:gsub("^%s*(.-)%s*$", "%1"))
|
print(ver)
|
||||||
}
|
}
|
||||||
%lua_version_nodots %{lua:
|
%lua_version_nodots %{lua:
|
||||||
local ver = rpm.expand("%{lua_version}")
|
local ver = rpm.expand("%{lua_version}")
|
||||||
local nodots = ver:gsub("%.", "")
|
local nodots = ver:gsub("%.", "")
|
||||||
print(nodots:gsub("^%s*(.-)%s*$", "%1"))
|
print(nodots)
|
||||||
}
|
}
|
||||||
# compiled modules should go here
|
# compiled modules should go here
|
||||||
%lua_archdir %{lua:
|
%lua_archdir %{lua:
|
||||||
@@ -64,47 +64,30 @@ print(result)
|
|||||||
}
|
}
|
||||||
# Lua default version
|
# Lua default version
|
||||||
# This REQUIRES macro %{mod_name} to be defined.
|
# This REQUIRES macro %{mod_name} to be defined.
|
||||||
# Optionally you can define macro `lua_provides_type`, which can
|
# -e: Exclude lua prefix
|
||||||
# have two different values:
|
# -n: Specify name
|
||||||
# 'exclude-prefix' which excludes lua prefix, or
|
%lua_provides(en:) %{lua:
|
||||||
# anything else which is used as the provided symbol
|
|
||||||
%lua_provides %{lua:
|
|
||||||
local mod_name = rpm.expand("%{?mod_name}")
|
local mod_name = rpm.expand("%{?mod_name}")
|
||||||
if mod_name == "" then
|
if mod_name == "" then
|
||||||
print("-- Error: %{mod_name} is not defined!")
|
print("-- Error: %{mod_name} is not defined!")
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
print([[
|
||||||
local current_ver = rpm.expand("%{lua_version_nodots}"):gsub("^%s*(.-)%s*$", "%1")
|
%if "%{lua_version_nodots}" == "%{lua_version_default_nodots}"
|
||||||
local default_ver = rpm.expand("%{lua_version_default_nodots}"):gsub("^%s*(.-)%s*$", "%1")
|
%if 0%{?-n:1}
|
||||||
|
Provides: %{-n*} = %{version}-%{release}
|
||||||
local output = ""
|
Obsoletes: %{-n*} < %{version}-%{release}
|
||||||
|
%else
|
||||||
-- Check if we are building for the default Lua version
|
%if 0%{?-e:1}
|
||||||
if current_ver == default_ver then
|
Provides: %{mod_name} = %{version}-%{release}
|
||||||
|
Obsoletes: %{mod_name} < %{version}-%{release}
|
||||||
local package_type = rpm.expand("%{?lua_provides_type}"):gsub("^%s*(.-)%s*$", "%1")
|
%else
|
||||||
local package_name = mod_name
|
Provides: lua-%{mod_name} = %{version}-%{release}
|
||||||
|
Obsoletes: lua-%{mod_name} < %{version}-%{release}
|
||||||
-- Check for type defined externally (e.g., via --define 'lua_provides_type package-name')
|
%endif
|
||||||
if package_type == "exclude-prefix" then
|
%endif
|
||||||
-- Use name without "lua-" prefix
|
%endif
|
||||||
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
|
||||||
@@ -114,7 +97,4 @@ luarocks --lua-version "%{lua_version}" make --deps-mode none --pack-binary-rock
|
|||||||
%luarocks_treedir %{_prefix}/lib/luarocks/rocks-%{lua_version}
|
%luarocks_treedir %{_prefix}/lib/luarocks/rocks-%{lua_version}
|
||||||
|
|
||||||
%luarocks_install \
|
%luarocks_install \
|
||||||
/bin/sh -c 'luarocks --lua-version="%{lua_version}" --tree="%{buildroot}%{_prefix}" install --deps-mode=none --no-manifest "$@" && \
|
%{_rpmconfigdir}/install-lua-rock.sh "%{lua_version}" "%{buildroot}%{_prefix}" "%{buildroot}%{luarocks_treedir}/%{mod_name}"
|
||||||
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