Compare commits
1 Commits
| Author | SHA256 | Date | |
|---|---|---|---|
| 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
|
|
||||||
|
|||||||
18
Makefile
18
Makefile
@@ -1,18 +0,0 @@
|
|||||||
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
|
|
||||||
5
_scmsync.obsinfo
Normal file
5
_scmsync.obsinfo
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
mtime: 1754402745
|
||||||
|
commit: efd19cb701415d2f476cfd403552a97597ea8c2fd08ecd1d651320e2eb45e956
|
||||||
|
url: https://src.opensuse.org/lua/lua-macros.git
|
||||||
|
revision: efd19cb701415d2f476cfd403552a97597ea8c2fd08ecd1d651320e2eb45e956
|
||||||
|
projectscmsync: https://src.opensuse.org/lua/_ObsPrj.git
|
||||||
BIN
build.specials.obscpio
LFS
Normal file
BIN
build.specials.obscpio
LFS
Normal file
Binary file not shown.
@@ -1,15 +0,0 @@
|
|||||||
#!/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,46 +1,3 @@
|
|||||||
-------------------------------------------------------------------
|
|
||||||
Mon Nov 3 00:20:49 UTC 2025 - Matej Cepl <mcepl@cepl.eu>
|
|
||||||
|
|
||||||
- Finally broke %lua_provides to be working. I got stumped by the
|
|
||||||
craziness of rpm which runs Lua interpreter with locales and
|
|
||||||
crazy reformatting of integers.
|
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
|
||||||
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>
|
|
||||||
|
|
||||||
- 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>
|
Tue Aug 5 14:05:41 UTC 2025 - Matej Cepl <mcepl@cepl.eu>
|
||||||
|
|
||||||
|
|||||||
@@ -27,14 +27,12 @@ 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
|
||||||
# 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
|
||||||
@@ -47,11 +45,9 @@ cp -p %{SOURCE0} .
|
|||||||
:
|
:
|
||||||
|
|
||||||
%install
|
%install
|
||||||
install -Dm644 %{SOURCE0} %{buildroot}%{_rpmmacrodir}/macros.lua
|
install -Dm644 macros.lua %{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
|
||||||
|
|||||||
126
macros.lua
126
macros.lua
@@ -1,108 +1,64 @@
|
|||||||
# RPM macros for Lua
|
# RPM macros for Lua
|
||||||
|
|
||||||
# The major.minor version of Lua
|
# The major.minor version of Lua
|
||||||
%lua_version %{lua:
|
%lua_version %(lua -e 'print(_VERSION)' | cut -d ' ' -f 2)
|
||||||
local f = io.popen("lua -e 'print(_VERSION)'")
|
%lua_version_nodots %(lua -e 'print((string.gsub("%{lua_version}", "%.", "")))')
|
||||||
local output = f:read("*a")
|
|
||||||
f:close()
|
|
||||||
local ver = output:match("Lua (%d%.%d)")
|
|
||||||
print(ver)
|
|
||||||
}
|
|
||||||
%lua_version_nodots %{lua:
|
|
||||||
local ver = rpm.expand("%{lua_version}")
|
|
||||||
local nodots = ver:gsub("%.", "")
|
|
||||||
print(nodots)
|
|
||||||
}
|
|
||||||
# compiled modules should go here
|
# compiled modules should go here
|
||||||
%lua_archdir %{lua:
|
%lua_archdir %{_libdir}/lua/%{lua_version}
|
||||||
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 %{lua:
|
%lua_noarchdir %{_datadir}/lua/%{lua_version}
|
||||||
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 %{lua:
|
%lua_incdir %{_includedir}/lua%{lua_version}
|
||||||
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}")
|
||||||
if #ver > 0 then
|
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 < 1600 then
|
elseif ver == 1500 then
|
||||||
result = "5.3"
|
result = 5.3
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
print(result)
|
print(result)
|
||||||
}
|
}
|
||||||
# Define a conditional that evaluates true when building for the default Lua version
|
%lua_version_default_nodots %(lua -e 'print((string.gsub("%{lua_version_default}", "%.", "")))')
|
||||||
%lua_version_default_nodots %{lua:
|
|
||||||
local ver = rpm.expand("%{lua_version_default}")
|
%ifluadefault \
|
||||||
local nodots = ver:gsub("%.", "")
|
%if %{lua_version_nodots} == %{lua_version_default_nodots} \
|
||||||
print(nodots)
|
%{nil}
|
||||||
}
|
|
||||||
# Lua default version
|
# Lua default version
|
||||||
# This REQUIRES macro %%{mod_name} to be defined.
|
|
||||||
# -e: Exclude lua prefix
|
# -e: Exclude lua prefix
|
||||||
# -n: Specify name
|
# -n: Specify name
|
||||||
%lua_provides(en:) %{lua:
|
%lua_provides(en:) \
|
||||||
local mod_name = rpm.expand("%{?mod_name}")
|
%ifluadefault \
|
||||||
if mod_name == "" or mod_name == "%{?mod_name}" then
|
%if 0%{?-n:1} \
|
||||||
print("-- Error: %%{mod_name} is not defined!")
|
Provides: %{-n*} = %{version}-%{release} \
|
||||||
return
|
Obsoletes: %{-n*} < %{version}-%{release} \
|
||||||
end
|
%else \
|
||||||
|
%if 0%{?-e:1} \
|
||||||
local lua_ver_nodots = rpm.expand("%{lua_version_nodots}")
|
Provides: %{mod_name} = %{version}-%{release} \
|
||||||
local lua_ver_default_nodots = rpm.expand("%{lua_version_default_nodots}")
|
Obsoletes: %{mod_name} < %{version}-%{release} \
|
||||||
local flavor = rpm.expand("%{flavor}")
|
%else \
|
||||||
local version = rpm.expand("%{version}")
|
Provides: lua-%{mod_name} = %{version}-%{release} \
|
||||||
local release = rpm.expand("%{release}")
|
Obsoletes: lua-%{mod_name} < %{version}-%{release} \
|
||||||
|
%endif \
|
||||||
local provides_name
|
%endif \
|
||||||
if rpm.expand("%{-n*}") ~= "" then
|
%endif \
|
||||||
provides_name = rpm.expand("%{-n*}")
|
%{nil}
|
||||||
elseif rpm.expand("%{-e:1}") == "1" then
|
|
||||||
provides_name = mod_name
|
|
||||||
else
|
|
||||||
provides_name = "lua-" .. mod_name
|
|
||||||
end
|
|
||||||
|
|
||||||
if lua_ver_nodots == lua_ver_default_nodots then
|
|
||||||
print("Provides: " .. provides_name .. " = " .. version .. "-" .. release .. "\\n")
|
|
||||||
print("Obsoletes: " .. provides_name .. " < " .. version .. "-" .. release .. "\\n")
|
|
||||||
end
|
|
||||||
|
|
||||||
if flavor == "luajit" then
|
|
||||||
print("Obsoletes: lua51-" .. mod_name .. " <= " .. version .. "-" .. release .. "\\n")
|
|
||||||
end
|
|
||||||
}
|
|
||||||
|
|
||||||
# LuaRocks
|
# LuaRocks
|
||||||
%luarocks_build \
|
%luarocks_build \
|
||||||
luarocks --lua-version "%{lua_version}" make --deps-mode none --pack-binary-rock
|
luarocks --lua-version "%{lua_version}" \\\
|
||||||
|
make --pack-binary-rock --deps-mode none
|
||||||
%luarocks_treedir %{_prefix}/lib/luarocks/rocks-%{lua_version}
|
|
||||||
|
|
||||||
%luarocks_install \
|
%luarocks_install \
|
||||||
%{_rpmconfigdir}/install-lua-rock.sh "%{lua_version}" "%{buildroot}%{_prefix}" "%{buildroot}%{luarocks_treedir}/%{mod_name}"
|
luarocks --lua-version="%{lua_version}" --tree="%{buildroot}%{_prefix}" \\\
|
||||||
|
install --deps-mode=none --no-manifest
|
||||||
|
|
||||||
|
%luarocks_treedir %{_prefix}/lib/luarocks/rocks-%{lua_version}
|
||||||
|
|||||||
Reference in New Issue
Block a user