From bd4d65615b3a5360d455b99e77bd113ad90f1539 Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Thu, 21 Apr 2016 09:17:11 +0200 Subject: [PATCH] w32: Replace libiconv DLL by iconv feature of libgpg-error. * configure.ac: Do nor require libiconv for W32. * common/utf8conv.c [W32]: Do not incluce iconv.h. Request libgpg-error iconv macros. (jnlib_iconv): Use ICONV_CONST macro. * build-aux/speedo/w32/inst.nsi [!WITH_GUI]: Do not install libiconv. * build-aux/speedo.mk (speedo_spkgs) [!WITH_GUI]: Likewise. Signed-off-by: Werner Koch --- build-aux/speedo.mk | 4 ++-- build-aux/speedo/w32/inst.nsi | 18 +++++++++--------- common/utf8conv.c | 16 ++++++++++++---- configure.ac | 4 +++- 4 files changed, 26 insertions(+), 16 deletions(-) diff --git a/build-aux/speedo.mk b/build-aux/speedo.mk index 7b29025a6..2812773c4 100644 --- a/build-aux/speedo.mk +++ b/build-aux/speedo.mk @@ -172,9 +172,9 @@ speedo_spkgs = \ ifeq ($(TARGETOS),w32) speedo_spkgs += \ - zlib bzip2 adns sqlite libiconv + zlib bzip2 adns sqlite ifeq ($(WITH_GUI),1) -speedo_spkgs += gettext +speedo_spkgs += gettext libiconv endif endif diff --git a/build-aux/speedo/w32/inst.nsi b/build-aux/speedo/w32/inst.nsi index a695d990a..3a2d5820b 100644 --- a/build-aux/speedo/w32/inst.nsi +++ b/build-aux/speedo/w32/inst.nsi @@ -633,11 +633,6 @@ Section "-libgpg-error" SEC_libgpg_error File include/gpg-error.h SectionEnd -Section "-libiconv" SEC_libiconv - SetOutPath "$INSTDIR\bin" - File bin/libiconv-2.dll -SectionEnd - Section "-zlib" SEC_zlib SetOutPath "$INSTDIR\bin" File bin/zlib1.dll @@ -701,6 +696,11 @@ Section "-gpgme" SEC_gpgme SectionEnd !ifdef WITH_GUI +Section "-libiconv" SEC_libiconv + SetOutPath "$INSTDIR\bin" + File bin/libiconv-2.dll +SectionEnd + Section "-gettext" SEC_gettext SetOutPath "$INSTDIR\bin" File bin/libintl-8.dll @@ -1054,6 +1054,10 @@ Section "-un.gettext" Delete "$INSTDIR\bin\libintl-8.dll" SectionEnd +Section "-un.libiconv" + Delete "$INSTDIR\bin\libiconv-2.dll" +SectionEnd + Section "-un.gpgme" Delete "$INSTDIR\bin\libgpgme-11.dll" Delete "$INSTDIR\bin\libgpgme-glib-11.dll" @@ -1097,10 +1101,6 @@ Section "-un.zlib" Delete "$INSTDIR\bin\zlib1.dll" SectionEnd -Section "-un.libiconv" - Delete "$INSTDIR\bin\libiconv-2.dll" -SectionEnd - Section "-un.libgpg-error" Delete "$INSTDIR\bin\libgpg-error-0.dll" Delete "$INSTDIR\lib\libgpg-error.imp" diff --git a/common/utf8conv.c b/common/utf8conv.c index 8a2cf8a20..83e6eae93 100644 --- a/common/utf8conv.c +++ b/common/utf8conv.c @@ -38,10 +38,17 @@ #include #endif #include -#ifndef HAVE_ANDROID_SYSTEM + +#if HAVE_W32_SYSTEM +# /* Tell libgpg-error to provide the iconv macros. */ +# define GPGRT_ENABLE_W32_ICONV_MACROS 1 +#elif HAVE_ANDROID_SYSTEM +# /* No iconv support. */ +#else # include #endif + #include "util.h" #include "common-defs.h" #include "i18n.h" @@ -244,8 +251,8 @@ set_native_charset (const char *newset) as Latin-1. This makes sense because many Unix system don't have their locale set up properly and thus would get annoying error messages and we have to handle all the "bug" reports. Latin-1 has - always been the character set used for 8 bit characters on Unix - systems. */ + traditionally been the character set used for 8 bit characters on + Unix systems. */ if ( !*newset || !ascii_strcasecmp (newset, "8859-1" ) || !ascii_strcasecmp (newset, "646" ) @@ -700,7 +707,8 @@ jnlib_iconv (jnlib_iconv_t cd, const char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft) { - return iconv ((iconv_t)cd, (char**)inbuf, inbytesleft, outbuf, outbytesleft); + return iconv ((iconv_t)cd, (ICONV_CONST char**)inbuf, inbytesleft, + outbuf, outbytesleft); } /* Wrapper function for iconv_close, required for W32 as we dlopen that diff --git a/configure.ac b/configure.ac index d959fc524..6bbb41f50 100644 --- a/configure.ac +++ b/configure.ac @@ -47,8 +47,9 @@ m4_define([mym4_version], m4_argn(4, mym4_verslist)) m4_define([mym4_revision], m4_argn(7, mym4_verslist)) m4_define([mym4_revision_dec], m4_argn(8, mym4_verslist)) m4_esyscmd([echo ]mym4_version[>VERSION]) -AC_INIT([mym4_package],[mym4_version], [http://bugs.gnupg.org]) +AC_INIT([mym4_package],[mym4_version], [https://bugs.gnupg.org]) +# Note that for Windows we require version 1.22 NEED_GPG_ERROR_VERSION=1.21 NEED_LIBGCRYPT_API=1 @@ -639,6 +640,7 @@ case "${host}" in we use a simplified version of gettext]) have_dosish_system=yes have_w32_system=yes + require_iconv=no run_tests=no use_ldapwrapper=no # Fixme: Do this only for CE. case "${host}" in