From a4a273d64537dfd0d6d624b3f336db6082c4c4b5 Mon Sep 17 00:00:00 2001 From: Tindy X <49061470+tindy2013@users.noreply.github.com> Date: Mon, 11 Dec 2023 04:16:24 +0800 Subject: [PATCH] Fix build scripts --- xmake.lua | 8 ++++---- xmake/curl-static.lua | 13 ++++++++++++- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/xmake.lua b/xmake.lua index d2835aaa6..56f131c18 100644 --- a/xmake.lua +++ b/xmake.lua @@ -15,7 +15,7 @@ includes("xmake/curl-static.lua") add_requires("libcron", {system = false}) add_requires("yaml-cpp-static", {system = false}) add_requires("quickjspp", {system = false}) -if not is_plat("macosx") and has_config("static") then +if not is_plat("macosx") and get_config("static") == true then add_requires("curl-static", {system = false}) else add_requires("libcurl") @@ -33,10 +33,10 @@ target("subconverter") add_includedirs("src") add_includedirs("include") add_packages("pcre2", "rapidjson", "toml11", "libcron", "quickjspp") - if is_plat("macosx") then - add_packages("libcurl") - else + if not is_plat("macosx") and get_config("static") == true then add_packages("curl-static") + else + add_packages("libcurl") end if has_config("static") then add_packages("yaml-cpp-static") diff --git a/xmake/curl-static.lua b/xmake/curl-static.lua index be7a4848d..e76c341f6 100644 --- a/xmake/curl-static.lua +++ b/xmake/curl-static.lua @@ -2,6 +2,17 @@ package("curl-static") add_deps("cmake") add_versions("8.5.0", "7161cb17c01dcff1dc5bf89a18437d9d729f1ecd") set_urls("https://github.com/curl/curl.git") + + if is_plat("macosx", "iphoneos") then + add_frameworks("Security", "CoreFoundation", "SystemConfiguration") + elseif is_plat("linux") then + add_deps("mbedtls") + add_syslinks("pthread") + elseif is_plat("windows", "mingw") then + add_deps("zlib") + add_syslinks("advapi32", "crypt32", "wldap32", "winmm", "ws2_32", "user32", "bcrypt") + end + on_install(function (package) local configs = {} table.insert(configs, "-DCURL_USE_LIBSSH2=OFF") @@ -14,7 +25,7 @@ package("curl-static") table.insert(configs, "-DHTTP_ONLY=ON") table.insert(configs, "-DCURL_USE_LIBSSH2=OFF") table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release")) - table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF")) + table.insert(configs, "-DBUILD_SHARED_LIBS=OFF") import("package.tools.cmake").install(package, configs) end) package_end()