xmake.lua 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. package("aws-lc")
  2. set_homepage("https://github.com/aws/aws-lc")
  3. set_description("AWS-LC is a general-purpose cryptographic library maintained by the AWS Cryptography team for AWS and their customers. It іs based on code from the Google BoringSSL project and the OpenSSL project.")
  4. add_urls("https://github.com/aws/aws-lc/archive/refs/tags/$(version).tar.gz",
  5. "https://github.com/aws/aws-lc.git")
  6. add_versions("v1.34.2", "4958ac76edd53ced46d3a064cb58be8bd11e4937bcc3857623d319c2894d0904")
  7. add_versions("v1.32.0", "67fbb78659055c2289c9068bb4ca1c0f1b6ca27700c7f6d34c6bc2f27cd46314")
  8. add_configs("jitter", {description = "Enable FIPS entropy source: CPU Jitter", default = false, type = "boolean"})
  9. add_configs("go", {description = "Enable go", default = false, type = "boolean"})
  10. add_configs("perl", {description = "Enable perl", default = false, type = "boolean"})
  11. add_configs("tools", {description = "Build tools", default = false, type = "boolean"})
  12. add_deps("cmake")
  13. if is_plat("windows", "mingw") or is_host("windows") then
  14. add_deps("nasm")
  15. end
  16. add_links("ssl", "crypto")
  17. if is_plat("windows", "mingw") then
  18. add_syslinks("ws2_32")
  19. elseif is_plat("linux", "bsd") then
  20. add_syslinks("pthread", "dl", "m")
  21. end
  22. on_load(function (package)
  23. if package:config("go") then
  24. package:add("deps", "go")
  25. end
  26. if package:config("perl") and package:is_plat() and (not package:is_precompiled()) then
  27. package:add("deps", "strawberry-perl")
  28. end
  29. end)
  30. on_install("!cross and windows|!arm64", function (package)
  31. if package:config("shared") and package:is_plat("windows") then
  32. package:add("defines", "BORINGSSL_SHARED_LIBRARY")
  33. end
  34. local configs = {
  35. "-DBUILD_TESTING=OFF",
  36. "-DCMAKE_INSTALL_INCLUDEDIR=include",
  37. "-DBUILD_LIBSSL=ON",
  38. }
  39. table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:is_debug() and "Debug" or "Release"))
  40. table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
  41. table.insert(configs, "-DENABLE_FIPS_ENTROPY_CPU_JITTER=" .. (package:config("jitter") and "ON" or "OFF"))
  42. table.insert(configs, "-DDISABLE_GO=" .. (package:config("go") and "OFF" or "ON"))
  43. table.insert(configs, "-DDISABLE_PERL=" .. (package:config("perl") and "OFF" or "ON"))
  44. table.insert(configs, "-DBUILD_TOOL=" .. (package:config("tools") and "ON" or "OFF"))
  45. import("package.tools.cmake").install(package, configs)
  46. end)
  47. on_test(function (package)
  48. assert(package:has_cfuncs("SSL_new", {includes = "openssl/ssl.h"}))
  49. end)