aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJussi Pakkanen <jpakkane@gmail.com>2015-07-29 00:04:29 +0300
committerJussi Pakkanen <jpakkane@gmail.com>2015-07-29 00:04:29 +0300
commitc12a4c1acaf44ba0c5e74e5723fa3d5ce72a90dd (patch)
tree7bed4abe5f5ed39517a62116b65b4c127ecadf3f
parentb6cb7fd29e289cf01f2ef13ef002a658ccb2d9c8 (diff)
parentba92f2126c9bf995a11b07ee8fac771eea153333 (diff)
downloadmeson-c12a4c1acaf44ba0c5e74e5723fa3d5ce72a90dd.zip
meson-c12a4c1acaf44ba0c5e74e5723fa3d5ce72a90dd.tar.gz
meson-c12a4c1acaf44ba0c5e74e5723fa3d5ce72a90dd.tar.bz2
Merge pull request #214 from mesonbuild/cross
Merge cross compilation branch.
-rw-r--r--backends.py4
-rw-r--r--compilers.py6
-rw-r--r--cross/ubuntu-armhf.txt12
-rw-r--r--cross/ubuntu-faketarget.txt12
-rw-r--r--cross/ubuntu-mingw.txt16
-rw-r--r--environment.py89
-rw-r--r--interpreter.py108
-rwxr-xr-xmeson.py4
-rw-r--r--ninjabackend.py27
-rw-r--r--test cases/common/26 endian/meson.build2
-rw-r--r--test cases/common/31 find program/meson.build2
-rw-r--r--test cases/common/38 run program/meson.build4
-rw-r--r--test cases/common/55 file grabber/meson.build2
-rw-r--r--test cases/common/59 object generator/meson.build2
-rw-r--r--test cases/objc/2 nsstring/meson.build2
-rw-r--r--test cases/prebuilt object/1 basic/meson.build2
16 files changed, 194 insertions, 100 deletions
diff --git a/backends.py b/backends.py
index 19ec9aa..3052ee6 100644
--- a/backends.py
+++ b/backends.py
@@ -258,9 +258,9 @@ class Backend():
fname = exe.fullpath
else:
fname = [os.path.join(self.environment.get_build_dir(), self.get_target_filename(t.get_exe()))]
- is_cross = self.environment.is_cross_build()
+ is_cross = self.environment.is_cross_build() and self.environment.cross_info.need_cross_compiler()
if is_cross:
- exe_wrapper = self.environment.cross_info.get('exe_wrapper', None)
+ exe_wrapper = self.environment.cross_info.config['binaries'].get('exe_wrapper', None)
else:
exe_wrapper = None
if mesonlib.is_windows():
diff --git a/compilers.py b/compilers.py
index 23c260f..38d9b33 100644
--- a/compilers.py
+++ b/compilers.py
@@ -326,7 +326,7 @@ int main(int argc, char **argv) {
varname = 'sizeof ' + element
varname = varname.replace(' ', '_')
if self.is_cross:
- val = env.cross_info.get(varname)
+ val = env.cross_info.config['properties'][varname]
if val is not None:
if isinstance(val, int):
return val
@@ -363,7 +363,7 @@ int main(int argc, char **argv) {
varname = 'alignment ' + typename
varname = varname.replace(' ', '_')
if self.is_cross:
- val = env.cross_info.get(varname)
+ val = env.cross_info.config['properties'][varname]
if val is not None:
if isinstance(val, int):
return val
@@ -399,7 +399,7 @@ int main(int argc, char **argv) {
varname = 'has function ' + funcname
varname = varname.replace(' ', '_')
if self.is_cross:
- val = env.cross_info.get(varname)
+ val = env.cross_info.config['properties'].get(varname, None)
if val is not None:
if isinstance(val, bool):
return val
diff --git a/cross/ubuntu-armhf.txt b/cross/ubuntu-armhf.txt
index 2d2ee62..73e3f67 100644
--- a/cross/ubuntu-armhf.txt
+++ b/cross/ubuntu-armhf.txt
@@ -1,11 +1,14 @@
-name = 'linux'
+[binaries]
+# we could set exe_wrapper = qemu-arm-static but to test the case
+# when cross compiled binaries can't be run we don't do that
c = '/usr/bin/arm-linux-gnueabihf-gcc'
cpp = '/usr/bin/arm-linux-gnueabihf-g++'
ar = '/usr/arm-linux-gnueabihf/bin/ar'
strip = '/usr/arm-linux-gnueabihf/bin/strip'
+pkgconfig = '/usr/bin/arm-linux-gnueabihf-pkg-config'
+[properties]
root = '/usr/arm-linux-gnueabihf'
-pkgconfig = '/usr/bin/arm-linux-gnueabihf-pkg-config'
sizeof_int = 4
sizeof_wchar_t = 4
@@ -17,3 +20,8 @@ alignment_double = 4 # Don't know if this is correct...
has_function_printf = true
has_function_hfkerhisadf = false
+
+[host_machine]
+name = 'linux'
+cpu = 'arm'
+endian = 'little'
diff --git a/cross/ubuntu-faketarget.txt b/cross/ubuntu-faketarget.txt
new file mode 100644
index 0000000..1ea0977
--- /dev/null
+++ b/cross/ubuntu-faketarget.txt
@@ -0,0 +1,12 @@
+# This is a setup for compiling a program that runs natively
+# but produces output that runs on a different platform.
+# That is either a cross compiler or something like binutils.
+
+# We don't need to specify any properties or compilers,
+# for we use the native ones and can run the resulting
+# binaries directly.
+
+[target_machine]
+name = 'linux'
+cpu = 'mips'
+endian = 'little'
diff --git a/cross/ubuntu-mingw.txt b/cross/ubuntu-mingw.txt
index 76a15a8..2f2fa34 100644
--- a/cross/ubuntu-mingw.txt
+++ b/cross/ubuntu-mingw.txt
@@ -1,8 +1,22 @@
-name = 'windows'
+# Something crazy: compiling on Linux a crosscompiler that
+# runs on Windows and generates code for OSX.
+
+[binaries]
exe_wrapper = 'wine' # A command used to run generated executables.
c = '/usr/bin/i686-w64-mingw32-gcc'
cpp = '/usr/bin/i686-w64-mingw32-g++'
ar = '/usr/bin/i686-w64-mingw32-ar'
strip = '/usr/bin/i686-w64-mingw32-strip'
+[properties]
root = '/usr/i686-w64-mingw32'
+
+[host_machine]
+name = 'windows'
+cpu = 'x86'
+endian = 'little'
+
+[target_machine]
+name = 'darwin'
+cpu = 'arm'
+endian = 'little'
diff --git a/environment.py b/environment.py
index 905f200..c594776 100644
--- a/environment.py
+++ b/environment.py
@@ -16,6 +16,7 @@ import re
import coredata
from glob import glob
from compilers import *
+import configparser
build_filename = 'meson.build'
@@ -90,7 +91,7 @@ class Environment():
cross = self.is_cross_build()
if (not cross and mesonlib.is_windows()) \
- or (cross and self.cross_info['name'] == 'windows'):
+ or (cross and self.cross_info.has_host() and self.cross_info.config['host_machine']['name'] == 'windows'):
self.exe_suffix = 'exe'
self.import_lib_suffix = 'lib'
self.shared_lib_suffix = 'dll'
@@ -101,7 +102,7 @@ class Environment():
else:
self.exe_suffix = ''
if (not cross and mesonlib.is_osx()) or \
- (cross and self.cross_info['name'] == 'darwin'):
+ (cross and self.cross_info.has_host() and self.cross_info.config['host_machine']['name'] == 'darwin'):
self.shared_lib_suffix = 'dylib'
else:
self.shared_lib_suffix = 'so'
@@ -151,10 +152,10 @@ class Environment():
def detect_c_compiler(self, want_cross):
evar = 'CC'
if self.is_cross_build() and want_cross:
- compilers = [self.cross_info['c']]
+ compilers = [self.cross_info.config['binaries']['c']]
ccache = []
is_cross = True
- exe_wrap = self.cross_info.get('exe_wrapper', None)
+ exe_wrap = self.cross_info.config['binaries'].get('exe_wrapper', None)
elif evar in os.environ:
compilers = os.environ[evar].split()
ccache = []
@@ -269,10 +270,10 @@ class Environment():
def detect_cpp_compiler(self, want_cross):
evar = 'CXX'
if self.is_cross_build() and want_cross:
- compilers = [self.cross_info['cpp']]
+ compilers = [self.cross_info.config['binaries']['cpp']]
ccache = []
is_cross = True
- exe_wrap = self.cross_info.get('exe_wrapper', None)
+ exe_wrap = self.cross_info.config['binaries'].get('exe_wrapper', None)
elif evar in os.environ:
compilers = os.environ[evar].split()
ccache = []
@@ -447,7 +448,7 @@ class Environment():
def detect_static_linker(self, compiler):
if compiler.is_cross:
- linker = self.cross_info['ar']
+ linker = self.cross_info.config['binaries']['ar']
else:
evar = 'AR'
if evar in os.environ:
@@ -587,49 +588,51 @@ def get_args_from_envvars(lang):
class CrossBuildInfo():
def __init__(self, filename):
- self.items = {}
+ self.config = {}
self.parse_datafile(filename)
- if not 'name' in self:
- raise EnvironmentException('Cross file must specify "name" (e.g. "linux", "darwin" or "windows".')
+ if 'target_machine' in self.config:
+ return
+ if not 'host_machine' in self.config:
+ raise coredata.MesonException('Cross info file must have either host or a target machine.')
+ if not 'properties' in self.config:
+ raise coredata.MesonException('Cross file is missing "properties".')
+ if not 'binaries' in self.config:
+ raise coredata.MesonException('Cross file is missing "binaries".')
def ok_type(self, i):
return isinstance(i, str) or isinstance(i, int) or isinstance(i, bool)
def parse_datafile(self, filename):
+ config = configparser.ConfigParser()
+ config.read(filename)
# This is a bit hackish at the moment.
- for i, line in enumerate(open(filename)):
- linenum = i+1
- line = line.strip()
- if line == '':
- continue
- if '=' not in line:
- raise EnvironmentException('Malformed line in cross file %s:%d.' % (filename, linenum))
- (varname, value) = line.split('=', 1)
- varname = varname.strip()
- if ' ' in varname or '\t' in varname or "'" in varname or '"' in varname:
- raise EnvironmentException('Malformed variable name in cross file %s:%d.' % (filename, linenum))
- try:
- res = eval(value, {'true' : True, 'false' : False})
- except Exception:
- raise EnvironmentException('Malformed line in cross file %s:%d.' % (filename, linenum))
- if self.ok_type(res):
- self.items[varname] = res
- elif isinstance(res, list):
- for i in res:
- if not self.ok_type(i):
- raise EnvironmentException('Malformed line in cross file %s:%d.' % (filename, linenum))
- self.items[varname] = res
- else:
- raise EnvironmentException('Malformed line in cross file %s:%d.' % (filename, linenum))
+ for s in config.sections():
+ self.config[s] = {}
+ for entry in config[s]:
+ value = config[s][entry]
+ if ' ' in entry or '\t' in entry or "'" in entry or '"' in entry:
+ raise EnvironmentException('Malformed variable name %s in cross file..' % varname)
+ try:
+ res = eval(value, {'true' : True, 'false' : False})
+ except Exception:
+ raise EnvironmentException('Malformed value in cross file variable %s.' % varname)
+ if self.ok_type(res):
+ self.config[s][entry] = res
+ elif isinstance(res, list):
+ for i in res:
+ if not self.ok_type(i):
+ raise EnvironmentException('Malformed value in cross file variable %s.' % varname)
+ self.items[varname] = res
+ else:
+ raise EnvironmentException('Malformed value in cross file variable %s.' % varname)
- def __getitem__(self, ind):
- try:
- return self.items[ind]
- except KeyError:
- raise EnvironmentException('Cross file does not specify variable "%s".' % ind)
+ def has_host(self):
+ return 'host_machine' in self.config
- def __contains__(self, item):
- return item in self.items
+ def has_target(self):
+ return 'target_machine' in self.config
- def get(self, *args, **kwargs):
- return self.items.get(*args, **kwargs)
+ # Wehn compiling a cross compiler we use the native compiler for everything.
+ # But not when cross compiling a cross compiler.
+ def need_cross_compiler(self):
+ return 'host_machine' in self.config
diff --git a/interpreter.py b/interpreter.py
index de3b199..60dd4d6 100644
--- a/interpreter.py
+++ b/interpreter.py
@@ -302,32 +302,54 @@ class GeneratedListHolder(InterpreterObject):
def add_file(self, a):
self.held_object.add_file(a)
-class Build(InterpreterObject):
+class BuildMachine(InterpreterObject):
def __init__(self):
InterpreterObject.__init__(self)
- self.methods.update({'name' : self.get_name_method,
+ self.methods.update({'name' : self.name_method,
+ 'endian' : self.endian_method,
})
- def get_name_method(self, args, kwargs):
+ # Python is inconsistent in its platform module.
+ # It returns different values for the same cpu.
+ # For x86 it might return 'x86', 'i686' or somesuch.
+ # Do some canonicalization.
+ def cpu_method(self, args, kwargs):
+ trial = platform.machine().lower()
+ if trial.startswith('i') and trial.endswith('86'):
+ return 'x86'
+ # This might be wrong. Maybe we should return the more
+ # specific string such as 'armv7l'. Need to get user
+ # feedback first.
+ if trial.startswith('arm'):
+ return 'arm'
+ # Add fixes here as bugs are reported.
+ return trial
+
+ def 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, envir):
+ def endian_method(self, args, kwargs):
+ return sys.byteorder
+
+# This class will provide both host_machine and
+# target_machine
+class CrossMachineInfo(InterpreterObject):
+ def __init__(self, cross_info):
InterpreterObject.__init__(self)
- self.environment = envir
- self.methods.update({'name' : self.get_name_method,
- 'is_big_endian' : self.is_big_endian_method,
+ self.info = cross_info
+ self.methods.update({'name' : self.name_method,
+ 'cpu' : self.cpu_method,
+ 'endian' : self.endian_method,
})
- 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 name_method(self, args, kwargs):
+ return self.info['name']
- def is_big_endian_method(self, args, kwargs):
- return sys.byteorder != 'little'
+ def cpu_method(self, args, kwargs):
+ return self.info['cpu']
+
+ def endian_method(self, args, kwargs):
+ return self.info['endian']
class IncludeDirsHolder(InterpreterObject):
def __init__(self, curdir, dirs):
@@ -734,9 +756,9 @@ class MesonMain(InterpreterObject):
return self.interpreter.environment.build_dir
def has_exe_wrapper_method(self, args, kwargs):
- if self.is_cross_build_method(None, None):
- return 'exe_wrap' in self.build.environment.cross_info
- return True # This is semantically confusing.
+ if self.is_cross_build_method(None, None) and 'binaries' in self.build.environment.cross_info.config:
+ return 'exe_wrap' in self.build.environment.cross_info.config['binaries']
+ return True # This is semantically confusing.
def is_cross_build_method(self, args, kwargs):
return self.build.environment.is_cross_build()
@@ -778,7 +800,7 @@ class Interpreter():
self.subproject_dir = subproject_dir
option_file = os.path.join(self.source_root, self.subdir, 'meson_options.txt')
if os.path.exists(option_file):
- oi = optinterpreter.OptionInterpreter(self.subproject,\
+ oi = optinterpreter.OptionInterpreter(self.subproject, \
self.build.environment.cmd_line_options)
oi.process(option_file)
self.build.environment.merge_options(oi.options)
@@ -797,8 +819,20 @@ class Interpreter():
self.sanity_check_ast()
self.variables = {}
self.builtin = {}
- self.builtin['build'] = Build()
- self.builtin['host'] = Host(build.environment)
+ self.builtin['build_machine'] = BuildMachine()
+ if not self.build.environment.is_cross_build():
+ self.builtin['host_machine'] = self.builtin['build_machine']
+ self.builtin['target_machine'] = self.builtin['build_machine']
+ else:
+ cross_info = self.build.environment.cross_info
+ if cross_info.has_host():
+ self.builtin['host_machine'] = CrossMachineInfo(cross_info.config['host_machine'])
+ else:
+ self.builtin['host_machine'] = self.builtin['build_machine']
+ if cross_info.has_target():
+ self.builtin['target_machine'] = CrossMachineInfo(cross_info.config['target_machine'])
+ else:
+ self.builtin['target_machine'] = self.builtin['host_machine']
self.builtin['meson'] = MesonMain(build, self)
self.environment = build.environment
self.build_func_dict()
@@ -1155,7 +1189,7 @@ class Interpreter():
@stringArgs
def func_project(self, node, args, kwargs):
- if len(args)< 2:
+ if len(args) < 2:
raise InvalidArguments('Not enough arguments to project(). Needs at least the project name and one language')
if list(kwargs.keys()) != ['subproject_dir'] and len(kwargs) != 0:
raise InvalidArguments('project() only accepts the keyword argument "subproject_dir"')
@@ -1189,7 +1223,7 @@ class Interpreter():
arg = posargs[0]
if isinstance(arg, list):
- argstr = stringifyUserArguments(arg)
+ argstr = stringifyUserArguments(arg)
elif isinstance(arg, str):
argstr = arg
elif isinstance(arg, int):
@@ -1207,7 +1241,7 @@ class Interpreter():
raise InterpreterException('Error encountered: ' + args[0])
def add_languages(self, node, args):
- is_cross = self.environment.is_cross_build()
+ need_cross_compiler = self.environment.is_cross_build() and self.environment.cross_info.need_cross_compiler()
for lang in args:
lang = lang.lower()
if lang in self.coredata.compilers:
@@ -1217,39 +1251,39 @@ class Interpreter():
cross_comp = None
if lang == 'c':
comp = self.environment.detect_c_compiler(False)
- if is_cross:
+ if need_cross_compiler:
cross_comp = self.environment.detect_c_compiler(True)
elif lang == 'cpp':
comp = self.environment.detect_cpp_compiler(False)
- if is_cross:
+ if need_cross_compiler:
cross_comp = self.environment.detect_cpp_compiler(True)
elif lang == 'objc':
comp = self.environment.detect_objc_compiler(False)
- if is_cross:
+ if need_cross_compiler:
cross_comp = self.environment.detect_objc_compiler(True)
elif lang == 'objcpp':
comp = self.environment.detect_objcpp_compiler(False)
- if is_cross:
+ if need_cross_compiler:
cross_comp = self.environment.detect_objcpp_compiler(True)
elif lang == 'java':
comp = self.environment.detect_java_compiler()
- if is_cross:
+ if need_cross_compiler:
cross_comp = comp # Java is platform independent.
elif lang == 'cs':
comp = self.environment.detect_cs_compiler()
- if is_cross:
+ if need_cross_compiler:
cross_comp = comp # C# is platform independent.
elif lang == 'vala':
comp = self.environment.detect_vala_compiler()
- if is_cross:
+ if need_cross_compiler:
cross_comp = comp # Vala is too (I think).
elif lang == 'rust':
comp = self.environment.detect_rust_compiler()
- if is_cross:
+ if need_cross_compiler:
cross_comp = comp # FIXME, probably not correct.
elif lang == 'fortran':
comp = self.environment.detect_fortran_compiler(False)
- if is_cross:
+ if need_cross_compiler:
cross_comp = self.environment.detect_fortran_compiler(True)
else:
raise InvalidCode('Tried to use unknown language "%s".' % lang)
@@ -1263,9 +1297,11 @@ class Interpreter():
self.coredata.external_args[comp.get_language()] = ext_compile_args
self.coredata.external_link_args[comp.get_language()] = ext_link_args
self.build.add_compiler(comp)
- if is_cross:
+ if need_cross_compiler:
mlog.log('Cross %s compiler: ' % lang, mlog.bold(' '.join(cross_comp.get_exelist())), ' (%s %s)' % (cross_comp.id, cross_comp.version), sep='')
self.build.add_cross_compiler(cross_comp)
+ if self.environment.is_cross_build() and not need_cross_compiler:
+ self.build.add_cross_compiler(comp)
def func_find_program(self, node, args, kwargs):
self.validate_arguments(args, 1, [str])
@@ -1504,7 +1540,7 @@ class Interpreter():
@stringArgs
def func_install_subdir(self, node, args, kwargs):
- if len(args ) != 1:
+ if len(args) != 1:
raise InvalidArguments('Install_subdir requires exactly one argument.')
if not 'install_dir' in kwargs:
raise InvalidArguments('Missing keyword argument install_dir')
diff --git a/meson.py b/meson.py
index e988f03..b2e8f3a 100755
--- a/meson.py
+++ b/meson.py
@@ -126,6 +126,10 @@ itself as required.'''
mlog.log('Build type:', mlog.bold('native build'))
b = build.Build(env)
intr = interpreter.Interpreter(b)
+ mlog.log('Build machine cpu:', mlog.bold(intr.builtin['build_machine'].cpu_method([], {})))
+ if env.is_cross_build():
+ mlog.log('Host machine cpu:', mlog.bold(intr.builtin['host_machine'].cpu_method([], {})))
+ mlog.log('Target machine cpu:', mlog.bold(intr.builtin['target_machine'].cpu_method([], {})))
intr.run()
if self.options.backend == 'ninja':
import ninjabackend
diff --git a/ninjabackend.py b/ninjabackend.py
index 9f8175c..9781990 100644
--- a/ninjabackend.py
+++ b/ninjabackend.py
@@ -773,7 +773,10 @@ class NinjaBackend(backends.Backend):
if not is_cross:
self.generate_java_link(outfile)
if is_cross:
- static_linker = self.build.static_cross_linker
+ if self.environment.cross_info.need_cross_compiler():
+ static_linker = self.build.static_cross_linker
+ else:
+ static_linker = self.build.static_linker
crstr = '_CROSS'
else:
static_linker = self.build.static_linker
@@ -790,7 +793,15 @@ class NinjaBackend(backends.Backend):
outfile.write(description)
def generate_dynamic_link_rules(self, outfile):
- ctypes = [(self.build.compilers, False), (self.build.cross_compilers, True)]
+ ctypes = [(self.build.compilers, False)]
+ if self.environment.is_cross_build():
+ if self.environment.cross_info.need_cross_compiler():
+ ctypes.append((self.build.cross_compilers, True))
+ else:
+ # Native compiler masquerades as the cross compiler.
+ ctypes.append((self.build.compilers, True))
+ else:
+ ctypes.append((self.build.cross_compilers, True))
for (complist, is_cross) in ctypes:
for compiler in complist:
langname = compiler.get_language()
@@ -982,7 +993,13 @@ rule FORTRAN_DEP_HACK
self.generate_compile_rule_for(langname, compiler, qstr, False, outfile)
self.generate_pch_rule_for(langname, compiler, qstr, False, outfile)
if self.environment.is_cross_build():
- for compiler in self.build.cross_compilers:
+ # In case we are going a target-only build, make the native compilers
+ # masquerade as cross compilers.
+ if self.environment.cross_info.need_cross_compiler():
+ cclist = self.build.cross_compilers
+ else:
+ cclist = self.build.compilers
+ for compiler in cclist:
langname = compiler.get_language()
self.generate_compile_rule_for(langname, compiler, qstr, True, outfile)
self.generate_pch_rule_for(langname, compiler, qstr, True, outfile)
@@ -1267,8 +1284,8 @@ rule FORTRAN_DEP_HACK
targetdir = self.get_target_private_dir(target)
symname = os.path.join(targetdir, target_name + '.symbols')
elem = NinjaBuildElement(symname, 'SHSYM', target_name)
- if self.environment.is_cross_build():
- elem.add_item('CROSS', '--cross-host=' + self.environment.cross_info['name'])
+ if self.environment.is_cross_build() and self.environment.cross_info.need_cross_compiler():
+ elem.add_item('CROSS', '--cross-host=' + self.environment.cross_info.config['host_machine']['name'])
elem.write(outfile)
def generate_link(self, target, outfile, outname, obj_list, linker, extra_args=[]):
diff --git a/test cases/common/26 endian/meson.build b/test cases/common/26 endian/meson.build
index abb26a4..80186fe 100644
--- a/test cases/common/26 endian/meson.build
+++ b/test cases/common/26 endian/meson.build
@@ -1,6 +1,6 @@
project('endian check', 'c')
-if host.is_big_endian()
+if host_machine.endian() == 'big'
add_global_arguments('-DIS_BE', language : 'c')
endif
diff --git a/test cases/common/31 find program/meson.build b/test cases/common/31 find program/meson.build
index 16b6cb5..cc3bba7 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 build.name() == 'windows'
+if build_machine.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 4f02a35..f0bc9ce 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 build.name() == 'windows'
+if build_machine.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 build.name() == 'windows'
+if build_machine.name() == 'windows'
cs = run_command('scripts/hello.bat')
else
cs = run_command('scripts/hello.sh')
diff --git a/test cases/common/55 file grabber/meson.build b/test cases/common/55 file grabber/meson.build
index f5c5b3c..d9ee2d3 100644
--- a/test cases/common/55 file grabber/meson.build
+++ b/test cases/common/55 file grabber/meson.build
@@ -9,7 +9,7 @@ project('grabber', 'c')
# acceptable to you, then we're certainly not going to stop you. Just don't
# file bugs when it fails. :)
-if build.name() == 'windows'
+if build_machine.name() == 'windows'
c = run_command('grabber.bat')
grabber = find_program('grabber2.bat')
else
diff --git a/test cases/common/59 object generator/meson.build b/test cases/common/59 object generator/meson.build
index 61349c2..ffdc1b9 100644
--- a/test cases/common/59 object generator/meson.build
+++ b/test cases/common/59 object generator/meson.build
@@ -6,7 +6,7 @@ python = find_program('python3')
# Code will not be rebuilt if it changes.
comp = '@0@/@1@'.format(meson.current_source_dir(), 'obj_generator.py')
-if host.name() == 'windows'
+if host_machine.name() == 'windows'
outputname = '@BASENAME@.obj'
else
outputname = '@BASENAME@.o'
diff --git a/test cases/objc/2 nsstring/meson.build b/test cases/objc/2 nsstring/meson.build
index add96cf..8bb06cb 100644
--- a/test cases/objc/2 nsstring/meson.build
+++ b/test cases/objc/2 nsstring/meson.build
@@ -1,6 +1,6 @@
project('nsstring', 'objc')
-if host.name() == 'darwin'
+if host_machine.name() == 'darwin'
dep = dependency('appleframeworks', modules : 'foundation')
else
dep = dependency('gnustep')
diff --git a/test cases/prebuilt object/1 basic/meson.build b/test cases/prebuilt object/1 basic/meson.build
index 01b2b9a..befb764 100644
--- a/test cases/prebuilt object/1 basic/meson.build
+++ b/test cases/prebuilt object/1 basic/meson.build
@@ -9,7 +9,7 @@
project('prebuilt object', 'c')
-if host.name() == 'windows'
+if host_machine.name() == 'windows'
prebuilt = 'prebuilt.obj'
else
prebuilt = 'prebuilt.o'