forked from pool/lua-macros
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
This commit is contained in:
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,5 +1,5 @@
|
|||||||
mtime: 1760049853
|
mtime: 1760224634
|
||||||
commit: db9766d6bd3427a28de3d6839f6f471ed86e6ae894bd85374497c35a2cc5dcdf
|
commit: 984b4bf4f2aada9069ea10fd24cedbfd7304d1b1bc74d792201a56543a747683
|
||||||
url: https://src.opensuse.org/lua/lua-macros.git
|
url: https://src.opensuse.org/lua/lua-macros.git
|
||||||
revision: db9766d6bd3427a28de3d6839f6f471ed86e6ae894bd85374497c35a2cc5dcdf
|
revision: 984b4bf4f2aada9069ea10fd24cedbfd7304d1b1bc74d792201a56543a747683
|
||||||
projectscmsync: https://src.opensuse.org/lua/_ObsPrj.git
|
projectscmsync: https://src.opensuse.org/lua/_ObsPrj.git
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
version https://git-lfs.github.com/spec/v1
|
version https://git-lfs.github.com/spec/v1
|
||||||
oid sha256:bb8d0d04e489936d74eadfd3bc50ccbaa57586c04545ff9d63b2e07f0f01283a
|
oid sha256:6f0dab0a704216725773db8af2af8e8f5bcdd83271b6ca6bb810062d99a0be44
|
||||||
size 356
|
size 356
|
||||||
|
|||||||
@@ -1,3 +1,13 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
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>
|
Thu Oct 9 22:44:04 UTC 2025 - Matej Cepl <mcepl@cepl.eu>
|
||||||
|
|
||||||
|
|||||||
32
macros.lua
32
macros.lua
@@ -1,14 +1,39 @@
|
|||||||
# 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)
|
||||||
|
}
|
||||||
|
%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 %(pkgconf --variable=INSTALL_CMOD lua)
|
%lua_archdir %(pkgconf --variable=INSTALL_CMOD lua)
|
||||||
|
|
||||||
# pure Lua modules should go here
|
# pure Lua modules should go here
|
||||||
%lua_noarchdir %(pkgconf --variable=INSTALL_LMOD lua)
|
%lua_noarchdir %{lua:
|
||||||
|
local output = ""
|
||||||
|
local f = io.popen("pkgconf --variable=INSTALL_LMOD lua")
|
||||||
|
|
||||||
|
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 %(pkgconf --variable=includedir lua)
|
%lua_incdir %(pkgconf --variable=includedir lua)
|
||||||
@@ -33,6 +58,7 @@ print(result)
|
|||||||
%{nil}
|
%{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_provides(en:) \
|
||||||
|
|||||||
Reference in New Issue
Block a user