From aad1458876e8a20739a7f2d21eec36ce2998681c Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Thu, 30 Jul 2020 16:40:11 -0700 Subject: [PATCH] mpd: fixup iconv support Removes liconv LDFLAG and fixes ICONV_FULL. Signed-off-by: Rosen Penev --- sound/mpd/Makefile | 6 +-- sound/mpd/patches/010-iconv.patch | 41 ++++++++++++++++++-- sound/mpd/patches/020-iconv-const.patch | 51 +++++++++++++++++++++++++ 3 files changed, 90 insertions(+), 8 deletions(-) create mode 100644 sound/mpd/patches/020-iconv-const.patch diff --git a/sound/mpd/Makefile b/sound/mpd/Makefile index 41dab43b5..00a4879ae 100644 --- a/sound/mpd/Makefile +++ b/sound/mpd/Makefile @@ -7,7 +7,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=mpd PKG_VERSION:=0.21.25 -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=https://www.musicpd.org/download/mpd/0.21/ @@ -97,10 +97,6 @@ define Package/mpd-avahi-service/conffiles /etc/avahi/services/mpd.service endef -TARGET_LDFLAGS += \ - -liconv \ - $(if $(CONFIG_USE_GLIBC),-lpthread) - ifeq ($(CONFIG_AUDIO_SUPPORT),y) TARGET_LDFLAGS += -Wl,-rpath-link=$(STAGING_DIR)/usr/lib/pulseaudio endif diff --git a/sound/mpd/patches/010-iconv.patch b/sound/mpd/patches/010-iconv.patch index 730b27108..c7dad5fd5 100644 --- a/sound/mpd/patches/010-iconv.patch +++ b/sound/mpd/patches/010-iconv.patch @@ -1,11 +1,46 @@ +From 90fcdb5b02e08b3faf2e321b081798cc18d35b15 Mon Sep 17 00:00:00 2001 +From: Rosen Penev +Date: Thu, 30 Jul 2020 14:34:07 -0700 +Subject: [PATCH] icu/meson: link against iconv when used externally + +This basically adds -liconv to LDFLAGS, fixing a linking issue when +iconv is missing in the libc. + +The previous commit fixed finding iconv but did not fix linking. + +Switched to using c_compiler for iconv. It seems compiler does not work +properly. + +Signed-off-by: Rosen Penev +--- + src/lib/icu/meson.build | 14 ++++++++++++-- + 1 file changed, 12 insertions(+), 2 deletions(-) + +diff --git a/src/lib/icu/meson.build b/src/lib/icu/meson.build +index bd6e30944..132e15b89 100644 --- a/src/lib/icu/meson.build +++ b/src/lib/icu/meson.build -@@ -18,7 +18,7 @@ if icu_dep.found() +@@ -18,8 +18,18 @@ if icu_dep.found() 'Init.cxx', ] elif not get_option('iconv').disabled() - have_iconv = compiler.has_function('iconv') -+ have_iconv = compiler.has_function('iconv', prefix : '#include ') - conf.set('HAVE_ICONV', have_iconv) +- conf.set('HAVE_ICONV', have_iconv) ++ have_iconv = c_compiler.has_header_symbol('iconv.h', 'iconv') ++ if have_iconv ++ libiconv = c_compiler.find_library('iconv') ++ conf.set('HAVE_ICONV', have_iconv) ++ libiconv_dep = static_library('iconv', icu_sources, include_directories: inc, dependencies: libiconv) ++ icu_dep = declare_dependency(link_with: libiconv_dep, dependencies: util_dep) ++ endif ++ if not have_iconv and c_compiler.has_function('iconv') ++ libiconv = [] ++ have_iconv = true ++ conf.set('HAVE_ICONV', have_iconv) ++ endif if not have_iconv and get_option('iconv').enabled() error('iconv() not available') + endif +-- +2.17.1 + diff --git a/sound/mpd/patches/020-iconv-const.patch b/sound/mpd/patches/020-iconv-const.patch new file mode 100644 index 000000000..82f19dd55 --- /dev/null +++ b/sound/mpd/patches/020-iconv-const.patch @@ -0,0 +1,51 @@ +From c2da1d47eeaf83d3683555b965a16654561f14b3 Mon Sep 17 00:00:00 2001 +From: Rosen Penev +Date: Thu, 30 Jul 2020 16:27:02 -0700 +Subject: [PATCH] icu: fix compilation with const char iconv + +libiconv uses const char. Test for it and use it properly to fix +compilation. + +Signed-off-by: Rosen Penev +--- + src/lib/icu/Converter.cxx | 2 +- + src/lib/icu/meson.build | 10 ++++++++++ + 2 files changed, 11 insertions(+), 1 deletion(-) + +diff --git a/src/lib/icu/Converter.cxx b/src/lib/icu/Converter.cxx +index b03543a82..4c459e57e 100644 +--- a/src/lib/icu/Converter.cxx ++++ b/src/lib/icu/Converter.cxx +@@ -83,7 +83,7 @@ DoConvert(iconv_t conv, const char *src) + { + // TODO: dynamic buffer? + char buffer[4096]; +- char *in = const_cast(src); ++ ICONV_CONST char *in = (ICONV_CONST char *)(src); + char *out = buffer; + size_t in_left = strlen(src); + size_t out_left = sizeof(buffer); +diff --git a/src/lib/icu/meson.build b/src/lib/icu/meson.build +index 132e15b89..ac7d1b72a 100644 +--- a/src/lib/icu/meson.build ++++ b/src/lib/icu/meson.build +@@ -30,6 +30,16 @@ elif not get_option('iconv').disabled() + have_iconv = true + conf.set('HAVE_ICONV', have_iconv) + endif ++ if have_iconv ++ iconvconsttest = '''#include ++size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft); ++''' ++ if c_compiler.compiles(iconvconsttest, dependencies : libiconv) ++ conf.set('ICONV_CONST', '') ++ else ++ conf.set('ICONV_CONST', 'const') ++ endif ++ endif + if not have_iconv and get_option('iconv').enabled() + error('iconv() not available') + endif +-- +2.17.1 +