[Gpg4win-commits] r718 - in trunk: . src
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Tue Feb 19 16:40:17 CET 2008
Author: marcus
Date: 2008-02-19 16:40:15 +0100 (Tue, 19 Feb 2008)
New Revision: 718
Added:
trunk/src/kleowrap.c
Removed:
trunk/src/kleopatra.bat
Modified:
trunk/ChangeLog
trunk/src/Makefile.am
trunk/src/inst-kleopatra.nsi
trunk/src/inst-sections.nsi
trunk/src/uninst-kleopatra.nsi
Log:
2008-02-19 Marcus Brinkmann <marcus at g10code.de>
* src/kleowrap.c: New file.
* src/kleopatra.bat: Removed.
* src/Makefile.am (EXTRA_DIST): Remove kleopatra.bat, add
kleowrap.c.
(CLEANFILES): Add kleowrap.exe.
(gpg4win-$(VERSION).exe, gpg4win-light-$(VERSION).exe,
(gpg4win-$(VERSION).wix, gpg4win-light-$(VERSION).wix): Add
kleowrap.exe as dependency.
(gpgwrap.exe): Use make magic.
(kleowrap.exe): New target.
* src/inst-kleopatra.nsi: Install kleowrap.exe as kleopatra.exe,
and do not install kleopatra.bat.
* src/uninst-kleopatra.nsi: Uninstall kleopatra.exe instead of
kleopatra.bat.
* src/inst-sections.nsi (no_desktop): Replace kleopatra.bat by
kleopatra.exe.
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2008-02-18 11:37:40 UTC (rev 717)
+++ trunk/ChangeLog 2008-02-19 15:40:15 UTC (rev 718)
@@ -1,3 +1,22 @@
+2008-02-19 Marcus Brinkmann <marcus at g10code.de>
+
+ * src/kleowrap.c: New file.
+ * src/kleopatra.bat: Removed.
+ * src/Makefile.am (EXTRA_DIST): Remove kleopatra.bat, add
+ kleowrap.c.
+ (CLEANFILES): Add kleowrap.exe.
+ (gpg4win-$(VERSION).exe, gpg4win-light-$(VERSION).exe,
+ (gpg4win-$(VERSION).wix, gpg4win-light-$(VERSION).wix): Add
+ kleowrap.exe as dependency.
+ (gpgwrap.exe): Use make magic.
+ (kleowrap.exe): New target.
+ * src/inst-kleopatra.nsi: Install kleowrap.exe as kleopatra.exe,
+ and do not install kleopatra.bat.
+ * src/uninst-kleopatra.nsi: Uninstall kleopatra.exe instead of
+ kleopatra.bat.
+ * src/inst-sections.nsi (no_desktop): Replace kleopatra.bat by
+ kleopatra.exe.
+
2008-02-18 Marcus Brinkmann <marcus at g10code.de>
* packages/packages.current: Update kdelibs and kleopatra.
Modified: trunk/src/Makefile.am
===================================================================
--- trunk/src/Makefile.am 2008-02-18 11:37:40 UTC (rev 717)
+++ trunk/src/Makefile.am 2008-02-19 15:40:15 UTC (rev 718)
@@ -22,7 +22,7 @@
installer-options.ini.in libiconv.def libintl.def loreley.mid \
gpg4win-splash.wav gpgwrap.c exdll.h g4wihelp.c g4wihelp.nsi \
inst-sections.nsi installer.nsi installer-finish.nsi \
- qt.conf kleopatra.bat \
+ qt.conf kleowrap.c \
inst-gpg4win.nsi uninst-gpg4win.nsi \
inst-atk.nsi uninst-atk.nsi \
inst-cairo.nsi uninst-cairo.nsi \
@@ -71,7 +71,7 @@
# 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 gpgwrap.exe
+ installer-options.ini NEWS.tmp gpgwrap.exe kleowrap.exe
# Supported source packages.
gpg4win_spkgs = glib gnupg libgpg-error gpgme gpgol gpgex \
@@ -407,26 +407,28 @@
# 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 gpgwrap.exe README.en.txt README.de.txt \
- installer-options.ini versioninfo.txt
+ g4wihelp.dll gpgwrap.exe kleowrap.exe README.en.txt \
+ README.de.txt installer-options.ini versioninfo.txt
$(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 gpgwrap.exe README.en.txt README.de.txt \
- installer-options.ini versioninfo.txt
+ g4wihelp.dll gpgwrap.exe kleowrap.exe README.en.txt \
+ README.de.txt installer-options.ini versioninfo.txt
$(MAKENSIS) -V3 -DBUILD_DIR=`pwd` -DTOP_SRCDIR=$(top_srcdir) \
-DSRCDIR=$(srcdir) -DGPG4WIN_LIGHT=1 $(srcdir)/gpg4win.nsi
gpg4win-$(VERSION).wix: gpg4win.nsi $(common_nsi) stamps/stamp-final \
- gpgwrap.exe README.en.txt README.de.txt versioninfo.txt
+ gpgwrap.exe kleowrap.exe README.en.txt \
+ README.de.txt versioninfo.txt
perl make-msi.pl --guids $(srcdir)/make-msi.guids \
--manifest gpg4win-$(VERSION).files \
-DBUILD_DIR=. -DTOP_SRCDIR=$(top_srcdir) \
-DSRCDIR=$(srcdir) $(srcdir)/gpg4win.nsi > $@
gpg4win-light-$(VERSION).wix: gpg4win.nsi $(common_nsi) stamps/stamp-final \
- gpgwrap.exe README.en.txt README.de.txt versioninfo.txt
+ gpgwrap.exe kleowrap.exe README.en.txt \
+ README.de.txt versioninfo.txt
perl make-msi.pl --guids $(srcdir)/make-msi.guids \
--manifest gpg4win-light-$(VERSION).files \
-DBUILD_DIR=. -DTOP_SRCDIR=$(top_srcdir) \
@@ -451,9 +453,13 @@
$(STRIP) g4wihelp.dll
gpgwrap.exe: gpgwrap.c
- $(CC) -I. -I.. -DHAVE_CONFIG_H -O2 -o gpgwrap.exe $(srcdir)/gpgwrap.c
- $(STRIP) gpgwrap.exe
+ $(CC) -I. -I.. -DHAVE_CONFIG_H -O2 -o $@ $^
+ $(STRIP) $@
+kleowrap.exe: kleowrap.c
+ $(CC) -I. -I.. -DHAVE_CONFIG_H -O2 -mwindows -o $@ $^
+ $(STRIP) $@
+
if BUILD_SOURCE_INSTALLER
all_src = gpg4win-src-$(VERSION).exe
else
Modified: trunk/src/inst-kleopatra.nsi
===================================================================
--- trunk/src/inst-kleopatra.nsi 2008-02-18 11:37:40 UTC (rev 717)
+++ trunk/src/inst-kleopatra.nsi 2008-02-19 15:40:15 UTC (rev 718)
@@ -1,5 +1,5 @@
# inst-kleopatra.nsi - Installer snippet for kleopatra. -*- coding: latin-1; -*-
-# Copyright (C) 2005, 2007 g10 Code GmbH
+# Copyright (C) 2005, 2007, 2008 g10 Code GmbH
#
# This file is part of GPG4Win.
#
@@ -33,7 +33,7 @@
SetOutPath "$INSTDIR\bin"
File ${prefix}/bin/kleopatra.exe
SetOutPath "$INSTDIR"
- File ${SRCDIR}/kleopatra.bat
+ File /oname=kleopatra.exe "${BUILD_DIR}/kleowrap.exe"
File ${prefix}/bin/kgpgconf.exe
File ${prefix}/lib/libgpgme++-glib.dll
Modified: trunk/src/inst-sections.nsi
===================================================================
--- trunk/src/inst-sections.nsi 2008-02-18 11:37:40 UTC (rev 717)
+++ trunk/src/inst-sections.nsi 2008-02-19 15:40:15 UTC (rev 718)
@@ -922,7 +922,7 @@
IntOp $R0 $R0 & ${SF_SELECTED}
IntCmp $R0 ${SF_SELECTED} 0 no_kleopatra_menu
CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\Kleopatra.lnk" \
- "$INSTDIR\kleopatra.bat" \
+ "$INSTDIR\kleopatra.exe" \
"" "" "" SW_SHOWNORMAL "" $(DESC_Menu_kleopatra)
no_kleopatra_menu:
!endif
@@ -1100,7 +1100,7 @@
IntOp $R0 $R0 & ${SF_SELECTED}
IntCmp $R0 ${SF_SELECTED} 0 no_kleopatra_desktop
CreateShortCut "$DESKTOP\Kleopatra.lnk" \
- "$INSTDIR\kleopatra.bat" \
+ "$INSTDIR\kleopatra.exe" \
"" "" "" SW_SHOWNORMAL "" $(DESC_Menu_kleopatra)
no_kleopatra_desktop:
!endif
@@ -1241,7 +1241,7 @@
IntOp $R0 $R0 & ${SF_SELECTED}
IntCmp $R0 ${SF_SELECTED} 0 no_kleopatra_quicklaunch
CreateShortCut "$QUICKLAUNCH\Kleopatra.lnk" \
- "$INSTDIR\kleopatra.bat" \
+ "$INSTDIR\kleopatra.exe" \
"" "" "" SW_SHOWNORMAL "" $(DESC_Menu_kleopatra)
no_kleopatra_quicklaunch:
!endif
Deleted: trunk/src/kleopatra.bat
===================================================================
--- trunk/src/kleopatra.bat 2008-02-18 11:37:40 UTC (rev 717)
+++ trunk/src/kleopatra.bat 2008-02-19 15:40:15 UTC (rev 718)
@@ -1,3 +0,0 @@
- at echo off
-cd %0\..\
-bin\kleopatra %*
Added: trunk/src/kleowrap.c
===================================================================
--- trunk/src/kleowrap.c 2008-02-18 11:37:40 UTC (rev 717)
+++ trunk/src/kleowrap.c 2008-02-19 15:40:15 UTC (rev 718)
@@ -0,0 +1,160 @@
+/* kleopatrawrap.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>
+
+
+/* Return a copy of ARGV, but with proper quoting. To release the
+ copy, you have to free argv_quoted[0] and argv_quoted. */
+static char **
+build_commandline (const char * const *argv)
+{
+ int i;
+ int j;
+ int n = 0;
+ char *buf;
+ char *p;
+ char **argv_quoted;
+
+ /* We have to quote some things because under Windows the program
+ parses the commandline and does some unquoting. We enclose the
+ whole argument in double-quotes, and escape literal double-quotes
+ as well as backslashes with a backslash. We end up with a
+ trailing space at the end of the line, but that is harmless. */
+ for (i = 0; argv[i]; i++)
+ {
+ p = (char *) argv[i];
+ /* The leading double-quote. */
+ n++;
+ while (*p)
+ {
+ /* An extra one for each literal that must be escaped. */
+ if (*p == '\\' || *p == '"')
+ n++;
+ n++;
+ p++;
+ }
+ /* The trailing double-quote and the delimiter. */
+ n += 2;
+ }
+ /* And a trailing zero. */
+ n++;
+
+ /* Allocate a new vector. */
+ argv_quoted = malloc (sizeof (char *) * (i + 1));
+ if (!argv_quoted)
+ return NULL;
+
+ buf = p = malloc (n);
+ if (!buf)
+ {
+ free (argv_quoted);
+ return NULL;
+ }
+
+ for (i = 0; argv[i]; i++)
+ {
+ const char *argvp = argv[i];
+
+ argv_quoted[i] = p;
+
+ *(p++) = '"';
+ while (*argvp)
+ {
+ if (*argvp == '\\' || *argvp == '"')
+ *(p++) = '\\';
+ *(p++) = *(argvp++);
+ }
+ *(p++) = '"';
+ *(p++) = 0;
+ }
+ *(p++) = 0;
+ argv_quoted[i] = NULL;
+
+ return argv_quoted;
+}
+
+
+int
+main (int argc, const char * const *argv)
+{
+ int rc;
+ char pgm[MAX_PATH+100];
+ char *p, *p0;
+ char **argv_quoted;
+
+ if (!GetModuleFileNameA (NULL, pgm, sizeof (pgm) - 1))
+ {
+ fprintf (stderr, "kleopatrawrap: error getting my own name: rc=%d\n",
+ GetLastError());
+ return 2;
+ }
+
+ /* Insert bin directory. */
+ p = strrchr (pgm, '\\');
+ if (!p)
+ goto leave;
+ p++;
+ memmove (p + 4, p, strlen (p) + 1);
+ strncpy (p, "bin\\", 4);
+
+ /* Hack to output our own version along with the real file name
+ before the actual, we require that the --version option is given
+ twice. */
+ if (argc > 2
+ && !strcmp(argv[1], "--version")
+ && !strcmp(argv[2], "--version"))
+ {
+ fputs ("kleopatrawrap (Gpg4win) " PACKAGE_VERSION " ;", stdout);
+ fputs (pgm, stdout);
+ fputc ('\n', stdout);
+ fflush (stdout);
+ }
+
+ argv_quoted = build_commandline (argv);
+ if (!argv_quoted)
+ goto leave;
+
+ /* Using execv does not replace the existing program image, but
+ spawns a new one and daemonizes it, confusing the command line
+ interpreter. So we have to use spawnv. */
+ rc = _spawnv (_P_WAIT, pgm, (const char **) argv_quoted);
+ if (rc < 0)
+ {
+ fprintf (stderr, "kleopatrawrap: executing `%s' failed: %s\n",
+ pgm, strerror (errno));
+ return 2;
+ }
+
+ return rc;
+
+ leave:
+ fprintf (stderr, "kleopatrawrap: internal error parsing my own name `%s'\n",
+ pgm);
+ return 2;
+}
Modified: trunk/src/uninst-kleopatra.nsi
===================================================================
--- trunk/src/uninst-kleopatra.nsi 2008-02-18 11:37:40 UTC (rev 717)
+++ trunk/src/uninst-kleopatra.nsi 2008-02-19 15:40:15 UTC (rev 718)
@@ -1,5 +1,5 @@
# uninst-kleopatra.nsi - Installer snippet for kleopatra. -*- coding: latin-1; -*-
-# Copyright (C) 2005, 2007 g10 Code GmbH
+# Copyright (C) 2005, 2007, 2008 g10 Code GmbH
#
# This file is part of GPG4Win.
#
@@ -34,7 +34,7 @@
# FIXME: See inst-kleopatra.nsi
Delete "$INSTDIR\bin\kleopatra.exe"
RMDir "$INSTDIR\bin"
- Delete "$INSTDIR\kleopatra.bat"
+ Delete "$INSTDIR\kleopatra.exe"
Delete "$INSTDIR\kgpgconf.exe"
Delete "$INSTDIR\libgpgme++-glib.dll"
More information about the Gpg4win-commits
mailing list