xmake.lua 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. package("mxml")
  2. set_homepage("https://www.msweet.org/mxml/")
  3. set_description("Mini-XML is a tiny XML library that you can use to read and write XML and XML-like data files in your application without requiring large non-standard libraries.")
  4. set_license("Apache-2.0")
  5. add_urls("https://github.com/michaelrsweet/mxml/releases/download/v$(version)/mxml-$(version).zip")
  6. add_urls("https://github.com/michaelrsweet/mxml.git")
  7. add_versions("4.0.4", "01778f753d18df9284d0ffa8eab42beda5adcfc2aba5ab8552a741c42eb3a744")
  8. add_versions("4.0.3", "a6201ad26ff3d14a84bc0027646ee89aeee858f0c9e69c166bb9705ba1eb55e7")
  9. add_versions("4.0.2", "7506c88640ae4bcf9b2f50edc6eb32c47b367df9da3dfa24654456b3b45be3a9")
  10. add_versions("3.3.1", "ca6b05725184866b9e5874329e98be22cbbdc1e733789e08b55b088be207484a")
  11. add_versions("3.3", "fca59b0d7fae2b9165c223cdce68e45dbf41e21e5e53190d8b214218b8353380")
  12. if is_plat("macosx", "linux") then
  13. add_syslinks("pthread")
  14. end
  15. on_install("windows", "macosx", "linux", function (package)
  16. io.gsub("config.h.in", "#undef (.-)\n", "${define %1}\n")
  17. io.writefile("xmake.lua", [[
  18. add_rules("mode.debug", "mode.release")
  19. includes("@builtin/check")
  20. if is_plat("macosx", "linux") then
  21. set_configvar("HAVE_PTHREAD_H", 1)
  22. end
  23. configvar_check_ctypes("HAVE_LONG_LONG_INT", "long long int")
  24. configvar_check_cfuncs("HAVE_SNPRINTF", "snprintf", {includes = "stdio.h"})
  25. configvar_check_cfuncs("HAVE_VASPRINTF", "vasprintf", {includes = "stdio.h", defines = "_GNU_SOURCE"})
  26. configvar_check_cfuncs("HAVE_VSNPRINTF", "vsnprintf", {includes = "stdio.h"})
  27. configvar_check_cfuncs("HAVE_STRDUP", "strdup", {includes = "string.h"})
  28. configvar_check_cfuncs("HAVE_STRLCAT", "strlcat", {includes = "string.h"})
  29. configvar_check_cfuncs("HAVE_STRLCPY", "strlcpy", {includes = "string.h"})
  30. target("mxml")
  31. set_kind("$(kind)")
  32. add_files("mxml-*.c")
  33. add_configfiles("config.h.in")
  34. add_includedirs("$(buildir)")
  35. add_headerfiles("mxml.h")
  36. if is_plat("macosx", "linux") then
  37. add_syslinks("pthread")
  38. end
  39. if is_plat("windows") and is_kind("shared") then
  40. add_rules("utils.symbols.export_all")
  41. end
  42. ]])
  43. import("package.tools.xmake").install(package)
  44. end)
  45. on_test(function (package)
  46. assert(package:has_cfuncs("mxmlLoadFile", {includes = "mxml.h"}))
  47. end)