package/mpd: fix iconv detection w/ libiconv installed

Fix build failures caused by meson failing to properly detect iconv() when
libiconv is installed and a missing link dependency.

Upstream pull request:
https://github.com/MusicPlayerDaemon/MPD/pull/1515

Fixes the following build failures:
http://autobuild.buildroot.net/results/7a0/7a0fe4e9248ed96a5c4934361de16e0b59a51d50/

Signed-off-by: Andreas Ziegler <br015@umbiko.net>
Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
This commit is contained in:
Andreas Ziegler 2022-04-28 08:10:31 +02:00 committed by Arnout Vandecappelle (Essensium/Mind)
parent 5dc0bfdb3b
commit 9b715b549c

View File

@ -0,0 +1,53 @@
From 3882a5a263caa681778a21b1f5f13a1b64536796 Mon Sep 17 00:00:00 2001
From: aeolio <git@aeolio.de>
Date: Wed, 20 Apr 2022 16:10:39 +0200
Subject: [PATCH] src/lib/icu: fix iconv() detection when libiconv is installed
Signed-off-by: aeolio <git@aeolio.de>
Upstream: https://github.com/MusicPlayerDaemon/MPD/pull/1515
Signed-off-by: Andreas Ziegler <br015@umbiko.net>
---
src/lib/icu/meson.build | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/src/lib/icu/meson.build b/src/lib/icu/meson.build
index 59215e704..972c1fda3 100644
--- a/src/lib/icu/meson.build
+++ b/src/lib/icu/meson.build
@@ -12,17 +12,23 @@ if is_windows
icu_sources += 'Win32.cxx'
endif
+iconv_dep = []
if icu_dep.found()
icu_sources += [
'Util.cxx',
'Init.cxx',
]
elif not get_option('iconv').disabled()
- have_iconv = compiler.has_function('iconv', prefix : '#include <iconv.h>')
- conf.set('HAVE_ICONV', have_iconv)
+ # an installed iconv library will make the builtin iconv() unavailable,
+ # so search for the library first and pass it as (possible) dependency
+ iconv_dep = compiler.find_library('libiconv', required: false)
+ have_iconv = compiler.has_function('iconv',
+ dependencies: iconv_dep,
+ prefix : '#include <iconv.h>')
if not have_iconv and get_option('iconv').enabled()
error('iconv() not available')
endif
+ conf.set('HAVE_ICONV', have_iconv)
endif
icu = static_library(
@@ -31,6 +37,7 @@ icu = static_library(
include_directories: inc,
dependencies: [
icu_dep,
+ iconv_dep,
fmt_dep,
],
)
--
2.34.1