2
0

xmake.lua 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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. "https://github.com/rockdaboot/libpsl.git")
  7. add_versions("0.21.5", "1dcc9ceae8b128f3c0b3f654decd0e1e891afc6ff81098f227ef260449dae208")
  8. add_versions("0.21.1", "ac6ce1e1fbd4d0254c4ddb9d37f1fa99dec83619c1253328155206b896210d4c")
  9. if is_plat("windows", "mingw") then
  10. add_syslinks("ws2_32")
  11. end
  12. add_deps("meson", "ninja")
  13. on_load("windows", function (package)
  14. if not package:config("shared") then
  15. package:add("defines", "PSL_STATIC")
  16. end
  17. end)
  18. on_install("windows", "macosx", "linux", "mingw", function (package)
  19. local configs = {"-Druntime=no"}
  20. if package:version():ge("0.21.5") then
  21. table.insert(configs, "-Dbuiltin=false")
  22. table.insert(configs, "-Dtests=false")
  23. else
  24. io.replace("meson.build", "subdir('tests')", "", {plain = true})
  25. io.replace("meson.build", "subdir('fuzz')", "", {plain = true})
  26. if package:is_plat("windows") and not package:config("shared") then
  27. io.replace("tools/meson.build", "'-DHAVE_CONFIG_H'", "'-DHAVE_CONFIG_H','-DPSL_STATIC'", {plain = true})
  28. end
  29. table.insert(configs, "-Dbuiltin=no")
  30. end
  31. table.insert(configs, "-Ddefault_library=" .. (package:config("shared") and "shared" or "static"))
  32. import("package.tools.meson").install(package, configs)
  33. end)
  34. on_test(function (package)
  35. assert(package:has_cfuncs("psl_suffix_count", {includes = "libpsl.h"}))
  36. end)