mirror of
https://github.com/wesnoth/wesnoth
synced 2025-04-19 20:41:27 +00:00
Added a custom check for lua.
This commit is contained in:
parent
22f78e8e08
commit
e94dcecf17
|
@ -82,6 +82,7 @@ opts.AddVariables(
|
||||||
('boost_suffix', 'Suffix of boost libraries.'),
|
('boost_suffix', 'Suffix of boost libraries.'),
|
||||||
PathVariable('gettextdir', 'Root directory of Gettext\'s installation.', "", OptionalPath),
|
PathVariable('gettextdir', 'Root directory of Gettext\'s installation.', "", OptionalPath),
|
||||||
PathVariable('gtkdir', 'Directory where GTK SDK is installed.', "", OptionalPath),
|
PathVariable('gtkdir', 'Directory where GTK SDK is installed.', "", OptionalPath),
|
||||||
|
PathVariable('luadir', 'Directory where Lua binary package is unpacked.', "", OptionalPath),
|
||||||
('host', 'Cross-compile host.', ''),
|
('host', 'Cross-compile host.', ''),
|
||||||
('jobs', 'Set the number of parallel compilations', "1", lambda key, value, env: int(value), int),
|
('jobs', 'Set the number of parallel compilations', "1", lambda key, value, env: int(value), int),
|
||||||
BoolVariable('distcc', 'Use distcc', False),
|
BoolVariable('distcc', 'Use distcc', False),
|
||||||
|
@ -201,7 +202,7 @@ def Warning(message):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
from metasconf import init_metasconf
|
from metasconf import init_metasconf
|
||||||
configure_args = dict(custom_tests = init_metasconf(env, ["cplusplus", "python_devel", "sdl", "boost", "pango", "pkgconfig", "gettext"]), config_h = "config.h",
|
configure_args = dict(custom_tests = init_metasconf(env, ["cplusplus", "python_devel", "sdl", "boost", "pango", "pkgconfig", "gettext", "lua"]), config_h = "config.h",
|
||||||
log_file="build/config.log", conf_dir="build/sconf_temp")
|
log_file="build/config.log", conf_dir="build/sconf_temp")
|
||||||
|
|
||||||
env.MergeFlags(env["extra_flags_config"])
|
env.MergeFlags(env["extra_flags_config"])
|
||||||
|
@ -219,7 +220,7 @@ if env["prereqs"]:
|
||||||
have_client_prereqs = have_server_prereqs and \
|
have_client_prereqs = have_server_prereqs and \
|
||||||
conf.CheckPango("cairo") and \
|
conf.CheckPango("cairo") and \
|
||||||
conf.CheckPKG("fontconfig") and \
|
conf.CheckPKG("fontconfig") and \
|
||||||
(conf.CheckPKG("lua >= 5.1") or conf.CheckPKG("lua5.1 >= 5.1")) and \
|
conf.CheckLua(require_version = "5.1") and \
|
||||||
conf.CheckBoost("regex") and \
|
conf.CheckBoost("regex") and \
|
||||||
conf.CheckSDL("SDL_ttf", require_version = "2.0.8") and \
|
conf.CheckSDL("SDL_ttf", require_version = "2.0.8") and \
|
||||||
conf.CheckSDL("SDL_mixer", require_version = '1.2.0') and \
|
conf.CheckSDL("SDL_mixer", require_version = '1.2.0') and \
|
||||||
|
|
28
scons/lua.py
Normal file
28
scons/lua.py
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
# vi: syntax=python:et:ts=4
|
||||||
|
from pkgconfig import run_pkg_config
|
||||||
|
|
||||||
|
def CheckLua(context, require_version):
|
||||||
|
env = context.env
|
||||||
|
|
||||||
|
context.Message("Checking for Lua version " + require_version + "... ")
|
||||||
|
|
||||||
|
version = ".".join(require_version.split(".")[0:2])
|
||||||
|
|
||||||
|
if env.get("luadir"):
|
||||||
|
env.Append(LIBPATH = ["$luadir"], CPPPATH = ["$luadir/include"], LIBS = "lua" + version)
|
||||||
|
found = True
|
||||||
|
else:
|
||||||
|
found = run_pkg_config(env, "lua >= " + require_version) or run_pkg_config(env, "lua" + version + " >= " + require_version)
|
||||||
|
|
||||||
|
result = found and context.TryLink("""
|
||||||
|
#include <lualib.h>
|
||||||
|
int main() { luaL_newstate(); }
|
||||||
|
""", ".c")
|
||||||
|
if result:
|
||||||
|
context.Result("yes")
|
||||||
|
return True
|
||||||
|
else:
|
||||||
|
context.Result("no")
|
||||||
|
return False
|
||||||
|
|
||||||
|
config_checks = { "CheckLua" : CheckLua }
|
Loading…
Reference in New Issue
Block a user