aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJussi Pakkanen <jpakkane@gmail.com>2013-08-24 01:46:36 +0300
committerJussi Pakkanen <jpakkane@gmail.com>2013-08-24 01:46:36 +0300
commit0259f906f2c6db0d6181a37cbd4ba3ee70fa9269 (patch)
treed92c0a19ac4b7636024254b16cf1606f0c4b2a7e
parent1467acc1bba1992f92284145400669352938c6d1 (diff)
downloadmeson-0259f906f2c6db0d6181a37cbd4ba3ee70fa9269.zip
meson-0259f906f2c6db0d6181a37cbd4ba3ee70fa9269.tar.gz
meson-0259f906f2c6db0d6181a37cbd4ba3ee70fa9269.tar.bz2
Can run test suite through mingw cross compiler.
-rw-r--r--interpreter.py21
-rw-r--r--test cases/common/31 find program/meson.build2
-rw-r--r--test cases/common/38 run program/meson.build4
3 files changed, 20 insertions, 7 deletions
diff --git a/interpreter.py b/interpreter.py
index 5a7027c..13b916a 100644
--- a/interpreter.py
+++ b/interpreter.py
@@ -284,23 +284,35 @@ class GeneratedList(InterpreterObject):
def get_generator(self):
return self.generator
+class Build(InterpreterObject):
+ def __init__(self):
+ InterpreterObject.__init__(self)
+ self.methods.update({'name' : self.get_name_method,
+ })
+
+ def get_name_method(self, args, kwargs):
+ return platform.system().lower()
+
# This currently returns data for the current environment.
# It should return info for the target host.
class Host(InterpreterObject):
-
- def __init__(self):
+ def __init__(self, envir):
InterpreterObject.__init__(self)
+ self.environment = envir
self.methods.update({'pointer_size' : self.get_ptrsize_method,
'name' : self.get_name_method,
'is_big_endian' : self.is_big_endian_method,
})
-
+ # Is this needed any more since we have proper compiler
+ # based tests? Consider removing it.
def get_ptrsize_method(self, args, kwargs):
if sys.maxsize > 2**32:
return 64
return 32
def get_name_method(self, args, kwargs):
+ if self.environment.is_cross_build():
+ return self.environment.cross_info.get('name')
return platform.system().lower()
def is_big_endian_method(self, args, kwargs):
@@ -810,7 +822,8 @@ class Interpreter():
self.sanity_check_ast()
self.variables = {}
self.builtin = {}
- self.builtin['host'] = Host()
+ self.builtin['build'] = Build()
+ self.builtin['host'] = Host(build.environment)
self.builtin['meson'] = MesonMain(build)
self.environment = build.environment
self.build_func_dict()
diff --git a/test cases/common/31 find program/meson.build b/test cases/common/31 find program/meson.build
index ec9c33b..7a407a9 100644
--- a/test cases/common/31 find program/meson.build
+++ b/test cases/common/31 find program/meson.build
@@ -1,6 +1,6 @@
project('find program', 'c')
-if host.name() == 'windows'
+if build.name() == 'windows'
# Things Windows does not provide:
# - an executable to copy files without prompting
# - working command line quoting
diff --git a/test cases/common/38 run program/meson.build b/test cases/common/38 run program/meson.build
index 5fe03d3..4f02a35 100644
--- a/test cases/common/38 run program/meson.build
+++ b/test cases/common/38 run program/meson.build
@@ -1,6 +1,6 @@
project('run command', 'c')
-if host.name() == 'windows'
+if build.name() == 'windows'
c = run_command('cmd', '/c', 'echo', 'hello')
else
c = run_command('echo', 'hello')
@@ -24,7 +24,7 @@ endif
# Now the same with a script.
-if host.name() == 'windows'
+if build.name() == 'windows'
cs = run_command('scripts/hello.bat')
else
cs = run_command('scripts/hello.sh')