diff options
author | George Koehler <xkernigh@netscape.net> | 2018-06-28 17:26:35 -0400 |
---|---|---|
committer | Nirbheek Chauhan <nirbheek.chauhan@gmail.com> | 2018-08-07 04:19:35 -0700 |
commit | e0ed1ceae2e00d6c6efab39d4712d2522d89e929 (patch) | |
tree | a897b67504f9ccc771d4978b14a111d952c033fb /mesonbuild/environment.py | |
parent | e4a83e47d4402d6fede8b284f079529fb78c2cbb (diff) | |
download | meson-e0ed1ceae2e00d6c6efab39d4712d2522d89e929.zip meson-e0ed1ceae2e00d6c6efab39d4712d2522d89e929.tar.gz meson-e0ed1ceae2e00d6c6efab39d4712d2522d89e929.tar.bz2 |
Refactor getting the host system of a cross compiler
Use mesonlib.for_windows or mesonlib.for_cygwin instead of
reimplementing them.
Add CrossBuildInfo.get_host_system to shorten the repeated the code in
the mesonlib.for_<platform> methods.
Diffstat (limited to 'mesonbuild/environment.py')
-rw-r--r-- | mesonbuild/environment.py | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/mesonbuild/environment.py b/mesonbuild/environment.py index df4d05b..099e5b9 100644 --- a/mesonbuild/environment.py +++ b/mesonbuild/environment.py @@ -345,13 +345,11 @@ class Environment: # static libraries, and executables. # Versioning is added to these names in the backends as-needed. cross = self.is_cross_build() - if (not cross and mesonlib.is_windows()) \ - or (cross and self.cross_info.has_host() and self.cross_info.config['host_machine']['system'] == 'windows'): + if mesonlib.for_windows(cross, self): self.exe_suffix = 'exe' self.object_suffix = 'obj' self.win_libdir_layout = True - elif (not cross and mesonlib.is_cygwin()) \ - or (cross and self.cross_info.has_host() and self.cross_info.config['host_machine']['system'] == 'cygwin'): + elif mesonlib.for_cygwin(cross, self): self.exe_suffix = 'exe' self.object_suffix = 'o' self.win_libdir_layout = True @@ -1039,6 +1037,12 @@ class CrossBuildInfo: def get_stdlib(self, language): return self.config['properties'][language + '_stdlib'] + def get_host_system(self): + "Name of host system like 'linux', or None" + if self.has_host(): + return self.config['host_machine']['system'] + return None + def get_properties(self): return self.config['properties'] |