add trantor (#358)

* add trantor

* update openssl

* fix openssl

* add version check for openssl
pull/359/head
Hoildkv 4 years ago committed by GitHub
parent 7d650ebf29
commit 3fe2cf293d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      packages/c/c-ares/xmake.lua
  2. 7
      packages/j/jsoncpp/xmake.lua
  3. 27
      packages/o/openssl/xmake.lua
  4. 41
      packages/t/trantor/xmake.lua

@ -7,6 +7,10 @@ package("c-ares")
add_versions("1.16.1", "d08312d0ecc3bd48eee0a4cc0d2137c9f194e0a28de2028928c0f6cae85f86ce")
add_versions("1.17.1", "d73dd0f6de824afd407ce10750ea081af47eba52b8a6cb307d220131ad93fc40")
if is_plat("macosx") then
add_syslinks("resolv")
end
on_install("windows", function (package)
local configs = {"-f", "Makefile.msvc"}
local cfg = (package:config("shared") and "dll" or "lib") .. "-" .. (package:config("debug") and "debug" or "release")

@ -10,10 +10,13 @@ package("jsoncpp")
add_deps("cmake")
on_install("linux", "macosx", "android", "iphoneos", "windows", "mingw", "cross", function(package)
local configs = {"-DJSONCPP_WITH_POST_BUILD_UNITTEST=OFF", "-DJSONCPP_WITH_TESTS=OFF"}
local configs = {"-DJSONCPP_WITH_POST_BUILD_UNITTEST=OFF", "-DJSONCPP_WITH_TESTS=OFF", "-DJSONCPP_WITH_EXAMPLE=OFF", "-DBUILD_OBJECT_LIBS=OFF"}
table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
table.insert(configs, "-DBUILD_STATIC_LIBS=" .. (package:config("static") and "ON" or "OFF"))
table.insert(configs, "-DBUILD_STATIC_LIBS=" .. (package:config("shared") and "OFF" or "ON"))
table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
if package:config("pic") ~= false then
table.insert(configs, "-DCMAKE_POSITION_INDEPENDENT_CODE=ON")
end
import("package.tools.cmake").install(package, configs)
end)

@ -6,17 +6,40 @@ package("openssl")
add_urls("https://www.openssl.org/source/openssl-$(version).tar.gz", {alias = "home", excludes = "*/fuzz/*"})
add_urls("https://github.com/openssl/openssl/archive/OpenSSL_$(version).zip",
{alias = "github", version = function (version) return version:gsub("%.", "_") end, excludes = "*/fuzz/*"})
add_versions("home:1.1.1k", "892a0875b9872acd04a9fde79b1f943075d5ea162415de3047c327df33fbaee5")
add_versions("home:1.1.1h", "5c9ca8774bd7b03e5784f26ae9e9e6d749c9da2438545077e6b3d755a06595d9")
add_versions("home:1.1.0l", "74a2f756c64fd7386a29184dc0344f4831192d61dc2481a93a4c5dd727f41148")
add_versions("home:1.0.2u", "ecd0c6ffb493dd06707d38b14bb4d8c2288bb7033735606569d8f90f89669d16")
add_versions("home:1.0.0", "1bbf9afc5a6215121ac094147d0a84178294fe4c3d0a231731038fd3717ba7ca")
add_versions("github:1.1.1k", "255c038f5861616f67b527434475d226f5fe00522fbd21fafd3df32019edd202")
add_versions("github:1.1.1h", "0a976b769bdb26470971a184f5263d0c3256152d5671ed7287cf17acc4698afc")
add_versions("github:1.1.0l", "a305d4af4b442ad61ba3d7e82905d09bfbd80424e132e10df4899d064aa47ce2")
add_versions("github:1.0.2u", "493f8b34574d0cf8598adbdec33c84b8a06f0617787c3710d20827c01291c09c")
add_versions("github:1.0.0", "9b67e5ad1a4234c1170ada75b66321e914da4f3ebaeaef6b28400173aaa6b378")
add_links("ssl", "crypto")
if is_plat("windows") then
add_deps("strawberry-perl", "nasm")
add_links("libssl", "libcrypto")
else
add_links("ssl", "crypto")
end
on_install("windows", function (package)
local args = {"Configure"}
table.insert(args, (package:is_arch("x86") and "VC-WIN32" or "VC-WIN64A"))
table.insert(args, "--prefix=" .. package:installdir())
table.insert(args, "--openssldir=" .. package:installdir("conf"))
os.vrunv("perl", args)
-- temporary workaround, will be removed in future
if xmake.version():ge("2.5.3") then
import("package.tools.nmake").install(package)
else
local envs = import("core.tool.toolchain").load("msvc"):runenvs()
envs.PATH = package:dep("nasm"):installdir("bin") .. path.envsep() .. envs.PATH
import("package.tools.nmake").install(package, {}, {envs = envs})
end
end)
on_install("linux", "macosx", function (package)
os.vrun("./config %s --prefix=\"%s\"", package:debug() and "--debug" or "", package:installdir())

@ -0,0 +1,41 @@
package("trantor")
set_homepage("https://github.com/an-tao/trantor/")
set_description("a non-blocking I/O tcp network lib based on c++14/17")
set_license("BSD-3-Clause")
add_urls("https://github.com/an-tao/trantor/archive/refs/tags/$(version).tar.gz",
"https://github.com/an-tao/trantor.git")
add_versions("v1.3.0", "524589dc9258e1ace3b2f887b835cfbeccab3c5efc4ba94963c59f3528248d9b")
add_deps("cmake")
add_deps("openssl", "c-ares", {optional = true})
if is_plat("windows") or is_plat("mingw") then
add_syslinks("ws2_32")
elseif is_plat("linux") then
add_syslinks("pthread")
end
on_install("windows", "macosx", "linux", "mingw@windows", function (package)
local configs = {}
table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
if package:config("pic") ~= false then
table.insert(configs, "-DCMAKE_POSITION_INDEPENDENT_CODE=ON")
end
import("package.tools.cmake").install(package, configs)
end)
on_test(function (package)
assert(package:check_cxxsnippets({test = [[
#include <thread>
#include <chrono>
using namespace std::chrono_literals;
void test() {
trantor::SerialTaskQueue queue("");
queue.runTaskInQueue([&]() {
for (int i = 0; i < 5; ++i)
std::this_thread::sleep_for(0.1s);
});
queue.waitAllTasksFinished();
}
]]}, {configs = {languages = "c++17"}, includes = "trantor/utils/SerialTaskQueue.h"}))
end)
Loading…
Cancel
Save