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.

68 lines
2.5 KiB

6 years ago
package("lua")
set_homepage("http://lua.org")
set_description("A powerful, efficient, lightweight, embeddable scripting language.")
set_urls("https://www.lua.org/ftp/lua-$(version).tar.gz",
"https://github.com/lua/lua.git")
add_versions("5.4.1", "4ba786c3705eb9db6567af29c91a01b81f1c0ac3124fdbf6cd94bdd9e53cca7d")
add_versions("5.3.6", "fc5fd69bb8736323f026672b1b7235da613d7177e72558893a0bdcd320466d60")
add_versions("5.2.4", "b9e2e4aad6789b3b63a056d442f7b39f0ecfca3ae0f1fc0ae4e9614401b69f4b")
add_versions("5.1.5", "2640fc56a795f29d28ef15e13c34a47e223960b0240e8cb0a82d9b0738695333")
6 years ago
add_includedirs("include/lua")
6 years ago
if not is_plat("windows") then
5 years ago
add_syslinks("dl", "m")
6 years ago
end
6 years ago
on_load(function (package)
package:addenv("PATH", "bin")
6 years ago
end)
5 years ago
on_install("linux", "macosx", "windows", "android", "bsd", function (package)
io.writefile("xmake.lua", format([[
6 years ago
target("lualib")
set_kind("%s")
6 years ago
set_basename("lua")
add_headerfiles("src/*.h", {prefixdir = "lua"})
add_files("src/*.c|lua.c|luac.c")
add_defines("LUA_COMPAT_5_2", "LUA_COMPAT_5_1")
5 years ago
if is_plat("linux", "bsd") then
add_defines("LUA_USE_LINUX")
5 years ago
add_defines("LUA_DL_DLOPEN")
elseif is_plat("macosx") then
add_defines("LUA_USE_MACOSX")
5 years ago
add_defines("LUA_DL_DYLD")
elseif is_plat("windows") then
-- Lua already detects Windows and sets according defines
if is_kind("shared") then
add_defines("LUA_BUILD_AS_DLL", {public = true})
end
end
6 years ago
target("lua")
set_enabled(%s)
6 years ago
set_kind("binary")
add_files("src/lua.c")
add_deps("lualib")
6 years ago
if not is_plat("windows") then
add_syslinks("dl")
end
5 years ago
]], package:config("shared") and "shared" or "static", is_plat(os.host()) and "true" or "false"))
local configs = {}
if package:config("shared") then
configs.kind = "shared"
end
import("package.tools.xmake").install(package, configs)
6 years ago
end)
6 years ago
on_test(function (package)
if is_plat(os.host()) then
os.vrun("lua -e \"print('hello xmake!')\"")
end
assert(package:has_cfuncs("lua_getinfo", {includes = "lua.h"}))
6 years ago
end)