[OpenWrt-Devel] [PATCH] libiconv-stub: Only define libiconv_ under FreeBSD
Rosen Penev
rosenp at gmail.com
Tue Jun 18 23:58:15 EDT 2019
They cause compilation failures.
Backportewd from upstream libiconv.
Signed-off-by: Rosen Penev <rosenp at gmail.com>
---
package/libs/libiconv/Makefile | 2 +-
package/libs/libiconv/src/include/iconv.h | 16 +++++++++++++---
2 files changed, 14 insertions(+), 4 deletions(-)
diff --git a/package/libs/libiconv/Makefile b/package/libs/libiconv/Makefile
index 4d7dcd3498..6e5b687363 100644
--- a/package/libs/libiconv/Makefile
+++ b/package/libs/libiconv/Makefile
@@ -11,7 +11,7 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=libiconv
-PKG_RELEASE:=8
+PKG_RELEASE:=9
PKG_LICENSE:=LGPL-2.1
PKG_LICENSE_FILES:=LICENSE
diff --git a/package/libs/libiconv/src/include/iconv.h b/package/libs/libiconv/src/include/iconv.h
index 8767be42ee..24d06e4374 100644
--- a/package/libs/libiconv/src/include/iconv.h
+++ b/package/libs/libiconv/src/include/iconv.h
@@ -13,9 +13,19 @@ extern int _libiconv_version; /* Likewise */
typedef long iconv_t;
-#define iconv_open libiconv_open
-#define iconv libiconv
-#define iconv_close libiconv_close
+#if defined __FreeBSD__ && !defined __gnu_freebsd__
+/* GNU libiconv is the native FreeBSD iconv implementation since 2002.
+ It wants to define the symbols 'iconv_open', 'iconv', 'iconv_close'. */
+#define strong_alias(name, aliasname) _strong_alias(name, aliasname)
+#define _strong_alias(name, aliasname) \
+ extern __typeof (name) aliasname __attribute__ ((alias (#name)));
+#undef iconv_open
+#undef iconv
+#undef iconv_close
+strong_alias (libiconv_open, iconv_open)
+strong_alias (libiconv, iconv)
+strong_alias (libiconv_close, iconv_close)
+#endif
extern iconv_t
iconv_open(const char *tocode, const char *fromcode);
--
2.17.1
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel
More information about the openwrt-devel
mailing list