add kcp and http-parser (#153)

* add kcp and http-parser

* kcp http-parser shared/static configuration
pull/155/head
yecate 4 years ago committed by GitHub
parent df021d734a
commit d0e262d93c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 46
      packages/h/http_parser/xmake.lua
  2. 53
      packages/k/kcp/xmake.lua

@ -0,0 +1,46 @@
package("http_parser")
set_homepage("https://github.com/nodejs/http-parser")
set_description("Parser for HTTP messages written in C.")
add_urls("https://github.com/nodejs/http-parser/archive/$(version).tar.gz",
"https://github.com/nodejs/http-parser.git")
add_versions("v2.9.4", "467b9e30fd0979ee301065e70f637d525c28193449e1b13fbcb1b1fab3ad224f")
on_install(function (package)
io.writefile("xmake.lua", [[
add_rules("mode.debug", "mode.release")
target("http_parser")
set_kind("$(kind)")
if is_kind("shared") and is_plat("windows") then
local funcs = {"http_body_is_final",
"http_errno_description",
"http_errno_name",
"http_method_str",
"http_parser_execute",
"http_parser_init",
"http_parser_parse_url",
"http_parser_pause",
"http_parser_set_max_header_size",
"http_parser_settings_init",
"http_parser_url_init",
"http_parser_version",
"http_should_keep_alive",
"http_status_str"}
for _, func in ipairs(funcs) do
add_shflags("/export:" .. func)
end
end
add_files("http_parser.c")
add_headerfiles("http_parser.h")
]])
local configs = {}
if package:config("shared") then
configs.kind = "shared"
end
import("package.tools.xmake").install(package, configs)
end)
on_test(function (package)
assert(package:has_cfuncs("http_parser_version", {includes = "http_parser.h"}))
end)

@ -0,0 +1,53 @@
package("kcp")
set_homepage("https://github.com/skywind3000/kcp")
set_description("A Fast and Reliable ARQ Protocol.")
add_urls("https://github.com/skywind3000/kcp/archive/$(version).tar.gz",
"https://github.com/skywind3000/kcp.git")
add_versions("1.7", "b4d26994d95599ab0c44e1f93002f9fda275094a879d66c192d79d596529199e")
on_install(function (package)
io.writefile("xmake.lua", [[
add_rules("mode.debug", "mode.release")
target("kcp")
set_kind("$(kind)")
if is_kind("shared") and is_plat("windows") then
local funcs = {"ikcp_allocator",
"ikcp_check",
"ikcp_create",
"ikcp_flush",
"ikcp_getconv",
"ikcp_input",
"ikcp_interval",
"ikcp_log",
"ikcp_nodelay",
"ikcp_parse_data",
"ikcp_peeksize",
"ikcp_qprint",
"ikcp_recv",
"ikcp_release",
"ikcp_send",
"ikcp_setmtu",
"ikcp_setoutput",
"ikcp_update",
"ikcp_waitsnd",
"ikcp_wndsize"}
for _, func in ipairs(funcs) do
add_shflags("/export:" .. func)
end
end
add_files("ikcp.c")
add_headerfiles("ikcp.h")
]])
local configs = {}
if package:config("shared") then
configs.kind = "shared"
end
import("package.tools.xmake").install(package, configs)
end)
on_test(function (package)
assert(package:has_cfuncs("ikcp_create", {includes = "ikcp.h"}))
end)
Loading…
Cancel
Save