100 lines
4.0 KiB
Diff
100 lines
4.0 KiB
Diff
diff -Naur luv-1.45.0-0.orig/cmake/Modules/FindLuaJIT.cmake luv-1.45.0-0/cmake/Modules/FindLuaJIT.cmake
|
|
--- luv-1.45.0-0.orig/cmake/Modules/FindLuaJIT.cmake 2023-07-02 20:42:04.879145563 +0200
|
|
+++ luv-1.45.0-0/cmake/Modules/FindLuaJIT.cmake 2023-07-02 20:47:02.921598475 +0200
|
|
@@ -9,47 +9,54 @@
|
|
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
# See the License for more information.
|
|
#=============================================================================
|
|
-# We use code from the CMake project to detect the Lua version.
|
|
|
|
-# Locate LuaJIT library
|
|
-# This module defines
|
|
-# LUAJIT_FOUND, if false, do not try to link to Lua JIT
|
|
-# LUAJIT_LIBRARIES
|
|
-# LUAJIT_INCLUDE_DIR, where to find lua.h
|
|
-#
|
|
-# Additionally it defines the Lua API/ABI version:
|
|
-# LUA_VERSION_STRING - the version of Lua found
|
|
-# LUA_VERSION_MAJOR - the major version of Lua
|
|
-# LUA_VERSION_MINOR - the minor version of Lua
|
|
-# LUA_VERSION_PATCH - the patch version of Lua
|
|
-
|
|
-FIND_PATH(LUAJIT_INCLUDE_DIR NAMES lua.h PATH_SUFFIXES luajit-2.0 luajit-2.1)
|
|
-FIND_LIBRARY(LUAJIT_LIBRARIES NAMES luajit-5.1 luajit)
|
|
-
|
|
-if (LUAJIT_INCLUDE_DIR AND EXISTS "${LUAJIT_INCLUDE_DIR}/lua.h")
|
|
- # At least 5.[012] have different ways to express the version
|
|
- # so all of them need to be tested. Lua 5.2 defines LUA_VERSION
|
|
- # and LUA_RELEASE as joined by the C preprocessor, so avoid those.
|
|
- file(STRINGS "${LUAJIT_INCLUDE_DIR}/lua.h" lua_version_strings
|
|
- REGEX "^#define[ \t]+LUA_(RELEASE[ \t]+\"Lua [0-9]|VERSION([ \t]+\"Lua [0-9]|_[MR])).*")
|
|
-
|
|
- string(REGEX REPLACE ".*;#define[ \t]+LUA_VERSION_MAJOR[ \t]+\"([0-9])\"[ \t]*;.*" "\\1" LUA_VERSION_MAJOR ";${lua_version_strings};")
|
|
- if (LUA_VERSION_MAJOR MATCHES "^[0-9]+$")
|
|
- string(REGEX REPLACE ".*;#define[ \t]+LUA_VERSION_MINOR[ \t]+\"([0-9])\"[ \t]*;.*" "\\1" LUA_VERSION_MINOR ";${lua_version_strings};")
|
|
- string(REGEX REPLACE ".*;#define[ \t]+LUA_VERSION_RELEASE[ \t]+\"([0-9])\"[ \t]*;.*" "\\1" LUA_VERSION_PATCH ";${lua_version_strings};")
|
|
- set(LUA_VERSION_STRING "${LUA_VERSION_MAJOR}.${LUA_VERSION_MINOR}.${LUA_VERSION_PATCH}")
|
|
- else ()
|
|
- string(REGEX REPLACE ".*;#define[ \t]+LUA_RELEASE[ \t]+\"Lua ([0-9.]+)\"[ \t]*;.*" "\\1" LUA_VERSION_STRING ";${lua_version_strings};")
|
|
- if (NOT LUA_VERSION_STRING MATCHES "^[0-9.]+$")
|
|
- string(REGEX REPLACE ".*;#define[ \t]+LUA_VERSION[ \t]+\"Lua ([0-9.]+)\"[ \t]*;.*" "\\1" LUA_VERSION_STRING ";${lua_version_strings};")
|
|
- endif ()
|
|
- string(REGEX REPLACE "^([0-9]+)\\.[0-9.]*$" "\\1" LUA_VERSION_MAJOR "${LUA_VERSION_STRING}")
|
|
- string(REGEX REPLACE "^[0-9]+\\.([0-9]+)[0-9.]*$" "\\1" LUA_VERSION_MINOR "${LUA_VERSION_STRING}")
|
|
- string(REGEX REPLACE "^[0-9]+\\.[0-9]+\\.([0-9]).*" "\\1" LUA_VERSION_PATCH "${LUA_VERSION_STRING}")
|
|
- endif ()
|
|
+if (UNIX)
|
|
+ find_package(PkgConfig)
|
|
+ if (PKG_CONFIG_FOUND)
|
|
+ pkg_check_modules(_LUAJIT luajit)
|
|
+ endif (PKG_CONFIG_FOUND)
|
|
+endif (UNIX)
|
|
+
|
|
+set(_LUAJIT_ROOT_HINTS
|
|
+ ${RSPAMD_SEARCH_PATH}
|
|
+ ${LUAJIT_ROOT_DIR}
|
|
+ ENV LUAJIT_ROOT_DIR
|
|
+)
|
|
+
|
|
+find_path(LUAJIT_INCLUDE_DIR
|
|
+ NAMES
|
|
+ luajit.h
|
|
+ PATHS
|
|
+ ${_LUAJIT_INCLUDEDIR}
|
|
+ HINTS
|
|
+ ${_LUAJIT_ROOT_HINTS}
|
|
+ PATH_SUFFIXES
|
|
+ luajit-5_1-2.0
|
|
+ luajit-5_2-2.0
|
|
+ luajit-5_3-2.0
|
|
+)
|
|
+
|
|
+find_library(LUAJIT_LIBRARY
|
|
+ NAMES
|
|
+ luajit
|
|
+ luajit-5.1
|
|
+ luajit-5.2
|
|
+ luajit-5.3
|
|
+ HINTS
|
|
+ ${_LUAJIT_ROOT_HINTS}
|
|
+ PATHS
|
|
+ ${_LUAJIT_LIBDIR}
|
|
+)
|
|
+
|
|
+if (LUAJIT_LIBRARY)
|
|
+ set(LUAJIT_LIBRARIES
|
|
+ ${LUAJIT_LIBRARIES}
|
|
+ ${LUAJIT_LIBRARY}
|
|
+ )
|
|
+endif (LUAJIT_LIBRARY)
|
|
|
|
- unset(lua_version_strings)
|
|
-endif()
|
|
+include(FindPackageHandleStandardArgs)
|
|
+find_package_handle_standard_args(LuaJIT DEFAULT_MSG LUAJIT_LIBRARIES LUAJIT_INCLUDE_DIR)
|
|
|
|
-INCLUDE(FindPackageHandleStandardArgs)
|
|
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(LuaJIT DEFAULT_MSG LUAJIT_LIBRARIES LUAJIT_INCLUDE_DIR)
|
|
+# show the LUAJIT_INCLUDE_DIR and LUAJIT_LIBRARIES variables only in the advanced view
|
|
+mark_as_advanced(LUAJIT_INCLUDE_DIR LUAJIT_LIBRARIES)
|