From 81f47ed7e88437c375f06aeea7733415cebb4e08 Mon Sep 17 00:00:00 2001 From: Clemens Jonischkeit Date: Fri, 26 Apr 2024 12:09:18 +0200 Subject: [PATCH 1/3] added libtinfo dependency required on aarch64 debian bookworm. While libreadline requires e.g. tputs it does not link against libtinfo itself. --- lua-5.4.6/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/lua-5.4.6/CMakeLists.txt b/lua-5.4.6/CMakeLists.txt index 58cf579..d67dfae 100644 --- a/lua-5.4.6/CMakeLists.txt +++ b/lua-5.4.6/CMakeLists.txt @@ -125,6 +125,7 @@ if(LUA_BUILD_BINARY) if (HAVE_READLINE_READLINE_H) target_compile_definitions(lua PRIVATE "LUA_USE_READLINE") target_link_libraries(lua PUBLIC readline) + target_link_libraries(lua PUBLIC tinfo) endif() list(APPEND TARGETS_TO_INSTALL lua) endif() From 8658373dd9f4b1354b75a7296b448017ed7f1d44 Mon Sep 17 00:00:00 2001 From: Clemens Jonischkeit Date: Sat, 27 Apr 2024 12:21:48 +0200 Subject: [PATCH 2/3] modified check for readline and tinfo - switched from CHECK_INCLUDE_FILE to CHECK_LIBRARY_EXISTS fixes detection issue of readline on archlinux due to missing imports (unknown type FILE) - discovering tinfo using CHECK_LIBRARY_EXISTS the result is used in the discovery of readline as the same error as discussed in walterschell/Lua#32 prevented the detection of readline --- lua-5.4.6/CMakeLists.txt | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/lua-5.4.6/CMakeLists.txt b/lua-5.4.6/CMakeLists.txt index d67dfae..ba4b2ba 100644 --- a/lua-5.4.6/CMakeLists.txt +++ b/lua-5.4.6/CMakeLists.txt @@ -113,8 +113,12 @@ elseif(Win32) endif() if(LUA_BUILD_BINARY) - include(CheckIncludeFile) - CHECK_INCLUDE_FILE("readline/readline.h" HAVE_READLINE_READLINE_H) + include(CheckLibraryExists) + CHECK_LIBRARY_EXISTS(tinfo tputs "" HAVE_LIBRARY_TINFO) + if (HAVE_LIBRARY_TINFO) + SET(CMAKE_REQUIRED_LIBRARIES tinfo) + endif() + CHECK_LIBRARY_EXISTS(readline readline "" HAVE_LIBRARY_READLINE) add_executable(lua "src/lua.c") # Can not use lua_shared because some symbols are not exported @@ -122,10 +126,12 @@ if(LUA_BUILD_BINARY) set_target_properties(lua PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR} ) - if (HAVE_READLINE_READLINE_H) + if (HAVE_LIBRARY_READLINE) target_compile_definitions(lua PRIVATE "LUA_USE_READLINE") target_link_libraries(lua PUBLIC readline) - target_link_libraries(lua PUBLIC tinfo) + if (HAVE_LIBRARY_TINFO) + target_link_libraries(lua PUBLIC tinfo) + endif() endif() list(APPEND TARGETS_TO_INSTALL lua) endif() From dcb562f13e0dbd00728377c024eade121cac48c7 Mon Sep 17 00:00:00 2001 From: Clemens Jonischkeit Date: Sat, 27 Apr 2024 13:03:33 +0200 Subject: [PATCH 3/3] unset CMAKE_REQUIRED_LIBRARIES after use --- lua-5.4.6/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/lua-5.4.6/CMakeLists.txt b/lua-5.4.6/CMakeLists.txt index ba4b2ba..0bc5dfb 100644 --- a/lua-5.4.6/CMakeLists.txt +++ b/lua-5.4.6/CMakeLists.txt @@ -119,6 +119,7 @@ if(LUA_BUILD_BINARY) SET(CMAKE_REQUIRED_LIBRARIES tinfo) endif() CHECK_LIBRARY_EXISTS(readline readline "" HAVE_LIBRARY_READLINE) + SET(CMAKE_REQUIRED_LIBRARIES "") add_executable(lua "src/lua.c") # Can not use lua_shared because some symbols are not exported