diff --git a/scripts/Dockerfile b/scripts/Dockerfile index 9232fca..7a2eb7a 100644 --- a/scripts/Dockerfile +++ b/scripts/Dockerfile @@ -7,7 +7,7 @@ ARG SHA="" WORKDIR /subconverter COPY . /subconverter/ RUN set -xe && \ - apk add --no-cache --virtual .build-tools git g++ build-base linux-headers cmake python3 curl unzip p7zip && \ + apk add --no-cache --virtual .build-tools git g++ build-base linux-headers cmake python3 curl unzip p7zip bash && \ apk add --no-cache --virtual .build-deps curl-dev rapidjson-dev pcre2-dev yaml-cpp-dev lua5.4-dev luajit-dev && \ curl -fsSL https://xmake.io/shget.text | bash && \ # git clone https://github.com/ftk/quickjspp --depth=1 && \ diff --git a/scripts/build.alpine.release.sh b/scripts/build.alpine.release.sh index 61dc66f..1eae9d1 100644 --- a/scripts/build.alpine.release.sh +++ b/scripts/build.alpine.release.sh @@ -47,8 +47,8 @@ set -xe ## shellcheck disable=SC2046 #g++ -o base/subconverter $(find CMakeFiles/subconverter.dir/src/ -name "*.o") -static -lpcre2-8 -lyaml-cpp -L/usr/lib64 -lcurl -lmbedtls -lmbedcrypto -lmbedx509 -lz -l:quickjs/libquickjs.a -llibcron -O3 -s -apk add git g++ build-base linux-headers cmake python3 curl unzip p7zip perl -apk add lua5.4-dev luajit-dev zlib-dev curl-dev curl-static +apk add git g++ build-base linux-headers cmake python3 curl unzip p7zip perl pkgconfig +apk add lua5.4-dev luajit-dev zlib-dev curl-dev curl-static mbedtls-dev mbedtls-static curl -fsSL https://xmake.io/shget.text | bash source "$HOME/.xmake/profile" diff --git a/xmake.lua b/xmake.lua index be390d0..776f86a 100644 --- a/xmake.lua +++ b/xmake.lua @@ -7,7 +7,9 @@ option("static") set_description("Build static binary.") option_end() -add_requires("libcurl >=8.4.0", "pcre2", "yaml-cpp", "rapidjson", "toml11") +add_requires("pcre2", "yaml-cpp", "rapidjson", "toml11") +add_requires("libcurl >=8.4.0") +add_requires("xmake::libcurl >=8.4.0", {configs = {shared = not has_config("static"), mbedtls = is_plat("linux"), openssl = false}}) includes("xmake/libcron.lua") includes("xmake/yaml-cpp-static.lua") includes("xmake/quickjspp.lua") @@ -26,7 +28,12 @@ target("subconverter") add_files("src/**.cpp|lib/wrapper.cpp|server/webserver_libevent.cpp|script/script.cpp|generator/template/template_jinja2.cpp") add_includedirs("src") add_includedirs("include") - add_packages("libcurl", "pcre2", "rapidjson", "toml11", "libcron", "quickjspp") + add_packages("pcre2", "rapidjson", "toml11", "libcron", "quickjspp") + if is_plat("macosx") then + add_packages("libcurl") + else + add_packages("xmake::libcurl") + end if has_config("static") then add_packages("yaml-cpp-static") else diff --git a/xmake/libcron.lua b/xmake/libcron.lua index 13144d3..a318b15 100644 --- a/xmake/libcron.lua +++ b/xmake/libcron.lua @@ -4,6 +4,7 @@ package("libcron") set_urls("https://github.com/PerMalmberg/libcron.git") on_install(function (package) local configs = {} + io.replace("CMakeLists.txt", "add_subdirectory(test)", "", {plain = true}) 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")) import("package.tools.cmake").install(package, configs)