diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..3f66718 --- /dev/null +++ b/Makefile @@ -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 diff --git a/_scmsync.obsinfo b/_scmsync.obsinfo index c731877..babf2a9 100644 --- a/_scmsync.obsinfo +++ b/_scmsync.obsinfo @@ -1,5 +1,5 @@ -mtime: 1760049853 -commit: db9766d6bd3427a28de3d6839f6f471ed86e6ae894bd85374497c35a2cc5dcdf +mtime: 1760224634 +commit: 984b4bf4f2aada9069ea10fd24cedbfd7304d1b1bc74d792201a56543a747683 url: https://src.opensuse.org/lua/lua-macros.git -revision: db9766d6bd3427a28de3d6839f6f471ed86e6ae894bd85374497c35a2cc5dcdf +revision: 984b4bf4f2aada9069ea10fd24cedbfd7304d1b1bc74d792201a56543a747683 projectscmsync: https://src.opensuse.org/lua/_ObsPrj.git diff --git a/build.specials.obscpio b/build.specials.obscpio index a8b7da5..9da2391 100644 --- a/build.specials.obscpio +++ b/build.specials.obscpio @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:bb8d0d04e489936d74eadfd3bc50ccbaa57586c04545ff9d63b2e07f0f01283a +oid sha256:6f0dab0a704216725773db8af2af8e8f5bcdd83271b6ca6bb810062d99a0be44 size 356 diff --git a/lua-macros.changes b/lua-macros.changes index 7283f75..d716e8c 100644 --- a/lua-macros.changes +++ b/lua-macros.changes @@ -1,3 +1,13 @@ +------------------------------------------------------------------- +Sat Oct 11 16:45:06 UTC 2025 - Matej Cepl + +- Rework Lua version and path macros using RPM Lua blocks. + +------------------------------------------------------------------- +Fri Oct 10 10:56:01 UTC 2025 - Matej Cepl + +- Make %{lua_noarchdir} work even without lua-devel installed. + ------------------------------------------------------------------- Thu Oct 9 22:44:04 UTC 2025 - Matej Cepl diff --git a/macros.lua b/macros.lua index 5c23f1f..cdaff75 100644 --- a/macros.lua +++ b/macros.lua @@ -1,14 +1,39 @@ # 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 %(pkgconf --variable=INSTALL_CMOD lua) # 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_incdir %(pkgconf --variable=includedir lua) @@ -33,6 +58,7 @@ print(result) %{nil} # Lua default version +# This REQUIRES macro %{mod_name} to be defined. # -e: Exclude lua prefix # -n: Specify name %lua_provides(en:) \