xmake.lua 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. package("openrestry-luajit")
  2. set_homepage("https://github.com/openresty/luajit2")
  3. set_description("OpenResty's Branch of LuaJIT 2")
  4. set_urls("https://github.com/openresty/luajit2/archive/refs/tags/$(version).zip",
  5. "https://github.com/openresty/luajit2.git")
  6. add_versions("v2.1-20220310", "5d765a7a60cb698afcba91c52204cbe085687ac32f6b99abeca6c3719ecf82a8")
  7. add_configs("nojit", { description = "Disable JIT.", default = false, type = "boolean"})
  8. add_configs("fpu", { description = "Enable FPU.", default = true, type = "boolean"})
  9. add_configs("gc64", { description = "Enable GC64.", default = false, type = "boolean"})
  10. add_includedirs("include/luajit")
  11. if not is_plat("windows") then
  12. add_syslinks("dl")
  13. end
  14. on_load(function (package)
  15. package:addenv("PATH", "bin")
  16. if package:config("shared") then
  17. package:addenv("PATH", "lib")
  18. end
  19. end)
  20. on_install("windows", "linux", "macosx", "bsd", "android", "iphoneos", function (package)
  21. local configs = {}
  22. if package:config("shared") then
  23. configs.kind = "shared"
  24. end
  25. configs.fpu = package:config("fpu")
  26. configs.nojit = package:config("nojit")
  27. configs.gc64 = package:config("gc64")
  28. os.cp(path.join(package:scriptdir(), "port", "xmake.lua"), "xmake.lua")
  29. import("package.tools.xmake").install(package, configs)
  30. end)
  31. on_test(function (package)
  32. if package:is_plat(os.host()) then
  33. os.vrun("luajit -e \"print('hello xmake!')\"")
  34. end
  35. assert(package:has_cfuncs("lua_pcall", {includes = "luajit.h"}))
  36. end)