Explorar o código

add kcp and http-parser (#153)

* add kcp and http-parser

* kcp http-parser shared/static configuration
yecate %!s(int64=4) %!d(string=hai) anos
pai
achega
d0e262d93c
Modificáronse 2 ficheiros con 99 adicións e 0 borrados
  1. 46 0
      packages/h/http_parser/xmake.lua
  2. 53 0
      packages/k/kcp/xmake.lua

+ 46 - 0
packages/h/http_parser/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)

+ 53 - 0
packages/k/kcp/xmake.lua

@@ -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)