diff --git a/packages/z/zlmediakit/xmake.lua b/packages/z/zlmediakit/xmake.lua new file mode 100644 index 000000000..fa8079aa0 --- /dev/null +++ b/packages/z/zlmediakit/xmake.lua @@ -0,0 +1,77 @@ +package("zlmediakit") + set_homepage("https://github.com/ZLMediaKit/ZLMediaKit") + set_description("WebRTC/RTSP/RTMP/HTTP/HLS/HTTP-FLV/WebSocket-FLV/HTTP-TS/HTTP-fMP4/WebSocket-TS/WebSocket-fMP4/GB28181/SRT server and client framework based on C++11") + set_license("MIT") + + add_urls("https://github.com/ZLMediaKit/ZLMediaKit.git", + "https://gitee.com/xia-chu/ZLMediaKit.git", {submodules = false}) + add_versions("2023.8.26", "895e93cb6aae82f9fd6f19b0980c28062b6b9d2f") + + add_configs("c_api", {description = "Enable C API SDK.", default = false, type = "boolean"}) + add_configs("c_static_api", {description = "Enable mk_api static lib.", default = false, type = "boolean"}) + + add_configs("cxx_api", {description = "Enable C++ API SDK.", default = true, type = "boolean"}) + add_configs("server_lib", {description = "Enable server as android static library.", default = false, type = "boolean"}) + + add_configs("asan", {description = "Enable Address Sanitize.", default = false, type = "boolean"}) + add_configs("mem_debug", {description = "Enable Memory Debug.", default = false, type = "boolean"}) + + add_configs("jemalloc", {description = "Enable static linking to the jemalloc library.", default = false, type = "boolean"}) + add_configs("ffmpeg", {description = "Enable FFMPEG.", default = false, type = "boolean"}) + add_configs("mysql", {description = "Enable MySQL.", default = false, type = "boolean"}) + add_configs("x264", {description = "Enable libx264.", default = false, type = "boolean"}) + add_configs("faac", {description = "Enable FAAC.", default = false, type = "boolean"}) + + add_deps("cmake") + add_deps("zltoolkit") + + on_install("macosx", "linux", "windows", function (package) + local configdeps = { + c_api = "ENABLE_API", + c_static_api = "ENABLE_API_STATIC_LIB", + cxx_api = "ENABLE_CXX_API", + server_lib = "ENABLE_SERVER_LIB", + asan = "ENABLE_ASAN", + mem_debug = "ENABLE_MEM_DEBUG", + jemalloc = "ENABLE_JEMALLOC_STATIC", + ffmpeg = "ENABLE_FFMPEG", + mysql = "ENABLE_MYSQL", + x264 = "ENABLE_X264", + faac = "ENABLE_FAAC" + } + local configs = {"-DENABLE_TESTS=OFF", "-DUSE_SOLUTION_FOLDERS=OFF", "-DENABLE_SERVER=OFF"} + table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release")) + for name, item in pairs(configdeps) do + table.insert(configs, "-D" .. item .. "=" .. (package:config(name) and "ON" or "OFF")) + end + io.replace("CMakeLists.txt", "add_subdirectory(3rdpart)", "", {plain = true}) + io.replace("srt/CMakeLists.txt", "ZLMediaKit::ToolKit", "", {plain = true}) + import("package.tools.cmake").install(package, configs, {packagedeps = {"zltoolkit"}}) + + if package:config("shared") then + if package:is_plat("windows") then + os.trycp("**.dll", package:installdir("lib")) + os.trycp("**.pdb", package:installdir("lib")) + else + os.trycp("**.so", package:installdir("lib")) + end + else + if package:is_plat("windows") then + os.trycp("**.lib", package:installdir("lib")) + else + os.trycp("**.a", package:installdir("lib")) + end + end + + os.cp("src/**.h", package:installdir("include"), {rootdir = "src"}) + end) + + on_test(function (package) + assert(package:check_cxxsnippets({test = [[ + void test() { + using namespace toolkit; + mINI ini; + ini[".dot"] = "dot-value"; + } + ]]}, {configs = {languages = "c++11"}, includes = {"Common/config.h"}})) + end) diff --git a/packages/z/zltoolkit/xmake.lua b/packages/z/zltoolkit/xmake.lua index 0dfd8738b..78de71237 100644 --- a/packages/z/zltoolkit/xmake.lua +++ b/packages/z/zltoolkit/xmake.lua @@ -3,8 +3,10 @@ package("zltoolkit") set_description("A lightweight network framework based on C++11 that utilizes thread pool technology to achieve high concurrent network I/O.") set_license("MIT") - set_urls("https://github.com/ZLMediaKit/ZLToolKit.git") + set_urls("https://github.com/ZLMediaKit/ZLToolKit.git", + "https://gitee.com/xia-chu/ZLToolKit.git") + add_versions("2023.8.26", "a4b8b5e00aac6251254a513c7759605c0ba35f90") add_versions("2023.7.8", "e4744a0a523817356f2ec995ee5a732264c31629") add_configs("mysql", {description = "Enable mysql support.", default = false, type = "boolean"})