gnupg (19 files)

cvs user wk cvs at cvs.gnupg.org
Thu Jan 20 12:34:10 CET 2005


    Date: Thursday, January 20, 2005 @ 12:42:05
  Author: wk
    Path: /cvs/gnupg/gnupg

Modified: ChangeLog NEWS README configure.ac doc/ChangeLog doc/README.W32
          doc/gnupg-w32.reg g10/ChangeLog g10/g10.c g10/gpgv.c g10/main.h
          g10/misc.c include/i18n.h scripts/mk-w32-dist
          scripts/w32installer.nsi util/ChangeLog util/argparse.c
          util/simple-gettext.c util/strgutil.c

* g10.c (i18n_init) [W32]: Pass registry key to gettext
initialization.
* gpgv.c (i18n_init) [W32]: Ditto.

* simple-gettext.c (set_gettext_file): Use MO files depending on
the installation directory.  Add new arg REGKEY.


--------------------------+
 ChangeLog                |    6 +
 NEWS                     |    9 ++
 README                   |    9 +-
 configure.ac             |    4 
 doc/ChangeLog            |    4 
 doc/README.W32           |    8 -
 doc/gnupg-w32.reg        |    8 -
 g10/ChangeLog            |   10 ++
 g10/g10.c                |   13 ---
 g10/gpgv.c               |   15 +--
 g10/main.h               |    3 
 g10/misc.c               |   59 +++++++++++++
 include/i18n.h           |    2 
 scripts/mk-w32-dist      |    7 +
 scripts/w32installer.nsi |  193 +++++++++++++++++++++++++++++----------------
 util/ChangeLog           |   13 +++
 util/argparse.c          |    2 
 util/simple-gettext.c    |   83 +++++++++++++------
 util/strgutil.c          |   47 +++++++++-
 19 files changed, 351 insertions(+), 144 deletions(-)


Index: gnupg/ChangeLog
diff -u gnupg/ChangeLog:1.235 gnupg/ChangeLog:1.236
--- gnupg/ChangeLog:1.235	Wed Jan 19 04:56:25 2005
+++ gnupg/ChangeLog	Thu Jan 20 12:42:03 2005
@@ -1,3 +1,7 @@
+2005-01-18  Werner Koch  <wk at g10code.com>
+
+	* configure.ac (HAVE_W32_SYSTEM): Define it.
+
 2005-01-18  David Shaw  <dshaw at grover.jabberwocky.com>
 
 	* NEWS: Note --rfc2440-text import/export-unusable-sigs and
@@ -8,6 +12,8 @@
 
 2005-01-17  Werner Koch  <wk at g10code.com>
 
+	* README: Updated for SHA1 checksums.
+
 	* configure.ac: Make --without-included-zlib work as
 	expected. Reported by Norihiko Murase.  Same for
 	--without-included-regex.
Index: gnupg/NEWS
diff -u gnupg/NEWS:1.227 gnupg/NEWS:1.228
--- gnupg/NEWS:1.227	Wed Jan 19 04:56:25 2005
+++ gnupg/NEWS	Thu Jan 20 12:42:03 2005
@@ -1,6 +1,15 @@
 Noteworthy changes in version 1.4.1
 -------------------------------------------------
 
+    * [W32] The algorithm for the default home directory changed:
+      First we look at the environment variable GNUPGHOME, if this one
+      is not set, we check whether the registry entry
+      HKCU\Software\GNU\GnuPG:HomeDir has been set and if this fails
+      we use a GnuPG directory below the standard application data
+      directory (APPDATA) of the current user. Only in the case that
+      this directory cannot be determined, the old default of c:\gnupg
+      will be used.  The option --homedir still overrides all of them.
+
     * New --rfc2440-text option which controls how text is handled in
       signatures.  This is in response to some problems seen with
       certain PGP/MIME mail clients and GnuPG version 1.4.0.  More
Index: gnupg/README
diff -u gnupg/README:1.91 gnupg/README:1.92
--- gnupg/README:1.91	Tue Dec 14 08:49:26 2004
+++ gnupg/README	Thu Jan 20 12:42:03 2005
@@ -54,7 +54,8 @@
        this.  Don't skip it - this is an important step!
 
     2) Unpack the tarball.  With GNU tar you can do it this way:
-       "tar xzvf gnupg-x.y.z.tar.gz"
+       "tar xzvf gnupg-x.y.z.tar.gz".  If got a bzip2 compressed
+       tarball you need to use: "tar xjvf gnupg-x.y.z.tar.bz2".
 
     3) "cd gnupg-x.y.z"
 
@@ -104,13 +105,13 @@
 
 
     b) If you don't have any of the above programs, you have to verify
-       the MD5 checksum:
+       the SHA1 checksum:
 
-	$ md5sum gnupg-x.y.z.tar.gz
+	$ sha1sum gnupg-x.y.z.tar.gz
 
        This should yield an output _similar_ to this:
 
-	fd9351b26b3189c1d577f0970f9dcadc  gnupg-x.y.z.tar.gz
+	fd9351b26b3189c1d577f0970f9dcadc1234abcd  gnupg-x.y.z.tar.gz
 
        Now check that this checksum is _exactly_ the same as the one
        published via the announcement list and probably via Usenet.
Index: gnupg/configure.ac
diff -u gnupg/configure.ac:1.127 gnupg/configure.ac:1.128
--- gnupg/configure.ac:1.127	Wed Jan 19 04:56:25 2005
+++ gnupg/configure.ac	Thu Jan 20 12:42:03 2005
@@ -19,7 +19,7 @@
 dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
 dnl
 dnl (Process this file with autoconf to produce a configure script.)
-dnlAC_REVISION($Revision: 1.127 $)dnl
+dnlAC_REVISION($Revision: 1.128 $)dnl
 
 AC_PREREQ(2.59)
 min_automake_version="1.9.3"
@@ -455,6 +455,8 @@
                   [because the Unix gettext has too much overhead on
                    MingW32 systems and these systems lack Posix functions,
                    we use a simplified version of gettext])
+        AC_DEFINE(HAVE_W32_SYSTEM,1,
+                  [Defined if we run on a W32 API based system])
         have_dosish_system=yes
         need_dlopen=no
         try_gettext="no"
Index: gnupg/doc/ChangeLog
diff -u gnupg/doc/ChangeLog:1.90 gnupg/doc/ChangeLog:1.91
--- gnupg/doc/ChangeLog:1.90	Thu Dec 16 11:13:02 2004
+++ gnupg/doc/ChangeLog	Thu Jan 20 12:42:03 2005
@@ -1,3 +1,7 @@
+2005-01-18  Werner Koch  <wk at g10code.com>
+
+	* gnupg-w32.reg: Remove the entry for the home directory.
+
 2004-12-16  Werner Koch  <wk at g10code.com>
 
 	* TRANSLATE: Add a note on how to send translations.
Index: gnupg/doc/README.W32
diff -u gnupg/doc/README.W32:1.4 gnupg/doc/README.W32:1.5
--- gnupg/doc/README.W32:1.4	Fri Nov 15 05:15:39 2002
+++ gnupg/doc/README.W32	Thu Jan 20 12:42:03 2005
@@ -7,6 +7,9 @@
 particular the list gnupg-users at gnupg.org might be useful to answer
 questions - but please read the FAQ first.
 
+Note: Due to the use of the NSIS installer, the information below are
+mostly out of date.
+
 Installation instructions:
 --------------------------
  1. Unpack the ZIP archive (alright, you already did this).
@@ -40,11 +43,6 @@
      (Example:	"copy fr.mo c:\gnu\locale\fr\gnupg.mo")
   4. Done.
 
-Currently we only support the Codepages 437, 850 und Latin1.  If you have
-problems, either delete the gnupg.mo file or don't set the environment
-variable
-
-
 
 How to build it from the source:
 --------------------------------
Index: gnupg/doc/gnupg-w32.reg
diff -u gnupg/doc/gnupg-w32.reg:1.3 gnupg/doc/gnupg-w32.reg:1.4
--- gnupg/doc/gnupg-w32.reg:1.3	Mon May 26 15:34:42 2003
+++ gnupg/doc/gnupg-w32.reg	Thu Jan 20 12:42:03 2005
@@ -1,13 +1,5 @@
 REGEDIT4
 
-[HKEY_LOCAL_MACHINE\Software\GNU]
-
-[HKEY_LOCAL_MACHINE\Software\GNU\GNUPG]
-
-[HKEY_LOCAL_MACHINE\Software\GNU\GNUPG]
-"HomeDir"="C:\\GnuPG"
-"gpgProgram"="C:\\GnuPG\\gpg.exe"
-
 
 [HKEY_CURRENT_USER\Control Panel\Mingw32]
 
Index: gnupg/g10/ChangeLog
diff -u gnupg/g10/ChangeLog:1.681 gnupg/g10/ChangeLog:1.682
--- gnupg/g10/ChangeLog:1.681	Tue Jan 18 10:51:58 2005
+++ gnupg/g10/ChangeLog	Thu Jan 20 12:42:03 2005
@@ -1,5 +1,15 @@
+2005-01-20  Werner Koch  <wk at g10code.com>
+
+	* g10.c (i18n_init) [W32]: Pass registry key to gettext
+	initialization.
+	* gpgv.c (i18n_init) [W32]: Ditto.
+
 2005-01-18  Werner Koch  <wk at g10code.com>
 
+	* misc.c (default_homedir): New.  Taken from gnupg 1.9.15.
+	* g10.c (main): Use it.
+	* gpgv.c (main): Ditto.
+
 	* keylist.c (public_key_list): Do a trustdb staleness check before
 	opening the keyring.
 	(secret_key_list): Ditto.
Index: gnupg/g10/g10.c
diff -u gnupg/g10/g10.c:1.296 gnupg/g10/g10.c:1.297
--- gnupg/g10/g10.c:1.296	Thu Jan  6 05:44:38 2005
+++ gnupg/g10/g10.c	Thu Jan 20 12:42:03 2005
@@ -1,6 +1,6 @@
 /* g10.c - The GnuPG utility (main for gpg)
  * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003
- *               2004 Free Software Foundation, Inc.
+ *               2004, 2005 Free Software Foundation, Inc.
  *
  * This file is part of GnuPG.
  *
@@ -839,7 +839,7 @@
 i18n_init(void)
 {
 #ifdef USE_SIMPLE_GETTEXT
-    set_gettext_file( PACKAGE );
+    set_gettext_file (PACKAGE, "Software\\GNU\\GnuPG");
 #else
 #ifdef ENABLE_NLS
     setlocale( LC_ALL, "" );
@@ -1673,14 +1673,7 @@
     set_screen_dimensions();
     opt.keyid_format=KF_SHORT;
     opt.rfc2440_text=1;
-#if defined (_WIN32)
-    set_homedir ( read_w32_registry_string( NULL,
-                                    "Software\\GNU\\GnuPG", "HomeDir" ));
-#else
-    set_homedir ( getenv("GNUPGHOME") );
-#endif
-    if( !*opt.homedir )
-	set_homedir ( GNUPG_HOMEDIR );
+    set_homedir ( default_homedir () );
 
 #ifdef ENABLE_CARD_SUPPORT
 # ifdef _WIN32
Index: gnupg/g10/gpgv.c
diff -u gnupg/g10/gpgv.c:1.25 gnupg/g10/gpgv.c:1.26
--- gnupg/g10/gpgv.c:1.25	Wed Nov 24 06:25:03 2004
+++ gnupg/g10/gpgv.c	Thu Jan 20 12:42:03 2005
@@ -1,5 +1,6 @@
 /* gpgv.c - The GnuPG signature verify utility
- * Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+ * Copyright (C) 1998, 1999, 2000, 2001, 2002,
+ *               2005 Free Software Foundation, Inc.
  *
  * This file is part of GnuPG.
  *
@@ -112,7 +113,7 @@
 i18n_init(void)
 {
 #ifdef USE_SIMPLE_GETTEXT
-    set_gettext_file( PACKAGE );
+    set_gettext_file (PACKAGE, "Software\\GNU\\GnuPG");
 #else
 #ifdef ENABLE_NLS
     setlocale( LC_ALL, "" );
@@ -141,14 +142,8 @@
     opt.trust_model = TM_ALWAYS;
     opt.batch = 1;
 
-#if defined (_WIN32)
-    opt.homedir = read_w32_registry_string( NULL, "Software\\GNU\\GnuPG", "HomeDir" );
-#else
-    opt.homedir = getenv("GNUPGHOME");
-#endif
-    if( !opt.homedir || !*opt.homedir ) {
-	opt.homedir = GNUPG_HOMEDIR;
-    }
+    opt.homedir = default_homedir ();
+
     tty_no_terminal(1);
     tty_batchmode(1);
     disable_dotlock();
Index: gnupg/g10/main.h
diff -u gnupg/g10/main.h:1.123 gnupg/g10/main.h:1.124
--- gnupg/g10/main.h:1.123	Thu Oct 14 09:11:56 2004
+++ gnupg/g10/main.h	Thu Jan 20 12:42:03 2005
@@ -122,6 +122,9 @@
 int parse_options(char *str,unsigned int *options,
 		  struct parse_options *opts,int noisy);
 
+char *default_homedir (void);
+
+
 /*-- helptext.c --*/
 void display_online_help( const char *keyword );
 
Index: gnupg/g10/misc.c
diff -u gnupg/g10/misc.c:1.63 gnupg/g10/misc.c:1.64
--- gnupg/g10/misc.c:1.63	Wed Nov  3 21:35:28 2004
+++ gnupg/g10/misc.c	Thu Jan 20 12:42:03 2005
@@ -1,6 +1,6 @@
 /* misc.c -  miscellaneous functions
  * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003,
- *               2004 Free Software Foundation, Inc.
+ *               2004, 2005 Free Software Foundation, Inc.
  *
  * This file is part of GnuPG.
  *
@@ -40,7 +40,19 @@
 #ifdef _WIN32
 #include <time.h>
 #include <process.h>
+#include <windows.h> 
+#include <shlobj.h>
+#ifndef CSIDL_APPDATA
+#define CSIDL_APPDATA 0x001a
 #endif
+#ifndef CSIDL_LOCAL_APPDATA
+#define CSIDL_LOCAL_APPDATA 0x001c
+#endif
+#ifndef CSIDL_FLAG_CREATE
+#define CSIDL_FLAG_CREATE 0x8000
+#endif
+#endif /*_WIN32*/
+
 #include "util.h"
 #include "main.h"
 #include "photoid.h"
@@ -49,6 +61,8 @@
 #include "cardglue.h"
 
 
+
+
 #ifdef ENABLE_SELINUX_HACKS
 /* A object and a global variable to keep track of files marked as
    secured. */
@@ -1002,3 +1016,46 @@
 
   return 1;
 }
+
+
+/* Set up the default home directory.  The usual --homedir option
+   should be parsed later. */
+char *
+default_homedir (void)
+{
+  char *dir;
+
+  dir = getenv("GNUPGHOME");
+#ifdef HAVE_W32_SYSTEM
+  if (!dir || !*dir)
+    dir = read_w32_registry_string (NULL, "Software\\GNU\\GnuPG", "HomeDir");
+  if (!dir || !*dir)
+    {
+      char path[MAX_PATH];
+      
+      /* It might be better to use LOCAL_APPDATA because this is
+         defined as "non roaming" and thus more likely to be kept
+         locally.  For private keys this is desired.  However, given
+         that many users copy private keys anyway forth and back,
+         using a system roaming serives might be better than to let
+         them do it manually.  A security conscious user will anyway
+         use the registry entry to have better control.  */
+      if (SHGetFolderPath(NULL, CSIDL_APPDATA|CSIDL_FLAG_CREATE, 
+                          NULL, 0, path) >= 0) 
+        {
+          char *tmp = xmalloc (strlen (path) + 6 +1);
+          strcpy (stpcpy (tmp, path), "\\gnupg");
+          dir = tmp;
+          
+          /* Try to create the directory if it does not yet
+             exists.  */
+          if (access (dir, F_OK))
+            CreateDirectory (dir, NULL);
+        }
+    }
+#endif /*HAVE_W32_SYSTEM*/
+  if (!dir || !*dir)
+    dir = GNUPG_HOMEDIR;
+
+  return dir;
+}
Index: gnupg/include/i18n.h
diff -u gnupg/include/i18n.h:1.10 gnupg/include/i18n.h:1.11
--- gnupg/include/i18n.h:1.10	Sat May 24 18:40:46 2003
+++ gnupg/include/i18n.h	Thu Jan 20 12:42:03 2005
@@ -22,7 +22,7 @@
 #define G10_I18N_H
 
 #ifdef USE_SIMPLE_GETTEXT
-int set_gettext_file( const char *filename );
+int set_gettext_file( const char *filename, const char *regkey );
 const char *gettext( const char *msgid );
 
 #define _(a) gettext (a)
Index: gnupg/scripts/mk-w32-dist
diff -u gnupg/scripts/mk-w32-dist:1.14 gnupg/scripts/mk-w32-dist:1.15
--- gnupg/scripts/mk-w32-dist:1.14	Mon Jan 17 11:19:57 2005
+++ gnupg/scripts/mk-w32-dist	Thu Jan 20 12:42:02 2005
@@ -96,8 +96,13 @@
 done
 
 if makensis -version >/dev/null 2>&1 ; then
+  echo "invokin installer as:"
+  echo makensis -v3 -nocd -DVERSION="${version}" \
+           -DPROD_VERSION="${prod_version}" \
+           -DGNUPG_SRCDIR="${srcdir}" ${srcdir}/scripts/w32installer.nsi
   makensis -v3 -nocd -DVERSION="${version}" \
-           -DPROD_VERSION="${prod_version}" ${srcdir}/scripts/w32installer.nsi
+           -DPROD_VERSION="${prod_version}" \
+           -DGNUPG_SRCDIR="${srcdir}" ${srcdir}/scripts/w32installer.nsi
   echo "Installer created" >&2
 else
   zip -9 "gnupg-w32cli-${version}.zip" *
Index: gnupg/scripts/w32installer.nsi
diff -u gnupg/scripts/w32installer.nsi:1.2 gnupg/scripts/w32installer.nsi:1.3
--- gnupg/scripts/w32installer.nsi:1.2	Mon Jan 17 11:19:57 2005
+++ gnupg/scripts/w32installer.nsi	Thu Jan 20 12:42:02 2005
@@ -1,4 +1,5 @@
-; w32installer.nsi - W32 Installer definition      -*- lisp -*-
+; w32installer.nsi                         -*- mode: lisp; coding: latin-1; -*-
+;                   W32 Installer script
 ; Copyright (C) 2005 Free Software Foundation, Inc.
 ;
 ; This file is free software; as a special exception the author gives
@@ -17,11 +18,8 @@
 ; TODO:
 ; - Display credit for the installer
 ; - Provide the location of the corresponding source
-; - Check for iconv.dll and optionalkly install or download it.
-; - Allow inclusion of the source into the installer.
 ; - Translate all strings
-; - Setup the home directory and check for old (c:/gnupg located)
-;   versions of the program
+
 
 ; We use the modern UI.
 !include "MUI.nsh"
@@ -35,11 +33,10 @@
 
 InstallDir "$PROGRAMFILES\GNU\GnuPG"
 
-InstallDirRegKey HKCU "Software\GNU\GnuPG" ""
+InstallDirRegKey HKLM "Software\GNU\GnuPG" "Install Directory"
 
 SetCompressor lzma
 
-ReserveFile "COPYING.txt"
 
 VIProductVersion "${PROD_VERSION}"
 VIAddVersionKey "ProductName" "GNU Privacy Guard (${VERSION})"
@@ -62,7 +59,7 @@
 ; Interface Settings
 ; ------------------
 
-!define MUI_ABORTWARNING
+;;;!define MUI_ABORTWARNING
 !define MUI_FINISHPAGE_NOAUTOCLOSE
 !define MUI_UNFINISHPAGE_NOAUTOCLOSE
 
@@ -95,15 +92,18 @@
 
 !insertmacro MUI_PAGE_LICENSE "COPYING.txt"
 
+;;Page custom PageSelectOptions
 
 !insertmacro MUI_PAGE_COMPONENTS
+
 !insertmacro MUI_PAGE_DIRECTORY
 !insertmacro MUI_PAGE_INSTFILES
 
 !define MUI_FINISHPAGE_SHOWREADME "README.txt"
 !define MUI_FINISHPAGE_SHOWREADME_TEXT "$(T_ShowReadme)"
-!define MUI_FINISHPAGE_LINK "Goto the GnuPG website"
-!define MUI_FINISHPAGE_LINK_LOCATION "http://www.gnupg.org"
+!define MUI_FINISHPAGE_LINK \
+  "Visit the GnuPG website for latest news and support"
+!define MUI_FINISHPAGE_LINK_LOCATION "http://www.gnupg.org/"
 !insertmacro MUI_PAGE_FINISH
 
   
@@ -122,9 +122,17 @@
 ; Installer Sections
 ; ------------------
 
+
+
 ;InstType "full"
 ;InstType "minimal"
 
+!insertmacro MUI_RESERVEFILE_LANGDLL
+;;!insertmacro MUI_RESERVEFILE_INSTALLOPTIONS
+;;ReserveFile "w32inst-opt.ini" 
+ReserveFile "COPYING.txt"
+
+
 ;----------------------
 Section "Base" SecBase
 ;  SectionIn 1 2 RO
@@ -132,26 +140,41 @@
 
   SetOutPath "$INSTDIR"
 
-  File "README.txt"
-  File "README.W32"
-  File "COPYING.txt"
   File "gpg.exe"
   File "gpgkeys_finger.exe"
   File "gpgkeys_hkp.exe"
   File "gpgkeys_http.exe"
   File "gpgkeys_ldap.exe"
-  File "*.mo"
 
-  WriteRegStr HKCU "Software\GNU\GnuPG" "" $INSTDIR
+  SetOutPath "$INSTDIR\Doc"
+
+  File "README.txt"
+  File "README.W32"
+  File "COPYING.txt"
+
+  Call InstallIconv
+
+  WriteRegStr HKLM "Software\GNU\GnuPG" "Install Directory" $INSTDIR
 
   WriteUninstaller "$INSTDIR\Uninstall.exe"
   
 SectionEnd ; Section Base
 
+;----------------------
+Section "NLS" SecNLS
+;  SectionIn 1
+
+  SetOutPath "$INSTDIR\gnupg.nls"
+
+  File "*.mo"
+
+SectionEnd ; Section NLS
+
 ;------------------------
 Section "Tools" SecTools
 ;  SectionIn 1
 
+  SetOutPath "$INSTDIR"
   File "gpgsplit.exe"
   File "gpgv.exe"
 
@@ -161,6 +184,8 @@
 Section "Documentation" SecDoc
 ;  SectionIn 1
 
+  SetOutPath "$INSTDIR\Doc"
+
   File "gnupg.man"
   File "gpg.man"
   File "gpgv.man"
@@ -174,76 +199,52 @@
 !ifdef WITH_SOURCE
 Section "Source" SecSource
 
-   ; Note that we include the uncompressed tarball because this allows
-   ; far better compression results for the distribution.  We might
-   ; want to compress it again after installation.
-   File "gnupg-1.4.0.tar"
+  SetOutPath "$INSTDIR\Src"
+
+  ; Note that we include the uncompressed tarball because this allows
+  ; far better compression results for the distribution.  We might
+  ; want to compress it again after installation.
+  File "gnupg-1.4.0.tar"
 
 SectionEnd ; Section Source
 !endif
 
 
-;----------------------
-Section "-Finish" 
-
-  ClearErrors
-  GetDllVersion "iconv.dll" $R0 $R1
-  IfErrors 0 +3
-    MessageBox MB_OK \
-       "iconv.dll is not installed.$\r$\n \
-        It is highy suggested to install  \
-        this DLL to help with character set conversion.$\r$\n$\r$\n \
-        See http://www.gnupg.org/download/iconv.html  for instructions."
-    Return
-
-  IntOp $R2 $R0 / 0x00010000
-  IntOp $R3 $R0 & 0x0000FFFF
-  IntOp $R4 $R1 / 0x00010000
-  IntOp $R5 $R1 & 0x0000FFFF
-  StrCpy $0 "$R2.$R3.$R4.$R5"
-
-  DetailPrint "iconv.dll version is $0"
-
-  IntCmp $R2 1 0 IconvTooOld
-  IntCmp $R3 9 0 IconvTooOld
-  goto +3
- IconvTooOld:
-    MessageBox MB_OK \
-      "The installed iconv.dll is too old.$\r$\n \
-       We require at least version 1.9.0.0  (installed: $0).$\r$\n \
-       It is highly suggested to install an updated DLL to help  \
-       with character set conversion.$\r$\n$\r$\n \
-       See http://www.gnupg.org/download/iconv.html  for instructions."
-
-
-SectionEnd
-
-
 ;------------------
 Section "Uninstall"
 
-  Delete "$INSTDIR\README.txt"
-  Delete "$INSTDIR\README.W32"
-  Delete "$INSTDIR\COPYING.txt"
   Delete "$INSTDIR\gpg.exe"
   Delete "$INSTDIR\gpgkeys_finger.exe"
   Delete "$INSTDIR\gpgkeys_hkp.exe"
   Delete "$INSTDIR\gpgkeys_http.exe"
   Delete "$INSTDIR\gpgkeys_ldap.exe"
-  Delete "$INSTDIR\*.mo"
+
+  Delete "$INSTDIR\Doc\README.txt"
+  Delete "$INSTDIR\Doc\README.W32"
+  Delete "$INSTDIR\Doc\COPYING.txt"
+
+  Delete "$INSTDIR\iconv.dll"
+
+  Delete "$INSTDIR\gnupg.nls\*.mo"
+
   Delete "$INSTDIR\gpgsplit.exe"
   Delete "$INSTDIR\gpgv.exe"
-  Delete "$INSTDIR\gnupg.man"
-  Delete "$INSTDIR\gpg.man"
-  Delete "$INSTDIR\gpgv.man"
-  Delete "$INSTDIR\NEWS.txt"
-  Delete "$INSTDIR\FAQ.txt"
+
+  Delete "$INSTDIR\Doc\gnupg.man"
+  Delete "$INSTDIR\Doc\gpg.man"
+  Delete "$INSTDIR\Doc\gpgv.man"
+  Delete "$INSTDIR\Doc\NEWS.txt"
+  Delete "$INSTDIR\Doc\FAQ.txt"
 
   Delete "$INSTDIR\Uninstall.exe"
 
+  RMDir "$INSTDIR\Doc"
+  RMDir "$INSTDIR\Src"
+  RMDir "$INSTDIR\gnupg.nls"
   RMDir "$INSTDIR"
 
-  DeleteRegKey /ifempty HKCU "Software\GNU\GnuPG"
+  DeleteRegValue HKLM "Software\GNU\GnuPG" "Install Directory"
+  DeleteRegKey /ifempty HKLM "Software\GNU\GnuPG"
 
 SectionEnd ; Uninstall
 
@@ -256,6 +257,9 @@
 
   !insertmacro MUI_LANGDLL_DISPLAY
 
+;  !insertmacro MUI_INSTALLOPTIONS_EXTRACT_AS \
+;               "${GNUPG_SRCDIR}/scripts/w32inst-opt.ini" "w32inst-opt.ini"
+
 FunctionEnd 
 
 
@@ -266,6 +270,53 @@
 FunctionEnd
 
 
+;;Function PageSelectOptions
+;;
+;;  ; Setup a default for the langage to install.  Take it form the registry 
+;;
+;;  !insertmacro MUI_HEADER_TEXT "Install Options" "Languages"
+;;  !insertmacro MUI_INSTALLOPTIONS_DISPLAY "w32inst-opt.ini"
+;;
+;;  ; Save away the language to install
+;;
+;;FunctionEnd
+;;
+
+
+; Install iconv.dll if it has not been installed on the system.
+Function InstallIconv
+
+  ; First delete a iconv DLL already installed in the target directory.
+  ; This is required to detect a meanwhile globally installed dll.
+  Delete "$INSTDIR\iconv.dll"
+  ClearErrors
+  GetDllVersion "iconv.dll" $R0 $R1
+  IfErrors 0 +3
+    DetailPrint "iconv.dll is not installed."
+    goto InstallIconv
+
+  IntOp $R2 $R0 / 0x00010000
+  IntOp $R3 $R0 & 0x0000FFFF
+  IntOp $R4 $R1 / 0x00010000
+  IntOp $R5 $R1 & 0x0000FFFF
+  StrCpy $0 "$R2.$R3.$R4.$R5"
+
+  DetailPrint "iconv.dll version is $0"
+
+  IntCmp $R2 1 0 IconvTooOld
+  IntCmp $R3 9 0 IconvTooOld
+  return
+
+ IconvTooOld:
+    DetailPrint "The installed iconv.dll is too old."
+
+ InstallIconv:
+  SetOutPath "$INSTDIR"
+  File "iconv.dll"
+
+FunctionEnd
+
+
 ; ------------
 ; Descriptions
 ; ------------
@@ -275,10 +326,12 @@
   "GnuPG is GNU's tool for secure communication and data storage. \
   It can be used to encrypt data and to create digital signatures. \
   It includes an advanced key management facility and is compliant \
-  with the proposed OpenPGP Internet standard as described in RFC2440."
+  with the proposed OpenPGP Internet standard as described in RFC2440. \
+  \r\n\r\nThis is GnuPG version ${VERSION}"
 LangString T_About ${LANG_GERMAN} \
   "GnuPG is das Werzeug aus dem GNU Projekt zur sicheren Kommunikation \
-   sowie zum sicheren Speichern von Daten."
+   sowie zum sicheren Speichern von Daten. \
+   \r\n\r\nThis is GnuPG version ${VERSION}"
 LangString T_ShowReadme ${LANG_ENGLISH} "Show the README file"
 LangString T_ShowReadme ${LANG_GERMAN} "Die README Datei anzeigen"
 
@@ -288,6 +341,11 @@
 LangString DESC_SecBase ${LANG_GERMAN} \
       "Die Basis Dateien zur Benutzung des OpenPGP Protokolls"
 
+Langstring DESC_SecNLS ${LANG_ENGLISH} \
+      "Support for languages other than English"
+LangString DESC_SecNLS ${LANG_GERMAN} \
+      "Unterstützung für weitere Sprachen neben Englisch"
+
 LangString DESC_SecTools ${LANG_ENGLISH} \
       "Extra tools like gpgv and gpgsplit"
 LangString DESC_SecTools ${LANG_GERMAN} \
@@ -300,6 +358,7 @@
 
 !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
   !insertmacro MUI_DESCRIPTION_TEXT ${SecBase} $(DESC_SecBase)
+  !insertmacro MUI_DESCRIPTION_TEXT ${SecNLS} $(DESC_SecNLS)
   !insertmacro MUI_DESCRIPTION_TEXT ${SecTools} $(DESC_SecTools)
   !insertmacro MUI_DESCRIPTION_TEXT ${SecDoc} $(DESC_SecDoc)
 !insertmacro MUI_FUNCTION_DESCRIPTION_END
Index: gnupg/util/ChangeLog
diff -u gnupg/util/ChangeLog:1.177 gnupg/util/ChangeLog:1.178
--- gnupg/util/ChangeLog:1.177	Mon Jan 17 11:19:57 2005
+++ gnupg/util/ChangeLog	Thu Jan 20 12:42:02 2005
@@ -1,3 +1,16 @@
+2005-01-20  Werner Koch  <wk at g10code.com>
+
+	* simple-gettext.c (set_gettext_file): Use MO files depending on
+	the installation directory.  Add new arg REGKEY.
+	
+2005-01-18  Werner Koch  <wk at g10code.com>
+
+	* argparse.c (default_strusage): Changed default copyright year to
+	2005.
+
+	* strgutil.c (handle_iconv_error): Print error messages only once.
+	(native_to_utf8, utf8_to_native): Ditto.
+
 2005-01-11  Werner Koch  <wk at g10code.com>
 
 	* strgutil.c (set_native_charset) [W32]: Use the alias table from
Index: gnupg/util/argparse.c
diff -u gnupg/util/argparse.c:1.38 gnupg/util/argparse.c:1.39
--- gnupg/util/argparse.c:1.38	Fri Jan 16 06:16:42 2004
+++ gnupg/util/argparse.c	Thu Jan 20 12:42:02 2005
@@ -914,7 +914,7 @@
     switch( level ) {
       case 11: p = "foo"; break;
       case 13: p = "0.0"; break;
-      case 14: p = "Copyright (C) 2004 Free Software Foundation, Inc."; break;
+      case 14: p = "Copyright (C) 2005 Free Software Foundation, Inc."; break;
       case 15: p =
 "This program comes with ABSOLUTELY NO WARRANTY.\n"
 "This is free software, and you are welcome to redistribute it\n"
Index: gnupg/util/simple-gettext.c
diff -u gnupg/util/simple-gettext.c:1.12 gnupg/util/simple-gettext.c:1.13
--- gnupg/util/simple-gettext.c:1.12	Wed Nov  3 21:03:46 2004
+++ gnupg/util/simple-gettext.c	Thu Jan 20 12:42:02 2005
@@ -1,5 +1,6 @@
 /* simple-gettext.c  - a simplified version of gettext.
- * Copyright (C) 1995, 1996, 1997, 1999 Free Software Foundation, Inc.
+ * Copyright (C) 1995, 1996, 1997, 1999,
+ *               2005 Free Software Foundation, Inc.
  *
  * This file is part of GnuPG.
  *
@@ -231,13 +232,14 @@
 
 
 /****************
- * Set the file used for translations.	Pass a NULL to disable
- * translation.  A new filename may be set at anytime.
- * WARNING: After changing the filename you should not access any data
- *	    retrieved by gettext().
+ * Set the file used for translations. Pass a NULL to disable
+ * translation.  A new filename may be set at anytime.  If REGKEY is
+ * not NULL, the function tries to selected the language the registry
+ * key "Lang" below that key.  WARNING: After changing the filename you
+ * should not access any data retrieved by gettext().
  */
 int
-set_gettext_file( const char *filename )
+set_gettext_file ( const char *filename, const char *regkey )
 {
     struct loaded_domain *domain = NULL;
 
@@ -252,30 +254,57 @@
 	    /* absolute path - use it as is */
 	    domain = load_domain( filename );
 	}
-	else { /* relative path - append ".mo" and get dir from the environment */
-	    char *buf = NULL;
-	    char *dir;
+	else if (regkey) { /* Standard.  */
+            char *instdir, *langid, *fname;
             char *p;
 
-	    dir = read_w32_registry_string( NULL,
-					    "Control Panel\\Mingw32\\NLS",
-					    "MODir" );
-	    if( dir && (buf=malloc(strlen(dir)+strlen(filename)+1+3+1)) ) {
-		strcpy(stpcpy(stpcpy(stpcpy( buf, dir),"\\"), filename),".mo");
-                /* Better make sure that we don't mix forward and
-                   backward slashes.  It seems that some Windoze
-                   versions don't accept this. */
-                for (p=buf; *p; p++)
-                  {
-                    if (*p == '/')
-                      *p = '\\';
-                  }
-		domain = load_domain( buf );
-		free(buf);
-	    }
-	    free(dir);
+            instdir = read_w32_registry_string ("HKEY_LOCAL_MACHINE",
+                                                regkey,
+                                                "Install Directory");
+            if (!instdir)
+                return -1;
+            langid = read_w32_registry_string (NULL, /* HKCU then HKLM */
+                                               regkey,
+                                               "Lang");
+            if (!langid) {
+                free (instdir);
+                return -1;
+            }
+            /* Strip stuff after a dot in case the user tried to enter
+             * the entire locale synatcs as usual for POSIX. */
+            p = strchr (langid, '.');
+            if (p)
+                *p = 0;
+                
+            /* Build the key: "<instdir>/<domain>.nls/<langid>.mo" We
+               use a directory below the installation directory with
+               the domain included in case the software has been
+               insalled with other software altogether at the same
+               place. */
+            fname = malloc (strlen (instdir) + 1 + strlen (filename) + 5
+                            + strlen (langid) + 3 + 1);
+            if (!fname) {
+                free (instdir);
+                free (langid);
+                return -1;
+            }
+            strcpy (stpcpy (stpcpy (stpcpy (stpcpy ( stpcpy (fname,
+                   instdir),"\\"), filename), ".nls\\"), langid), ".mo");
+            free (instdir);
+            free (langid);
+
+            /* Better make sure that we don't mix forward and
+               backward slashes.  It seems that some Windoze
+               versions don't accept this. */
+            for (p=fname; *p; p++) {
+                if (*p == '/')
+                    *p = '\\';
+            }
+            domain = load_domain (fname);
+            free(fname);
 	}
-	if( !domain )
+
+	if (!domain)
 	    return -1;
     }
 
Index: gnupg/util/strgutil.c
diff -u gnupg/util/strgutil.c:1.48 gnupg/util/strgutil.c:1.49
--- gnupg/util/strgutil.c:1.48	Mon Jan 17 11:19:57 2005
+++ gnupg/util/strgutil.c	Thu Jan 20 12:42:02 2005
@@ -1,6 +1,6 @@
 /* strgutil.c -  string utilities
  * Copyright (C) 1994, 1998, 1999, 2000, 2001,
- *               2003 Free Software Foundation, Inc.
+ *               2003, 2004, 2005 Free Software Foundation, Inc.
  *
  * This file is part of GnuPG.
  *
@@ -453,10 +453,33 @@
 handle_iconv_error (const char *to, const char *from, int use_fallback)
 {
   if (errno == EINVAL)
-    log_info (_("conversion from `%s' to `%s' not available\n"),
-               from, to);
+    {
+      static int shown1, shown2;
+      int x;
+
+      if (to && !strcmp (to, "utf-8"))
+        {
+          x = shown1;
+          shown1 = 1;
+        }
+      else
+        {
+          x = shown2;
+          shown2 = 1;
+        }
+
+      if (!x)
+        log_info (_("conversion from `%s' to `%s' not available\n"),
+                  from, to);
+    }
   else
-    log_info (_("iconv_open failed: %s\n"), strerror (errno));
+    {
+      static int shown;
+
+      if (!shown)
+        log_info (_("iconv_open failed: %s\n"), strerror (errno));
+      shown = 1;
+    }
 
   if (use_fallback)
     {
@@ -706,8 +729,12 @@
       if ( iconv (cd, (ICONV_CONST char **)&inptr, &inbytes,
                   &outptr, &outbytes) == (size_t)-1)
         {
-          log_info (_("conversion from `%s' to `%s' failed: %s\n"),
-                       active_charset_name, "utf-8", strerror (errno));
+          static int shown;
+
+          if (!shown)
+            log_info (_("conversion from `%s' to `%s' failed: %s\n"),
+                      active_charset_name, "utf-8", strerror (errno));
+          shown = 1;
           /* We don't do any conversion at all but use the strings as is. */
           strcpy (buffer, string);
         }
@@ -980,8 +1007,12 @@
             outbuf = outptr = m_alloc (outbytes);
             if ( iconv (cd, (ICONV_CONST char **)&inptr, &inbytes,
                         &outptr, &outbytes) == (size_t)-1) {
-                log_info (_("conversion from `%s' to `%s' failed: %s\n"),
-                           "utf-8", active_charset_name, strerror (errno));
+                static int shown;
+                
+                if (!shown)
+                  log_info (_("conversion from `%s' to `%s' failed: %s\n"),
+                            "utf-8", active_charset_name, strerror (errno));
+                shown = 1;
                 /* Didn't worked out.  Temporary disable the use of
                  * iconv and fall back to our old code. */
                 m_free (buffer);




More information about the Gnupg-commits mailing list