xmake.lua 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. package("bison")
  2. set_kind("binary")
  3. set_homepage("https://www.gnu.org/software/bison/")
  4. set_description("A general-purpose parser generator.")
  5. set_license("GPL-3.0")
  6. if on_source then
  7. on_source(function (package)
  8. if not package:is_plat("windows", "mingw", "msys") then
  9. package:add("urls", "http://ftpmirror.gnu.org/gnu/bison/bison-$(version).tar.gz",
  10. "http://ftp.gnu.org/gnu/bison/bison-$(version).tar.gz")
  11. end
  12. end)
  13. elseif not is_plat("windows", "mingw", "msys") then
  14. add_urls("http://ftpmirror.gnu.org/gnu/bison/bison-$(version).tar.gz",
  15. "http://ftp.gnu.org/gnu/bison/bison-$(version).tar.gz")
  16. end
  17. add_versions("3.7.4", "fbabc7359ccd8b4b36d47bfe37ebbce44805c052526d5558b95eda125d1677e2")
  18. add_versions("3.7.6", "69dc0bb46ea8fc307d4ca1e0b61c8c355eb207d0b0c69f4f8462328e74d7b9ea")
  19. add_versions("3.8.2", "06c9e13bdf7eb24d4ceb6b59205a4f67c2c7e7213119644430fe82fbd14a0abb")
  20. if is_subhost("msys") then
  21. add_deps("pacman::bison")
  22. end
  23. on_load("macosx", "linux", "bsd", "windows", function (package)
  24. if package:is_plat("windows") then
  25. package:add("deps", "winflexbison", {private = true})
  26. elseif package:is_plat("linux", "bsd") then
  27. package:add("deps", "m4")
  28. end
  29. -- we always set it, because bison may be modified as library
  30. -- by add_deps("bison", {kind = "library"})
  31. package:addenv("PATH", "bin")
  32. if package:is_library() then
  33. package:set("kind", "library", {headeronly = true})
  34. end
  35. end)
  36. on_install("@msys", function (package)
  37. end)
  38. on_install("windows", function (package)
  39. os.cp(path.join(package:dep("winflexbison"):installdir(), "*"), package:installdir())
  40. os.rm(path.join(package:installdir(), "bin", "flex.exe"))
  41. os.rm(path.join(package:installdir(), "include", "FlexLexer.h"))
  42. end)
  43. on_install("macosx", "linux", "bsd", "android", "iphoneos", "cross", function (package)
  44. import("package.tools.autoconf").install(package)
  45. os.rm(package:installdir("share", "doc"))
  46. end)
  47. on_test(function (package)
  48. if not package:is_cross() then
  49. os.vrun("bison -h")
  50. end
  51. end)