6
0

Update the build-with-lua51.patch to work even with LuaJIT, but

make the application of the patch conditional (it probably breaks
with Lua >= 5.2).
This commit is contained in:
2025-10-10 10:29:33 +02:00
parent a675218ee4
commit d7253a6a60
4 changed files with 86 additions and 14 deletions

43
Makefile Normal file
View File

@@ -0,0 +1,43 @@
all:
mkdir -p build && cd build/ \
&& cmake .. \
'-GUnix Makefiles' \
-DCMAKE_INSTALL_PREFIX:PATH=/usr \
-DCMAKE_INSTALL_BINDIR:PATH=bin \
-DCMAKE_INSTALL_SBINDIR:PATH=sbin \
-DCMAKE_INSTALL_LIBEXECDIR:PATH=libexec \
-DCMAKE_INSTALL_SYSCONFDIR:PATH=etc \
-DCMAKE_INSTALL_SHAREDSTATEDIR:PATH=/var/lib \
-DCMAKE_INSTALL_LOCALSTATEDIR:PATH=var \
-DCMAKE_INSTALL_RUNSTATEDIR:PATH=run \
-DCMAKE_INSTALL_LIBDIR:PATH=lib64 \
-DCMAKE_INSTALL_INCLUDEDIR:PATH=include \
-DCMAKE_INSTALL_DATAROOTDIR:PATH=share \
-DCMAKE_INSTALL_DOCDIR:PATH=share/doc/packages/luajit-editorconfig-core-lua \
-DCMAKE_INSTALL_MANDIR:PATH=share/man \
-DCMAKE_INSTALL_INFODIR:PATH=share/info \
-DINCLUDE_INSTALL_DIR:PATH=/usr/include \
-DLIB_INSTALL_DIR:PATH=/usr/lib64 \
-DSYSCONF_INSTALL_DIR:PATH=/etc \
-DSHARE_INSTALL_PREFIX:PATH=/usr/share \
-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_CXX_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_Fortran_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' \
-DLIB_SUFFIX=64 \
-DCMAKE_VERBOSE_MAKEFILE:BOOL=ON \
-DBUILD_SHARED_LIBS:BOOL=ON \
-DBUILD_STATIC_LIBS:BOOL=OFF \
-DCMAKE_COLOR_MAKEFILE:BOOL=OFF \
-DCMAKE_INSTALL_DO_STRIP:BOOL=OFF \
-DCMAKE_MODULES_INSTALL_DIR=/usr/lib64/cmake/luajit-editorconfig-core-lua \
-DCMAKE_POLICY_VERSION_MINIMUM=3.5 \
-DECL_LIBDIR:PATH=$(shell pkgconf --variable=INSTALL_CMOD lua) \
-DLUA_LIBRARY:PATH=$(shell pkgconf --variable=INSTALL_CMOD lua) \
-DLUA_INCLUDE_DIR:PATH=$(shell pkgconf --variable=includedir lua) \
&& make
clean:
rm -rf build CMakeCache.txt

View File

@@ -1,13 +1,23 @@
---
CMakeLists.txt | 2 +-
editorconfig_lua.c | 34 ++++++++++++++++++++++++++++------
2 files changed, 29 insertions(+), 7 deletions(-)
CMakeLists.txt | 6 ++++--
editorconfig_lua.c | 37 +++++++++++++++++++++++++++++++------
2 files changed, 35 insertions(+), 8 deletions(-)
Index: editorconfig-core-lua-0.3.0/CMakeLists.txt
===================================================================
--- editorconfig-core-lua-0.3.0.orig/CMakeLists.txt 2019-10-04 19:06:29.000000000 +0200
+++ editorconfig-core-lua-0.3.0/CMakeLists.txt 2025-10-05 23:46:24.364066893 +0200
@@ -35,7 +35,7 @@
+++ editorconfig-core-lua-0.3.0/CMakeLists.txt 2025-10-10 11:39:03.526268594 +0200
@@ -24,7 +24,8 @@
# POSSIBILITY OF SUCH DAMAGE.
#
-cmake_minimum_required(VERSION 3.0)
+cmake_minimum_required(VERSION 3.10)
+cmake_policy(SET CMP0074 NEW)
project(editorconfig-core-lua VERSION 0.3.0 LANGUAGES C)
@@ -35,7 +36,7 @@
include(GNUInstallDirs)
find_package(EditorConfig REQUIRED)
@@ -16,10 +26,18 @@ Index: editorconfig-core-lua-0.3.0/CMakeLists.txt
find_package(Lua REQUIRED)
set(CMAKE_C_STANDARD 99)
@@ -55,6 +56,7 @@
)
target_link_libraries(editorconfig_lua
${EDITORCONFIG_LIBRARIES}
+ ${LUA_LIBRARIES}
)
# Omit the lib<name>.so prefix from the DSO
set_target_properties(editorconfig_lua PROPERTIES
Index: editorconfig-core-lua-0.3.0/editorconfig_lua.c
===================================================================
--- editorconfig-core-lua-0.3.0.orig/editorconfig_lua.c 2019-10-04 19:06:29.000000000 +0200
+++ editorconfig-core-lua-0.3.0/editorconfig_lua.c 2025-10-05 23:46:58.750059153 +0200
+++ editorconfig-core-lua-0.3.0/editorconfig_lua.c 2025-10-10 11:38:53.210693172 +0200
@@ -6,10 +6,10 @@
* modification, are permitted provided that the following conditions are met:
*
@@ -34,7 +52,7 @@ Index: editorconfig-core-lua-0.3.0/editorconfig_lua.c
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
@@ -36,6 +36,28 @@
@@ -36,6 +36,31 @@
#error "LEC_VERSION is not defined."
#endif
@@ -43,7 +61,7 @@ Index: editorconfig-core-lua-0.3.0/editorconfig_lua.c
+ * Lua 5.1 compatibility functions.
+ * Adapted from Lua 5.2.x source.
+ */
+static void
+void
+luaL_setfuncs(lua_State *L, const luaL_Reg *l, int nup)
+{
+ luaL_checkstack(L, nup, "too many upvalues");
@@ -57,13 +75,16 @@ Index: editorconfig-core-lua-0.3.0/editorconfig_lua.c
+ lua_pop(L, nup);
+}
+
+#ifndef luaL_newlib
+#define luaL_newlib(L, l) (lua_newtable(L), luaL_setfuncs(L, l, 0))
+#endif
+#endif
+
+
/***
* Lua bindings to the EditorConfig C Core library.
* @module editorconfig
@@ -94,7 +116,7 @@
@@ -94,7 +119,7 @@
editorconfig_handle eh;
int name_value_count;
const char *name, *value;
@@ -72,7 +93,7 @@ Index: editorconfig-core-lua-0.3.0/editorconfig_lua.c
eh = open_ec_handle(L);
assert(eh != NULL);
@@ -108,7 +130,7 @@
@@ -108,7 +133,7 @@
lua_pushstring(L, name);
lua_pushstring(L, value);
lua_settable(L, 1);
@@ -81,7 +102,7 @@ Index: editorconfig-core-lua-0.3.0/editorconfig_lua.c
lua_pushstring(L, name);
lua_settable(L, 2);
idx += 1;
@@ -149,4 +171,4 @@
@@ -149,4 +174,4 @@
luaL_newlib(L, editorconfig_reg);
add_version(L);
return 1;

View File

@@ -1,3 +1,10 @@
-------------------------------------------------------------------
Fri Oct 10 08:28:46 UTC 2025 - Matej Cepl <mcepl@cepl.eu>
- Update the build-with-lua51.patch to work even with LuaJIT,
but make the application of the patch conditional (it probably
breaks with Lua >= 5.2).
-------------------------------------------------------------------
Sun Oct 5 21:48:42 UTC 2025 - Matej Cepl <mcepl@cepl.eu>

View File

@@ -16,7 +16,8 @@
#
%define flavor @BUILD_FLAVOR@
# %%define flavor @BUILD_FLAVOR@
%define flavor luajit
%define _name lgi
%define mod_name editorconfig-core-lua
Version: 0.3.0
@@ -26,8 +27,8 @@ License: BSD-2-Clause
Group: Development/Libraries/Other
URL: https://github.com/editorconfig/editorconfig-core-lua
Source: https://github.com/editorconfig/%{mod_name}/archive/v%{version}.tar.gz#/%{mod_name}-%{version}.tar.gz
# PATCH-FIX-UPSTREAM build-with-lua51.patch gh#editorconfig/editorconfig-core-lua!5 mcepl@suse.com
# make package building with Lua 5.1
# PATCH-FIX-OPENSUSE build-with-lua51.patch gh#editorconfig/editorconfig-core-lua!5 mcepl@suse.com
# make package building with Lua 5.1 and LuaJIT
Patch0: build-with-lua51.patch
BuildRequires: %{flavor}-devel
BuildRequires: %{flavor}-luafilesystem