2
0

xmake.lua 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. package("tidy-html5")
  2. set_homepage("http://www.html-tidy.org")
  3. set_description("The granddaddy of HTML tools, with support for modern standards")
  4. add_urls("https://github.com/htacg/tidy-html5.git")
  5. add_versions("5.9.20", "d08ddc2860aa95ba8e301343a30837f157977cba")
  6. if is_plat("mingw") and is_subhost("msys") then
  7. add_extsources("pacman::tidy")
  8. elseif is_plat("linux") then
  9. add_extsources("pacman::tidy")
  10. end
  11. add_deps("cmake")
  12. on_install(function (package)
  13. io.replace("CMakeLists.txt", "set(name tidy-static)",
  14. "set(name tidy-static)\nif(NOT BUILD_SHARED_LIB)", {plain = true})
  15. io.replace("CMakeLists.txt", "install( FILES ${HFILES} DESTINATION ${INCLUDE_INSTALL_DIR} )",
  16. "endif()\ninstall( FILES ${HFILES} DESTINATION ${INCLUDE_INSTALL_DIR} )", {plain = true})
  17. if package:is_plat("windows") and not package:config("shared") then
  18. package:add("defines", "TIDY_STATIC")
  19. end
  20. local configs = {
  21. "-DBUILD_TAB2SPACE=OFF",
  22. "-DSUPPORT_CONSOLE_APP=OFF",
  23. "-DCMAKE_POLICY_DEFAULT_CMP0057=NEW"
  24. }
  25. table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:is_debug() and "Debug" or "Release"))
  26. table.insert(configs, "-DENABLE_DEBUG_LOG=" .. (package:is_debug() and "ON" or "OFF"))
  27. table.insert(configs, "-DENABLE_ALLOC_DEBUG=" .. (package:is_debug() and "ON" or "OFF"))
  28. table.insert(configs, "-DENABLE_MEMORY_DEBUG=" .. (package:is_debug() and "ON" or "OFF"))
  29. table.insert(configs, "-DBUILD_SHARED_LIB=" .. (package:config("shared") and "ON" or "OFF"))
  30. local opt = {}
  31. if package:is_plat("wasm") then
  32. opt.cxflags = "-DHAS_FUTIME=0"
  33. package:add("defines", "HAS_FUTIME=0")
  34. end
  35. import("package.tools.cmake").install(package, configs, opt)
  36. end)
  37. on_test(function (package)
  38. assert(package:has_cfuncs("tidyCreate", {includes = "tidy.h"}))
  39. end)