diff --git a/.appveyor.yml b/.appveyor.yml deleted file mode 100644 index 59290a80d73..00000000000 --- a/.appveyor.yml +++ /dev/null @@ -1,58 +0,0 @@ ---- -image: Visual Studio 2019 - -shallow_clone: true - -# set clone depth -clone_depth: 1 - -# environment: -# APPVEYOR_SAVE_CACHE_ON_ERROR: true - -platform: - - x64 - -configuration: - - Release - -matrix: - fast_finish: true - -only_commits: - files: - - src/ - - vc14/ - - .appveyor.yml - - cmake/ - - CMakeLists.txt - -install: - - call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars64.bat" - - cd C:\Tools\vcpkg - - git pull - - .\bootstrap-vcpkg.bat - - .\vcpkg integrate install - - cd %APPVEYOR_BUILD_FOLDER% - -before_build: - - cmd: |- - if not exist build mkdir build - cd build - cmake -DCMAKE_TOOLCHAIN_FILE=C:\Tools\vcpkg\scripts\buildsystems\vcpkg.cmake .. - cmake --build . --config Release - -build: - project: C:\projects\canary\build\canary.sln - verbosity: minimal - parallel: true - -after_build: - - cd %APPVEYOR_BUILD_FOLDER%\build\bin - - 7z a -tzip canary.zip Release\ - -cache: - - C:\projects\canary\build\vcpkg_installed\ - - C:\Users\appveyor\AppData\Local\vcpkg\archives - -artifacts: - - path: \build\bin\canary.zip diff --git a/.github/workflows/analysis-codeql.yml b/.github/workflows/analysis-codeql.yml index dd464b25d73..994b55b4d98 100644 --- a/.github/workflows/analysis-codeql.yml +++ b/.github/workflows/analysis-codeql.yml @@ -38,8 +38,7 @@ jobs: - name: Install Linux Dependencies if: ${{ matrix.language == 'cpp' }} run: > - sudo apt-get update && sudo apt-get install ccache build-essential - libluajit-5.1-dev zip + sudo apt-get update && sudo apt-get install ccache linux-headers-$(uname -r) - name: Switch to gcc-11 if: ${{ matrix.language == 'cpp' }} @@ -60,7 +59,7 @@ jobs: if: ${{ matrix.language == 'cpp' }} uses: lukka/run-vcpkg@v10 with: - vcpkgGitCommitId: 773516ecf6014d89cc69b11bb54605ad4be56694 + vcpkgGitCommitId: 8d41d43e1f7f5933622b02e16430312da649361e - name: Get latest CMake and ninja if: ${{ matrix.language == 'cpp' }} diff --git a/.github/workflows/analysis-reviewdog.yml b/.github/workflows/analysis-reviewdog.yml index 4ae14eb631d..cb7c5d0e8f8 100644 --- a/.github/workflows/analysis-reviewdog.yml +++ b/.github/workflows/analysis-reviewdog.yml @@ -39,7 +39,7 @@ jobs: uses: reviewdog/action-setup@v1 - name: Setup Lua/Luacheck - run: sudo apt-get update && sudo apt-get install -y lua5.1 liblua5.1-0-dev lua-check + run: sudo apt-get update && sudo apt-get install -y libluajit-5.1-dev lua-check - name: luac env: @@ -61,7 +61,7 @@ jobs: uses: reviewdog/action-setup@v1 - name: Setup Lua/Luacheck - run: sudo apt-get update && sudo apt-get install -y lua5.1 liblua5.1-0-dev lua-check + run: sudo apt-get update && sudo apt-get install -y libluajit-5.1-dev lua-check - name: luacheck env: diff --git a/.github/workflows/analysis-sonarcloud.yml b/.github/workflows/analysis-sonarcloud.yml index 26f4858c6b4..17d1cbd5261 100644 --- a/.github/workflows/analysis-sonarcloud.yml +++ b/.github/workflows/analysis-sonarcloud.yml @@ -34,8 +34,7 @@ jobs: - name: Install Linux Dependencies run: > - sudo apt-get update && sudo apt-get install ccache build-essential - libluajit-5.1-dev zip + sudo apt-get update && sudo apt-get install ccache linux-headers-$(uname -r) - name: Switch to gcc-11 run: | @@ -74,7 +73,7 @@ jobs: - name: Restore artifacts, or setup vcpkg (do not install any package) uses: lukka/run-vcpkg@v10 with: - vcpkgGitCommitId: 773516ecf6014d89cc69b11bb54605ad4be56694 + vcpkgGitCommitId: 8d41d43e1f7f5933622b02e16430312da649361e - name: Set up JDK 11 uses: actions/setup-java@v1 diff --git a/.github/workflows/build-ubuntu.yml b/.github/workflows/build-ubuntu.yml index f3153344374..4fc32bf1e12 100644 --- a/.github/workflows/build-ubuntu.yml +++ b/.github/workflows/build-ubuntu.yml @@ -20,13 +20,13 @@ jobs: strategy: fail-fast: false matrix: - os: [ubuntu-18.04, ubuntu-20.04] + os: [ubuntu-20.04, ubuntu-22.04] buildtype: [linux-release, linux-debug] include: - - os: ubuntu-18.04 - triplet: x64-linux - os: ubuntu-20.04 triplet: x64-linux + - os: ubuntu-22.04 + triplet: x64-linux steps: - name: Checkout repository @@ -34,8 +34,7 @@ jobs: - name: Install Linux Dependencies run: > - sudo apt-get update && sudo apt-get install ccache build-essential - libluajit-5.1-dev zip + sudo apt-get update && sudo apt-get install ccache linux-headers-$(uname -r) - name: Switch to gcc-11 run: | @@ -54,7 +53,7 @@ jobs: - name: Restore artifacts and install vcpkg uses: lukka/run-vcpkg@v10 with: - vcpkgGitCommitId: 773516ecf6014d89cc69b11bb54605ad4be56694 + vcpkgGitCommitId: 8d41d43e1f7f5933622b02e16430312da649361e - name: Get latest CMake and ninja uses: lukka/get-cmake@latest diff --git a/.github/workflows/build-windows.yml b/.github/workflows/build-windows.yml index 46c8a24a9e0..f3a6491a17d 100644 --- a/.github/workflows/build-windows.yml +++ b/.github/workflows/build-windows.yml @@ -18,13 +18,9 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - os: [windows-2019, windows-2022] + os: [windows-2022] buildtype: [windows-release, windows-release-asan, windows-debug] include: - - os: windows-2019 - triplet: x64-windows - packages: > - sccache - os: windows-2022 triplet: x64-windows packages: > @@ -50,7 +46,7 @@ jobs: - name: Restore artifacts and install vcpkg uses: lukka/run-vcpkg@v10 with: - vcpkgGitCommitId: 773516ecf6014d89cc69b11bb54605ad4be56694 + vcpkgGitCommitId: 8d41d43e1f7f5933622b02e16430312da649361e - name: Get latest CMake and ninja uses: lukka/get-cmake@latest diff --git a/.github/workflows/tests-lua.yml b/.github/workflows/tests-lua.yml index b7f470a3684..df133aa522c 100644 --- a/.github/workflows/tests-lua.yml +++ b/.github/workflows/tests-lua.yml @@ -20,7 +20,7 @@ jobs: run: sudo apt-get update - name: Setup Lua - run: sudo apt-get install -y lua5.1 liblua5.1-0-dev + run: sudo apt-get install -y libluajit-5.1-dev - name: Check out code. uses: actions/checkout@v1 diff --git a/README.md b/README.md index 13ae7dcd688..da0a28b6985 100644 --- a/README.md +++ b/README.md @@ -13,9 +13,6 @@ [![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=opentibiabr_canary&metric=alert_status)](https://sonarcloud.io/dashboard?id=opentibiabr_canary) ## Builds - -[![Build status](https://ci.appveyor.com/api/projects/status/github/opentibiabr/canary?branch=master&passingText=master%20-%20OK&svg=true)](https://ci.appveyor.com/project/opentibiabr/canary/build/artifacts "Download nightly builds for Windows") - [![Build - Ubuntu](https://github.com/opentibiabr/canary/actions/workflows/build-ubuntu.yml/badge.svg)](https://github.com/opentibiabr/canary/actions/workflows/build-ubuntu.yml) [![Build - Windows](https://github.com/opentibiabr/canary/actions/workflows/build-windows.yml/badge.svg)](https://github.com/opentibiabr/canary/actions/workflows/build-windows.yml) @@ -42,7 +39,7 @@ You are subject to our code of conduct, read at [this link](https://github.com/o ### Getting **Started** * **WARNING: YOU NEED TO UNZIP THE MAP BEFORE START THE SERVER.** -* [Compiling on Windows](https://forums.otserv.com.br/index.php?/forums/topic/169235-windowsvc2019-compilando-sources-canary/), alternatively if you are ****not** going to change anything on the source** you can download the latest compiled version for windows from [nightly builds for Windows](https://ci.appveyor.com/project/opentibiabr/canary/build/artifacts). +* [Compiling on Windows](https://forums.otserv.com.br/index.php?/forums/topic/169235-windowsvc2019-compilando-sources-canary/), alternatively if you are ****not** going to change anything on the source** you can download the latest compiled version for windows from [nightly builds for Windows](https://github.com/opentibiabr/canary/actions/workflows/build-windows.yml?query=branch%3Amain). * Wiki: Compiling ([Ubuntu/Debian](https://github.com/opentibiabr/canary/wiki/Compiling-on-Ubuntu-or-Debian-GNU-Linux), [Windows](https://github.com/opentibiabr/canary/wiki/Compiling-on-Windows-(vcpkg))) ### Issues diff --git a/cmake/FindLua.cmake b/cmake/FindLua.cmake deleted file mode 100644 index 57a48ebca92..00000000000 --- a/cmake/FindLua.cmake +++ /dev/null @@ -1,118 +0,0 @@ -# Locate Lua library -# This module defines -# LUA_EXECUTABLE, if found -# LUA_FOUND, if false, do not try to link to Lua -# LUA_LIBRARIES -# LUA_INCLUDE_DIR, where to find lua.h -# LUA_VERSION_STRING, the version of Lua found (since CMake 2.8.8) -# -# Note that the expected include convention is -# #include "lua.h" -# and not -# #include -# This is because, the lua location is not standardized and may exist -# in locations other than lua/ - -#============================================================================= -# Copyright 2007-2009 Kitware, Inc. -# Modified to support Lua 5.2 by LuaDist 2012 -# -# Distributed under the OSI-approved BSD License (the "License"); -# see accompanying file Copyright.txt for details. -# -# This software is distributed WITHOUT ANY WARRANTY; without even the -# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -# See the License for more information. -#============================================================================= -# (To distribute this file outside of CMake, substitute the full -# License text for the above reference.) -# -# The required version of Lua can be specified using the -# standard syntax, e.g. FIND_PACKAGE(Lua 5.1) -# Otherwise the module will search for any available Lua implementation - -# Always search for non-versioned lua first (recommended) -SET(_POSSIBLE_LUA_INCLUDE include include/lua) -SET(_POSSIBLE_LUA_EXECUTABLE lua) -SET(_POSSIBLE_LUA_LIBRARY lua) - -# Determine possible naming suffixes (there is no standard for this) -IF(Lua_FIND_VERSION_MAJOR AND Lua_FIND_VERSION_MINOR) - SET(_POSSIBLE_SUFFIXES "${Lua_FIND_VERSION_MAJOR}${Lua_FIND_VERSION_MINOR}" "${Lua_FIND_VERSION_MAJOR}.${Lua_FIND_VERSION_MINOR}" "-${Lua_FIND_VERSION_MAJOR}.${Lua_FIND_VERSION_MINOR}") -ELSE(Lua_FIND_VERSION_MAJOR AND Lua_FIND_VERSION_MINOR) - SET(_POSSIBLE_SUFFIXES "52" "5.2" "-5.2" "51" "5.1" "-5.1") -ENDIF(Lua_FIND_VERSION_MAJOR AND Lua_FIND_VERSION_MINOR) - -# Set up possible search names and locations -FOREACH(_SUFFIX ${_POSSIBLE_SUFFIXES}) - LIST(APPEND _POSSIBLE_LUA_INCLUDE "include/lua${_SUFFIX}") - LIST(APPEND _POSSIBLE_LUA_EXECUTABLE "lua${_SUFFIX}") - LIST(APPEND _POSSIBLE_LUA_LIBRARY "lua${_SUFFIX}") -ENDFOREACH(_SUFFIX) - -# Find the lua executable -FIND_PROGRAM(LUA_EXECUTABLE - NAMES ${_POSSIBLE_LUA_EXECUTABLE} -) - -# Find the lua header -FIND_PATH(LUA_INCLUDE_DIR lua.h - HINTS - $ENV{LUA_DIR} - PATH_SUFFIXES ${_POSSIBLE_LUA_INCLUDE} - PATHS - ~/Library/Frameworks - /Library/Frameworks - /usr/local - /usr - /sw # Fink - /opt/local # DarwinPorts - /opt/csw # Blastwave - /opt -) - -# Find the lua library -FIND_LIBRARY(LUA_LIBRARY - NAMES ${_POSSIBLE_LUA_LIBRARY} - HINTS - $ENV{LUA_DIR} - PATH_SUFFIXES lib64 lib - PATHS - ~/Library/Frameworks - /Library/Frameworks - /usr/local - /usr - /sw - /opt/local - /opt/csw - /opt -) - -IF(LUA_LIBRARY) - # include the math library for Unix - IF(UNIX AND NOT APPLE) - FIND_LIBRARY(LUA_MATH_LIBRARY m) - SET( LUA_LIBRARIES "${LUA_LIBRARY};${LUA_MATH_LIBRARY}" CACHE STRING "Lua Libraries") - # For Windows and Mac, don't need to explicitly include the math library - ELSE(UNIX AND NOT APPLE) - SET( LUA_LIBRARIES "${LUA_LIBRARY}" CACHE STRING "Lua Libraries") - ENDIF(UNIX AND NOT APPLE) -ENDIF(LUA_LIBRARY) - -# Determine Lua version -IF(LUA_INCLUDE_DIR AND EXISTS "${LUA_INCLUDE_DIR}/lua.h") - FILE(STRINGS "${LUA_INCLUDE_DIR}/lua.h" lua_version_str REGEX "^#define[ \t]+LUA_RELEASE[ \t]+\"Lua .+\"") - - STRING(REGEX REPLACE "^#define[ \t]+LUA_RELEASE[ \t]+\"Lua ([^\"]+)\".*" "\\1" LUA_VERSION_STRING "${lua_version_str}") - UNSET(lua_version_str) -ENDIF() - -INCLUDE(FindPackageHandleStandardArgs) -# handle the QUIETLY and REQUIRED arguments and set LUA_FOUND to TRUE if -# all listed variables are TRUE -FIND_PACKAGE_HANDLE_STANDARD_ARGS(Lua - REQUIRED_VARS LUA_LIBRARIES LUA_INCLUDE_DIR - VERSION_VAR LUA_VERSION_STRING) - -MARK_AS_ADVANCED(LUA_INCLUDE_DIR LUA_LIBRARIES LUA_LIBRARY LUA_MATH_LIBRARY LUA_EXECUTABLE) - diff --git a/cmake/FindLuaJIT.cmake b/cmake/FindLuaJIT.cmake index 9ae91c25ef0..d5a5c74f82a 100644 --- a/cmake/FindLuaJIT.cmake +++ b/cmake/FindLuaJIT.cmake @@ -1,62 +1,88 @@ -# Locate LuaJIT library -# This module defines -# LUAJIT_FOUND, if false, do not try to link to Lua -# LUA_LIBRARIES -# LUA_INCLUDE_DIR, where to find lua.h -# LUAJIT_VERSION_STRING, the version of Lua found (since CMake 2.8.8) +# Once done these will be defined: +# +# LUAJIT_FOUND +# LUAJIT_INCLUDE_DIRS +# LUAJIT_LIBRARIES +# +# For use in OBS: +# +# LUAJIT_INCLUDE_DIR -## Copied from default CMake FindLua51.cmake +IF(CMAKE_SIZEOF_VOID_P EQUAL 8) + SET(_LIB_SUFFIX 64) +ELSE() + SET(_LIB_SUFFIX 32) +ENDIF() -find_path(LUA_INCLUDE_DIR luajit.h - HINTS - ENV LUA_DIR - PATH_SUFFIXES include/luajit-2.0 include/luajit-2.1 include luajit - PATHS - ~/Library/Frameworks - /Library/Frameworks - /sw # Fink - /opt/local # DarwinPorts - /opt/csw # Blastwave - /opt -) +FIND_PATH(LUAJIT_INCLUDE_DIR + NAMES lua.h lualib.h + HINTS + ENV LuajitPath${_LIB_SUFFIX} + ENV LuajitPath + ENV DepsPath${_LIB_SUFFIX} + ENV DepsPath + ${LuajitPath${_LIB_SUFFIX}} + ${LuajitPath} + ${DepsPath${_LIB_SUFFIX}} + ${DepsPath} + ${_LUAJIT_INCLUDE_DIRS} + PATHS + /usr/include + /usr/local/include + /opt/local/include + /opt/local + /sw/include + ~/Library/Frameworks + /Library/Frameworks + PATH_SUFFIXES + include + luajit + luajit/src + include/luajit + include/luajit/src + luajit-2.0 + include/luajit-2.0 + luajit2.0 + include/luajit2.0 + luajit-2.1 + include/luajit-2.1 + luajit2.1 + include/luajit2.1 + ) -find_library(LUA_LIBRARY - NAMES luajit-5.1 lua51 - HINTS - ENV LUA_DIR - PATH_SUFFIXES lib - PATHS - ~/Library/Frameworks - /Library/Frameworks - /sw - /opt/local - /opt/csw - /opt -) - -if(LUA_LIBRARY) - # include the math library for Unix - if(UNIX AND NOT APPLE) - find_library(LUA_MATH_LIBRARY m) - set( LUA_LIBRARIES "${LUA_LIBRARY};${LUA_MATH_LIBRARY}" CACHE STRING "Lua Libraries") - # For Windows and Mac, don't need to explicitly include the math library - else() - set( LUA_LIBRARIES "${LUA_LIBRARY}" CACHE STRING "Lua Libraries") - endif() -endif() - -if(LUA_INCLUDE_DIR AND EXISTS "${LUA_INCLUDE_DIR}/luajit.h") - file(STRINGS "${LUA_INCLUDE_DIR}/luajit.h" luajit_version_str REGEX "^#define[ \t]+LUAJIT_VERSION[ \t]+\"LuaJIT .+\"") - - string(REGEX REPLACE "^#define[ \t]+LUAJIT_VERSION[ \t]+\"LuaJIT ([^\"]+)\".*" "\\1" LUAJIT_VERSION_STRING "${luajit_version_str}") - unset(luajit_version_str) -endif() +find_library(LUAJIT_LIB + NAMES ${_LUAJIT_LIBRARIES} luajit luajit-51 luajit-5.1 lua51 + HINTS + ENV LuajitPath${_lib_suffix} + ENV LuajitPath + ENV DepsPath${_lib_suffix} + ENV DepsPath + ${LuajitPath${_lib_suffix}} + ${LuajitPath} + ${DepsPath${_lib_suffix}} + ${DepsPath} + ${_LUAJIT_LIBRARY_DIRS} + PATHS + /usr/lib + /usr/local/lib + /opt/local/lib + /opt/local + /sw/lib + ~/Library/Frameworks + /Library/Frameworks + PATH_SUFFIXES + lib${_lib_suffix} lib + libs${_lib_suffix} libs + bin${_lib_suffix} bin + ../lib${_lib_suffix} ../lib + ../libs${_lib_suffix} ../libs + ../bin${_lib_suffix} ../bin) include(FindPackageHandleStandardArgs) -# handle the QUIETLY and REQUIRED arguments and set LUA_FOUND to TRUE if -# all listed variables are TRUE -FIND_PACKAGE_HANDLE_STANDARD_ARGS(LuaJIT - REQUIRED_VARS LUA_LIBRARIES LUA_INCLUDE_DIR - VERSION_VAR LUAJIT_VERSION_STRING) +find_package_handle_standard_args(LuaJIT DEFAULT_MSG LUAJIT_LIB LUAJIT_INCLUDE_DIR) +mark_as_advanced(LUAJIT_INCLUDE_DIR LUAJIT_LIB) -mark_as_advanced(LUA_INCLUDE_DIR LUA_LIBRARIES LUA_LIBRARY LUA_MATH_LIBRARY) +if(LUAJIT_FOUND) + set(LUAJIT_INCLUDE_DIRS ${LUAJIT_INCLUDE_DIR}) + set(LUAJIT_LIBRARIES ${LUAJIT_LIB}) +endif() diff --git a/data/startup/others/bitwise_flags.lua b/data/startup/others/bitwise_flags.lua index c6e6b6c07f1..c4781a728d5 100644 --- a/data/startup/others/bitwise_flags.lua +++ b/data/startup/others/bitwise_flags.lua @@ -16,4 +16,4 @@ function clearFlag(set, flag) return set - flag end return set -end \ No newline at end of file +end diff --git a/docker/server/Dockerfile b/docker/server/Dockerfile index bfb81278498..68a0725e029 100644 --- a/docker/server/Dockerfile +++ b/docker/server/Dockerfile @@ -2,7 +2,7 @@ FROM ubuntu:22.04 AS dependencies RUN apt-get update && apt-get install -y --no-install-recommends cmake git \ - libluajit-5.1-dev unzip build-essential ca-certificates curl zip unzip tar \ + unzip build-essential ca-certificates curl zip unzip tar \ pkg-config ninja-build autoconf automake libtool \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* @@ -34,7 +34,7 @@ COPY config.lua.dist /canary/config.lua WORKDIR /canary RUN apt-get update && apt-get install -y --no-install-recommends \ - libluajit-5.1-dev mariadb-client \ + mariadb-client \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* diff --git a/docker/test-server.sh b/docker/test-server.sh index d68d83cdad2..0f7d8aee84b 100755 --- a/docker/test-server.sh +++ b/docker/test-server.sh @@ -18,7 +18,6 @@ apt-get install -y \ curl \ git \ libapache2-mod-php \ - libluajit-5.1-dev \ php \ php-mysql \ pkg-config \ diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 6d764401666..6e54a384c1c 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -305,7 +305,7 @@ if (MSVC) ${Boost_LIBRARY_DIRS} ${CMAKE_SOURCE_DIR}/src ${MYSQL_INCLUDE_DIR} - ${LUA_INCLUDE_DIR} + ${LUAJIT_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS} ${PUGIXML_INCLUDE_DIR} ${CURL_INCLUDE_DIRS} @@ -318,7 +318,7 @@ if (MSVC) target_link_libraries(${PROJECT_NAME} PRIVATE ${MYSQL_CLIENT_LIBS} - ${LUA_LIBRARIES} + ${LUAJIT_LIBRARIES} ${Boost_LIBRARIES} ${PUGIXML_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} @@ -336,14 +336,14 @@ else() target_include_directories(${PROJECT_NAME} PRIVATE ${CMAKE_SOURCE_DIR}/src - ${LUA_INCLUDE_DIR} + ${LUAJIT_INCLUDE_DIRS} ${Protobuf_INCLUDE_DIRS} ${GMP_INCLUDE_DIRS} ) target_link_libraries(${PROJECT_NAME} PRIVATE - ${LUA_LIBRARIES} + ${LUAJIT_LIBRARIES} ${Protobuf_LIBRARIES} ${GMP_LIBRARIES} Boost::boost diff --git a/vcpkg.json b/vcpkg.json index cb262e036dd..bb8e62e56a7 100644 --- a/vcpkg.json +++ b/vcpkg.json @@ -14,13 +14,10 @@ "jsoncpp", "libzippp", "protobuf", + "luajit", { "name": "libmariadb", "features": [ "mariadbclient" ] }, - { - "name": "luajit", - "platform": "windows" - }, { "name": "gmp", "platform": "linux"