xmake.lua 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. package("http_parser")
  2. set_homepage("https://github.com/nodejs/http-parser")
  3. set_description("Parser for HTTP messages written in C.")
  4. set_license("MIT")
  5. add_urls("https://github.com/nodejs/http-parser/archive/refs/tags/$(version).tar.gz",
  6. "https://github.com/nodejs/http-parser.git")
  7. add_versions("v2.9.4", "467b9e30fd0979ee301065e70f637d525c28193449e1b13fbcb1b1fab3ad224f")
  8. on_install(function (package)
  9. io.writefile("xmake.lua", [[
  10. add_rules("mode.debug", "mode.release")
  11. target("http_parser")
  12. set_kind("$(kind)")
  13. if is_kind("shared") and is_plat("windows") then
  14. local funcs = {"http_body_is_final",
  15. "http_errno_description",
  16. "http_errno_name",
  17. "http_method_str",
  18. "http_parser_execute",
  19. "http_parser_init",
  20. "http_parser_parse_url",
  21. "http_parser_pause",
  22. "http_parser_set_max_header_size",
  23. "http_parser_settings_init",
  24. "http_parser_url_init",
  25. "http_parser_version",
  26. "http_should_keep_alive",
  27. "http_status_str"}
  28. for _, func in ipairs(funcs) do
  29. add_shflags("/export:" .. func)
  30. end
  31. end
  32. add_files("http_parser.c")
  33. add_headerfiles("http_parser.h")
  34. ]])
  35. import("package.tools.xmake").install(package)
  36. end)
  37. on_test(function (package)
  38. assert(package:has_cfuncs("http_parser_version", {includes = "http_parser.h"}))
  39. end)