xmake.lua 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. package("lzma")
  2. set_homepage("https://www.7-zip.org/sdk.html")
  3. set_description("LZMA SDK")
  4. add_urls("https://www.7-zip.org/a/lzma$(version).7z", {version = function (version) return version:gsub("%.", "") end})
  5. add_versions("19.00", "00f569e624b3d9ed89cf8d40136662c4c5207eaceb92a70b1044c77f84234bad")
  6. add_versions("21.07", "833888f03c6628c8a062ce5844bb8012056e7ab7ba294c7ea232e20ddadf0d75")
  7. add_versions("22.01", "35b1689169efbc7c3c147387e5495130f371b4bad8ec24f049d28e126d52d9fe")
  8. add_versions("23.01", "317dd834d6bbfd95433488b832e823cd3d4d420101436422c03af88507dd1370")
  9. add_versions("24.09", "79b39f10b7b69eea293caa90c3e7ea07faf8f01f8ae9db1bb1b90c092375e5f3")
  10. if is_plat("linux", "bsd") then
  11. add_syslinks("pthread")
  12. end
  13. on_install(function (package)
  14. os.cd("C")
  15. local xmake_lua = [[
  16. add_rules("mode.debug", "mode.release")
  17. target("lzma")
  18. set_kind("$(kind)")
  19. add_files("*.c")
  20. add_headerfiles("*.h")
  21. if is_plat("windows") then
  22. add_files("Util/LzmaLib/LzmaLib.def")
  23. end
  24. if is_plat("linux", "bsd") then
  25. add_syslinks("pthread")
  26. end
  27. ]]
  28. if package:version():le("19.00") then
  29. xmake_lua = xmake_lua .. [[
  30. if not is_plat("windows", "mingw") then
  31. add_defines("_7ZIP_ST")
  32. remove_headerfiles("Threads.h", "LzFindMt.h")
  33. remove_files("Threads.c", "LzFindMt.c")
  34. end
  35. ]]
  36. end
  37. io.writefile("xmake.lua", xmake_lua)
  38. local cxflags
  39. if not package:is_plat("windows") and package:is_arch("arm.*") then
  40. cxflags = "-march=armv8-a+crc+crypto"
  41. end
  42. import("package.tools.xmake").install(package, {cxflags = cxflags})
  43. end)
  44. on_test(function (package)
  45. assert(package:check_csnippets({test = [[
  46. void test() {
  47. // we only test links...
  48. LzmaCompress(
  49. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
  50. );
  51. }
  52. ]]}, {configs = {languages = "c99"}, includes = "LzmaLib.h"}))
  53. end)