2
1

0002-threads-use-forward-declarations-only-for-glibc.patch 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. Fix musl compile
  2. Downloaded from upstream commit
  3. https://git.gnome.org/browse/libxml2/commit/?id=fff8a6b87e05200a0ad0af6f86c2e859c7de9172
  4. Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de>
  5. ---
  6. From fff8a6b87e05200a0ad0af6f86c2e859c7de9172 Mon Sep 17 00:00:00 2001
  7. From: Michael Heimpold <mhei@heimpold.de>
  8. Date: Mon, 22 Dec 2014 11:12:12 +0800
  9. Subject: threads: use forward declarations only for glibc
  10. Fixes bug #704908
  11. The declarations of pthread functions, used to generate weak references
  12. to them, fail to suppress macros. Thus, if any pthread function has
  13. been provided as a macro, compiling threads.c will fail.
  14. This breaks on musl libc, which defines pthread_equal as a macro (in
  15. addition to providing the function, as required).
  16. Prevent the declarations for e.g. musl libc by refining the condition.
  17. The idea for this solution was borrowed from the alpine linux guys, see
  18. http://git.alpinelinux.org/cgit/aports/tree/main/libxml2/libxml2-pthread.patch
  19. Signed-off-by: Michael Heimpold <mhei@heimpold.de>
  20. diff --git a/threads.c b/threads.c
  21. index 8921204..78006a2 100644
  22. --- a/threads.c
  23. +++ b/threads.c
  24. @@ -47,7 +47,7 @@
  25. #ifdef HAVE_PTHREAD_H
  26. static int libxml_is_threaded = -1;
  27. -#ifdef __GNUC__
  28. +#if defined(__GNUC__) && defined(__GLIBC__)
  29. #ifdef linux
  30. #if (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) || (__GNUC__ > 3)
  31. extern int pthread_once (pthread_once_t *__once_control,
  32. @@ -89,7 +89,7 @@ extern int pthread_cond_signal ()
  33. __attribute((weak));
  34. #endif
  35. #endif /* linux */
  36. -#endif /* __GNUC__ */
  37. +#endif /* defined(__GNUC__) && defined(__GLIBC__) */
  38. #endif /* HAVE_PTHREAD_H */
  39. /*
  40. --
  41. cgit v0.10.2