xmake.lua 1.7 KB

1234567891011121314151617181920212223242526272829303132333435
  1. package("libressl")
  2. set_homepage("https://www.libressl.org/")
  3. set_description("LibreSSL is a version of the TLS/crypto stack forked from OpenSSL in 2014, with goals of modernizing the codebase, improving security, and applying best practice development processes.")
  4. add_urls("https://ftp.openbsd.org/pub/OpenBSD/LibreSSL/libressl-$(version).tar.gz")
  5. add_versions("3.4.2", "cb82ca7d547336917352fbd23db2fc483c6c44d35157b32780214ec74197b3ce")
  6. if is_plat("windows") then
  7. add_deps("cmake")
  8. add_syslinks("ws2_32", "bcrypt")
  9. elseif is_plat("linux") then
  10. add_syslinks("pthread")
  11. end
  12. on_install("windows", function (package)
  13. local configs = {"-DLIBRESSL_TESTS=OFF", "-DLIBRESSL_APPS=OFF"}
  14. table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
  15. table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
  16. table.insert(configs, "-DUSE_STATIC_MSVC_RUNTIMES=" .. (package:config("vs_runtime"):startswith("MT") and "ON" or "OFF"))
  17. import("package.tools.cmake").install(package, configs)
  18. end)
  19. on_install("macosx", "linux", "bsd", function (package)
  20. local configs = {}
  21. table.insert(configs, "--enable-shared=" .. (package:config("shared") and "yes" or "no"))
  22. table.insert(configs, "--enable-static=" .. (package:config("shared") and "no" or "yes"))
  23. if package:config("pic") then
  24. table.insert(configs, "--with-pic")
  25. end
  26. import("package.tools.autoconf").install(package, configs)
  27. end)
  28. on_test(function (package)
  29. assert(package:has_cfuncs("SSL_new", {includes = "openssl/ssl.h"}))
  30. end)