xmake.lua 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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_load(function (package)
  15. -- @see https://github.com/xmake-io/xmake-repo/pull/8179#issuecomment-3327113818, patches from msys2/MINGW-packages.
  16. if package:is_plat("msys", "mingw", "cygwin") then
  17. package:add("patches", "*", "patches/cygming.patch", "7e67f77172b19f3e6c1f0875b1d3e9cb79211f8e1c752794ef9afd3704f928cf")
  18. package:add("patches", "*", "patches/show-progress.patch", "57f35bd9ef9113629c1d0ab6bcbbb7c0df0f7f4402ba0dccada32aa1cfe838f5")
  19. end
  20. end)
  21. on_install(function (package)
  22. local configs = {}
  23. configs.enable_tools = not package:is_plat("wasm")
  24. if not package:is_plat("iphoneos", "android") then
  25. package:addenv("PATH", "bin")
  26. end
  27. os.cp(path.join(package:scriptdir(), "port", "xmake.lua"), "xmake.lua")
  28. import("package.tools.xmake").install(package, configs)
  29. end)
  30. on_test(function (package)
  31. if not package:is_cross() then
  32. os.vrun("bunzip2 --help")
  33. os.vrun("bzcat --help")
  34. os.vrun("bzip2 --help")
  35. end
  36. assert(package:has_cfuncs("BZ2_bzCompressInit", {includes = "bzlib.h"}))
  37. end)