0005-meson-try-iconv-in-libintl-lookup.patch 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. From fe7f54d4f339b7948c961b60729f620f2eaec716 Mon Sep 17 00:00:00 2001
  2. From: Jan200101 <sentrycraft123@gmail.com>
  3. Date: Tue, 23 May 2023 23:42:37 +0200
  4. Subject: [PATCH] meson: try iconv in libintl lookup
  5. MIME-Version: 1.0
  6. Content-Type: text/plain; charset=UTF-8
  7. Content-Transfer-Encoding: 8bit
  8. This was originally removed in !2734 but still appears to be required for
  9. some MinGW setups, such as the `x86_64-w64-mingw32.static` target in
  10. [mxe](https://github.com/mxe/mxe).
  11. Currently, this configuration fails the libintl internal assert on line
  12. 2128, as on this platform `ngettext()` is only found inside libiconv.
  13. This commit will look up iconv potentially twice, once as `libiconv` and
  14. potentially once as `libintl_iconv`. This is what the code did before
  15. !2734 landed, so it’s known to work reliably on a number of platforms.
  16. Upstream: https://gitlab.gnome.org/GNOME/glib/-/commit/a497d5be122f193dcf8679334308333bbbc14a71
  17. Signed-off-by: Thomas Devoogdt <thomas@devoogdt.com>
  18. ---
  19. meson.build | 13 +++++++++----
  20. 1 file changed, 9 insertions(+), 4 deletions(-)
  21. diff --git a/meson.build b/meson.build
  22. index de0bee5a3..653f9eddf 100644
  23. --- a/meson.build
  24. +++ b/meson.build
  25. @@ -2104,11 +2104,16 @@ if libintl.found()
  26. if cc.has_function('ngettext', dependencies : libintl, prefix: libintl_prefix)
  27. libintl_deps += [libintl]
  28. else
  29. - libintl_pthread = cc.find_library('pthread', required : false)
  30. - if libintl_pthread.found() and cc.has_function('ngettext', dependencies : [libintl, libintl_pthread], prefix: libintl_prefix)
  31. - libintl_deps += [libintl, libintl_pthread]
  32. + libintl_iconv = cc.find_library('iconv', required : false)
  33. + if libintl_iconv.found() and cc.has_function('ngettext', dependencies : [libintl, libintl_iconv])
  34. + libintl_deps += [libintl, libintl_iconv]
  35. else
  36. - libintl = disabler()
  37. + libintl_pthread = cc.find_library('pthread', required : false)
  38. + if libintl_pthread.found() and cc.has_function('ngettext', dependencies : [libintl, libintl_pthread], prefix: libintl_prefix)
  39. + libintl_deps += [libintl, libintl_pthread]
  40. + else
  41. + libintl = disabler()
  42. + endif
  43. endif
  44. endif
  45. endif
  46. --
  47. 2.34.1