freeswitch-stable: backport iconv fixes
Backport iconv fixes from master. - Include nls.mk and remove the uclibc iconv hack. - The above change pointed to an issue with the unimrcp sed script. It is missing brackets, which causes follow-up breakage when APR_SETVAR is called, because the latter uses commas to separate its arguments - commas that TARGET_LDFLAGS contains when nls.mk is included. So add the missing brackets. - mod_gsmopen is unable to detect whether iconv's inbuf is const. Update the patch so the Makefile can pass this information on to mod_gsmopen. Signed-off-by: Sebastian Kemper <sebastian_ml@gmx.net>
This commit is contained in:
parent
278ca69386
commit
367854557b
2 changed files with 44 additions and 34 deletions
|
@ -239,6 +239,19 @@ PKG_CONFIG_DEPENDS:= \
|
||||||
|
|
||||||
include $(INCLUDE_DIR)/uclibc++.mk
|
include $(INCLUDE_DIR)/uclibc++.mk
|
||||||
include $(INCLUDE_DIR)/package.mk
|
include $(INCLUDE_DIR)/package.mk
|
||||||
|
# iconv support
|
||||||
|
include $(INCLUDE_DIR)/nls.mk
|
||||||
|
#######################################################
|
||||||
|
# mod_gsmopen can't detect if iconv's inbuf is const. #
|
||||||
|
# #
|
||||||
|
# musl uclibc #
|
||||||
|
# libiconv-stub - - #
|
||||||
|
# libiconv-full - const #
|
||||||
|
# #
|
||||||
|
#######################################################
|
||||||
|
ifeq ($(ICONV_FULL)$(CONFIG_USE_UCLIBC),1y)
|
||||||
|
TARGET_CFLAGS+=-DFS_STABLE_ICONV_INBUF_CONST
|
||||||
|
endif
|
||||||
|
|
||||||
FS_STABLE_PERL_FEED:=$(TOPDIR)/feeds/packages/lang/perl
|
FS_STABLE_PERL_FEED:=$(TOPDIR)/feeds/packages/lang/perl
|
||||||
|
|
||||||
|
@ -251,14 +264,6 @@ FS_STABLE_PERL_LIBS:=$(shell grep "^libs=" \
|
||||||
|
|
||||||
FS_STABLE_PYTHON_SITE_DIR:=$(FS_STABLE_LIB_DIR)/python$(PYTHON_VERSION)/site-packages
|
FS_STABLE_PYTHON_SITE_DIR:=$(FS_STABLE_LIB_DIR)/python$(PYTHON_VERSION)/site-packages
|
||||||
|
|
||||||
# musl and glibc include their own iconv, but uclibc does not
|
|
||||||
ifneq ($(CONFIG_USE_UCLIBC),)
|
|
||||||
TARGET_CPPFLAGS+= \
|
|
||||||
-I$(STAGING_DIR)/usr/lib/libiconv-full/include
|
|
||||||
TARGET_LDFLAGS += \
|
|
||||||
-L$(STAGING_DIR)/usr/lib/libiconv-full/lib
|
|
||||||
endif
|
|
||||||
|
|
||||||
define Download/files
|
define Download/files
|
||||||
define Download/$(1)
|
define Download/$(1)
|
||||||
FILE:=$(2)
|
FILE:=$(2)
|
||||||
|
@ -361,11 +366,11 @@ $(call Package/$(PKG_NAME)/Default)
|
||||||
USERID:=$(PRG_NAME)=372:$(PRG_NAME)=372
|
USERID:=$(PRG_NAME)=372:$(PRG_NAME)=372
|
||||||
DEPENDS:= \
|
DEPENDS:= \
|
||||||
$(CXX_DEPENDS) \
|
$(CXX_DEPENDS) \
|
||||||
|
$(ICONV_DEPENDS) \
|
||||||
+FS_STABLE_WITH_FREETYPE:libfreetype \
|
+FS_STABLE_WITH_FREETYPE:libfreetype \
|
||||||
+FS_STABLE_WITH_ODBC:unixodbc \
|
+FS_STABLE_WITH_ODBC:unixodbc \
|
||||||
+FS_STABLE_WITH_PGSQL:libpq \
|
+FS_STABLE_WITH_PGSQL:libpq \
|
||||||
+FS_STABLE_WITH_PNG:libpng \
|
+FS_STABLE_WITH_PNG:libpng \
|
||||||
+USE_UCLIBC:libiconv-full \
|
|
||||||
+libcurl \
|
+libcurl \
|
||||||
+libedit \
|
+libedit \
|
||||||
+libopenssl \
|
+libopenssl \
|
||||||
|
@ -911,7 +916,7 @@ define Build/Prepare
|
||||||
echo '#codecs/mod_yuv' >> $(PKG_BUILD_DIR)/modules.conf
|
echo '#codecs/mod_yuv' >> $(PKG_BUILD_DIR)/modules.conf
|
||||||
echo '#event_handlers/mod_event_test' >> $(PKG_BUILD_DIR)/modules.conf
|
echo '#event_handlers/mod_event_test' >> $(PKG_BUILD_DIR)/modules.conf
|
||||||
|
|
||||||
$(SED) 's|$(FS_STABLE_ANCHOR)|APR_SETVAR(LDFLAGS,$(FS_STABLE_APR_LIBS) $(TARGET_LDFLAGS))|' \
|
$(SED) 's|$(FS_STABLE_ANCHOR)|APR_SETVAR(LDFLAGS,[$(FS_STABLE_APR_LIBS) $(TARGET_LDFLAGS)])|' \
|
||||||
$(PKG_BUILD_DIR)/libs/unimrcp/build/acmacros/apr.m4
|
$(PKG_BUILD_DIR)/libs/unimrcp/build/acmacros/apr.m4
|
||||||
endef
|
endef
|
||||||
|
|
||||||
|
|
|
@ -1,62 +1,67 @@
|
||||||
--- a/src/mod/endpoints/mod_gsmopen/gsmopen_protocol.cpp
|
--- a/src/mod/endpoints/mod_gsmopen/gsmopen_protocol.cpp
|
||||||
+++ b/src/mod/endpoints/mod_gsmopen/gsmopen_protocol.cpp
|
+++ b/src/mod/endpoints/mod_gsmopen/gsmopen_protocol.cpp
|
||||||
@@ -2521,11 +2521,11 @@ int ucs2_to_utf8(private_t *tech_pvt, ch
|
@@ -104,6 +104,12 @@ int gettimeofday(struct timeval *tv, str
|
||||||
|
/***************/
|
||||||
|
#endif /* WIN32 */
|
||||||
|
|
||||||
|
+#if defined(FS_STABLE_ICONV_INBUF_CONST)
|
||||||
|
+#define ICONV_INBUF_TYPE const char **
|
||||||
|
+#else
|
||||||
|
+#define ICONV_INBUF_TYPE char **
|
||||||
|
+#endif
|
||||||
|
+
|
||||||
|
int gsmopen_serial_init(private_t *tech_pvt, int controldevice_speed)
|
||||||
|
{
|
||||||
|
if (!tech_pvt)
|
||||||
|
@@ -2521,11 +2527,7 @@ int ucs2_to_utf8(private_t *tech_pvt, ch
|
||||||
DEBUGA_GSMOPEN("1 ciao in=%s, inleft=%d, out=%s, outleft=%d, converted=%s, utf8_out=%s\n",
|
DEBUGA_GSMOPEN("1 ciao in=%s, inleft=%d, out=%s, outleft=%d, converted=%s, utf8_out=%s\n",
|
||||||
GSMOPEN_P_LOG, inbuf, (int) inbytesleft, outbuf, (int) outbytesleft, converted, utf8_out);
|
GSMOPEN_P_LOG, inbuf, (int) inbytesleft, outbuf, (int) outbytesleft, converted, utf8_out);
|
||||||
|
|
||||||
-#ifdef WIN32
|
-#ifdef WIN32
|
||||||
+#ifdef __UCLIBC__ // libiconv-full needs this conversion
|
- iconv_res = iconv(iconv_format, (const char **) &inbuf, &inbytesleft, &outbuf, &outbytesleft);
|
||||||
iconv_res = iconv(iconv_format, (const char **) &inbuf, &inbytesleft, &outbuf, &outbytesleft);
|
|
||||||
-#else // WIN32
|
-#else // WIN32
|
||||||
+#else
|
- iconv_res = iconv(iconv_format, &inbuf, &inbytesleft, &outbuf, &outbytesleft);
|
||||||
iconv_res = iconv(iconv_format, &inbuf, &inbytesleft, &outbuf, &outbytesleft);
|
|
||||||
-#endif // WIN32
|
-#endif // WIN32
|
||||||
+#endif
|
+ iconv_res = iconv(iconv_format, (ICONV_INBUF_TYPE)&inbuf, &inbytesleft, &outbuf, &outbytesleft);
|
||||||
if (iconv_res == (size_t) -1) {
|
if (iconv_res == (size_t) -1) {
|
||||||
DEBUGA_GSMOPEN("2 ciao in=%s, inleft=%d, out=%s, outleft=%d, converted=%s, utf8_out=%s\n",
|
DEBUGA_GSMOPEN("2 ciao in=%s, inleft=%d, out=%s, outleft=%d, converted=%s, utf8_out=%s\n",
|
||||||
GSMOPEN_P_LOG, inbuf, (int) inbytesleft, outbuf, (int) outbytesleft, converted, utf8_out);
|
GSMOPEN_P_LOG, inbuf, (int) inbytesleft, outbuf, (int) outbytesleft, converted, utf8_out);
|
||||||
@@ -2560,11 +2560,11 @@ int utf8_to_iso_8859_1(private_t *tech_p
|
@@ -2560,11 +2562,7 @@ int utf8_to_iso_8859_1(private_t *tech_p
|
||||||
|
|
||||||
DEBUGA_GSMOPEN("in=%s, inleft=%d, out=%s, outleft=%d, utf8_in=%s, iso_8859_1_out=%s\n",
|
DEBUGA_GSMOPEN("in=%s, inleft=%d, out=%s, outleft=%d, utf8_in=%s, iso_8859_1_out=%s\n",
|
||||||
GSMOPEN_P_LOG, inbuf, (int) inbytesleft, outbuf, (int) outbytesleft, utf8_in, iso_8859_1_out);
|
GSMOPEN_P_LOG, inbuf, (int) inbytesleft, outbuf, (int) outbytesleft, utf8_in, iso_8859_1_out);
|
||||||
-#ifdef WIN32
|
-#ifdef WIN32
|
||||||
+#ifdef __UCLIBC__
|
- iconv_res = iconv(iconv_format, (const char **) &inbuf, &inbytesleft, &outbuf, &outbytesleft);
|
||||||
iconv_res = iconv(iconv_format, (const char **) &inbuf, &inbytesleft, &outbuf, &outbytesleft);
|
|
||||||
-#else // WIN32
|
-#else // WIN32
|
||||||
+#else
|
- iconv_res = iconv(iconv_format, &inbuf, &inbytesleft, &outbuf, &outbytesleft);
|
||||||
iconv_res = iconv(iconv_format, &inbuf, &inbytesleft, &outbuf, &outbytesleft);
|
|
||||||
-#endif // WIN32
|
-#endif // WIN32
|
||||||
+#endif
|
+ iconv_res = iconv(iconv_format, (ICONV_INBUF_TYPE)&inbuf, &inbytesleft, &outbuf, &outbytesleft);
|
||||||
if (iconv_res == (size_t) -1) {
|
if (iconv_res == (size_t) -1) {
|
||||||
DEBUGA_GSMOPEN("cannot translate in iso_8859_1 error: %s (errno: %d)\n", GSMOPEN_P_LOG, strerror(errno), errno);
|
DEBUGA_GSMOPEN("cannot translate in iso_8859_1 error: %s (errno: %d)\n", GSMOPEN_P_LOG, strerror(errno), errno);
|
||||||
return -1;
|
return -1;
|
||||||
@@ -2597,11 +2597,11 @@ int iso_8859_1_to_utf8(private_t *tech_p
|
@@ -2597,11 +2595,7 @@ int iso_8859_1_to_utf8(private_t *tech_p
|
||||||
}
|
}
|
||||||
|
|
||||||
inbytesleft = strlen(iso_8859_1_in) * 2;
|
inbytesleft = strlen(iso_8859_1_in) * 2;
|
||||||
-#ifdef WIN32
|
-#ifdef WIN32
|
||||||
+#ifdef __UCLIBC__
|
- iconv_res = iconv(iconv_format, (const char **) &inbuf, &inbytesleft, &outbuf, &outbytesleft);
|
||||||
iconv_res = iconv(iconv_format, (const char **) &inbuf, &inbytesleft, &outbuf, &outbytesleft);
|
|
||||||
-#else // WIN32
|
-#else // WIN32
|
||||||
+#else
|
- iconv_res = iconv(iconv_format, &inbuf, &inbytesleft, &outbuf, &outbytesleft);
|
||||||
iconv_res = iconv(iconv_format, &inbuf, &inbytesleft, &outbuf, &outbytesleft);
|
|
||||||
-#endif // WIN32
|
-#endif // WIN32
|
||||||
+#endif
|
+ iconv_res = iconv(iconv_format, (ICONV_INBUF_TYPE)&inbuf, &inbytesleft, &outbuf, &outbytesleft);
|
||||||
if (iconv_res == (size_t) -1) {
|
if (iconv_res == (size_t) -1) {
|
||||||
DEBUGA_GSMOPEN("ciao in=%s, inleft=%d, out=%s, outleft=%d, utf8_out=%s\n",
|
DEBUGA_GSMOPEN("ciao in=%s, inleft=%d, out=%s, outleft=%d, utf8_out=%s\n",
|
||||||
GSMOPEN_P_LOG, inbuf, (int) inbytesleft, outbuf, (int) outbytesleft, utf8_out);
|
GSMOPEN_P_LOG, inbuf, (int) inbytesleft, outbuf, (int) outbytesleft, utf8_out);
|
||||||
@@ -2642,11 +2642,11 @@ int utf8_to_ucs2(private_t *tech_pvt, ch
|
@@ -2642,11 +2636,7 @@ int utf8_to_ucs2(private_t *tech_pvt, ch
|
||||||
|
|
||||||
DEBUGA_GSMOPEN("in=%s, inleft=%d, out=%s, outleft=%d, utf8_in=%s, converted=%s\n",
|
DEBUGA_GSMOPEN("in=%s, inleft=%d, out=%s, outleft=%d, utf8_in=%s, converted=%s\n",
|
||||||
GSMOPEN_P_LOG, inbuf, (int) inbytesleft, outbuf, (int) outbytesleft, utf8_in, converted);
|
GSMOPEN_P_LOG, inbuf, (int) inbytesleft, outbuf, (int) outbytesleft, utf8_in, converted);
|
||||||
-#ifdef WIN32
|
-#ifdef WIN32
|
||||||
+#ifdef __UCLIBC__
|
- iconv_res = iconv(iconv_format, (const char **) &inbuf, &inbytesleft, &outbuf, &outbytesleft);
|
||||||
iconv_res = iconv(iconv_format, (const char **) &inbuf, &inbytesleft, &outbuf, &outbytesleft);
|
|
||||||
-#else // WIN32
|
-#else // WIN32
|
||||||
+#else
|
- iconv_res = iconv(iconv_format, &inbuf, &inbytesleft, &outbuf, &outbytesleft);
|
||||||
iconv_res = iconv(iconv_format, &inbuf, &inbytesleft, &outbuf, &outbytesleft);
|
|
||||||
-#endif // WIN32
|
-#endif // WIN32
|
||||||
+#endif
|
+ iconv_res = iconv(iconv_format, (ICONV_INBUF_TYPE)&inbuf, &inbytesleft, &outbuf, &outbytesleft);
|
||||||
if (iconv_res == (size_t) -1) {
|
if (iconv_res == (size_t) -1) {
|
||||||
ERRORA("error: %s %d\n", GSMOPEN_P_LOG, strerror(errno), errno);
|
ERRORA("error: %s %d\n", GSMOPEN_P_LOG, strerror(errno), errno);
|
||||||
return -1;
|
return -1;
|
||||||
|
|
Loading…
Reference in a new issue