mail[Wesnoth-commits] r34060 - in /trunk: SConstruct scons/lua.py


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by loonycyborg on March 23, 2009 - 02:26:
Author: loonycyborg
Date: Mon Mar 23 02:26:52 2009
New Revision: 34060

URL: http://svn.gna.org/viewcvs/wesnoth?rev=34060&view=rev
Log:
Added a custom check for lua.

Added:
    trunk/scons/lua.py
Modified:
    trunk/SConstruct

Modified: trunk/SConstruct
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/SConstruct?rev=34060&r1=34059&r2=34060&view=diff
==============================================================================
--- trunk/SConstruct (original)
+++ trunk/SConstruct Mon Mar 23 02:26:52 2009
@@ -82,6 +82,7 @@
     ('boost_suffix', 'Suffix of boost libraries.'),
     PathVariable('gettextdir', 'Root directory of Gettext\'s installation.', 
"", OptionalPath), 
     PathVariable('gtkdir', 'Directory where GTK SDK is installed.', "", 
OptionalPath),
+    PathVariable('luadir', 'Directory where Lua binary package is 
unpacked.', "", OptionalPath),
     ('host', 'Cross-compile host.', ''),
     ('jobs', 'Set the number of parallel compilations', "1", lambda key, 
value, env: int(value), int),
     BoolVariable('distcc', 'Use distcc', False),
@@ -201,7 +202,7 @@
     return False
 
 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")
 
 env.MergeFlags(env["extra_flags_config"])
@@ -219,7 +220,7 @@
     have_client_prereqs = have_server_prereqs and \
         conf.CheckPango("cairo") 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.CheckSDL("SDL_ttf", require_version = "2.0.8") and \
         conf.CheckSDL("SDL_mixer", require_version = '1.2.0') and \

Added: trunk/scons/lua.py
URL: http://svn.gna.org/viewcvs/wesnoth/trunk/scons/lua.py?rev=34060&view=auto
==============================================================================
--- trunk/scons/lua.py (added)
+++ trunk/scons/lua.py Mon Mar 23 02:26:52 2009
@@ -1,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 }




Related Messages


Powered by MHonArc, Updated Mon Mar 23 04:40:37 2009