summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDylan Baker <dylan@pnwbakers.com>2017-11-20 10:20:27 -0800
committerDylan Baker <dylan@pnwbakers.com>2017-12-07 09:35:12 -0800
commitfc547ad05e5a8e650ae5bc2ecc7d40e4dbcc9f0f (patch)
tree2564b9e98b3a1c0c9ceb5ccc3db87fa69fdb5165
parent4ae0cadb7f951691e2913a660a61d024d04b5485 (diff)
downloadmeson-fc547ad05e5a8e650ae5bc2ecc7d40e4dbcc9f0f.tar.gz
haiku: do not add pthread arguments
Haiku has pthreads, but they are part of the standard C library, and do not need either special compiler or linker flags.
-rw-r--r--mesonbuild/backend/backends.py2
-rw-r--r--mesonbuild/backend/ninjabackend.py2
-rw-r--r--mesonbuild/compilers/c.py22
-rw-r--r--mesonbuild/linkers.py4
-rw-r--r--mesonbuild/mesonlib.py12
5 files changed, 30 insertions, 12 deletions
diff --git a/mesonbuild/backend/backends.py b/mesonbuild/backend/backends.py
index 067b71936..f899735ba 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 bcda603ed..954ead5f2 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 0f92e7880..9c1d1fcad 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 de788b7b6..2333e272b 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 09b5d9273..f10a1381e 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)