diff options
-rw-r--r-- | mesonbuild/backend/backends.py | 2 | ||||
-rw-r--r-- | mesonbuild/backend/ninjabackend.py | 2 | ||||
-rw-r--r-- | mesonbuild/compilers/c.py | 22 | ||||
-rw-r--r-- | mesonbuild/linkers.py | 4 | ||||
-rw-r--r-- | mesonbuild/mesonlib.py | 12 |
5 files changed, 30 insertions, 12 deletions
diff --git a/mesonbuild/backend/backends.py b/mesonbuild/backend/backends.py index 067b719..f899735 100644 --- a/mesonbuild/backend/backends.py +++ b/mesonbuild/backend/backends.py @@ -509,7 +509,7 @@ class Backend: # For 'automagic' deps: Boost and GTest. Also dependency('threads'). # pkg-config puts the thread flags itself via `Cflags:` if dep.need_threads(): - commands += compiler.thread_flags() + commands += compiler.thread_flags(self.environment) # Fortran requires extra include directives. if compiler.language == 'fortran': for lt in target.link_targets: diff --git a/mesonbuild/backend/ninjabackend.py b/mesonbuild/backend/ninjabackend.py index bcda603..954ead5 100644 --- a/mesonbuild/backend/ninjabackend.py +++ b/mesonbuild/backend/ninjabackend.py @@ -2430,7 +2430,7 @@ rule FORTRAN_DEP_HACK # pkg-config puts the thread flags itself via `Cflags:` for d in target.external_deps: if d.need_threads(): - commands += linker.thread_link_flags() + commands += linker.thread_link_flags(self.environment) # Only non-static built targets need link args and link dependencies if not isinstance(target, build.StaticLibrary): commands += target.link_args diff --git a/mesonbuild/compilers/c.py b/mesonbuild/compilers/c.py index 0f92e78..9c1d1fc 100644 --- a/mesonbuild/compilers/c.py +++ b/mesonbuild/compilers/c.py @@ -16,9 +16,11 @@ import subprocess, os.path, tempfile from .. import mlog from .. import coredata -from ..mesonlib import EnvironmentException, version_compare, Popen_safe, listify -from ..mesonlib import for_windows, for_darwin, for_cygwin from . import compilers +from ..mesonlib import ( + EnvironmentException, version_compare, Popen_safe, listify, + for_windows, for_darwin, for_cygwin, for_haiku, +) from .compilers import ( GCC_MINGW, @@ -281,12 +283,12 @@ class CCompiler(Compiler): # Add compile flags needed by dependencies args += d.get_compile_args() if d.need_threads(): - args += self.thread_flags() + args += self.thread_flags(env) if mode == 'link': # Add link flags needed to find dependencies args += d.get_link_args() if d.need_threads(): - args += self.thread_link_flags() + args += self.thread_link_flags(env) # Select a CRT if needed since we're linking if mode == 'link': args += self.get_linker_debug_crt_args() @@ -781,10 +783,14 @@ class CCompiler(Compiler): return [trial] return None - def thread_flags(self): + def thread_flags(self, env): + if for_haiku(self.is_cross, env): + return [] return ['-pthread'] - def thread_link_flags(self): + def thread_link_flags(self, env): + if for_haiku(self.is_cross, env): + return [] return ['-pthread'] def has_multi_arguments(self, args, env): @@ -1005,10 +1011,10 @@ class VisualStudioCCompiler(CCompiler): return [] # FIXME, no idea what these should be. - def thread_flags(self): + def thread_flags(self, env): return [] - def thread_link_flags(self): + def thread_link_flags(self, env): return [] def get_options(self): diff --git a/mesonbuild/linkers.py b/mesonbuild/linkers.py index de788b7..2333e27 100644 --- a/mesonbuild/linkers.py +++ b/mesonbuild/linkers.py @@ -48,7 +48,7 @@ class VisualStudioLinker(StaticLinker): def build_rpath_args(self, build_dir, from_dir, rpath_paths, build_rpath, install_rpath): return [] - def thread_link_flags(self): + def thread_link_flags(self, env): return [] def get_option_link_args(self, options): @@ -100,7 +100,7 @@ class ArLinker(StaticLinker): def get_always_args(self): return [] - def thread_link_flags(self): + def thread_link_flags(self, env): return [] def get_option_link_args(self, options): diff --git a/mesonbuild/mesonlib.py b/mesonbuild/mesonlib.py index 09b5d92..f10a138 100644 --- a/mesonbuild/mesonlib.py +++ b/mesonbuild/mesonlib.py @@ -292,6 +292,18 @@ def for_darwin(is_cross, env): return env.cross_info.config['host_machine']['system'] == 'darwin' return False +def for_haiku(is_cross, env): + """ + Host machine is Haiku? + + Note: 'host' is the machine on which compiled binaries will run + """ + if not is_cross: + return is_haiku() + elif env.cross_info.has_host(): + return env.cross_info.config['host_machine']['system'] == 'haiku' + return False + def exe_exists(arglist): try: p = subprocess.Popen(arglist, stdout=subprocess.PIPE, stderr=subprocess.PIPE) |