0001-fix-build-with-disable-threads.patch 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. From 26646028f79d7f3d857df9b46cd6d0285796c699 Mon Sep 17 00:00:00 2001
  2. From: Fabrice Fontaine <fontaine.fabrice@gmail.com>
  3. Date: Wed, 21 Nov 2018 22:31:09 +0100
  4. Subject: [PATCH] fix build with --disable-threads
  5. SDL_LinuxSetThreadPriority() has been added since version 2.0.9 and
  6. https://github.com/SDL-mirror/SDL/commit/f25a7fa870bdceb339e5105973f689606bcb9086
  7. However, this function is used in src/dynapi/SDL_dynapi_procs.h even
  8. when SDL_THREADS_DISABLED
  9. However, when SDL_THREADS_DISABLED is set, SDL_LinuxSetThreadPriority is
  10. not defined because thread/pthread/SDL_systhread.c is not built
  11. So check SDL_THREADS_DISABLED in addition to __LINUX__
  12. Fixes:
  13. - http://autobuild.buildroot.org/results/539cb9ab6c605dc6be73ebe90debab1a998f2451
  14. Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
  15. ---
  16. include/SDL_system.h | 4 ++--
  17. src/dynapi/SDL_dynapi_procs.h | 2 +-
  18. 2 files changed, 3 insertions(+), 3 deletions(-)
  19. diff --git a/include/SDL_system.h b/include/SDL_system.h
  20. index 4dc372d6b..0513d7fa5 100644
  21. --- a/include/SDL_system.h
  22. +++ b/include/SDL_system.h
  23. @@ -77,7 +77,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_DXGIGetOutputInfo( int displayIndex, int *a
  24. /* Platform specific functions for Linux */
  25. -#ifdef __LINUX__
  26. +#if defined(__LINUX__) && !defined(SDL_THREADS_DISABLED)
  27. /**
  28. \brief Sets the UNIX nice value for a thread, using setpriority() if possible, and RealtimeKit if available.
  29. @@ -86,7 +86,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_DXGIGetOutputInfo( int displayIndex, int *a
  30. */
  31. extern DECLSPEC int SDLCALL SDL_LinuxSetThreadPriority(Sint64 threadID, int priority);
  32. -#endif /* __LINUX__ */
  33. +#endif /* defined(__LINUX__) && !defined(SDL_THREADS_DISABLED) */
  34. /* Platform specific functions for iOS */
  35. #if defined(__IPHONEOS__) && __IPHONEOS__
  36. diff --git a/src/dynapi/SDL_dynapi_procs.h b/src/dynapi/SDL_dynapi_procs.h
  37. index c95cf708b..ee9bf60a6 100644
  38. --- a/src/dynapi/SDL_dynapi_procs.h
  39. +++ b/src/dynapi/SDL_dynapi_procs.h
  40. @@ -708,7 +708,7 @@ SDL_DYNAPI_PROC(SDL_bool,SDL_IsAndroidTV,(void),(),return)
  41. SDL_DYNAPI_PROC(double,SDL_log10,(double a),(a),return)
  42. SDL_DYNAPI_PROC(float,SDL_log10f,(float a),(a),return)
  43. SDL_DYNAPI_PROC(char*,SDL_GameControllerMappingForDeviceIndex,(int a),(a),return)
  44. -#ifdef __LINUX__
  45. +#if defined(__LINUX__) && !defined(SDL_THREADS_DISABLED)
  46. SDL_DYNAPI_PROC(int,SDL_LinuxSetThreadPriority,(Sint64 a, int b),(a,b),return)
  47. #endif
  48. SDL_DYNAPI_PROC(SDL_bool,SDL_HasAVX512F,(void),(),return)
  49. --
  50. 2.17.1