xmake.lua 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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/v3.3/mxml-3.3.zip")
  6. add_versions("3.3", "fca59b0d7fae2b9165c223cdce68e45dbf41e21e5e53190d8b214218b8353380")
  7. if is_plat("macosx", "linux") then
  8. add_syslinks("pthread")
  9. end
  10. on_install("windows", "macosx", "linux", function (package)
  11. io.gsub("config.h.in", "#undef (.-)\n", "${define %1}\n")
  12. io.writefile("xmake.lua", [[
  13. add_rules("mode.debug", "mode.release")
  14. includes("check_cfuncs.lua")
  15. includes("check_ctypes.lua")
  16. if is_plat("macosx", "linux") then
  17. set_configvar("HAVE_PTHREAD_H", 1)
  18. end
  19. configvar_check_ctypes("HAVE_LONG_LONG_INT", "long long int")
  20. configvar_check_cfuncs("HAVE_SNPRINTF", "snprintf", {includes = "stdio.h"})
  21. configvar_check_cfuncs("HAVE_VASPRINTF", "vasprintf", {includes = "stdio.h", defines = "_GNU_SOURCE"})
  22. configvar_check_cfuncs("HAVE_VSNPRINTF", "vsnprintf", {includes = "stdio.h"})
  23. configvar_check_cfuncs("HAVE_STRDUP", "strdup", {includes = "string.h"})
  24. configvar_check_cfuncs("HAVE_STRLCAT", "strlcat", {includes = "string.h"})
  25. configvar_check_cfuncs("HAVE_STRLCPY", "strlcpy", {includes = "string.h"})
  26. target("mxml")
  27. set_kind("$(kind)")
  28. add_files("mxml-*.c")
  29. add_configfiles("config.h.in")
  30. add_includedirs("$(buildir)")
  31. add_headerfiles("mxml.h")
  32. if is_plat("macosx", "linux") then
  33. add_syslinks("pthread")
  34. end
  35. ]])
  36. import("package.tools.xmake").install(package)
  37. end)
  38. on_test(function (package)
  39. assert(package:has_cfuncs("mxmlLoadFile", {includes = "mxml.h"}))
  40. end)