xmake.lua 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  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 not is_plat("windows") then
  7. add_urls("http://ftpmirror.gnu.org/gnu/bison/bison-$(version).tar.gz",
  8. "http://ftp.gnu.org/gnu/bison/bison-$(version).tar.gz")
  9. end
  10. add_versions("3.7.4", "fbabc7359ccd8b4b36d47bfe37ebbce44805c052526d5558b95eda125d1677e2")
  11. add_versions("3.7.6", "69dc0bb46ea8fc307d4ca1e0b61c8c355eb207d0b0c69f4f8462328e74d7b9ea")
  12. add_versions("3.8.2", "06c9e13bdf7eb24d4ceb6b59205a4f67c2c7e7213119644430fe82fbd14a0abb")
  13. if is_plat("windows") then
  14. add_deps("winflexbison", {private = true})
  15. elseif is_plat("linux", "bsd") then
  16. add_deps("m4")
  17. end
  18. on_load("macosx", "linux", "bsd", "windows", function (package)
  19. -- we always set it, because flex may be modified as library
  20. -- by add_deps("bison", {kind = "library"})
  21. package:addenv("PATH", "bin")
  22. end)
  23. on_install(function (package)
  24. if package:is_plat("windows") then
  25. os.cp(path.join(package:dep("winflexbison"):installdir(), "*"), package:installdir())
  26. os.rm(path.join(package:installdir(), "bin", "flex.exe"))
  27. os.rm(path.join(package:installdir(), "include", "FlexLexer.h"))
  28. else
  29. import("package.tools.autoconf").install(package)
  30. os.rm(package:installdir("share", "doc"))
  31. end
  32. end)
  33. on_test(function (package)
  34. os.vrun("bison -h")
  35. end)