diff options
author | Nirbheek Chauhan <nirbheek.chauhan@gmail.com> | 2016-04-14 22:52:15 +0530 |
---|---|---|
committer | Nirbheek Chauhan <nirbheek.chauhan@gmail.com> | 2016-04-15 00:25:34 +0530 |
commit | c0765b0e8da6ad699b02dcc19a6480b3e6f71655 (patch) | |
tree | 62efa4ee1aaffb03afcf5ab8c0f8bd55ccf265bc /mesonbuild/interpreter.py | |
parent | a76693f338fa55a1d914c331fdb954e539e4561b (diff) | |
download | meson-c0765b0e8da6ad699b02dcc19a6480b3e6f71655.zip meson-c0765b0e8da6ad699b02dcc19a6480b3e6f71655.tar.gz meson-c0765b0e8da6ad699b02dcc19a6480b3e6f71655.tar.bz2 |
Don't require an exe_wrapper when cross-compiling 32-bit on 64-bit
Almost all 64-bit x86 OSes can run 32-bit x86 binaries natively. Detect
that case and don't require an exe wrapper.
Diffstat (limited to 'mesonbuild/interpreter.py')
-rw-r--r-- | mesonbuild/interpreter.py | 27 |
1 files changed, 12 insertions, 15 deletions
diff --git a/mesonbuild/interpreter.py b/mesonbuild/interpreter.py index d6a3a3e..3a831ce 100644 --- a/mesonbuild/interpreter.py +++ b/mesonbuild/interpreter.py @@ -322,24 +322,14 @@ class BuildMachine(InterpreterObject): 'endian' : self.endian_method, }) - # 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_family_method(self, args, kwargs): - trial = platform.machine().lower() - if trial.startswith('i') and trial.endswith('86'): - return 'x86' - if trial.startswith('arm'): - return 'arm' - # Add fixes here as bugs are reported. - return trial + return environment.detect_cpu_family() def cpu_method(self, args, kwargs): return platform.machine().lower() def system_method(self, args, kwargs): - return platform.system().lower() + return environment.detect_system() def endian_method(self, args, kwargs): return sys.byteorder @@ -883,9 +873,16 @@ 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) 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. + if self.is_cross_build_method(None, None) and \ + 'binaries' in self.build.environment.cross_info.config and \ + self.build.environment.cross_info.need_exe_wrapper(): + exe_wrap = self.build.environment.cross_info.config['binaries'].get('exe_wrap', None) + if exe_wrap is None: + return False + # We return True when exe_wrap is defined, when it's not needed, and + # when we're compiling natively. The last two are semantically confusing. + # Need to revisit this. + return True def is_cross_build_method(self, args, kwargs): return self.build.environment.is_cross_build() |