xmake.lua 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. package("flex")
  2. set_kind("binary")
  3. set_homepage("https://github.com/westes/flex/")
  4. set_license("BSD-2-Clause")
  5. if not is_plat("windows") then
  6. add_urls("https://github.com/westes/flex/releases/download/v$(version)/flex-$(version).tar.gz")
  7. end
  8. add_versions("2.6.4", "e87aae032bf07c26f85ac0ed3250998c37621d95f8bd748b31f15b33c45ee995")
  9. if is_plat("windows") then
  10. add_deps("winflexbison", {private = true})
  11. elseif is_plat("linux") then
  12. add_deps("m4")
  13. end
  14. on_load("macosx", "linux", "bsd", "windows", function (package)
  15. -- we always set it, because flex may be modified as library
  16. -- by add_deps("flex", {kind = "library"})
  17. package:addenv("PATH", "bin")
  18. end)
  19. on_install("windows", function (package)
  20. os.cp(path.join(package:dep("winflexbison"):installdir(), "*"), package:installdir())
  21. os.rm(path.join(package:installdir(), "bin", "bison.exe"))
  22. end)
  23. on_install("macosx", "linux", "bsd", "android", "iphoneos", "cross", function (package)
  24. import("package.tools.autoconf").install(package)
  25. if not package:is_binary() then
  26. package:add("links", "")
  27. end
  28. end)
  29. on_test(function (package)
  30. if not package:is_cross() then
  31. os.vrun("flex -h")
  32. end
  33. if not package:is_binary() then
  34. assert(package:has_cxxincludes("FlexLexer.h"))
  35. end
  36. end)