xmake.lua 1.2 KB

1234567891011121314151617181920212223242526272829303132333435
  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. add_versions("1.0.8", "ab5a03176ee106d3f0fa90e381da478ddae405918153cca248e682cd0c4a2269")
  6. if is_plat("mingw") and is_subhost("msys") then
  7. add_extsources("pacman::bzip2")
  8. elseif is_plat("linux") then
  9. add_extsources("pacman::bzip2", "apt::libbz2-dev")
  10. elseif is_plat("macosx") then
  11. add_extsources("brew::bzip2")
  12. end
  13. on_install(function (package)
  14. local configs = {}
  15. configs.enable_tools = not package:is_plat("wasm")
  16. if not package:is_plat("iphoneos", "android") then
  17. package:addenv("PATH", "bin")
  18. end
  19. os.cp(path.join(package:scriptdir(), "port", "xmake.lua"), "xmake.lua")
  20. import("package.tools.xmake").install(package, configs)
  21. end)
  22. on_test(function (package)
  23. if not package:is_cross() then
  24. os.vrun("bunzip2 --help")
  25. os.vrun("bzcat --help")
  26. os.vrun("bzip2 --help")
  27. end
  28. assert(package:has_cfuncs("BZ2_bzCompressInit", {includes = "bzlib.h"}))
  29. end)