package/harfbuzz: fix build without threads
authorFabrice Fontaine <fontaine.fabrice@gmail.com>
Sun, 15 Nov 2020 10:23:52 +0000 (11:23 +0100)
committerPeter Korsgaard <peter@korsgaard.com>
Mon, 16 Nov 2020 20:32:30 +0000 (21:32 +0100)
Fixes:
 - http://autobuild.buildroot.org/results/70c98e89b1d5e5b651d1f6928dc53f465103f57a

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
package/harfbuzz/0002-meson.build-check-for-pthread.h.patch [new file with mode: 0644]

diff --git a/package/harfbuzz/0002-meson.build-check-for-pthread.h.patch b/package/harfbuzz/0002-meson.build-check-for-pthread.h.patch
new file mode 100644 (file)
index 0000000..128876d
--- /dev/null
@@ -0,0 +1,49 @@
+From 96bbf3a3af45d86f790afdf91a6686c37421e92b Mon Sep 17 00:00:00 2001
+From: Fabrice Fontaine <fontaine.fabrice@gmail.com>
+Date: Sun, 15 Nov 2020 10:57:37 +0100
+Subject: [PATCH] meson.build: check for pthread.h
+
+Check for pthread.h otherwise the build will fail with some toolchains
+that have libphtread.so but not pthread.h:
+
+Run-time dependency threads found: YES
+
+../src/hb-mutex.hh:53:10: fatal error: pthread.h: No such file or directory
+ #include <pthread.h>
+          ^~~~~~~~~~~
+
+Moreover, fix detection of pthread fallback
+
+Fixes:
+ - http://autobuild.buildroot.org/results/70c98e89b1d5e5b651d1f6928dc53f465103f57a
+
+Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
+---
+ meson.build | 6 ++++--
+ 1 file changed, 4 insertions(+), 2 deletions(-)
+
+diff --git a/meson.build b/meson.build
+index bf3925db..6d263d48 100644
+--- a/meson.build
++++ b/meson.build
+@@ -284,13 +284,15 @@ endif
+ # threads
+ thread_dep = null_dep
+ if host_machine.system() != 'windows'
+-  thread_dep = dependency('threads', required: false)
++  if cpp.has_header('pthread.h')
++    thread_dep = dependency('threads', required: false)
++  endif
+   if thread_dep.found()
+     conf.set('HAVE_PTHREAD', 1)
+   else
+     check_headers += ['sched.h']
+-    check_funcs += ['sched_yield', {'link_with': 'rt'}]
++    check_funcs += [['sched_yield', {'link_with': 'rt'}]]
+   endif
+ endif
+-- 
+2.29.2
+