xmake.lua 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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.32.0", "67fbb78659055c2289c9068bb4ca1c0f1b6ca27700c7f6d34c6bc2f27cd46314")
  7. add_configs("jitter", {description = "Enable FIPS entropy source: CPU Jitter", default = false, type = "boolean"})
  8. add_configs("go", {description = "Enable go", default = false, type = "boolean"})
  9. add_configs("perl", {description = "Enable perl", default = false, type = "boolean"})
  10. add_configs("tools", {description = "Build tools", default = false, type = "boolean"})
  11. add_deps("cmake")
  12. if is_plat("windows", "mingw") or is_host("windows") then
  13. add_deps("nasm")
  14. end
  15. add_links("ssl", "crypto")
  16. if is_plat("windows", "mingw") then
  17. add_syslinks("ws2_32")
  18. elseif is_plat("linux", "bsd") then
  19. add_syslinks("pthread", "dl", "m")
  20. end
  21. on_load(function (package)
  22. if package:config("go") then
  23. package:add("deps", "go")
  24. end
  25. if package:config("perl") and package:is_plat() and (not package:is_precompiled()) then
  26. package:add("deps", "strawberry-perl")
  27. end
  28. end)
  29. on_install("!cross and windows|!arm64", function (package)
  30. if package:config("shared") and package:is_plat("windows") then
  31. package:add("defines", "BORINGSSL_SHARED_LIBRARY")
  32. end
  33. local configs = {
  34. "-DBUILD_TESTING=OFF",
  35. "-DCMAKE_INSTALL_INCLUDEDIR=include",
  36. "-DBUILD_LIBSSL=ON",
  37. }
  38. table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:is_debug() and "Debug" or "Release"))
  39. table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
  40. table.insert(configs, "-DENABLE_FIPS_ENTROPY_CPU_JITTER=" .. (package:config("jitter") and "ON" or "OFF"))
  41. table.insert(configs, "-DDISABLE_GO=" .. (package:config("go") and "OFF" or "ON"))
  42. table.insert(configs, "-DDISABLE_PERL=" .. (package:config("perl") and "OFF" or "ON"))
  43. table.insert(configs, "-DBUILD_TOOL=" .. (package:config("tools") and "ON" or "OFF"))
  44. import("package.tools.cmake").install(package, configs)
  45. end)
  46. on_test(function (package)
  47. assert(package:has_cfuncs("SSL_new", {includes = "openssl/ssl.h"}))
  48. end)