From 70c6a59a1690dd81dfd073ae79752a8529be3285 Mon Sep 17 00:00:00 2001 From: Chunmei Xu Date: Sun, 24 Apr 2022 17:02:58 +0800 Subject: [PATCH] add rule to autoconfig to make sure luaconf.h has defined macros Signed-off-by: Chunmei Xu --- ....patch => 0001-lua-5.4.4-autotoolize.patch | 0 ...oconfig-luaconf.h-to-make-sure-luaco.patch | 120 ++++++++++++++++++ lua.spec | 12 +- 3 files changed, 130 insertions(+), 2 deletions(-) rename lua-5.4.4-autotoolize.patch => 0001-lua-5.4.4-autotoolize.patch (100%) create mode 100644 0002-add-rules-to-autoconfig-luaconf.h-to-make-sure-luaco.patch diff --git a/lua-5.4.4-autotoolize.patch b/0001-lua-5.4.4-autotoolize.patch similarity index 100% rename from lua-5.4.4-autotoolize.patch rename to 0001-lua-5.4.4-autotoolize.patch diff --git a/0002-add-rules-to-autoconfig-luaconf.h-to-make-sure-luaco.patch b/0002-add-rules-to-autoconfig-luaconf.h-to-make-sure-luaco.patch new file mode 100644 index 0000000..4314702 --- /dev/null +++ b/0002-add-rules-to-autoconfig-luaconf.h-to-make-sure-luaco.patch @@ -0,0 +1,120 @@ +From 4affaf91b3744c9d55a66b83efa5bbdc0f6cb8a5 Mon Sep 17 00:00:00 2001 +From: Chunmei Xu +Date: Sun, 24 Apr 2022 17:13:58 +0800 +Subject: [PATCH] add rules to autoconfig luaconf.h to make sure luaconf.h has + defined macros + +refer to https://src.fedoraproject.org/rpms/lua/blob/rawhide/f/lua-5.4.0-beta-autotoolize.patch + +Signed-off-by: Chunmei Xu +--- + configure.ac | 7 ++++--- + src/Makefile.am | 20 +++++++++++++++++++- + src/luaconf.h.template.in | 14 ++++++++++---- + 3 files changed, 33 insertions(+), 8 deletions(-) + +diff --git a/configure.ac b/configure.ac +index f00db66..3400077 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -61,13 +61,13 @@ LUA_BUILD_AS_DLL_DEFS="#undef LUA_BUILD_AS_DLL" + + if test "x$use_os" == "xwin32"; then + LUA_BUILD_AS_DLL_DEFS="#define LUA_BUILD_AS_DLL" ++elif test "x$use_os" == "xmacosx"; then ++ POSIX_DEFS="#define LUA_USE_POSIX" ++ LUA_DL_DEFS="#define LUA_DL_DYLD" + elif test "x$use_os" == "xlinux"; then + POSIX_DEFS="#define LUA_USE_LINUX" + LUA_DL_DEFS="#define LUA_DL_DLOPEN" + LUA_LIBS="$LUA_LIBS -ldl" +-elif test "x$use_os" == "xmacosx"; then +- POSIX_DEFS="#define LUA_USE_POSIX" +- LUA_DL_DEFS="#define LUA_DL_DYLD" + elif test "x$use_os" == "xposix"; then + POSIX_DEFS="#define LUA_USE_POSIX" + LUA_DL_DEFS="#define LUA_DL_DLOPEN" +@@ -82,6 +82,7 @@ AC_SUBST(LUA_LIBS) + AC_CONFIG_FILES([Makefile + src/Makefile + src/lua.pc ++ src/luaconf.h.template + doc/Makefile + ]) + AC_OUTPUT +diff --git a/src/Makefile.am b/src/Makefile.am +index 7c90942..d1d563f 100644 +--- a/src/Makefile.am ++++ b/src/Makefile.am +@@ -1,6 +1,8 @@ + AM_CFLAGS = -Wall + +-include_HEADERS = lua.h lualib.h lauxlib.h lua.hpp luaconf.h ++include_HEADERS = lua.h lualib.h lauxlib.h lua.hpp ++ ++nodist_include_HEADERS = luaconf.h + + lib_LTLIBRARIES = liblua.la + liblua_la_LDFLAGS = -release @MAJOR_VERSION@ +@@ -26,3 +28,19 @@ luac_SOURCES = luac.c + # Statically link liblua against luac since luac uses symbols not exported in liblua + luac_LDADD = .libs/liblua.a @LUA_LIBS@ + luac_DEPENDENCIES = liblua.la ++ ++EXTRA_DIST = luaconf.h.template ++BUILT_SOURCES = luaconf.h ++CLEANFILES = luaconf.h luaconf.h.template ++ ++readline_defs = @READLINE_DEFS@ ++ ++edit = sed \ ++ -e 's,%prefix%,$(prefix),g' \ ++ -e 's,%lua_datadir%,$(datadir),g' \ ++ -e 's,%lua_libdir%,$(libdir),g' ++ ++luaconf.h : luaconf.h.template ++ rm -f $@ $@.tmp ++ $(edit) $< >$@.tmp ++ mv $@.tmp $@ +diff --git a/src/luaconf.h.template.in b/src/luaconf.h.template.in +index d42d14b..67ee30f 100644 +--- a/src/luaconf.h.template.in ++++ b/src/luaconf.h.template.in +@@ -11,6 +11,12 @@ + #include + #include + ++@POSIX_DEFS@ ++@LUA_DL_DEFS@ ++@LUA_BUILD_AS_DLL_DEFS@ ++@READLINE_DEFS@ ++@COMPAT_DEFS@ ++ + + /* + ** =================================================================== +@@ -217,9 +223,9 @@ + + #else /* }{ */ + +-#define LUA_ROOT "/usr/local/" +-#define LUA_LDIR LUA_ROOT "share/lua/" LUA_VDIR "/" +-#define LUA_CDIR LUA_ROOT "lib/lua/" LUA_VDIR "/" ++#define LUA_ROOT "@prefix@/" ++#define LUA_LDIR "@pkgdatadir@/lua/" LUA_VDIR "/" ++#define LUA_CDIR "@libdir@/lua/" LUA_VDIR "/" + + #if !defined(LUA_PATH_DEFAULT) + #define LUA_PATH_DEFAULT \ +@@ -750,7 +756,7 @@ + @@ of a function in debug information. + ** CHANGE it if you want a different size. + */ +-#define LUA_IDSIZE 60 ++#define LUA_IDSIZE 512 + + + /* +-- +2.34.1 + diff --git a/lua.spec b/lua.spec index 85c63c5..a986af7 100644 --- a/lua.spec +++ b/lua.spec @@ -1,4 +1,4 @@ -%define anolis_release 1 +%define anolis_release 2 %global major_version 5.4 # Normally, this is the same as version, but... not always. %global test_version 5.4.4 @@ -19,7 +19,8 @@ Source1: mit.txt Source3: http://www.lua.org/tests/lua-%{test_version}-tests.tar.gz Source4: luaconf.h -Patch0001: lua-5.4.4-autotoolize.patch +Patch0001: 0001-lua-5.4.4-autotoolize.patch +Patch0002: 0002-add-rules-to-autoconfig-luaconf.h-to-make-sure-luaco.patch BuildRequires: automake autoconf libtool readline-devel ncurses-devel BuildRequires: make @@ -64,7 +65,9 @@ This package contains the static version of liblua for %{name}. %prep %setup -q -a 3 cp %{SOURCE1} . +mv src/luaconf.h src/luaconf.h.template.in %patch0001 -p1 +%patch0002 -p1 autoreconf -ifv %build @@ -72,6 +75,8 @@ autoreconf -ifv sed -i 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' libtool sed -i 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' libtool +sed -i 's|@pkgdatadir@|%{_datadir}|g' src/luaconf.h.template + # hack so that only /usr/bin/lua gets linked with readline as it is the # only one which needs this and otherwise we get License troubles %make_build LIBS="-lm -ldl" @@ -124,5 +129,8 @@ install -p -m 644 %{SOURCE4} %{buildroot}%{_includedir}/luaconf.h %{_libdir}/*.a %changelog +* Sun Apr 24 2022 Chunmei Xu - 5.4.4-2 +- add rule to autoconfig to make sure luaconf.h has defined macros + * Wed Mar 9 2022 Liwei Ge - 5.4.4-1 - Init version from upstream v5.4.4 -- Gitee