xmake.lua 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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.5", "04d0a86450cdb1be018f26af6699857171a188ac6d5b8c90786a60854e1198e5")
  8. if is_plat("mingw") and is_subhost("msys") then
  9. add_extsources("pacman::p11-kit")
  10. elseif is_plat("linux") then
  11. add_extsources("pacman::libp11-kit", "apt::libp11-kit-dev")
  12. elseif is_plat("macosx") then
  13. add_extsources("brew::p11-kit")
  14. end
  15. add_deps("meson", "ninja")
  16. add_deps("libffi", "libtasn1")
  17. on_load(function (package)
  18. if package:is_cross() then
  19. package:add("deps", "libtasn1~host", {host = true, private = true})
  20. else
  21. package:addenv("PATH", "bin")
  22. end
  23. end)
  24. on_install("linux", "mingw", "macosx", "iphoneos", "bsd", "cross", function (package)
  25. local configs = {"-Dsystemd=disabled", "-Dbash_completion=disabled", "-Dtest=false"}
  26. table.insert(configs, "-Ddefault_library=" .. (package:config("shared") and "shared" or "static"))
  27. import("package.tools.meson").install(package, configs)
  28. os.trymv(package:installdir("include", "p11-kit-1", "*"), package:installdir("include"))
  29. end)
  30. on_test(function (package)
  31. assert(package:check_csnippets({test = [[
  32. void test(CK_FUNCTION_LIST_PTR_PTR modules) {
  33. p11_kit_modules_finalize(modules);
  34. p11_kit_modules_release(modules);
  35. }
  36. ]]}, {includes = "p11-kit/p11-kit.h"}))
  37. end)