xmake.lua 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. package("p11-kit")
  2. set_homepage("https://p11-glue.github.io/p11-glue/p11-kit.html")
  3. set_description("Provides a way to load and enumerate PKCS#11 modules.")
  4. set_license("BSD-3-Clause")
  5. add_urls("https://github.com/p11-glue/p11-kit/releases/download/$(version)/p11-kit-$(version).tar.xz",
  6. "https://github.com/p11-glue/p11-kit.git")
  7. add_versions("0.25.10", "a62a137a966fb3a9bbfa670b4422161e369ddea216be51425e3be0ab2096e408")
  8. add_versions("0.25.9", "98a96f6602a70206f8073deb5e894b1c8efd76ef53c629ab88815d58273f2561")
  9. add_versions("0.25.8", "2fd4073ee2a47edafaae2c8affa2bcca64e0697f8881f68f580801ef43cab0ce")
  10. add_versions("0.25.5", "04d0a86450cdb1be018f26af6699857171a188ac6d5b8c90786a60854e1198e5")
  11. if is_plat("mingw") and is_subhost("msys") then
  12. add_extsources("pacman::p11-kit")
  13. elseif is_plat("linux") then
  14. add_extsources("pacman::libp11-kit", "apt::libp11-kit-dev")
  15. elseif is_plat("macosx") then
  16. add_extsources("brew::p11-kit")
  17. end
  18. add_deps("meson", "ninja")
  19. add_deps("libffi", "libtasn1")
  20. add_includedirs("include/p11-kit-1")
  21. on_load(function (package)
  22. if package:is_cross() then
  23. package:add("deps", "libtasn1~host", {host = true, private = true})
  24. else
  25. package:addenv("PATH", "bin")
  26. end
  27. end)
  28. on_install("linux", "mingw", "macosx", "iphoneos", "bsd", "cross", function (package)
  29. local configs = {
  30. "-Dsystemd=disabled",
  31. "-Dbash_completion=disabled",
  32. "-Dman=false",
  33. "-Dnls=false",
  34. "-Dtest=false"
  35. }
  36. table.insert(configs, "-Ddefault_library=" .. (package:config("shared") and "shared" or "static"))
  37. import("package.tools.meson").install(package, configs)
  38. end)
  39. on_test(function (package)
  40. assert(package:check_csnippets({test = [[
  41. void test(CK_FUNCTION_LIST_PTR_PTR modules) {
  42. p11_kit_modules_finalize(modules);
  43. p11_kit_modules_release(modules);
  44. }
  45. ]]}, {includes = "p11-kit/p11-kit.h"}))
  46. end)