xmake.lua 1.4 KB

123456789101112131415161718192021222324252627282930313233
  1. package("libpsl")
  2. set_homepage("https://github.com/rockdaboot/libpsl")
  3. set_description("C library to handle the Public Suffix List")
  4. set_license("MIT")
  5. add_urls("https://github.com/rockdaboot/libpsl/releases/download/$(version)/libpsl-$(version).tar.gz")
  6. add_versions("0.21.1", "ac6ce1e1fbd4d0254c4ddb9d37f1fa99dec83619c1253328155206b896210d4c")
  7. add_deps("meson", "ninja")
  8. if is_plat("windows", "mingw") then
  9. add_syslinks("ws2_32")
  10. end
  11. on_load("windows", function (package)
  12. if not package:config("shared") then
  13. package:add("defines", "PSL_STATIC")
  14. end
  15. end)
  16. on_install("windows", "macosx", "linux", "mingw", function (package)
  17. io.replace("meson.build", "subdir('tests')", "", {plain = true})
  18. io.replace("meson.build", "subdir('fuzz')", "", {plain = true})
  19. if package:is_plat("windows") and not package:config("shared") then
  20. io.replace("tools/meson.build", "'-DHAVE_CONFIG_H'", "'-DHAVE_CONFIG_H','-DPSL_STATIC'", {plain = true})
  21. end
  22. local configs = {"-Druntime=no", "-Dbuiltin=no"}
  23. table.insert(configs, "-Ddefault_library=" .. (package:config("shared") and "shared" or "static"))
  24. import("package.tools.meson").install(package, configs)
  25. end)
  26. on_test(function (package)
  27. assert(package:has_cfuncs("psl_suffix_count", {includes = "libpsl.h"}))
  28. end)