2
1

0002-src-lib-icu-fix-iconv-detection-when-libiconv-is-ins.patch 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. From 3882a5a263caa681778a21b1f5f13a1b64536796 Mon Sep 17 00:00:00 2001
  2. From: aeolio <git@aeolio.de>
  3. Date: Wed, 20 Apr 2022 16:10:39 +0200
  4. Subject: [PATCH] src/lib/icu: fix iconv() detection when libiconv is installed
  5. Signed-off-by: aeolio <git@aeolio.de>
  6. Upstream: https://github.com/MusicPlayerDaemon/MPD/pull/1515
  7. Signed-off-by: Andreas Ziegler <br015@umbiko.net>
  8. ---
  9. src/lib/icu/meson.build | 11 +++++++++--
  10. 1 file changed, 9 insertions(+), 2 deletions(-)
  11. diff --git a/src/lib/icu/meson.build b/src/lib/icu/meson.build
  12. index 59215e704..972c1fda3 100644
  13. --- a/src/lib/icu/meson.build
  14. +++ b/src/lib/icu/meson.build
  15. @@ -12,17 +12,23 @@ if is_windows
  16. icu_sources += 'Win32.cxx'
  17. endif
  18. +iconv_dep = []
  19. if icu_dep.found()
  20. icu_sources += [
  21. 'Util.cxx',
  22. 'Init.cxx',
  23. ]
  24. elif not get_option('iconv').disabled()
  25. - have_iconv = compiler.has_function('iconv', prefix : '#include <iconv.h>')
  26. - conf.set('HAVE_ICONV', have_iconv)
  27. + # an installed iconv library will make the builtin iconv() unavailable,
  28. + # so search for the library first and pass it as (possible) dependency
  29. + iconv_dep = compiler.find_library('libiconv', required: false)
  30. + have_iconv = compiler.has_function('iconv',
  31. + dependencies: iconv_dep,
  32. + prefix : '#include <iconv.h>')
  33. if not have_iconv and get_option('iconv').enabled()
  34. error('iconv() not available')
  35. endif
  36. + conf.set('HAVE_ICONV', have_iconv)
  37. endif
  38. icu = static_library(
  39. @@ -31,6 +37,7 @@ icu = static_library(
  40. include_directories: inc,
  41. dependencies: [
  42. icu_dep,
  43. + iconv_dep,
  44. fmt_dep,
  45. ],
  46. )
  47. --
  48. 2.34.1