xmake.lua 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. package("winflexbison")
  2. set_kind("binary")
  3. set_homepage("https://github.com/lexxmark/winflexbison")
  4. set_description("Win flex-bison is a windows port the Flex (the fast lexical analyser) and Bison (GNU parser generator)")
  5. set_license("GPL")
  6. set_urls("https://github.com/lexxmark/winflexbison/archive/refs/tags/$(version).tar.gz",
  7. "https://github.com/lexxmark/winflexbison.git")
  8. add_versions("v2.5.25", "8e1b71e037b524ba3f576babb0cf59182061df1f19cd86112f085a882560f60b")
  9. add_deps("cmake")
  10. on_load(function (package)
  11. package:addenv("PATH", "bin")
  12. end)
  13. on_install("windows", function (package)
  14. local debugType = (package:debug() and "Debug" or "Release")
  15. local configs = {}
  16. table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. debugType)
  17. table.insert(configs, "-DUSE_STATIC_RUNTIME=" .. (package:config("vs_runtime"):startswith("MT") and "ON" or "OFF"))
  18. import("package.tools.cmake").build(package, configs)
  19. os.mv("custom_build_rules", package:installdir("bin"))
  20. os.mv("flex/src/FlexLexer.h", package:installdir("include"))
  21. os.mv(path.join("bin", debugType, "*"), package:installdir("bin"))
  22. os.cp(path.join(package:installdir("bin"), "win_bison.exe"), path.join(package:installdir("bin"), "bison.exe"))
  23. os.cp(path.join(package:installdir("bin"), "win_flex.exe"), path.join(package:installdir("bin"), "flex.exe"))
  24. end)
  25. on_test(function (package)
  26. os.vrun("win_bison.exe -h")
  27. os.vrun("win_flex.exe -h")
  28. end)