xmake.lua 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. package("libsodium")
  2. set_homepage("https://libsodium.org")
  3. set_description("Sodium is a new, easy-to-use software library for encryption, decryption, signatures, password hashing and more.")
  4. set_license("ISC")
  5. set_urls("https://download.libsodium.org/libsodium/releases/libsodium-$(version).tar.gz",
  6. "https://github.com/jedisct1/libsodium/releases/download/$(version)-RELEASE/libsodium-$(version).tar.gz",
  7. "https://github.com/jedisct1/libsodium.git")
  8. add_versions("1.0.20", "ebb65ef6ca439333c2bb41a0c1990587288da07f6c7fd07cb3a18cc18d30ce19")
  9. add_versions("1.0.19", "018d79fe0a045cca07331d37bd0cb57b2e838c51bc48fd837a1472e50068bbea")
  10. add_versions("1.0.18", "6f504490b342a4f8a4c4a02fc9b866cbef8622d5df4e5452b46be121e46636c1")
  11. if is_plat("linux", "macosx") then
  12. add_deps("autoconf", "automake", "libtool", "pkg-config")
  13. end
  14. on_install(function (package)
  15. if not package:config("shared") then
  16. package:add("defines", "SODIUM_STATIC")
  17. end
  18. if package:is_plat("linux", "macosx") then
  19. local configs = {}
  20. if package:debug() then
  21. table.insert(configs, "--enable-debug")
  22. end
  23. if package:config("shared") then
  24. table.insert(configs, "--enable-static=no")
  25. table.insert(configs, "--enable-shared=yes")
  26. else
  27. table.insert(configs, "--enable-static=yes")
  28. table.insert(configs, "--enable-shared=no")
  29. end
  30. import("package.tools.autoconf").install(package, configs)
  31. else
  32. os.cp(path.join(package:scriptdir(), "port", "xmake.lua"), "xmake.lua")
  33. import("package.tools.xmake").install(package)
  34. end
  35. end)
  36. on_test(function (package)
  37. assert(package:has_cfuncs("sodium_init", {includes = "sodium.h"}))
  38. end)