From dd90cad8b5762972fa43a45ce16546ca941f1f1b Mon Sep 17 00:00:00 2001 From: mckaygerhard Date: Sun, 17 Sep 2023 21:18:28 -0400 Subject: [PATCH 1/2] small comand build in fixesd: no new line checks --- builtin/game/chatcommands.lua | 5 ++++- builtin/mainmenu/modmgr.lua | 2 ++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/builtin/game/chatcommands.lua b/builtin/game/chatcommands.lua index 3bd8f2f9c..4b6ceab73 100644 --- a/builtin/game/chatcommands.lua +++ b/builtin/game/chatcommands.lua @@ -7,7 +7,10 @@ core.chatcommands = core.registered_chatcommands -- BACKWARDS COMPATIBILITY core.register_on_chat_message(function(name, message) - if message:sub(1,1) ~= "/" then + if message:find("[\r\n]") then + core.chat_send_player(name, "You cannot use newlines in chat messages.") + return true + elseif message:sub(1,1) ~= "/" then return end diff --git a/builtin/mainmenu/modmgr.lua b/builtin/mainmenu/modmgr.lua index dee048982..aa630ddcb 100644 --- a/builtin/mainmenu/modmgr.lua +++ b/builtin/mainmenu/modmgr.lua @@ -402,6 +402,8 @@ function modmgr.preparemodlist(data) if modpath ~= nil and modpath ~= "" then get_mods(modpath,global_mods) + else + get_mods("/usr/share/games/minetest/mods",global_mods) end for i=1,#global_mods,1 do From 43dea9d6d257270e5f4e709831ae379194018e71 Mon Sep 17 00:00:00 2001 From: mckaygerhard Date: Sun, 17 Sep 2023 21:48:03 -0400 Subject: [PATCH 2/2] fix compilaton and ci/build due luajit module package process * fix CFLAGS/CXXFLAGS from env for pacakgers --- .gitlab-ci.yml | 2 ++ cmake/Modules/FindLuaJIT.cmake | 52 ++++++++++++++++++++++++++++++---- src/CMakeLists.txt | 14 ++++----- 3 files changed, 55 insertions(+), 13 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index e2958bc03..8328080b2 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -151,6 +151,8 @@ build:ubuntu-14.10: - apt-get update -y || true - apt-get -y --force-yes install build-essential git cmake pkg-config cmake-data debhelper lsb-release gettext libbz2-dev libcurl4-gnutls-dev libnl-genl-3-dev libnl-3-dev librtmp-dev libidn11-dev libncurses-dev libfreetype6-dev libglu1-mesa-dev libgmp-dev libirrlicht-dev libjpeg-dev libjsoncpp-dev libleveldb-dev libluajit-5.1-dev liblua5.1-dev libogg-dev libopenal-dev libpng-dev libpq-dev libhiredis-dev libsqlite3-dev libvorbis-dev libx11-dev libxxf86vm-dev libpq-dev libhiredis-dev zlib1g-dev doxygen libxrandr-dev mesa-common-dev x11proto-xf86vidmode-dev +# Zesty most close to stretch + build:ubuntu-17.04: extends: .build_template image: ubuntu:zesty diff --git a/cmake/Modules/FindLuaJIT.cmake b/cmake/Modules/FindLuaJIT.cmake index f62fe8ac0..97b0b7c64 100644 --- a/cmake/Modules/FindLuaJIT.cmake +++ b/cmake/Modules/FindLuaJIT.cmake @@ -6,16 +6,56 @@ # # This module is similar to FindLua51.cmake except that it finds LuaJit instead. -find_package (PkgConfig REQUIRED) -pkg_check_modules (LuaJIT QUIET REQUIRED luajit) -set (LUA_LIBRARY ${LuaJIT_LIBRARIES}) -set (LUA_INCLUDE_DIR ${LuaJIT_INCLUDE_DIRS}) -set (LUA_VERSION_STRING ${LuaJIT_VERSION}) +FIND_PATH(LUA_INCLUDE_DIR luajit.h + HINTS + $ENV{LUA_DIR} + PATH_SUFFIXES include/luajit-2.1 include/luajit-2.0 include/luajit-5_1-2.1 include/luajit-5_1-2.0 include luajit + PATHS + ~/Library/Frameworks + /Library/Frameworks + /sw # Fink + /opt/local # DarwinPorts + /opt/csw # Blastwave + /opt +) + +# Test if running on vcpkg toolchain +if(DEFINED VCPKG_TARGET_TRIPLET AND DEFINED VCPKG_APPLOCAL_DEPS) + # On vcpkg luajit is 'lua51' and normal lua is 'lua' + FIND_LIBRARY(LUA_LIBRARY + NAMES lua51 + HINTS + $ENV{LUA_DIR} + PATH_SUFFIXES lib + ) +else() + FIND_LIBRARY(LUA_LIBRARY + NAMES luajit-5.1 + HINTS + $ENV{LUA_DIR} + PATH_SUFFIXES lib64 lib + PATHS + ~/Library/Frameworks + /Library/Frameworks + /sw + /opt/local + /opt/csw + /opt + ) +endif() + + +IF(LUA_INCLUDE_DIR AND EXISTS "${LUA_INCLUDE_DIR}/luajit.h") + FILE(STRINGS "${LUA_INCLUDE_DIR}/luajit.h" lua_version_str REGEX "^#define[ \t]+LUA_RELEASE[ \t]+\"LuaJIT .+\"") + + STRING(REGEX REPLACE "^#define[ \t]+LUA_RELEASE[ \t]+\"LuaJIT ([^\"]+)\".*" "\\1" LUA_VERSION_STRING "${lua_version_str}") + UNSET(lua_version_str) +ENDIF() INCLUDE(FindPackageHandleStandardArgs) # handle the QUIETLY and REQUIRED arguments and set LUAJIT_FOUND to TRUE if # all listed variables are TRUE -FIND_PACKAGE_HANDLE_STANDARD_ARGS(LuaJit +FIND_PACKAGE_HANDLE_STANDARD_ARGS(LuaJIT REQUIRED_VARS LUA_LIBRARY LUA_INCLUDE_DIR VERSION_VAR LUA_VERSION_STRING) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 1f645cff8..3033b418d 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -174,7 +174,7 @@ option(ENABLE_POSTGRESQL "Enable PostgreSQL backend" TRUE) set(USE_POSTGRESQL FALSE) if(ENABLE_POSTGRESQL) - if(CMAKE_VERSION VERSION_LESS "3.10") + if(CMAKE_VERSION VERSION_LESS "3.20") find_package(PostgreSQL QUIET) # Before CMake 3.20 FindPostgreSQL.cmake always looked for server includes # but we don't need them, so continue anyway if only those are missing. @@ -647,7 +647,7 @@ if(BUILD_CLIENT) target_link_libraries(${PROJECT_NAME} ${CURSES_LIBRARIES}) endif() if (USE_POSTGRESQL) - target_link_libraries(${PROJECT_NAME} ${POSTGRESQL_LIBRARY}) + target_link_libraries(${PROJECT_NAME} ${PostgreSQL_LIBRARIES}) endif() if (USE_LEVELDB) target_link_libraries(${PROJECT_NAME} ${LEVELDB_LIBRARY}) @@ -682,7 +682,7 @@ if(BUILD_SERVER) target_link_libraries(${PROJECT_NAME}server ${CURSES_LIBRARIES}) endif() if (USE_POSTGRESQL) - target_link_libraries(${PROJECT_NAME}server ${POSTGRESQL_LIBRARY}) + target_link_libraries(${PROJECT_NAME}server ${PostgreSQL_LIBRARIES}) endif() if (USE_LEVELDB) target_link_libraries(${PROJECT_NAME}server ${LEVELDB_LIBRARY}) @@ -870,12 +870,12 @@ else() endif() endif(CMAKE_SYSTEM_NAME MATCHES "(Darwin|BSD|DragonFly)") - set(CMAKE_CXX_FLAGS_SEMIDEBUG "-g -O1 -Wall ${WARNING_FLAGS} ${CMAKE_C_FLAGS} ${OTHER_FLAGS}") - set(CMAKE_CXX_FLAGS_DEBUG "-g -O0 -Wall ${WARNING_FLAGS} ${CMAKE_C_FLAGS} ${OTHER_FLAGS}") - set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} ${CMAKE_C_FLAGS} ") + set(CMAKE_CXX_FLAGS_SEMIDEBUG "-g -O1 -Wall ${WARNING_FLAGS} ${CMAKE_CXX_FLAGS} ${OTHER_FLAGS} $ENV{CPPFLAGS}") + set(CMAKE_CXX_FLAGS_DEBUG "-g -O0 -Wall ${WARNING_FLAGS} ${CMAKE_CXX_FLAGS} ${OTHER_FLAGS} $ENV{CPPFLAGS}") + set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} ${CMAKE_C_FLAGS} $ENV{CFLAGS}") set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} ${CMAKE_C_FLAGS} -g") set(CMAKE_C_FLAGS_PROFILE "${CMAKE_C_FLAGS_PROFILE} ${CMAKE_C_FLAGS} -O1 -g") - set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_WITHDEBINFO} ${CMAKE_C_FLAGS} -g") + set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_WITHDEBINFO} ${CMAKE_C_FLAGS} $ENV{CFLAGS} -g") if(USE_GPROF) set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -pg")