[Gpg4win-commits] r397 - in trunk: . src

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Thu May 17 13:14:04 CEST 2007


Author: werner
Date: 2007-05-17 13:14:03 +0200 (Thu, 17 May 2007)
New Revision: 397

Added:
   trunk/src/gpgwrap.c
Modified:
   trunk/ChangeLog
   trunk/NEWS
   trunk/autogen.sh
   trunk/configure.ac
   trunk/src/Makefile.am
   trunk/src/inst-gnupg.nsi
   trunk/src/inst-gpa.nsi
   trunk/src/installer.nsi
   trunk/src/uninst-gnupg.nsi
   trunk/src/uninst-gpa.nsi
Log:
Install wrapper so that gpg can be searched via PATH.


Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2007-05-16 18:14:26 UTC (rev 396)
+++ trunk/ChangeLog	2007-05-17 11:14:03 UTC (rev 397)
@@ -1,3 +1,15 @@
+2007-05-17  Werner Koch  <wk at g10code.com>
+
+	* src/installer.nsi (AddToPath,RemoveFromPath): New.
+	* src/inst-gpa.nsi: Install gpgwrap for gpa.
+	* src/inst-gnupg.nsi: Install gpgwrap for gpg, gpgv and gpgsplit.
+	
+	* src/gpgwrap.c: New.
+	* configure.ac: Check for strip.
+	(AC_CONFIG_HEADER): New.
+	* src/Makefile.am (g4wihelp.dll): Strip.
+	(gpgwrap.exe): Build.
+
 2007-05-16  Werner Koch  <wk at g10code.com>
 
 	* src/inst-gtk+.nsi: Install new themes and the engines.  Update

Modified: trunk/NEWS
===================================================================
--- trunk/NEWS	2007-05-16 18:14:26 UTC (rev 396)
+++ trunk/NEWS	2007-05-17 11:14:03 UTC (rev 397)
@@ -6,8 +6,29 @@
 Noteworthy changes in version 1.0.10
 ------------------------------------------------
 
+(en) Included Brigitte Hamilton's english translation of the novice's
+     manual.
 
+(en) gpg, gpgv, gpgsplit and gpa are now installed so that they are
+     searched via PATH.
 
+(en) Updated to the latest stable version of GTK+ libraries (2.10).
+
+
+~~~~~~~~~~~~~~~
+GnuPG: 1.4.7
+GPA:   0.7.5
+GPGol: 0.9.91
+GPGee: 1.3.1
+WinPT: 1.2.0
+Sylpheed-Claws: 2.4.0
+Novices:         
+Einsteiger:     2.0.2
+Durchblicker:   2.0.2
+~~~~~~~~~~~~~~~
+
+
+
 Noteworthy changes in version 1.0.9 (2007-03-09)
 ------------------------------------------------
 

Modified: trunk/autogen.sh
===================================================================
--- trunk/autogen.sh	2007-05-16 18:14:26 UTC (rev 396)
+++ trunk/autogen.sh	2007-05-17 11:14:03 UTC (rev 397)
@@ -133,8 +133,8 @@
 
 echo "Running aclocal -I m4 ${ACLOCAL_FLAGS:+$ACLOCAL_FLAGS }..."
 $ACLOCAL -I m4 $ACLOCAL_FLAGS
-#echo "Running autoheader..."
-#$AUTOHEADER
+echo "Running autoheader..."
+$AUTOHEADER
 echo "Running automake --gnu ..."
 $AUTOMAKE --gnu;
 echo "Running autoconf${FORCE} ..."

Modified: trunk/configure.ac
===================================================================
--- trunk/configure.ac	2007-05-16 18:14:26 UTC (rev 396)
+++ trunk/configure.ac	2007-05-17 11:14:03 UTC (rev 397)
@@ -58,6 +58,7 @@
 AM_INIT_AUTOMAKE
 AM_MAINTAINER_MODE
 AC_CANONICAL_HOST
+AM_CONFIG_HEADER(config.h)
 
 AC_SUBST(PACKAGE)
 AC_SUBST(VERSION)
@@ -112,6 +113,7 @@
 # Required tools.
 AC_PROG_CC
 AC_PROG_CPP
+AC_CHECK_TOOLS(STRIP, strip)
 AC_CHECK_TOOLS(DLLTOOL, dlltool)
 AC_CHECK_PROGS(MAKE, make)
 AC_CHECK_PROGS(UNZIP, unzip)

Modified: trunk/src/Makefile.am
===================================================================
--- trunk/src/Makefile.am	2007-05-16 18:14:26 UTC (rev 396)
+++ trunk/src/Makefile.am	2007-05-17 11:14:03 UTC (rev 397)
@@ -1,14 +1,14 @@
 # Makefile.am - Installer for GnuPG 4 Windows Makefile.
-# Copyright (C) 2005, 2006 g10 Code GmbH
+# Copyright (C) 2005, 2006, 2007 g10 Code GmbH
 # 
-# This file is part of GPG4Win.
+# This file is part of Gpg4win.
 # 
-# GPG4Win is free software; you can redistribute it and/or modify
+# Gpg4win is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
 # the Free Software Foundation; either version 2 of the License, or
 # (at your option) any later version.
 # 
-# GPG4Win is distributed in the hope that it will be useful,
+# Gpg4win is distributed in the hope that it will be useful,
 # but WITHOUT ANY WARRANTY; without even the implied warranty of
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 # GNU General Public License for more details.
@@ -20,14 +20,14 @@
 
 EXTRA_DIST = pkg-config $(common_nsi) gpg4win.nsi gpg4win-src.nsi \
         inst-gpg4win.nsi uninst-gpg4win.nsi installer-options.ini.in \
-	libiconv.def libintl.def  gpg4win-splash.wav \
+	libiconv.def libintl.def  gpg4win-splash.wav gpgwrap.c \
 	exdll.h g4wihelp.c g4wihelp.nsi config.site loreley.mid \
 	inst-man_novice_en.nsi inst-man_advanced_en.nsi \
 	uninst-man_novice_en.nsi uninst-man_advanced_en.nsi
 
 # Need to clean the dll because we bypassed automake.
 CLEANFILES = g4wihelp.dll versioninfo.txt README.en.txt README.de.txt \
-             installer-options.ini NEWS.tmp
+             installer-options.ini NEWS.tmp gpgwrap.exe
 
 # Supported source packages.
 gpg4win_spkgs := glib gnupg libgpg-error gpgme gpgol gpa winpt sylpheed-claws
@@ -253,13 +253,13 @@
 # if makensis changed to the directory of the source file at startup.
 # So we have to pull a couple of strings to correct this.
 gpg4win-$(VERSION).exe: gpg4win.nsi $(common_nsi) stamps/stamp-final \
-                        g4wihelp.dll README.en.txt README.de.txt \
+                        g4wihelp.dll gpgwrap.exe README.en.txt README.de.txt \
 			installer-options.ini
 	$(MAKENSIS) -V3 -DBUILD_DIR=`pwd` -DTOP_SRCDIR=$(top_srcdir) \
 		-DSRCDIR=$(srcdir) $(srcdir)/gpg4win.nsi
 
 gpg4win-light-$(VERSION).exe: gpg4win.nsi $(common_nsi) stamps/stamp-final \
-                        g4wihelp.dll README.en.txt README.de.txt \
+                        g4wihelp.dll gpgwrap.exe README.en.txt README.de.txt \
 			installer-options.ini
 	$(MAKENSIS) -V3 -DBUILD_DIR=`pwd` -DTOP_SRCDIR=$(top_srcdir) \
 		-DSRCDIR=$(srcdir) -DGPG4WIN_LIGHT=1 $(srcdir)/gpg4win.nsi
@@ -276,7 +276,12 @@
 g4wihelp.dll: g4wihelp.c exdll.h
 	$(CC) -I. -shared -O2 -o g4wihelp.dll $(srcdir)/g4wihelp.c \
 	   -lwinmm -lgdi32
+	$(STRIP) g4wihelp.dll
 
+gpgwrap.exe: gpgwrap.c
+	$(CC) -I. -I.. -DHAVE_CONFIG_H -O2 -o gpgwrap.exe $(srcdir)/gpgwrap.c 
+	$(STRIP) gpgwrap.exe
+
 if BUILD_SOURCE_INSTALLER
 all_src = gpg4win-src-$(VERSION).exe
 else

Added: trunk/src/gpgwrap.c
===================================================================
--- trunk/src/gpgwrap.c	2007-05-16 18:14:26 UTC (rev 396)
+++ trunk/src/gpgwrap.c	2007-05-17 11:14:03 UTC (rev 397)
@@ -0,0 +1,74 @@
+/* gpgwrap.c - Wrapper to call gpg udner Windows.
+ * Copyright (C) 2007 g10 Code GmbH
+ *
+ * This file is part of Gpg4win.
+ *
+ * Gpg4win is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Gpg4win is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <process.h>
+#include <windows.h>
+
+
+int
+main (int argc, const char * const *argv)
+{
+  int rc;
+  char pgm[MAX_PATH+100];
+  char *p, *p0;
+
+  if (argc >= 2 && !strcmp(argv[1], "--version"))
+    {
+      puts ("gpgwrap (gpg4win) " PACKAGE_VERSION "\n");
+      fflush (stdout);
+    }
+
+  if ( !GetModuleFileNameA (NULL, pgm, sizeof pgm -1) )
+    {
+      fprintf (stderr, "gpgwrap: error getting my own name: rc=%d\n",
+               GetLastError());
+      return 2;
+    }
+
+  /* Remove one directory part of the file name.  */
+  p = strrchr (pgm, '\\');
+  if (!p)
+    goto leave;
+  *p = 0;
+  p0 = strrchr (pgm, '\\');
+  *p = '\\';
+  if (!p0)
+    goto leave;
+  while (*p)
+    *p0++ = *p++;
+  *p0 = 0;
+  execv (pgm, argv);
+  fprintf (stderr, "gpgwrap: executing `%s' failed: %s\n",
+           pgm, strerror (errno));
+  return 2;
+ leave:
+  fprintf (stderr, "gpgwrap: internal error parsing my own name `%s'\n",
+           pgm);
+  return 2;
+}
+
+

Modified: trunk/src/inst-gnupg.nsi
===================================================================
--- trunk/src/inst-gnupg.nsi	2007-05-16 18:14:26 UTC (rev 396)
+++ trunk/src/inst-gnupg.nsi	2007-05-17 11:14:03 UTC (rev 397)
@@ -35,6 +35,11 @@
   File "${prefix}/bin/gpgsplit.exe"
   File "${prefix}/bin/gpgv.exe"
 
+  SetOutPath "$INSTDIR\pub"
+  File /oname=gpg.exe      "${BUILD_DIR}/gpgwrap.exe"
+  File /oname=gpgv.exe     "${BUILD_DIR}/gpgwrap.exe"
+  File /oname=gpgsplit.exe "${BUILD_DIR}/gpgwrap.exe"
+
   # As a special exception, these programs are not kept in
   # libexec/gnupg, where they belong.  Please see the comment in
   # gnupg/g10/keyserver.c::keyserver_spawn() for an explanation.
@@ -59,6 +64,11 @@
 
 
   WriteRegStr HKLM "Software\GNU\GnuPG" "Install Directory" $INSTDIR
+
+  # Add the public directory to the PATH
+  Push "$INSTDIR\pub"
+  Call AddToPath
+
 !endif
 SectionEnd
 

Modified: trunk/src/inst-gpa.nsi
===================================================================
--- trunk/src/inst-gpa.nsi	2007-05-16 18:14:26 UTC (rev 396)
+++ trunk/src/inst-gpa.nsi	2007-05-17 11:14:03 UTC (rev 397)
@@ -31,6 +31,9 @@
 !else
   File ${prefix}/bin/gpa.exe
 
+  SetOutPath "$INSTDIR\pub"
+  File /oname=gpa.exe "${BUILD_DIR}/gpgwrap.exe"
+
   SetOutPath "$INSTDIR\share\locale\de\LC_MESSAGES"
   File ${prefix}/share/locale/de/LC_MESSAGES/gpa.mo
 

Modified: trunk/src/installer.nsi
===================================================================
--- trunk/src/installer.nsi	2007-05-16 18:14:26 UTC (rev 396)
+++ trunk/src/installer.nsi	2007-05-17 11:14:03 UTC (rev 397)
@@ -29,7 +29,19 @@
 !macroend
 !endif
 
+!include "WinMessages.nsh"
 
+# Define for the registry key to change the environment.  The
+# commented one may be used if the setting should affect only the
+# current user.
+!define Regkey_for_Env \
+    'HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"'
+# !define Regkey_for_Env 'HKCU "Environment"'
+
+
+
+
+
 # We use the modern UI.
 !include "MUI.nsh"
 
@@ -655,7 +667,8 @@
 #   Pop $R0
 #  ($R0 at this point is "ass string")
 #
-Function StrStr
+!macro StrStr un
+Function ${un}StrStr
    Exch $R1 # st=haystack,old$R1, $R1=needle
    Exch     # st=old$R1,haystack
    Exch $R2 # st=old$R1,old$R2, $R2=haystack
@@ -683,7 +696,11 @@
    Pop $R2
    Exch $R1
 FunctionEnd
+!macroend
+!insertmacro StrStr ""
+!insertmacro StrStr "un."
 
+
 # TrimNewlines  - taken from the NSIS reference
 # input, top of stack  (e.g. whatever$\r$\n)
 # output, top of stack (replaces, with e.g. whatever)
@@ -709,3 +726,111 @@
    Exch $R0
 FunctionEnd
 
+
+#
+# AddToPath - Adds the given dir to the search path.
+#        Input - head of the stack
+# (Taken from Kichik's code at the NSIS Wiki)
+#
+Function AddToPath
+  Exch $0
+  Push $1
+  Push $2
+  Push $3
+ 
+  # Don't add if the path doesn't exist
+  IfFileExists "$0\*.*" "" AddToPath_done
+ 
+  ReadEnvStr $1 PATH
+  Push "$1;"
+  Push "$0;"
+  Call StrStr
+  Pop $2
+  StrCmp $2 "" "" AddToPath_done
+  Push "$1;"
+  Push "$0\;"
+  Call StrStr
+  Pop $2
+  StrCmp $2 "" "" AddToPath_done
+  GetFullPathName /SHORT $3 $0
+  Push "$1;"
+  Push "$3;"
+  Call StrStr
+  Pop $2
+  StrCmp $2 "" "" AddToPath_done
+  Push "$1;"
+  Push "$3\;"
+  Call StrStr
+  Pop $2
+  StrCmp $2 "" "" AddToPath_done
+ 
+  ReadRegStr $1 ${Regkey_for_Env} "PATH"
+  StrCmp $1 "" AddToPath_NTdoIt
+    Push $1
+    #  We do not need the follwing call
+    #  Call Trim
+    Pop $1
+    StrCpy $0 "$1;$0"
+  AddToPath_NTdoIt:
+    WriteRegExpandStr ${Regkey_for_Env} "PATH" $0
+    SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000
+ 
+  AddToPath_done:
+    Pop $3
+    Pop $2
+    Pop $1
+    Pop $0
+FunctionEnd
+ 
+#
+# RemoveFromPath - Remove a given dir from the path
+#     Input: head of the stack
+# (Taken from Kichik's code at the NSIS Wiki)
+# 
+Function un.RemoveFromPath
+  Exch $0
+  Push $1
+  Push $2
+  Push $3
+  Push $4
+  Push $5
+  Push $6
+ 
+  IntFmt $6 "%c" 26 # DOS EOF
+ 
+  ReadRegStr $1 ${Regkey_for_Env} "PATH"
+  StrCpy $5 $1 1 -1 # copy last char
+  StrCmp $5 ";" +2 # if last char != ;
+    StrCpy $1 "$1;" # append ;
+  Push $1
+  Push "$0;"
+  Call un.StrStr # Find `$0;` in $1
+  Pop $2 ; pos of our dir
+  StrCmp $2 "" unRemoveFromPath_done
+    # else, it is in path
+    # $0 - path to add
+    # $1 - path var
+    StrLen $3 "$0;"
+    StrLen $4 $2
+    StrCpy $5 $1 -$4   # $5 is now the part before the path to remove
+    StrCpy $6 $2 "" $3 # $6 is now the part after the path to remove
+    StrCpy $3 $5$6
+ 
+    StrCpy $5 $3 1 -1  # copy last char
+    StrCmp $5 ";" 0 +2 # if last char == ;
+      StrCpy $3 $3 -1  # remove last char
+ 
+    WriteRegExpandStr ${Regkey_for_Env} "PATH" $3
+    SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000
+ 
+  unRemoveFromPath_done:
+    Pop $6
+    Pop $5
+    Pop $4
+    Pop $3
+    Pop $2
+    Pop $1
+    Pop $0
+FunctionEnd
+ 
+ 

Modified: trunk/src/uninst-gnupg.nsi
===================================================================
--- trunk/src/uninst-gnupg.nsi	2007-05-16 18:14:26 UTC (rev 396)
+++ trunk/src/uninst-gnupg.nsi	2007-05-17 11:14:03 UTC (rev 397)
@@ -33,6 +33,9 @@
   Delete "$INSTDIR\gpg.exe"
   Delete "$INSTDIR\gpgsplit.exe"
   Delete "$INSTDIR\gpgv.exe"
+  Delete "$INSTDIR\pub\gpg.exe"
+  Delete "$INSTDIR\pub\gpgsplit.exe"
+  Delete "$INSTDIR\pub\gpgv.exe"
 
   Delete "$INSTDIR\gpgkeys_finger.exe"
   Delete "$INSTDIR\gpgkeys_hkp.exe"
@@ -55,5 +58,10 @@
   RMDir  "$INSTDIR\gnupg.nls"
 
   DeleteRegValue HKLM "Software\GNU\GnuPG" "Install Directory"
+
+  # Remove the public directory from the PATH
+  Push "$INSTDIR\pub"
+  Call un.RemoveFromPath
+
 !endif
 SectionEnd

Modified: trunk/src/uninst-gpa.nsi
===================================================================
--- trunk/src/uninst-gpa.nsi	2007-05-16 18:14:26 UTC (rev 396)
+++ trunk/src/uninst-gpa.nsi	2007-05-17 11:14:03 UTC (rev 397)
@@ -31,6 +31,7 @@
   Call un.SourceDelete
 !else
   Delete "$INSTDIR\gpa.exe"
+  Delete "$INSTDIR\pub\gpa.exe"
 
   Delete "$INSTDIR\share\locale\de\LC_MESSAGES\gpa.mo"
 



More information about the Gpg4win-commits mailing list