xmake.lua 1.3 KB

123456789101112131415161718192021222324252627282930313233343536
  1. package("bzip2")
  2. set_homepage("https://sourceware.org/bzip2/")
  3. set_description("Freely available, patent free, high-quality data compressor.")
  4. add_urls("https://sourceware.org/pub/bzip2/bzip2-$(version).tar.gz",
  5. "https://pub.sortix.org/mirror/bzip2/bzip2-$(version).tar.gz")
  6. add_versions("1.0.8", "ab5a03176ee106d3f0fa90e381da478ddae405918153cca248e682cd0c4a2269")
  7. if is_plat("mingw") and is_subhost("msys") then
  8. add_extsources("pacman::bzip2")
  9. elseif is_plat("linux") then
  10. add_extsources("pacman::bzip2", "apt::libbz2-dev")
  11. elseif is_plat("macosx") then
  12. add_extsources("brew::bzip2")
  13. end
  14. on_install(function (package)
  15. local configs = {}
  16. configs.enable_tools = not package:is_plat("wasm")
  17. if not package:is_plat("iphoneos", "android") then
  18. package:addenv("PATH", "bin")
  19. end
  20. os.cp(path.join(package:scriptdir(), "port", "xmake.lua"), "xmake.lua")
  21. import("package.tools.xmake").install(package, configs)
  22. end)
  23. on_test(function (package)
  24. if not package:is_cross() then
  25. os.vrun("bunzip2 --help")
  26. os.vrun("bzcat --help")
  27. os.vrun("bzip2 --help")
  28. end
  29. assert(package:has_cfuncs("BZ2_bzCompressInit", {includes = "bzlib.h"}))
  30. end)