0003-meson.build-fix-build-without-threads.patch 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. From a7abe11105ac71081455fb4ff0400606bf1668e8 Mon Sep 17 00:00:00 2001
  2. From: Fabrice Fontaine <fontaine.fabrice@gmail.com>
  3. Date: Thu, 18 Mar 2021 09:00:23 +0100
  4. Subject: [PATCH] meson.build: fix build without threads
  5. Fix the following build failure with -Dsingle_threaded=true on embedded
  6. toolchains without pthread:
  7. FAILED: janet.p/meson-generated_.._janet.c.o
  8. /home/buildroot/autobuild/run/instance-3/output-1/host/bin/arm-linux-gcc -Ijanet.p -I. -I.. -I../src/include -fdiagnostics-color=always -pipe -Wall -Winvalid-pch -std=c99 -O3 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -Os -pthread -fvisibility=hidden -MD -MQ janet.p/meson-generated_.._janet.c.o -MF janet.p/meson-generated_.._janet.c.o.d -o janet.p/meson-generated_.._janet.c.o -c janet.c
  9. In file included from /home/buildroot/autobuild/run/instance-3/output-1/host/arm-buildroot-linux-uclibcgnueabihf/sysroot/usr/include/stdlib.h:24,
  10. from ../src/include/janet.h:300,
  11. from src/core/features.h:57:
  12. /home/buildroot/autobuild/run/instance-3/output-1/host/arm-buildroot-linux-uclibcgnueabihf/sysroot/usr/include/features.h:218:5: warning: #warning requested reentrant code, but thread support was disabled [-Wcpp]
  13. 218 | # warning requested reentrant code, but thread support was disabled
  14. | ^~~~~~~
  15. src/core/ev.c:39:10: fatal error: pthread.h: No such file or directory
  16. Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
  17. [Retrieved from:
  18. https://github.com/janet-lang/janet/commit/a7abe11105ac71081455fb4ff0400606bf1668e8]
  19. ---
  20. meson.build | 13 +++++++++----
  21. 1 file changed, 9 insertions(+), 4 deletions(-)
  22. diff --git a/meson.build b/meson.build
  23. index ea8c2f2e..d6c6c069 100644
  24. --- a/meson.build
  25. +++ b/meson.build
  26. @@ -60,7 +60,7 @@ conf.set('JANET_NO_SOURCEMAPS', not get_option('sourcemaps'))
  27. conf.set('JANET_NO_ASSEMBLER', not get_option('assembler'))
  28. conf.set('JANET_NO_PEG', not get_option('peg'))
  29. conf.set('JANET_NO_NET', not get_option('net'))
  30. -conf.set('JANET_NO_EV', not get_option('ev'))
  31. +conf.set('JANET_NO_EV', not get_option('ev') or get_option('single_threaded'))
  32. conf.set('JANET_REDUCED_OS', get_option('reduced_os'))
  33. conf.set('JANET_NO_TYPED_ARRAY', not get_option('typed_array'))
  34. conf.set('JANET_NO_INT_TYPES', not get_option('int_types'))
  35. @@ -173,9 +173,14 @@ janetc = custom_target('janetc',
  36. 'JANET_PATH', janet_path, 'JANET_HEADERPATH', header_path
  37. ])
  38. +janet_dependencies = [m_dep, dl_dep]
  39. +if not get_option('single_threaded')
  40. + janet_dependencies += thread_dep
  41. +endif
  42. +
  43. libjanet = library('janet', janetc,
  44. include_directories : incdir,
  45. - dependencies : [m_dep, dl_dep, thread_dep],
  46. + dependencies : janet_dependencies,
  47. version: meson.project_version(),
  48. soversion: version_parts[0] + '.' + version_parts[1],
  49. install : true)
  50. @@ -189,7 +194,7 @@ else
  51. endif
  52. janet_mainclient = executable('janet', janetc, mainclient_src,
  53. include_directories : incdir,
  54. - dependencies : [m_dep, dl_dep, thread_dep],
  55. + dependencies : janet_dependencies,
  56. c_args : extra_cflags,
  57. install : true)
  58. @@ -202,7 +207,7 @@ if meson.is_cross_build()
  59. endif
  60. janet_nativeclient = executable('janet-native', janetc, mainclient_src,
  61. include_directories : incdir,
  62. - dependencies : [m_dep, dl_dep, thread_dep],
  63. + dependencies : janet_dependencies,
  64. c_args : extra_native_cflags,
  65. native : true)
  66. else