package An official xmake package repository https://xrepo.xmake.io/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

70 lines
2.7 KiB

package("luajit")
set_homepage("http://luajit.org")
set_description("A Just-In-Time Compiler (JIT) for the Lua programming language.")
set_urls("http://luajit.org/download/LuaJIT-$(version).tar.gz",
"http://luajit.org/git/luajit-2.0.git",
"http://repo.or.cz/luajit-2.0.git")
add_versions("2.0.0", "deaed645c4a093c5fb250c30c9933c9131ee05c94b13262d58f6e0b60b338c15")
add_versions("2.0.1", "2371cceb53453d8a7b36451e6a0ccdb66236924545d6042ddd4c34e9668990c0")
add_versions("2.0.2", "c05202974a5890e777b181908ac237625b499aece026654d7cc33607e3f46c38")
add_versions("2.0.3", "55be6cb2d101ed38acca32c5b1f99ae345904b365b642203194c585d27bebd79")
add_versions("2.0.4", "620fa4eb12375021bef6e4f237cbd2dd5d49e56beb414bee052c746beef1807d")
add_versions("2.0.5", "874b1f8297c697821f561f9b73b57ffd419ed8f4278c82e05b48806d30c1e979")
add_includedirs("include/luajit")
6 years ago
if not is_plat("windows") then
add_syslinks("dl")
end
6 years ago
on_load(function (package)
6 years ago
if is_plat("windows") then
package:addenv("PATH", "lib")
6 years ago
end
package:addenv("PATH", "bin")
6 years ago
end)
6 years ago
on_install("windows", function (package)
os.cd("src")
if not package:config("shared") then
os.vrun("msvcbuild.bat static")
elseif package:debug() then
os.vrun("msvcbuild.bat debug")
else
os.vrun("msvcbuild.bat")
end
6 years ago
os.cp("luajit.exe", package:installdir("bin"))
6 years ago
os.cp("lua51.lib", package:installdir("lib"))
if package:config("shared") then
os.cp("lua51.dll", package:installdir("lib"))
end
os.cp("*.h", package:installdir("include/luajit"))
end)
6 years ago
on_install("macosx", "linux", function (package)
io.gsub("./Makefile", "export PREFIX= /usr/local", "export PREFIX=" .. package:installdir())
if package:debug() then
io.gsub("./src/Makefile", "CCDEBUG=", "CCDEBUG= -g")
end
if package:config("shared") then
io.gsub("./src/Makefile", "BUILDMODE= mixed", "BUILDMODE= dynamic")
else
io.gsub("./src/Makefile", "BUILDMODE= mixed", "BUILDMODE= static")
end
os.vrun("make")
6 years ago
os.cp("src/luajit", package:installdir("bin"))
if package:config("shared") then
os.cp("src/*" .. (is_plat("macosx") and ".dylib" or ".so"), package:installdir("lib"))
else
os.cp("src/*.a", package:installdir("lib"))
end
os.cp("src/*.h", package:installdir("include/luajit"))
end)
6 years ago
on_test(function (package)
os.vrun("luajit -e \"print('hello xmake!')\"")
assert(package:has_cfuncs("lua_pcall", {includes = "luajit.h"}))
6 years ago
end)