drogon: fix build with mysql (#2751)

* drogon: fix build with mysql

* mariadb-connector-c: Use trycp instead of ln

* drogon: fix mysql_optionsv check

* drogon: fix compile on gcc13
pull/2769/head
Bai Miao 1 year ago committed by GitHub
parent 91f78377d3
commit c96f6b5f9d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 14
      packages/d/drogon/patches/1.8.0/check.patch
  2. 12
      packages/d/drogon/patches/1.8.2/gcc13.patch
  3. 10
      packages/d/drogon/xmake.lua
  4. 10
      packages/m/mariadb-connector-c/xmake.lua

@ -0,0 +1,14 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index d9dbd66..87c92e6 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -379,8 +379,7 @@ if (BUILD_MYSQL)
if (DROGON_FOUND_MYSQL)
message(STATUS "Ok! We find mariadb!")
- include(CheckLibraryExists)
- check_library_exists(${MYSQL_LIB_NAME} mysql_optionsv "" HAS_MYSQL_OPTIONSV)
+ set(HAS_MYSQL_OPTIONSV TRUE)
if (HAS_MYSQL_OPTIONSV)
message(STATUS "Mariadb support mysql_optionsv")
add_definitions(-DHAS_MYSQL_OPTIONSV)

@ -0,0 +1,12 @@
diff --git a/lib/inc/drogon/RateLimiter.h b/lib/inc/drogon/RateLimiter.h
index 3b8706b..dece795 100644
--- a/lib/inc/drogon/RateLimiter.h
+++ b/lib/inc/drogon/RateLimiter.h
@@ -3,6 +3,7 @@
#include <memory>
#include <chrono>
#include <mutex>
+#include <string>
namespace drogon
{

@ -26,6 +26,8 @@ package("drogon")
add_patches("1.8.0", path.join(os.scriptdir(), "patches", "1.8.0", "redis.patch" ), "cf09beb4f07fd970ef4ad8911eec71ce7c94609ad9fbf1626b5ca8fcd070e09e")
add_patches(">=1.8.0", path.join(os.scriptdir(), "patches", "1.8.0", "resolv.patch"), "e9b6b320c70d17024931be8481f7b6413681216113466b5d6699431bb98d50e2")
add_patches(">=1.8.0", path.join(os.scriptdir(), "patches", "1.8.0", "config.patch"), "67a921899a24c1646be6097943cc2ed8228c40f177493451f011539c6df0ed76")
add_patches(">=1.8.0", path.join(os.scriptdir(), "patches", "1.8.0", "check.patch"), "e4731995bb754f04e1bb813bfe3dfb480a850fbbd5cdb48d5a53b32b4ed8669c")
add_patches(">=1.8.2 <1.8.5", path.join(os.scriptdir(), "patches", "1.8.2", "gcc13.patch"), "d2842a734df52c590ab950414c7a95a1ac1be48f8680f909d0eeba5f36087cb0")
add_configs("c_ares", {description = "Enable async DNS query support.", default = false, type = "boolean"})
add_configs("mysql", {description = "Enable mysql support.", default = false, type = "boolean"})
@ -34,7 +36,7 @@ package("drogon")
add_configs("sqlite3", {description = "Enable sqlite3 support.", default = false, type = "boolean"})
add_deps("cmake")
add_deps("trantor", "jsoncpp", "brotli")
add_deps("trantor", "jsoncpp", "brotli", "zlib")
if is_plat("windows") then
add_syslinks("ws2_32", "rpcrt4", "crypt32", "advapi32", "iphlpapi")
@ -47,7 +49,7 @@ package("drogon")
on_load(function(package)
local configdeps = {c_ares = "c-ares",
mysql = "mysql",
mysql = "mariadb-connector-c",
openssl = "openssl",
postgresql = "postgresql",
sqlite3 = "sqlite3"}
@ -58,13 +60,11 @@ package("drogon")
end
end
if not table.contains(package:get("deps"), "mysql") then
package:add("deps", "zlib")
end
end)
on_install("windows", "macosx", "linux", function (package)
io.replace("cmake/templates/config.h.in", "\"@COMPILATION_FLAGS@@DROGON_CXX_STANDARD@\"", "R\"(@COMPILATION_FLAGS@@DROGON_CXX_STANDARD@)\"", {plain = true})
io.replace("cmake_modules/FindMySQL.cmake", "PATH_SUFFIXES mysql", "PATH_SUFFIXES mysql mariadb", {plain = true})
local configs = {"-DBUILD_EXAMPLES=OFF"}
table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))

@ -65,6 +65,16 @@ package("mariadb-connector-c")
end
end
import("package.tools.cmake").install(package, configs)
if package:is_plat("windows") then
for _, lib in ipairs(os.files(path.join(package:installdir("lib"), "mariadb", "*.lib"))) do
os.trycp(lib, path.join(package:installdir("lib"), path.filename(lib)))
end
else
for _, lib in ipairs(os.files(path.join(package:installdir("lib"), "mariadb", "*.a"))) do
os.trycp(lib, path.join(package:installdir("lib"), path.filename(lib)))
end
end
if package:config("shared") then
os.trycp(path.join(package:installdir("lib"), "mariadb", "*.dll"), package:installdir("bin"))
os.trycp(path.join(package:installdir("lib"), "mariadb", "*.so"), package:installdir("bin"))

Loading…
Cancel
Save