7
0
forked from pool/lua-macros

11 Commits

Author SHA256 Message Date
d36769bee6 Revert "Fake commit for testing"
This reverts commit 1decb6c307.
2025-10-28 12:52:27 +00:00
1decb6c307 Fake commit for testing 2025-10-28 12:17:11 +00:00
eb992adb85 Merge pull request 'Remove unnecessary "build.specials.obscpio" file' (#1) from bundle-fix-broken-build into bundle
Reviewed-on: #1
Reviewed-by: Victor Zhestkov <vizhestkov@noreply.src.opensuse.org>
2025-10-22 10:39:06 +02:00
2578b5f5c6 Remove unnecessary build.specials.obscpio file 2025-10-22 09:04:50 +01:00
4d041efe72 Remove conflictive _scmsync.obsinfo file 2025-10-21 12:37:10 +01:00
8ec966a680 Only build package on debbuild environments 2025-10-21 12:37:10 +01:00
993b85863f Initial package import 2025-10-21 12:37:09 +01:00
56653b8ed9 Initial commit 2025-10-21 12:36:58 +01:00
e0968c8b6d Accepting request 1311191 from devel:languages:lua
- Rework Lua version and path macros using RPM Lua blocks.

- Make %{lua_noarchdir} work even without lua-devel installed.

OBS-URL: https://build.opensuse.org/request/show/1311191
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/lua-macros?expand=0&rev=12
2025-10-15 10:44:28 +00:00
7525e0fc06 Accepting request 1310405 from devel:languages:lua
- Make definition of variables dynamic based on pkgconf output.

OBS-URL: https://build.opensuse.org/request/show/1310405
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/lua-macros?expand=0&rev=11
2025-10-12 20:21:25 +00:00
accd1b4891 Accepting request 1297788 from devel:languages:lua
On Factory BR lua-interpreter.

OBS-URL: https://build.opensuse.org/request/show/1297788
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/lua-macros?expand=0&rev=10
2025-08-06 12:30:49 +00:00
5 changed files with 139 additions and 43 deletions

3
.gitattributes vendored
View File

@@ -1,4 +1,4 @@
## Default LFS
*.changes merge=merge-changes
*.7z filter=lfs diff=lfs merge=lfs -text
*.bsp filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
@@ -12,6 +12,7 @@
*.pdf filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.rpm filter=lfs diff=lfs merge=lfs -text
*.tar filter=lfs diff=lfs merge=lfs -text
*.tbz filter=lfs diff=lfs merge=lfs -text
*.tbz2 filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text

18
Makefile Normal file
View 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

View File

@@ -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>

View File

@@ -27,10 +27,16 @@ License: MIT
Group: Development/Languages/Other
URL: https://www.lua.org
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
Requires: lua
%endif
Requires: pkgconfig
%if "%_vendor" != "debbuild"
ExclusiveArch: do_not_build
%endif
BuildArch: noarch
%description
@@ -38,9 +44,6 @@ RPM macros for lua packaging
%prep
cp -p %{SOURCE0} .
%if 0%{?rhel} || 0%{?fedora}
sed -i -e '/includedir/s!/lua!&-!' macros.lua
%endif
%build
:

View File

@@ -1,18 +1,48 @@
# RPM macros for Lua
# The major.minor version of Lua
%lua_version %(lua -e 'print(_VERSION)' | cut -d ' ' -f 2)
%lua_version_nodots %(lua -e 'print((string.gsub("%{lua_version}", "%.", "")))')
%lua_version %{lua:
local f = io.popen("lua -e 'print(_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
%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
%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_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:
local result = 5.4
local ver = rpm.expand("%{?suse_version}")
@@ -20,45 +50,54 @@ 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 \
/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' --