Add tool to create a portable version.
authorWerner Koch <wk@gnupg.org>
Thu, 8 Aug 2013 10:43:56 +0000 (12:43 +0200)
committerWerner Koch <wk@gnupg.org>
Thu, 8 Aug 2013 10:43:56 +0000 (12:43 +0200)
* src/mkportable.c: New
* src/mkportable-vanilla.h: New.
* src/mkportable-light.h: New.
* src/mkportable-full.h: New.
* src/Makefile.am (mkportable.exe): New rule.
(foosum_exe): Add mkportable.exe.
* src/inst-gpg4win.nsi, src/uninst-gpg4win.nsi: Add mkportable.exe.

.gitignore
src/Makefile.am
src/inst-gpg4win.nsi
src/mkportable-full.h [new file with mode: 0644]
src/mkportable-light.h [new file with mode: 0644]
src/mkportable-vanilla.h [new file with mode: 0644]
src/mkportable.c [new file with mode: 0644]
src/uninst-gpg4win.nsi

index 9567d79..6fac73c 100644 (file)
@@ -78,3 +78,4 @@ src/mingwm10.dll
 /src/libstdc++-6.dll-x
 /po/build-cc
 /src/license.blurb
+/src/mkportable.exe
index c13780d..401ca58 100644 (file)
@@ -22,7 +22,8 @@ EXTRA_DIST = pkg-config gpg4win.nsi gpg4win-src.nsi \
         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  \
-       QtCore.pc QtGui.pc zlib.pc sha1sum.c                  \
+       QtCore.pc QtGui.pc zlib.pc sha1sum.c mkportable.c     \
+       mkportable-vanilla.h mkportable-light.h mkportable-full.h \
         qt.conf kleowrap.c potomo Memento.nsh dirmngr.conf    \
         inst-gpg4win.nsi          uninst-gpg4win.nsi         \
         inst-atk.nsi               uninst-atk.nsi            \
@@ -91,7 +92,7 @@ gpg4win_howto_smime_ll = en de
 HOWTO_files = $(addsuffix .txt, \
                 $(addprefix HOWTO-SMIME.,$(gpg4win_howto_smime_ll)))
 
-foosum_exe = sha1sum.exe md5sum.exe sha256sum.exe
+foosum_exe = sha1sum.exe md5sum.exe sha256sum.exe mkportable.exe
 
 # Need to clean the dll because we bypassed automake.
 CLEANFILES = g4wihelp.dll versioninfo.txt $(README_files) $(HOWTO_files) \
@@ -688,6 +689,10 @@ sha256sum.exe: sha1sum.c
        $(CC) -DBUILD_SHA256SUM -O2 -o $@ $^
        $(STRIP) $@
 
+mkportable.exe: mkportable.c \
+                mkportable-vanilla.h mkportable-light.h mkportable-full.h
+       $(CC) -O2 -o $@ $(srcdir)/mkportable.c
+       $(STRIP) $@
 
 if BUILD_SOURCE_INSTALLER
 all_src = gpg4win-src-$(VERSION).exe
index d655aac..81c6e05 100644 (file)
@@ -84,6 +84,7 @@ Section "-gpg4win" SEC_gpg4win
   File "${BUILD_DIR}/sha1sum.exe"
   File "${BUILD_DIR}/sha256sum.exe"
   File "${BUILD_DIR}/md5sum.exe"
+  File "${BUILD_DIR}/mkportable.exe"
 
   SetOutPath "$INSTDIR\pub"
   # Install the mingw32 runtime libraries.  They are stored in the
diff --git a/src/mkportable-full.h b/src/mkportable-full.h
new file mode 100644 (file)
index 0000000..ab97182
--- /dev/null
@@ -0,0 +1,790 @@
+const char * const full_files[] =
+{
+  "bin/dbus-daemon.exe",
+  "bin/kbuildsycoca4.exe",
+  "bin/kdebugdialog.exe",
+  "bin/kgpgconf.exe",
+  "bin/kleopatra.exe",
+  "bin/kwatchgnupg.exe",
+  "bin/libkdecore.dll",
+  "claws-mail-manual.pdf",
+  "claws-mail.exe",
+  "dbus-env.bat",
+  "dbus-launch.exe",
+  "dbus-monitor.exe",
+  "dbus-send.exe",
+  "dirmngr-client.exe",
+  "dirmngr.exe",
+  "dirmngr_ldap.exe",
+  "etc/fonts/fonts.conf",
+  "etc/gtk-2.0/im-multipress.conf",
+  "etc/pango/pango.modules",
+  "etc/session.conf",
+  "etc/system.conf",
+  "freetype6.dll",
+  "gdbus.exe",
+  "gdk-pixbuf-pixdata.exe",
+  "gdk-pixbuf-query-loaders.exe",
+  "gio-querymodules.exe",
+  "glib-compile-resources.exe",
+  "glib-compile-schemas.exe",
+  "glib-genmarshal.exe",
+  "gobject-query.exe",
+  "gpa.exe",
+  "gpg-agent.exe",
+  "gpg-connect-agent.exe",
+  "gpg-error.exe",
+  "gpg-preset-passphrase.exe",
+  "gpg-protect-tool.exe",
+  "gpg2.exe",
+  "gpg2keys_curl.exe",
+  "gpg2keys_finger.exe",
+  "gpg2keys_hkp.exe",
+  "gpg2keys_kdns.exe",
+  "gpg2keys_ldap.exe",
+  "gpgconf.exe",
+  "gpgme-w32spawn.exe",
+  "gpgsm.exe",
+  "gpgtar.exe",
+  "gpgv2.exe",
+  "gresource.exe",
+  "gsettings.exe",
+  "gspawn-win32-helper-console.exe",
+  "gspawn-win32-helper.exe",
+  "gtk-query-immodules-2.0.exe",
+  "gtk-update-icon-cache.exe",
+  "gtk-update-icon-cache.exe.manifest",
+  "include/assuan.h",
+  "include/gcrypt-module.h",
+  "include/gcrypt.h",
+  "include/gpg-error.h",
+  "include/gpgme.h",
+  "include/ksba.h",
+  "intl.dll",
+  "kbuildsycoca4.exe",
+  "kdebugdialog.exe",
+  "kgpgconf.exe",
+  "kleopatra.exe",
+  "kwatchgnupg.exe",
+  "lib/claws-mail/plugins/address_keeper.dll",
+  "lib/claws-mail/plugins/attachwarner.dll",
+  "lib/claws-mail/plugins/att_remover.dll",
+  "lib/claws-mail/plugins/bsfilter.dll",
+  "lib/claws-mail/plugins/fetchinfo.dll",
+  "lib/claws-mail/plugins/gtkhtml2_viewer.dll",
+  "lib/claws-mail/plugins/notification.dll",
+  "lib/claws-mail/plugins/pgpcore.dll",
+  "lib/claws-mail/plugins/pgpinline.deps",
+  "lib/claws-mail/plugins/pgpinline.dll",
+  "lib/claws-mail/plugins/pgpmime.deps",
+  "lib/claws-mail/plugins/pgpmime.dll",
+  "lib/claws-mail/plugins/rssyl.dll",
+  "lib/claws-mail/plugins/smime.deps",
+  "lib/claws-mail/plugins/smime.dll",
+  "lib/claws-mail/plugins/spamreport.dll",
+  "lib/claws-mail/plugins/tnef_parse.dll",
+  "lib/claws-mail/plugins/vcalendar.dll",
+  "lib/enchant/libenchant_myspell.dll",
+  "lib/gtk-2.0/2.10.0/engines/libpixmap.dll",
+  "lib/gtk-2.0/2.10.0/engines/libwimp.dll",
+  "lib/gtk-2.0/2.10.0/immodules/im-am-et.dll",
+  "lib/gtk-2.0/2.10.0/immodules/im-cedilla.dll",
+  "lib/gtk-2.0/2.10.0/immodules/im-cyrillic-translit.dll",
+  "lib/gtk-2.0/2.10.0/immodules/im-ime.dll",
+  "lib/gtk-2.0/2.10.0/immodules/im-inuktitut.dll",
+  "lib/gtk-2.0/2.10.0/immodules/im-ipa.dll",
+  "lib/gtk-2.0/2.10.0/immodules/im-multipress.dll",
+  "lib/gtk-2.0/2.10.0/immodules/im-thai.dll",
+  "lib/gtk-2.0/2.10.0/immodules/im-ti-er.dll",
+  "lib/gtk-2.0/2.10.0/immodules/im-ti-et.dll",
+  "lib/gtk-2.0/2.10.0/immodules/im-viqr.dll",
+  "lib/gtk-2.0/modules/libgail.dll",
+  "lib/kde4/kcm_kleopatra.dll",
+  "libadns-1.dll",
+  "libassuan-0.dll",
+  "libatk-1.0-0.dll",
+  "libattica.dll",
+  "libcairo-2.dll",
+  "libcairo-gobject-2.dll",
+  "libcairo-script-interpreter-2.dll",
+  "libcurl-4.dll",
+  "libdbus-1.dll",
+  "libdbusmenu-qt.dll",
+  "libenchant-1.dll",
+  "libetpan-13.dll",
+  "libexpat-1.dll",
+  "libexpat.dll",
+  "libffi-6.dll",
+  "libfontconfig-1.dll",
+  "libgailutil-18.dll",
+  "libgcc_s_sjlj-1.dll",
+  "libgcrypt-11.dll",
+  "libgdk-win32-2.0-0.dll",
+  "libgdk_pixbuf-2.0-0.dll",
+  "libgio-2.0-0.dll",
+  "libglib-2.0-0.dll",
+  "libgmodule-2.0-0.dll",
+  "libgnutls-26.dll",
+  "libgnutls-extra-26.dll",
+  "libgnutls-openssl-27.dll",
+  "libgobject-2.0-0.dll",
+  "libgpg-error-0.dll",
+  "libgpgme++.dll",
+  "libgpgme-11.dll",
+  "libgpgme-glib-11.dll",
+  "libgsasl-7.dll",
+  "libgthread-2.0-0.dll",
+  "libgtk-win32-2.0-0.dll",
+  "libiconv-2.dll",
+  "libintl-8.dll",
+  "libintl.dll",
+  "libkcmutils.dll",
+  "libkdeui.dll",
+  "libkdewin.dll",
+  "libkleo.dll",
+  "libkleopatraclientcore.dll",
+  "libkleopatraclientgui.dll",
+  "libkmime.dll",
+  "libksba-8.dll",
+  "libpango-1.0-0.dll",
+  "libpangocairo-1.0-0.dll",
+  "libpangoft2-1.0-0.dll",
+  "libpangowin32-1.0-0.dll",
+  "libpng14-14.dll",
+  "libqgpgme.dll",
+  "libregex-1.dll",
+  "libtasn1-3.dll",
+  "libw32pth-0.dll",
+  "libxml2-2.dll",
+  "md5sum.exe",
+  "pango-querymodules.exe",
+  "paperkey.exe",
+  "pinentry-gtk-2.exe",
+  "pinentry-qt4.exe",
+  "pinentry-w32.exe",
+  "pinentry.exe",
+  "plugins/imageformats/qgif4.dll",
+  "plugins/imageformats/qico4.dll",
+  "plugins/imageformats/qjpeg4.dll",
+  "plugins/imageformats/qmng4.dll",
+  "plugins/imageformats/qsvg4.dll",
+  "plugins/imageformats/qtiff4.dll",
+  "pthreadGC2.dll",
+  "pub/gpa.exe",
+  "pub/gpg-connect-agent.exe",
+  "pub/gpg.exe",
+  "pub/gpg2.exe",
+  "pub/gpgconf.exe",
+  "pub/gpgsm.exe",
+  "pub/gpgv.exe",
+  "pub/libgcc_s_sjlj-1.dll",
+  "pub/libstdc++-6.dll",
+  "qdbus.exe",
+  "qt.conf",
+  "QtCore4.dll",
+  "QtDBus4.dll",
+  "QtGui4.dll",
+  "QtNetwork4.dll",
+  "QtSvg4.dll",
+  "QtXml4.dll",
+  "scdaemon.exe",
+  "scute.dll",
+  "sha1sum.exe",
+  "sha256sum.exe",
+  "share/applications/kde4/kleopatra.desktop",
+  "share/applications/kde4/kleopatra_import.desktop",
+  "share/apps/kcharselect/kcharselect-data",
+  "share/apps/kdeui/about/bar-bottom-left.png",
+  "share/apps/kdeui/about/bar-bottom-middle.png",
+  "share/apps/kdeui/about/bar-bottom-right.png",
+  "share/apps/kdeui/about/bar-middle-left.png",
+  "share/apps/kdeui/about/bar-middle-right.png",
+  "share/apps/kdeui/about/bar-top-left.png",
+  "share/apps/kdeui/about/bar-top-middle.png",
+  "share/apps/kdeui/about/bar-top-right.png",
+  "share/apps/kdeui/about/box-bottom-left.png",
+  "share/apps/kdeui/about/box-bottom-middle.png",
+  "share/apps/kdeui/about/box-bottom-right.png",
+  "share/apps/kdeui/about/box-middle-left.png",
+  "share/apps/kdeui/about/box-middle-right.png",
+  "share/apps/kdeui/about/box-top-left.png",
+  "share/apps/kdeui/about/box-top-middle.png",
+  "share/apps/kdeui/about/box-top-right.png",
+  "share/apps/kdeui/about/kde_infopage.css",
+  "share/apps/kdeui/about/kde_infopage_rtl.css",
+  "share/apps/kdeui/about/top-middle.png",
+  "share/apps/kdeui/pics/aboutkde.png",
+  "share/apps/kdeui/pics/kdeprint_nup1.png",
+  "share/apps/kdeui/pics/kdeprint_nup2.png",
+  "share/apps/kdeui/pics/kdeprint_nup4.png",
+  "share/apps/kdeui/pics/kdeprint_nupother.png",
+  "share/apps/kdeui/pics/ktip-bulb.png",
+  "share/apps/kleopatra/kleopatra.rc",
+  "share/apps/kleopatra/pics/gpg4win-compact.png",
+  "share/apps/kleopatra/pics/gpg4win.png",
+  "share/apps/kleopatra/pics/kleopatra_splashscreen.png",
+  "share/apps/kleopatra/pics/kleopatra_splashscreen.svgz",
+  "share/apps/kleopatra/pics/kleopatra_wizard.png",
+  "share/apps/kleopatra/pics/kleopatra_wizard.svgz",
+  "share/apps/kwatchgnupg/kwatchgnupgui.rc",
+  "share/apps/kwatchgnupg/pics/kwatchgnupg.png",
+  "share/apps/kwatchgnupg/pics/kwatchgnupg2.png",
+  "share/apps/libkleopatra/pics/chiasmus_chi.png",
+  "share/apps/libkleopatra/pics/hi16-app-gpg.png",
+  "share/apps/libkleopatra/pics/hi16-app-gpgsm.png",
+  "share/apps/libkleopatra/pics/hi22-app-gpg.png",
+  "share/apps/libkleopatra/pics/hi22-app-gpgsm.png",
+  "share/apps/libkleopatra/pics/hi32-app-gpg.png",
+  "share/apps/libkleopatra/pics/hi32-app-gpgsm.png",
+  "share/apps/libkleopatra/pics/key.png",
+  "share/apps/libkleopatra/pics/key_bad.png",
+  "share/apps/libkleopatra/pics/key_ok.png",
+  "share/apps/libkleopatra/pics/key_unknown.png",
+  "share/apps/libkleopatra/pics/smartcard.xpm",
+  "share/claws-mail/ca-certificates.crt",
+  "share/config/colors/40.colors",
+  "share/config/colors/Oxygen.colors",
+  "share/config/colors/Rainbow.colors",
+  "share/config/colors/Royal.colors",
+  "share/config/colors/Web.colors",
+  "share/config/kdebug.areas",
+  "share/config/kdebugrc",
+  "share/config/kdeglobals",
+  "share/config/libkleopatrarc",
+  "share/config/ui/ui_standards.rc",
+  "share/doc/HTML/common/1.png",
+  "share/doc/HTML/common/10.png",
+  "share/doc/HTML/common/2.png",
+  "share/doc/HTML/common/3.png",
+  "share/doc/HTML/common/4.png",
+  "share/doc/HTML/common/5.png",
+  "share/doc/HTML/common/6.png",
+  "share/doc/HTML/common/7.png",
+  "share/doc/HTML/common/8.png",
+  "share/doc/HTML/common/9.png",
+  "share/doc/HTML/common/artistic-license.html",
+  "share/doc/HTML/common/block_title_bottom.png",
+  "share/doc/HTML/common/block_title_mid.png",
+  "share/doc/HTML/common/block_title_top.png",
+  "share/doc/HTML/common/bottom-left.png",
+  "share/doc/HTML/common/bottom-middle.png",
+  "share/doc/HTML/common/bottom-right.png",
+  "share/doc/HTML/common/bsd-license.html",
+  "share/doc/HTML/common/doxygen.css",
+  "share/doc/HTML/common/favicon.ico",
+  "share/doc/HTML/common/fdl-license",
+  "share/doc/HTML/common/fdl-license.html",
+  "share/doc/HTML/common/fdl-notice.html",
+  "share/doc/HTML/common/fdl-translated.html",
+  "share/doc/HTML/common/footer.html",
+  "share/doc/HTML/common/gpl-license",
+  "share/doc/HTML/common/gpl-license.html",
+  "share/doc/HTML/common/gpl-translated.html",
+  "share/doc/HTML/common/header.html",
+  "share/doc/HTML/common/kde-default.css",
+  "share/doc/HTML/common/kde-docs.css",
+  "share/doc/HTML/common/kde-localised.css",
+  "share/doc/HTML/common/kde_logo_bg.png",
+  "share/doc/HTML/common/lgpl-license",
+  "share/doc/HTML/common/lgpl-license.html",
+  "share/doc/HTML/common/lgpl-translated.html",
+  "share/doc/HTML/common/mainfooter.html",
+  "share/doc/HTML/common/mainheader.html",
+  "share/doc/HTML/common/qpl-license.html",
+  "share/doc/HTML/common/tabs.css",
+  "share/doc/HTML/common/top-kde.jpg",
+  "share/doc/HTML/common/top-left.jpg",
+  "share/doc/HTML/common/top-left.png",
+  "share/doc/HTML/common/top-middle.png",
+  "share/doc/HTML/common/top-right.jpg",
+  "share/doc/HTML/common/top-right.png",
+  "share/doc/HTML/common/top.jpg",
+  "share/doc/HTML/common/x11-license.html",
+  "share/doc/HTML/common/xml.dcl",
+  "share/doc/HTML/de/kleopatra/admin-archive-definitions.html",
+  "share/doc/HTML/de/kleopatra/admin-checksum-definitions.html",
+  "share/doc/HTML/de/kleopatra/admin-key-filters.html",
+  "share/doc/HTML/de/kleopatra/admin.html",
+  "share/doc/HTML/de/kleopatra/commandline-options.html",
+  "share/doc/HTML/de/kleopatra/configuration-appearance.html",
+  "share/doc/HTML/de/kleopatra/configuration-crypto-operations.html",
+  "share/doc/HTML/de/kleopatra/configuration-gnupg-system.html",
+  "share/doc/HTML/de/kleopatra/configuration-smime-validation.html",
+  "share/doc/HTML/de/kleopatra/configuration.html",
+  "share/doc/HTML/de/kleopatra/credits-and-license.html",
+  "share/doc/HTML/de/kleopatra/functions-newkey.html",
+  "share/doc/HTML/de/kleopatra/functions-search.html",
+  "share/doc/HTML/de/kleopatra/functions.html",
+  "share/doc/HTML/de/kleopatra/index.html",
+  "share/doc/HTML/de/kleopatra/introduction.html",
+  "share/doc/HTML/de/kleopatra/menu.html",
+  "share/doc/HTML/de/kleopatra/menucertificates.html",
+  "share/doc/HTML/de/kleopatra/menuhelp.html",
+  "share/doc/HTML/de/kleopatra/menusettings.html",
+  "share/doc/HTML/de/kleopatra/menutools.html",
+  "share/doc/HTML/de/kleopatra/menuview.html",
+  "share/doc/HTML/de/kleopatra/menuwindow.html",
+  "share/doc/HTML/en/kleopatra/admin-archive-definitions.html",
+  "share/doc/HTML/en/kleopatra/admin-checksum-definitions.html",
+  "share/doc/HTML/en/kleopatra/admin-key-filters.html",
+  "share/doc/HTML/en/kleopatra/admin.html",
+  "share/doc/HTML/en/kleopatra/commandline-options.html",
+  "share/doc/HTML/en/kleopatra/configuration-appearance.html",
+  "share/doc/HTML/en/kleopatra/configuration-crypto-operations.html",
+  "share/doc/HTML/en/kleopatra/configuration-gnupg-system.html",
+  "share/doc/HTML/en/kleopatra/configuration-smime-validation.html",
+  "share/doc/HTML/en/kleopatra/configuration.html",
+  "share/doc/HTML/en/kleopatra/credits-and-license.html",
+  "share/doc/HTML/en/kleopatra/functions-newkey.html",
+  "share/doc/HTML/en/kleopatra/functions-search.html",
+  "share/doc/HTML/en/kleopatra/functions.html",
+  "share/doc/HTML/en/kleopatra/index.html",
+  "share/doc/HTML/en/kleopatra/introduction.html",
+  "share/doc/HTML/en/kleopatra/menu.html",
+  "share/doc/HTML/en/kleopatra/menucertificates.html",
+  "share/doc/HTML/en/kleopatra/menuhelp.html",
+  "share/doc/HTML/en/kleopatra/menusettings.html",
+  "share/doc/HTML/en/kleopatra/menutools.html",
+  "share/doc/HTML/en/kleopatra/menuview.html",
+  "share/doc/HTML/en/kleopatra/menuwindow.html",
+  "share/enchant/myspell/de.aff",
+  "share/enchant/myspell/de.dic",
+  "share/enchant/myspell/en_US.aff",
+  "share/enchant/myspell/en_US.dic",
+  "share/enchant/myspell/fr.aff",
+  "share/enchant/myspell/fr.dic",
+  "share/glib-2.0/schemas/gschema.dtd",
+  "share/gnupg/gpg-agent.man",
+  "share/gnupg/gpg-conf.skel",
+  "share/gnupg/gpg-connect-agent.man",
+  "share/gnupg/gpg2.man",
+  "share/gnupg/gpgconf.man",
+  "share/gnupg/gpgsm.man",
+  "share/gnupg/gpgv2.man",
+  "share/gnupg/help.*.txt",
+  "share/gnupg/paperkey.man",
+  "share/gnupg/qualified.txt",
+  "share/gnupg/scdaemon.man",
+  "share/gpa/gpa-logo.ppm",
+  "share/gpa/gpa.png",
+  "share/gpg4win/gpg4win-compendium-de.pdf",
+  "share/gpg4win/gpg4win-compendium-en.pdf",
+  "share/gpg4win/HOWTO-SMIME.*.txt",
+  "share/gpg4win/README.*.txt",
+  "share/gpg4win/versioninfo.txt",
+  "share/icons/hicolor/128x128/apps/kleopatra.png",
+  "share/icons/hicolor/16x16/apps/kleopatra.png",
+  "share/icons/hicolor/22x22/apps/kleopatra.png",
+  "share/icons/hicolor/256x256/apps/kleopatra.png",
+  "share/icons/hicolor/32x32/apps/kleopatra.png",
+  "share/icons/hicolor/48x48/apps/kleopatra.png",
+  "share/icons/hicolor/64x64/apps/kleopatra.png",
+  "share/icons/hicolor/index.theme",
+  "share/icons/hicolor/scalable/apps/kleopatra.svgz",
+  "share/icons/oxygen/128x128/actions/application-exit.png",
+  "share/icons/oxygen/128x128/actions/configure.png",
+  "share/icons/oxygen/128x128/actions/dialog-ok-apply.png",
+  "share/icons/oxygen/128x128/actions/dialog-ok.png",
+  "share/icons/oxygen/128x128/actions/edit-find.png",
+  "share/icons/oxygen/128x128/actions/go-bottom.png",
+  "share/icons/oxygen/128x128/actions/go-down.png",
+  "share/icons/oxygen/128x128/actions/go-first.png",
+  "share/icons/oxygen/128x128/actions/go-last.png",
+  "share/icons/oxygen/128x128/actions/go-next.png",
+  "share/icons/oxygen/128x128/actions/go-previous.png",
+  "share/icons/oxygen/128x128/actions/go-top.png",
+  "share/icons/oxygen/128x128/actions/go-up.png",
+  "share/icons/oxygen/128x128/actions/list-remove.png",
+  "share/icons/oxygen/128x128/actions/tools-report-bug.png",
+  "share/icons/oxygen/128x128/apps/kde.png",
+  "share/icons/oxygen/128x128/categories/applications-graphics.png",
+  "share/icons/oxygen/128x128/categories/preferences-system-network.png",
+  "share/icons/oxygen/128x128/devices/secure-card.png",
+  "share/icons/oxygen/128x128/status/dialog-error.png",
+  "share/icons/oxygen/128x128/status/dialog-information.png",
+  "share/icons/oxygen/128x128/status/dialog-password.png",
+  "share/icons/oxygen/128x128/status/dialog-warning.png",
+  "share/icons/oxygen/128x128/status/security-high.png",
+  "share/icons/oxygen/128x128/status/security-low.png",
+  "share/icons/oxygen/128x128/status/security-medium.png",
+  "share/icons/oxygen/16x16/actions/application-exit.png",
+  "share/icons/oxygen/16x16/actions/arrow-down.png",
+  "share/icons/oxygen/16x16/actions/arrow-up.png",
+  "share/icons/oxygen/16x16/actions/configure-shortcuts.png",
+  "share/icons/oxygen/16x16/actions/configure-toolbars.png",
+  "share/icons/oxygen/16x16/actions/configure.png",
+  "share/icons/oxygen/16x16/actions/dialog-cancel.png",
+  "share/icons/oxygen/16x16/actions/dialog-close.png",
+  "share/icons/oxygen/16x16/actions/dialog-ok-apply.png",
+  "share/icons/oxygen/16x16/actions/dialog-ok.png",
+  "share/icons/oxygen/16x16/actions/document-edit-decrypt-verify.png",
+  "share/icons/oxygen/16x16/actions/document-edit-decrypt.png",
+  "share/icons/oxygen/16x16/actions/document-edit-encrypt.png",
+  "share/icons/oxygen/16x16/actions/document-edit-sign-encrypt.png",
+  "share/icons/oxygen/16x16/actions/document-edit-sign.png",
+  "share/icons/oxygen/16x16/actions/document-edit-verify.png",
+  "share/icons/oxygen/16x16/actions/document-encrypt.png",
+  "share/icons/oxygen/16x16/actions/document-open.png",
+  "share/icons/oxygen/16x16/actions/document-print.png",
+  "share/icons/oxygen/16x16/actions/document-revert.png",
+  "share/icons/oxygen/16x16/actions/edit-clear-locationbar-rtl.png",
+  "share/icons/oxygen/16x16/actions/edit-delete.png",
+  "share/icons/oxygen/16x16/actions/edit-find.png",
+  "share/icons/oxygen/16x16/actions/edit-redo.png",
+  "share/icons/oxygen/16x16/actions/edit-rename.png",
+  "share/icons/oxygen/16x16/actions/edit-undo.png",
+  "share/icons/oxygen/16x16/actions/go-bottom.png",
+  "share/icons/oxygen/16x16/actions/go-down.png",
+  "share/icons/oxygen/16x16/actions/go-first.png",
+  "share/icons/oxygen/16x16/actions/go-last.png",
+  "share/icons/oxygen/16x16/actions/go-next.png",
+  "share/icons/oxygen/16x16/actions/go-previous.png",
+  "share/icons/oxygen/16x16/actions/go-top.png",
+  "share/icons/oxygen/16x16/actions/go-up.png",
+  "share/icons/oxygen/16x16/actions/help-contents.png",
+  "share/icons/oxygen/16x16/actions/help-contextual.png",
+  "share/icons/oxygen/16x16/actions/list-add.png",
+  "share/icons/oxygen/16x16/actions/list-remove.png",
+  "share/icons/oxygen/16x16/actions/process-stop.png",
+  "share/icons/oxygen/16x16/actions/tab-close.png",
+  "share/icons/oxygen/16x16/actions/tab-duplicate.png",
+  "share/icons/oxygen/16x16/actions/tab-new-background.png",
+  "share/icons/oxygen/16x16/actions/tools-report-bug.png",
+  "share/icons/oxygen/16x16/actions/view-certificate-add.png",
+  "share/icons/oxygen/16x16/actions/view-certificate-export-secret.png",
+  "share/icons/oxygen/16x16/actions/view-certificate-export-server.png",
+  "share/icons/oxygen/16x16/actions/view-certificate-export.png",
+  "share/icons/oxygen/16x16/actions/view-certificate-import.png",
+  "share/icons/oxygen/16x16/actions/view-certificate-server-configure.png",
+  "share/icons/oxygen/16x16/actions/view-certificate-sign.png",
+  "share/icons/oxygen/16x16/actions/view-refresh.png",
+  "share/icons/oxygen/16x16/actions/window-close.png",
+  "share/icons/oxygen/16x16/animations/process-working-kde.png",
+  "share/icons/oxygen/16x16/apps/internet-mail.png",
+  "share/icons/oxygen/16x16/apps/kde.png",
+  "share/icons/oxygen/16x16/categories/applications-graphics.png",
+  "share/icons/oxygen/16x16/categories/preferences-system-network.png",
+  "share/icons/oxygen/16x16/devices/secure-card.png",
+  "share/icons/oxygen/16x16/status/dialog-error.png",
+  "share/icons/oxygen/16x16/status/dialog-information.png",
+  "share/icons/oxygen/16x16/status/dialog-password.png",
+  "share/icons/oxygen/16x16/status/dialog-warning.png",
+  "share/icons/oxygen/16x16/status/security-high.png",
+  "share/icons/oxygen/16x16/status/security-low.png",
+  "share/icons/oxygen/16x16/status/security-medium.png",
+  "share/icons/oxygen/22x22/actions/application-exit.png",
+  "share/icons/oxygen/22x22/actions/arrow-down.png",
+  "share/icons/oxygen/22x22/actions/arrow-up.png",
+  "share/icons/oxygen/22x22/actions/configure-shortcuts.png",
+  "share/icons/oxygen/22x22/actions/configure-toolbars.png",
+  "share/icons/oxygen/22x22/actions/configure.png",
+  "share/icons/oxygen/22x22/actions/dialog-cancel.png",
+  "share/icons/oxygen/22x22/actions/dialog-close.png",
+  "share/icons/oxygen/22x22/actions/dialog-ok-apply.png",
+  "share/icons/oxygen/22x22/actions/dialog-ok.png",
+  "share/icons/oxygen/22x22/actions/document-edit-decrypt-verify.png",
+  "share/icons/oxygen/22x22/actions/document-edit-decrypt.png",
+  "share/icons/oxygen/22x22/actions/document-edit-encrypt.png",
+  "share/icons/oxygen/22x22/actions/document-edit-sign-encrypt.png",
+  "share/icons/oxygen/22x22/actions/document-edit-sign.png",
+  "share/icons/oxygen/22x22/actions/document-edit-verify.png",
+  "share/icons/oxygen/22x22/actions/document-encrypt.png",
+  "share/icons/oxygen/22x22/actions/document-open.png",
+  "share/icons/oxygen/22x22/actions/document-print.png",
+  "share/icons/oxygen/22x22/actions/document-revert.png",
+  "share/icons/oxygen/22x22/actions/edit-clear-locationbar-rtl.png",
+  "share/icons/oxygen/22x22/actions/edit-delete.png",
+  "share/icons/oxygen/22x22/actions/edit-find.png",
+  "share/icons/oxygen/22x22/actions/edit-redo.png",
+  "share/icons/oxygen/22x22/actions/edit-rename.png",
+  "share/icons/oxygen/22x22/actions/edit-undo.png",
+  "share/icons/oxygen/22x22/actions/go-bottom.png",
+  "share/icons/oxygen/22x22/actions/go-down.png",
+  "share/icons/oxygen/22x22/actions/go-first.png",
+  "share/icons/oxygen/22x22/actions/go-last.png",
+  "share/icons/oxygen/22x22/actions/go-next.png",
+  "share/icons/oxygen/22x22/actions/go-previous.png",
+  "share/icons/oxygen/22x22/actions/go-top.png",
+  "share/icons/oxygen/22x22/actions/go-up.png",
+  "share/icons/oxygen/22x22/actions/help-contents.png",
+  "share/icons/oxygen/22x22/actions/help-contextual.png",
+  "share/icons/oxygen/22x22/actions/list-add.png",
+  "share/icons/oxygen/22x22/actions/list-remove.png",
+  "share/icons/oxygen/22x22/actions/process-stop.png",
+  "share/icons/oxygen/22x22/actions/tab-close.png",
+  "share/icons/oxygen/22x22/actions/tab-duplicate.png",
+  "share/icons/oxygen/22x22/actions/tab-new-background.png",
+  "share/icons/oxygen/22x22/actions/tools-report-bug.png",
+  "share/icons/oxygen/22x22/actions/view-certificate-add.png",
+  "share/icons/oxygen/22x22/actions/view-certificate-export-secret.png",
+  "share/icons/oxygen/22x22/actions/view-certificate-export-server.png",
+  "share/icons/oxygen/22x22/actions/view-certificate-export.png",
+  "share/icons/oxygen/22x22/actions/view-certificate-import.png",
+  "share/icons/oxygen/22x22/actions/view-certificate-server-configure.png",
+  "share/icons/oxygen/22x22/actions/view-certificate-sign.png",
+  "share/icons/oxygen/22x22/actions/view-refresh.png",
+  "share/icons/oxygen/22x22/actions/window-close.png",
+  "share/icons/oxygen/22x22/animations/process-working-kde.png",
+  "share/icons/oxygen/22x22/apps/internet-mail.png",
+  "share/icons/oxygen/22x22/apps/kde.png",
+  "share/icons/oxygen/22x22/apps/preferences-desktop-locale.png",
+  "share/icons/oxygen/22x22/categories/applications-graphics.png",
+  "share/icons/oxygen/22x22/categories/preferences-system-network.png",
+  "share/icons/oxygen/22x22/devices/secure-card.png",
+  "share/icons/oxygen/22x22/status/dialog-error.png",
+  "share/icons/oxygen/22x22/status/dialog-information.png",
+  "share/icons/oxygen/22x22/status/dialog-password.png",
+  "share/icons/oxygen/22x22/status/dialog-warning.png",
+  "share/icons/oxygen/22x22/status/security-high.png",
+  "share/icons/oxygen/22x22/status/security-low.png",
+  "share/icons/oxygen/22x22/status/security-medium.png",
+  "share/icons/oxygen/256x256/categories/applications-graphics.png",
+  "share/icons/oxygen/256x256/categories/preferences-system-network.png",
+  "share/icons/oxygen/256x256/devices/secure-card.png",
+  "share/icons/oxygen/32x32/actions/application-exit.png",
+  "share/icons/oxygen/32x32/actions/arrow-down.png",
+  "share/icons/oxygen/32x32/actions/arrow-up.png",
+  "share/icons/oxygen/32x32/actions/configure-shortcuts.png",
+  "share/icons/oxygen/32x32/actions/configure-toolbars.png",
+  "share/icons/oxygen/32x32/actions/configure.png",
+  "share/icons/oxygen/32x32/actions/dialog-cancel.png",
+  "share/icons/oxygen/32x32/actions/dialog-close.png",
+  "share/icons/oxygen/32x32/actions/dialog-ok-apply.png",
+  "share/icons/oxygen/32x32/actions/dialog-ok.png",
+  "share/icons/oxygen/32x32/actions/document-edit-decrypt-verify.png",
+  "share/icons/oxygen/32x32/actions/document-edit-decrypt.png",
+  "share/icons/oxygen/32x32/actions/document-edit-encrypt.png",
+  "share/icons/oxygen/32x32/actions/document-edit-sign-encrypt.png",
+  "share/icons/oxygen/32x32/actions/document-edit-sign.png",
+  "share/icons/oxygen/32x32/actions/document-edit-verify.png",
+  "share/icons/oxygen/32x32/actions/document-encrypt.png",
+  "share/icons/oxygen/32x32/actions/document-open.png",
+  "share/icons/oxygen/32x32/actions/document-print.png",
+  "share/icons/oxygen/32x32/actions/document-revert.png",
+  "share/icons/oxygen/32x32/actions/edit-clear-locationbar-rtl.png",
+  "share/icons/oxygen/32x32/actions/edit-delete.png",
+  "share/icons/oxygen/32x32/actions/edit-find.png",
+  "share/icons/oxygen/32x32/actions/edit-redo.png",
+  "share/icons/oxygen/32x32/actions/edit-rename.png",
+  "share/icons/oxygen/32x32/actions/edit-undo.png",
+  "share/icons/oxygen/32x32/actions/go-bottom.png",
+  "share/icons/oxygen/32x32/actions/go-down.png",
+  "share/icons/oxygen/32x32/actions/go-first.png",
+  "share/icons/oxygen/32x32/actions/go-last.png",
+  "share/icons/oxygen/32x32/actions/go-next.png",
+  "share/icons/oxygen/32x32/actions/go-previous.png",
+  "share/icons/oxygen/32x32/actions/go-top.png",
+  "share/icons/oxygen/32x32/actions/go-up.png",
+  "share/icons/oxygen/32x32/actions/help-contents.png",
+  "share/icons/oxygen/32x32/actions/help-contextual.png",
+  "share/icons/oxygen/32x32/actions/list-add.png",
+  "share/icons/oxygen/32x32/actions/list-remove.png",
+  "share/icons/oxygen/32x32/actions/process-stop.png",
+  "share/icons/oxygen/32x32/actions/tab-close.png",
+  "share/icons/oxygen/32x32/actions/tab-duplicate.png",
+  "share/icons/oxygen/32x32/actions/tab-new-background.png",
+  "share/icons/oxygen/32x32/actions/tools-report-bug.png",
+  "share/icons/oxygen/32x32/actions/view-certificate-add.png",
+  "share/icons/oxygen/32x32/actions/view-certificate-export-secret.png",
+  "share/icons/oxygen/32x32/actions/view-certificate-export-server.png",
+  "share/icons/oxygen/32x32/actions/view-certificate-export.png",
+  "share/icons/oxygen/32x32/actions/view-certificate-import.png",
+  "share/icons/oxygen/32x32/actions/view-certificate-server-configure.png",
+  "share/icons/oxygen/32x32/actions/view-certificate-sign.png",
+  "share/icons/oxygen/32x32/actions/view-refresh.png",
+  "share/icons/oxygen/32x32/actions/window-close.png",
+  "share/icons/oxygen/32x32/animations/process-working-kde.png",
+  "share/icons/oxygen/32x32/apps/kde.png",
+  "share/icons/oxygen/32x32/categories/applications-graphics.png",
+  "share/icons/oxygen/32x32/categories/preferences-system-network.png",
+  "share/icons/oxygen/32x32/devices/secure-card.png",
+  "share/icons/oxygen/32x32/status/dialog-error.png",
+  "share/icons/oxygen/32x32/status/dialog-information.png",
+  "share/icons/oxygen/32x32/status/dialog-password.png",
+  "share/icons/oxygen/32x32/status/dialog-warning.png",
+  "share/icons/oxygen/32x32/status/security-high.png",
+  "share/icons/oxygen/32x32/status/security-low.png",
+  "share/icons/oxygen/32x32/status/security-medium.png",
+  "share/icons/oxygen/48x48/actions/application-exit.png",
+  "share/icons/oxygen/48x48/actions/arrow-down.png",
+  "share/icons/oxygen/48x48/actions/arrow-up.png",
+  "share/icons/oxygen/48x48/actions/configure-shortcuts.png",
+  "share/icons/oxygen/48x48/actions/configure-toolbars.png",
+  "share/icons/oxygen/48x48/actions/configure.png",
+  "share/icons/oxygen/48x48/actions/dialog-cancel.png",
+  "share/icons/oxygen/48x48/actions/dialog-close.png",
+  "share/icons/oxygen/48x48/actions/dialog-ok-apply.png",
+  "share/icons/oxygen/48x48/actions/dialog-ok.png",
+  "share/icons/oxygen/48x48/actions/document-edit-decrypt-verify.png",
+  "share/icons/oxygen/48x48/actions/document-edit-decrypt.png",
+  "share/icons/oxygen/48x48/actions/document-edit-encrypt.png",
+  "share/icons/oxygen/48x48/actions/document-edit-sign-encrypt.png",
+  "share/icons/oxygen/48x48/actions/document-edit-sign.png",
+  "share/icons/oxygen/48x48/actions/document-edit-verify.png",
+  "share/icons/oxygen/48x48/actions/document-encrypt.png",
+  "share/icons/oxygen/48x48/actions/document-open.png",
+  "share/icons/oxygen/48x48/actions/document-print.png",
+  "share/icons/oxygen/48x48/actions/document-revert.png",
+  "share/icons/oxygen/48x48/actions/edit-clear-locationbar-rtl.png",
+  "share/icons/oxygen/48x48/actions/edit-delete.png",
+  "share/icons/oxygen/48x48/actions/edit-find.png",
+  "share/icons/oxygen/48x48/actions/edit-redo.png",
+  "share/icons/oxygen/48x48/actions/edit-rename.png",
+  "share/icons/oxygen/48x48/actions/edit-undo.png",
+  "share/icons/oxygen/48x48/actions/go-bottom.png",
+  "share/icons/oxygen/48x48/actions/go-down.png",
+  "share/icons/oxygen/48x48/actions/go-first.png",
+  "share/icons/oxygen/48x48/actions/go-last.png",
+  "share/icons/oxygen/48x48/actions/go-next.png",
+  "share/icons/oxygen/48x48/actions/go-previous.png",
+  "share/icons/oxygen/48x48/actions/go-top.png",
+  "share/icons/oxygen/48x48/actions/go-up.png",
+  "share/icons/oxygen/48x48/actions/help-contents.png",
+  "share/icons/oxygen/48x48/actions/help-contextual.png",
+  "share/icons/oxygen/48x48/actions/list-add.png",
+  "share/icons/oxygen/48x48/actions/list-remove.png",
+  "share/icons/oxygen/48x48/actions/process-stop.png",
+  "share/icons/oxygen/48x48/actions/tab-close.png",
+  "share/icons/oxygen/48x48/actions/tab-duplicate.png",
+  "share/icons/oxygen/48x48/actions/tab-new-background.png",
+  "share/icons/oxygen/48x48/actions/tools-report-bug.png",
+  "share/icons/oxygen/48x48/actions/view-certificate-add.png",
+  "share/icons/oxygen/48x48/actions/view-certificate-export-secret.png",
+  "share/icons/oxygen/48x48/actions/view-certificate-export-server.png",
+  "share/icons/oxygen/48x48/actions/view-certificate-export.png",
+  "share/icons/oxygen/48x48/actions/view-certificate-import.png",
+  "share/icons/oxygen/48x48/actions/view-certificate-server-configure.png",
+  "share/icons/oxygen/48x48/actions/view-certificate-sign.png",
+  "share/icons/oxygen/48x48/actions/view-refresh.png",
+  "share/icons/oxygen/48x48/actions/window-close.png",
+  "share/icons/oxygen/48x48/animations/process-working-kde.png",
+  "share/icons/oxygen/48x48/apps/kde.png",
+  "share/icons/oxygen/48x48/categories/applications-graphics.png",
+  "share/icons/oxygen/48x48/categories/preferences-system-network.png",
+  "share/icons/oxygen/48x48/devices/secure-card.png",
+  "share/icons/oxygen/48x48/status/dialog-error.png",
+  "share/icons/oxygen/48x48/status/dialog-information.png",
+  "share/icons/oxygen/48x48/status/dialog-password.png",
+  "share/icons/oxygen/48x48/status/dialog-warning.png",
+  "share/icons/oxygen/48x48/status/security-high.png",
+  "share/icons/oxygen/48x48/status/security-low.png",
+  "share/icons/oxygen/48x48/status/security-medium.png",
+  "share/icons/oxygen/64x64/actions/application-exit.png",
+  "share/icons/oxygen/64x64/actions/configure.png",
+  "share/icons/oxygen/64x64/actions/dialog-ok-apply.png",
+  "share/icons/oxygen/64x64/actions/dialog-ok.png",
+  "share/icons/oxygen/64x64/actions/edit-find.png",
+  "share/icons/oxygen/64x64/actions/go-bottom.png",
+  "share/icons/oxygen/64x64/actions/go-down.png",
+  "share/icons/oxygen/64x64/actions/go-first.png",
+  "share/icons/oxygen/64x64/actions/go-last.png",
+  "share/icons/oxygen/64x64/actions/go-next.png",
+  "share/icons/oxygen/64x64/actions/go-previous.png",
+  "share/icons/oxygen/64x64/actions/go-top.png",
+  "share/icons/oxygen/64x64/actions/go-up.png",
+  "share/icons/oxygen/64x64/actions/list-remove.png",
+  "share/icons/oxygen/64x64/actions/tools-report-bug.png",
+  "share/icons/oxygen/64x64/apps/kde.png",
+  "share/icons/oxygen/64x64/categories/applications-graphics.png",
+  "share/icons/oxygen/64x64/categories/preferences-system-network.png",
+  "share/icons/oxygen/64x64/status/dialog-error.png",
+  "share/icons/oxygen/64x64/status/dialog-information.png",
+  "share/icons/oxygen/64x64/status/dialog-password.png",
+  "share/icons/oxygen/64x64/status/dialog-warning.png",
+  "share/icons/oxygen/64x64/status/security-high.png",
+  "share/icons/oxygen/64x64/status/security-low.png",
+  "share/icons/oxygen/64x64/status/security-medium.png",
+  "share/icons/oxygen/index.theme",
+  "share/kde4/services/kleopatra_config_appear.desktop",
+  "share/kde4/services/kleopatra_config_cryptooperations.desktop",
+  "share/kde4/services/kleopatra_config_dirserv.desktop",
+  "share/kde4/services/kleopatra_config_gnupgsystem.desktop",
+  "share/kde4/services/kleopatra_config_smimevalidation.desktop",
+  "share/kde4/services/kleopatra_decryptverifyfiles.desktop",
+  "share/kde4/services/kleopatra_decryptverifyfolders.desktop",
+  "share/kde4/services/kleopatra_signencryptfiles.desktop",
+  "share/kde4/services/kleopatra_signencryptfolders.desktop",
+  "share/locale/all_languages",
+  "share/locale/de/entry.desktop",
+  "share/locale/*/LC_MESSAGES/akonaditray.mo",
+  "share/locale/*/LC_MESSAGES/akregator.mo",
+  "share/locale/*/LC_MESSAGES/atk10.mo",
+  "share/locale/*/LC_MESSAGES/claws-mail.mo",
+  "share/locale/*/LC_MESSAGES/glib20.mo",
+  "share/locale/*/LC_MESSAGES/gnupg2.mo",
+  "share/locale/*/LC_MESSAGES/gpa.mo",
+  "share/locale/*/LC_MESSAGES/gtk20-properties.mo",
+  "share/locale/*/LC_MESSAGES/gtk20.mo",
+  "share/locale/*/LC_MESSAGES/gtkhtml2_viewer.mo",
+  "share/locale/*/LC_MESSAGES/kabc.mo",
+  "share/locale/*/LC_MESSAGES/kabcclient.mo",
+  "share/locale/*/LC_MESSAGES/kabcformat_binary.mo",
+  "share/locale/*/LC_MESSAGES/kabc_dir.mo",
+  "share/locale/*/LC_MESSAGES/kabc_file.mo",
+  "share/locale/*/LC_MESSAGES/kabc_ldapkio.mo",
+  "share/locale/*/LC_MESSAGES/kabc_net.mo",
+  "share/locale/*/LC_MESSAGES/kaddressbook-mobile.mo",
+  "share/locale/*/LC_MESSAGES/kaddressbook.mo",
+  "share/locale/*/LC_MESSAGES/kalarm.mo",
+  "share/locale/*/LC_MESSAGES/katepart4.mo",
+  "share/locale/*/LC_MESSAGES/kcertpart.mo",
+  "share/locale/*/LC_MESSAGES/kcmcrypto.mo",
+  "share/locale/*/LC_MESSAGES/kdelibs4.mo",
+  "share/locale/*/LC_MESSAGES/kdelibs_colors4.mo",
+  "share/locale/*/LC_MESSAGES/kdeqt.mo",
+  "share/locale/*/LC_MESSAGES/kfileaudiopreview4.mo",
+  "share/locale/*/LC_MESSAGES/kio4.mo",
+  "share/locale/*/LC_MESSAGES/kio_help4.mo",
+  "share/locale/*/LC_MESSAGES/kio_imap4.mo",
+  "share/locale/*/LC_MESSAGES/kio_ldap.mo",
+  "share/locale/*/LC_MESSAGES/kio_mbox.mo",
+  "share/locale/*/LC_MESSAGES/kio_nntp.mo",
+  "share/locale/*/LC_MESSAGES/kio_pop3.mo",
+  "share/locale/*/LC_MESSAGES/kio_sieve.mo",
+  "share/locale/*/LC_MESSAGES/kio_smtp.mo",
+  "share/locale/*/LC_MESSAGES/kjots.mo",
+  "share/locale/*/LC_MESSAGES/kleopatra.mo",
+  "share/locale/*/LC_MESSAGES/kmail-mobile.mo",
+  "share/locale/*/LC_MESSAGES/kmail.mo",
+  "share/locale/*/LC_MESSAGES/kmailcvt.mo",
+  "share/locale/*/LC_MESSAGES/knode.mo",
+  "share/locale/*/LC_MESSAGES/knotes.mo",
+  "share/locale/*/LC_MESSAGES/konsolekalendar.mo",
+  "share/locale/*/LC_MESSAGES/kontact.mo",
+  "share/locale/*/LC_MESSAGES/kontactinterfaces.mo",
+  "share/locale/*/LC_MESSAGES/korganizer-mobile.mo",
+  "share/locale/*/LC_MESSAGES/korganizer.mo",
+  "share/locale/*/LC_MESSAGES/kres_blog.mo",
+  "share/locale/*/LC_MESSAGES/kres_remote.mo",
+  "share/locale/*/LC_MESSAGES/ktexteditorkabcbridge_plugin.mo",
+  "share/locale/*/LC_MESSAGES/ktexteditor_plugins.mo",
+  "share/locale/*/LC_MESSAGES/ktimetracker.mo",
+  "share/locale/*/LC_MESSAGES/ktnef.mo",
+  "share/locale/*/LC_MESSAGES/kwatchgnupg.mo",
+  "share/locale/*/LC_MESSAGES/libakonadi.mo",
+  "share/locale/*/LC_MESSAGES/libgpg-error.mo",
+  "share/locale/*/LC_MESSAGES/libkblog.mo",
+  "share/locale/*/LC_MESSAGES/libkcal.mo",
+  "share/locale/*/LC_MESSAGES/libkdepim.mo",
+  "share/locale/*/LC_MESSAGES/libkholidays.mo",
+  "share/locale/*/LC_MESSAGES/libkldap.mo",
+  "share/locale/*/LC_MESSAGES/libkleopatra.mo",
+  "share/locale/*/LC_MESSAGES/libkmime.mo",
+  "share/locale/*/LC_MESSAGES/libkpgp.mo",
+  "share/locale/*/LC_MESSAGES/libkpimidentities.mo",
+  "share/locale/*/LC_MESSAGES/libkpimutils.mo",
+  "share/locale/*/LC_MESSAGES/libkresources.mo",
+  "share/locale/*/LC_MESSAGES/libksieve.mo",
+  "share/locale/*/LC_MESSAGES/libktnef.mo",
+  "share/locale/*/LC_MESSAGES/libkxmlrpcclient.mo",
+  "share/locale/*/LC_MESSAGES/libmailtransport.mo",
+  "share/locale/*/LC_MESSAGES/timezones4.mo",
+  "share/themes/Default/gtk-2.0-key/gtkrc",
+  "share/themes/Emacs/gtk-2.0-key/gtkrc",
+  "share/themes/MS-Windows/gtk-2.0/gtkrc",
+  "share/themes/Raleigh/gtk-2.0/gtkrc",
+  "share/xdg/menus/applications.menu",
+  "VERSION",
+  "zlib1.dll",
+  NULL
+};
diff --git a/src/mkportable-light.h b/src/mkportable-light.h
new file mode 100644 (file)
index 0000000..61ae36c
--- /dev/null
@@ -0,0 +1,179 @@
+const char * const light_files[] =
+{
+  "claws-mail.exe",
+  "dirmngr-client.exe",
+  "dirmngr.exe",
+  "dirmngr_ldap.exe",
+  "etc/fonts/fonts.conf",
+  "etc/gtk-2.0/im-multipress.conf",
+  "etc/pango/pango.modules",
+  "freetype6.dll",
+  "gdbus.exe",
+  "gdk-pixbuf-pixdata.exe",
+  "gdk-pixbuf-query-loaders.exe",
+  "gio-querymodules.exe",
+  "glib-compile-resources.exe",
+  "glib-compile-schemas.exe",
+  "glib-genmarshal.exe",
+  "gobject-query.exe",
+  "gpa.exe",
+  "gpg-agent.exe",
+  "gpg-connect-agent.exe",
+  "gpg-error.exe",
+  "gpg-preset-passphrase.exe",
+  "gpg-protect-tool.exe",
+  "gpg2.exe",
+  "gpg2keys_curl.exe",
+  "gpg2keys_finger.exe",
+  "gpg2keys_hkp.exe",
+  "gpg2keys_kdns.exe",
+  "gpg2keys_ldap.exe",
+  "gpgconf.exe",
+  "gpgme-w32spawn.exe",
+  "gpgsm.exe",
+  "gpgtar.exe",
+  "gpgv2.exe",
+  "gresource.exe",
+  "gsettings.exe",
+  "gspawn-win32-helper-console.exe",
+  "gspawn-win32-helper.exe",
+  "gtk-query-immodules-2.0.exe",
+  "gtk-update-icon-cache.exe",
+  "gtk-update-icon-cache.exe.manifest",
+  "intl.dll",
+  "lib/claws-mail/plugins/address_keeper.dll",
+  "lib/claws-mail/plugins/attachwarner.dll",
+  "lib/claws-mail/plugins/att_remover.dll",
+  "lib/claws-mail/plugins/bsfilter.dll",
+  "lib/claws-mail/plugins/fetchinfo.dll",
+  "lib/claws-mail/plugins/gtkhtml2_viewer.dll",
+  "lib/claws-mail/plugins/notification.dll",
+  "lib/claws-mail/plugins/pgpcore.dll",
+  "lib/claws-mail/plugins/pgpinline.deps",
+  "lib/claws-mail/plugins/pgpinline.dll",
+  "lib/claws-mail/plugins/pgpmime.deps",
+  "lib/claws-mail/plugins/pgpmime.dll",
+  "lib/claws-mail/plugins/rssyl.dll",
+  "lib/claws-mail/plugins/smime.deps",
+  "lib/claws-mail/plugins/smime.dll",
+  "lib/claws-mail/plugins/spamreport.dll",
+  "lib/claws-mail/plugins/tnef_parse.dll",
+  "lib/claws-mail/plugins/vcalendar.dll",
+  "lib/enchant/libenchant_myspell.dll",
+  "lib/gtk-2.0/2.10.0/engines/libpixmap.dll",
+  "lib/gtk-2.0/2.10.0/engines/libwimp.dll",
+  "lib/gtk-2.0/2.10.0/immodules/im-am-et.dll",
+  "lib/gtk-2.0/2.10.0/immodules/im-cedilla.dll",
+  "lib/gtk-2.0/2.10.0/immodules/im-cyrillic-translit.dll",
+  "lib/gtk-2.0/2.10.0/immodules/im-ime.dll",
+  "lib/gtk-2.0/2.10.0/immodules/im-inuktitut.dll",
+  "lib/gtk-2.0/2.10.0/immodules/im-ipa.dll",
+  "lib/gtk-2.0/2.10.0/immodules/im-multipress.dll",
+  "lib/gtk-2.0/2.10.0/immodules/im-thai.dll",
+  "lib/gtk-2.0/2.10.0/immodules/im-ti-er.dll",
+  "lib/gtk-2.0/2.10.0/immodules/im-ti-et.dll",
+  "lib/gtk-2.0/2.10.0/immodules/im-viqr.dll",
+  "lib/gtk-2.0/modules/libgail.dll",
+  "libadns-1.dll",
+  "libassuan-0.dll",
+  "libatk-1.0-0.dll",
+  "libcairo-2.dll",
+  "libcairo-gobject-2.dll",
+  "libcairo-script-interpreter-2.dll",
+  "libcurl-4.dll",
+  "libenchant-1.dll",
+  "libetpan-13.dll",
+  "libexpat-1.dll",
+  "libffi-6.dll",
+  "libfontconfig-1.dll",
+  "libgailutil-18.dll",
+  "libgcrypt-11.dll",
+  "libgdk-win32-2.0-0.dll",
+  "libgdk_pixbuf-2.0-0.dll",
+  "libgio-2.0-0.dll",
+  "libglib-2.0-0.dll",
+  "libgmodule-2.0-0.dll",
+  "libgnutls-26.dll",
+  "libgnutls-extra-26.dll",
+  "libgnutls-openssl-27.dll",
+  "libgobject-2.0-0.dll",
+  "libgpg-error-0.dll",
+  "libgpgme-11.dll",
+  "libgpgme-glib-11.dll",
+  "libgsasl-7.dll",
+  "libgthread-2.0-0.dll",
+  "libgtk-win32-2.0-0.dll",
+  "libiconv-2.dll",
+  "libintl-8.dll",
+  "libksba-8.dll",
+  "libpango-1.0-0.dll",
+  "libpangocairo-1.0-0.dll",
+  "libpangoft2-1.0-0.dll",
+  "libpangowin32-1.0-0.dll",
+  "libpng14-14.dll",
+  "libregex-1.dll",
+  "libtasn1-3.dll",
+  "libw32pth-0.dll",
+  "libxml2-2.dll",
+  "md5sum.exe",
+  "pango-querymodules.exe",
+  "paperkey.exe",
+  "pinentry-gtk-2.exe",
+  "pinentry-w32.exe",
+  "pinentry.exe",
+  "pthreadGC2.dll",
+  "pub/gpa.exe",
+  "pub/gpg-connect-agent.exe",
+  "pub/gpg.exe",
+  "pub/gpg2.exe",
+  "pub/gpgconf.exe",
+  "pub/gpgsm.exe",
+  "pub/gpgv.exe",
+  "pub/libgcc_s_sjlj-1.dll",
+  "pub/libstdc++-6.dll",
+  "scdaemon.exe",
+  "scute.dll",
+  "sha1sum.exe",
+  "sha256sum.exe",
+  "share/claws-mail/ca-certificates.crt",
+  "share/enchant/myspell/de.aff",
+  "share/enchant/myspell/de.dic",
+  "share/enchant/myspell/en_US.aff",
+  "share/enchant/myspell/en_US.dic",
+  "share/enchant/myspell/fr.aff",
+  "share/enchant/myspell/fr.dic",
+  "share/glib-2.0/schemas/gschema.dtd",
+  "share/gnupg/gpg-agent.man",
+  "share/gnupg/gpg-conf.skel",
+  "share/gnupg/gpg-connect-agent.man",
+  "share/gnupg/gpg2.man",
+  "share/gnupg/gpgconf.man",
+  "share/gnupg/gpgsm.man",
+  "share/gnupg/gpgv2.man",
+  "share/gnupg/help.*.txt",
+  "share/gnupg/paperkey.man",
+  "share/gnupg/qualified.txt",
+  "share/gnupg/scdaemon.man",
+  "share/gpa/gpa-logo.ppm",
+  "share/gpa/gpa.png",
+  "share/gpg4win/HOWTO-SMIME.*.txt",
+  "share/gpg4win/README.*.txt",
+  "share/gpg4win/versioninfo.txt",
+  "share/locale/*/LC_MESSAGES/atk10.mo",
+  "share/locale/*/LC_MESSAGES/glib20.mo",
+  "share/locale/*/LC_MESSAGES/gpa.mo",
+  "share/locale/*/LC_MESSAGES/gtk20-properties.mo",
+  "share/locale/*/LC_MESSAGES/gtk20.mo",
+  "share/locale/*/LC_MESSAGES/gnupg2.mo",
+  "share/locale/*/LC_MESSAGES/claws-mail.mo",
+  "share/locale/*/LC_MESSAGES/gnupg2.mo",
+  "share/locale/*/LC_MESSAGES/gtkhtml2_viewer.mo",
+  "share/locale/*/LC_MESSAGES/libgpg-error.mo",
+  "share/themes/Default/gtk-2.0-key/gtkrc",
+  "share/themes/Emacs/gtk-2.0-key/gtkrc",
+  "share/themes/MS-Windows/gtk-2.0/gtkrc",
+  "share/themes/Raleigh/gtk-2.0/gtkrc",
+  "VERSION",
+  "zlib1.dll",
+  NULL
+};
diff --git a/src/mkportable-vanilla.h b/src/mkportable-vanilla.h
new file mode 100644 (file)
index 0000000..3e2a16f
--- /dev/null
@@ -0,0 +1,70 @@
+const char * const vanilla_files[] =
+{
+  "dirmngr-client.exe",
+  "dirmngr.exe",
+  "dirmngr_ldap.exe",
+  "gdk-pixbuf-pixdata.exe",
+  "gdk-pixbuf-query-loaders.exe",
+  "gpg-agent.exe",
+  "gpg-connect-agent.exe",
+  "gpg-error.exe",
+  "gpg-preset-passphrase.exe",
+  "gpg-protect-tool.exe",
+  "gpg2.exe",
+  "gpg2keys_curl.exe",
+  "gpg2keys_finger.exe",
+  "gpg2keys_hkp.exe",
+  "gpg2keys_kdns.exe",
+  "gpg2keys_ldap.exe",
+  "gpgconf.exe",
+  "gpgsm.exe",
+  "gpgtar.exe",
+  "gpgv2.exe",
+  "intl.dll",
+  "libadns-1.dll",
+  "libassuan-0.dll",
+  "libcurl-4.dll",
+  "libffi-6.dll",
+  "libgcrypt-11.dll",
+  "libgdk_pixbuf-2.0-0.dll",
+  "libgpg-error-0.dll",
+  "libiconv-2.dll",
+  "libintl-8.dll",
+  "libksba-8.dll",
+  "libw32pth-0.dll",
+  "md5sum.exe",
+  "paperkey.exe",
+  "pinentry-w32.exe",
+  "pinentry.exe",
+  "pub/gpg-connect-agent.exe",
+  "pub/gpg.exe",
+  "pub/gpg2.exe",
+  "pub/gpgconf.exe",
+  "pub/gpgsm.exe",
+  "pub/gpgv.exe",
+  "pub/libgcc_s_sjlj-1.dll",
+  "pub/libstdc++-6.dll",
+  "scdaemon.exe",
+  "scute.dll",
+  "sha1sum.exe",
+  "sha256sum.exe",
+  "share/gnupg/gpg-agent.man",
+  "share/gnupg/gpg-conf.skel",
+  "share/gnupg/gpg-connect-agent.man",
+  "share/gnupg/gpg2.man",
+  "share/gnupg/gpgconf.man",
+  "share/gnupg/gpgsm.man",
+  "share/gnupg/gpgv2.man",
+  "share/gnupg/help.*.txt",
+  "share/gnupg/paperkey.man",
+  "share/gnupg/qualified.txt",
+  "share/gnupg/scdaemon.man",
+  "share/gpg4win/HOWTO-SMIME.*.txt",
+  "share/gpg4win/README.*.txt",
+  "share/gpg4win/versioninfo.txt",
+  "share/locale/*/LC_MESSAGES/gnupg2.mo",
+  "share/locale/*/LC_MESSAGES/libgpg-error.mo",
+  "VERSION",
+  "zlib1.dll",
+  NULL
+};
diff --git a/src/mkportable.c b/src/mkportable.c
new file mode 100644 (file)
index 0000000..b37bd46
--- /dev/null
@@ -0,0 +1,783 @@
+/* mkportable.c - Tool to create portable version of Gpg4win
+ * Copyright (C) 2013 g10 Code GmbH
+ *
+ * This program 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 3, or (at your option) any
+ * later version.
+ *
+ * This program 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, see <http://www.gnu.org/licenses/>.
+ */
+
+/* History:
+   2013-08-07 wk  Written.
+*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <stdarg.h>
+#include <assert.h>
+#include <errno.h>
+#include <dirent.h>
+#include <unistd.h>
+#if _WIN32
+# include <windows.h>
+# define MKDIR_MODE_PRIVATE
+# define MKDIR_MODE_PERMISSIVE
+#else
+# include <sys/stat.h>
+# include <sys/types.h>
+# define MKDIR_MODE_PRIVATE     , 0700
+# define MKDIR_MODE_PERMISSIVE  , 0755
+#endif
+
+
+#define VERSION "1.0"
+#define PGM "mkportable"
+
+/* We use 3 complete lists for the 3 installation types.  Given that
+   gcc only writes one copy of a constant string, this doesn't
+   require too much extra space.
+
+   The lists have initially been created by running
+
+     find . -type f | sed 's,^./,  ",' | awk '{print $0 "\","}'
+
+   in a Unix mounted Windows installation directory.  Non-required
+   files have then been removed and some common pattern replaced by
+   wildcards.  Note that using a wildcard makes the presence of a
+   source file optional.  */
+#include "mkportable-vanilla.h"
+#include "mkportable-light.h"
+#include "mkportable-full.h"
+
+static int verbose;
+static enum { iVANILLA = 0, iLIGHT, iFULL } install_type;
+static const char *install_name;
+static const char *target_dir;
+static const char * const *filelist;
+
+static void
+die (const char *format, ...)
+{
+  va_list arg_ptr;
+
+  fflush (stdout);
+  fprintf (stderr, "%s: ", PGM);
+
+  va_start (arg_ptr, format);
+  vfprintf (stderr, format, arg_ptr);
+  va_end (arg_ptr);
+  putc ('\n', stderr);
+
+  exit (1);
+}
+
+
+static void
+err (const char *format, ...)
+{
+  va_list arg_ptr;
+
+  fflush (stdout);
+  fprintf (stderr, "%s: ", PGM);
+
+  va_start (arg_ptr, format);
+  vfprintf (stderr, format, arg_ptr);
+  va_end (arg_ptr);
+  putc ('\n', stderr);
+}
+
+
+static void
+inf (const char *format, ...)
+{
+  va_list arg_ptr;
+
+  if (!verbose)
+    return;
+
+  fflush (stdout);
+  fprintf (stdout, "%s: ", PGM);
+
+  va_start (arg_ptr, format);
+  vfprintf (stdout, format, arg_ptr);
+  va_end (arg_ptr);
+  putc ('\n', stdout);
+}
+
+#if _WIN32
+static const char *
+w32_strerror (int ec)
+{
+  static char strerr[256];
+
+  if (ec == -1)
+    ec = (int)GetLastError ();
+  FormatMessage (FORMAT_MESSAGE_FROM_SYSTEM, NULL, ec,
+                 MAKELANGID (LANG_NEUTRAL, SUBLANG_DEFAULT),
+                 strerr, sizeof (strerr)-1, NULL);
+  return strerr;
+}
+#endif /*_WIN32*/
+
+static void *
+xmalloc (size_t n)
+{
+  void *p = malloc (n);
+  if (!p)
+    die ("out of core");
+  return p;
+}
+
+
+static char *
+fix_backslashes (char *buffer)
+{
+#if _WIN32
+  char *p;
+
+  for (p=buffer; *p; p++)
+    if (*p == '\\')
+      *p = '/';
+#endif
+  return buffer;
+}
+
+
+#if _WIN32
+static char *
+unfix_backslashes (char *buffer)
+{
+  char *p;
+
+  for (p=buffer; *p; p++)
+    if (*p == '/')
+      *p = '\\';
+  return buffer;
+}
+#endif
+
+
+/* Determine the root directory of the gnupg installation on Windows.  */
+static const char *
+get_sourcedir (void)
+{
+#if _WIN32
+  static int got_dir;
+  static char dir[MAX_PATH+5];
+
+  if (!got_dir)
+    {
+      char *p;
+      int rc;
+
+      rc = GetModuleFileName (NULL, dir, MAX_PATH);
+      if (!rc)
+        die ("GetModuleFileName failed: %s\n", w32_strerror (-1));
+      got_dir = 1;
+      p = strrchr (dir, '\\');
+      if (p)
+        {
+          *p = 0;
+
+          /* If we are installed below "bin" we strip that and use
+             the top directory instead.  */
+          p = strrchr (dir, '\\');
+          if (p && !strcmp (p+1, "bin"))
+            *p = 0;
+        }
+      if (!p)
+        die ("bad filename '%s' returned for this process\n", dir);
+      fix_backslashes (dir);
+    }
+
+  if (*dir)
+    return dir;
+#endif /*_WIN32*/
+  /* Fallback to the current directory. */
+  return ".";
+}
+
+
+/* Return 0 if the target directory is suitable.  */
+static int
+check_target_dir (int force)
+{
+  int count = 0;
+
+#if _WIN32
+  {
+    char *fname;
+    HANDLE hd = INVALID_HANDLE_VALUE;
+    WIN32_FIND_DATAA fi;
+
+    fname = xmalloc (strlen (target_dir) + 2 + 2 + 1);
+    if (!strcmp (target_dir, "/"))
+      strcpy (fname, "/*"); /* Trailing slash is not allowed.  */
+    else if (!strcmp (target_dir, "."))
+      strcpy (fname, "*");
+    else if (*target_dir && target_dir[strlen (target_dir)-1] == '/')
+      {
+        strcpy (fname, target_dir);
+        strcat (fname, "*");
+      }
+    else if (*target_dir && target_dir[strlen (target_dir)-1] != '*')
+      {
+        strcpy (fname, target_dir);
+        strcat (fname, "/*");
+      }
+    else
+      strcpy (fname, target_dir);
+
+    inf ("finding files in '%s'", fname);
+
+    unfix_backslashes (fname);
+    hd = FindFirstFileA (fname, &fi);
+    if (hd == INVALID_HANDLE_VALUE)
+      {
+        err ("error reading target directory '%s': %s",
+             target_dir, w32_strerror (-1));
+        free (fname);
+        return 1;
+      }
+    do
+      {
+        if (!strcmp (fi.cFileName, "." ) || !strcmp (fi.cFileName, ".."))
+          ;
+        else
+          count++;
+      }
+    while (FindNextFileA (hd, &fi));
+    FindClose (hd);
+    free (fname);
+  }
+#else /*!_WIN32*/
+  {
+    DIR *dir;
+    struct dirent *de;
+
+    dir = opendir (target_dir);
+    if (!dir)
+      {
+        err ("error reading read target directory '%s': %s",
+             target_dir, strerror (errno));
+        return 1;
+      }
+    while ((de = readdir (dir)))
+      {
+        if (!strcmp (de->d_name, "." ) || !strcmp (de->d_name, ".."))
+          continue; /* Skip self and parent dir entry.  */
+        count++;
+      }
+    closedir (dir);
+  }
+#endif /*!_WIN32*/
+
+  if (count)
+    inf ("number of files in target directory: %d", count);
+  if (count)
+    {
+      err ("target directory '%s' is not empty%s",
+           target_dir, force? " - continuing anyway":"");
+      if (!force)
+        return 1;
+    }
+
+  return 0;
+}
+
+
+static char *
+make_sourcename (const char *name)
+{
+  const char *sdir = get_sourcedir ();
+  char *fname;
+
+  fname = xmalloc (strlen (sdir) + 1 + strlen (name) + 1);
+  strcpy (fname, sdir);
+  if (*fname && fname[strlen (fname)-1] != '/')
+    strcat (fname, "/");
+  strcat (fname, name);
+  return fname;
+}
+
+static char *
+make_targetname (const char *name)
+{
+  const char *tdir = target_dir;
+  char *fname;
+
+  fname = xmalloc (strlen (tdir) + 1 + strlen (name) + 1);
+  strcpy (fname, tdir);
+  if (*fname && fname[strlen (fname)-1] != '/')
+    strcat (fname, "/");
+  strcat (fname, name);
+  return fname;
+}
+
+
+/* Call access for a file NAME in the installation directory.  */
+static int
+access_sourcename (const char *name)
+{
+  char *fname = make_sourcename (name);
+  int rc = access (fname, F_OK);
+  free (fname);
+  return rc;
+}
+
+
+/* Check that all source files are available.  Return 0 on success.
+   We do this so that we don't start to copy files and only later
+   realize that some files are missing.  This is in particular useful
+   because we require an empty target directory.  */
+static int
+check_all_files (void)
+{
+  const char *name;
+  int bad = 0;
+  int i;
+
+  /* First a quick check for gpgconf.  */
+  name = "gpgconf.exe";
+  if (access_sourcename (name))
+    {
+      err ("file '%s' not found in the source directory", name);
+      return 1;
+    }
+
+  for (i=0; (name = filelist[i]); i++)
+    {
+      if (strchr (filelist[i], '*'))
+        continue;
+      if (access_sourcename (name))
+        {
+          err ("file '%s' not found in the source directory", name);
+          bad++;
+        }
+    }
+
+  if (bad)
+    inf ("number of missing files: %d", bad);
+
+  return !!bad;
+}
+
+/* Try to make intermediate directories.  */
+static void
+make_dirs (const char *name)
+{
+  char *fname, *p;
+
+  fname = make_targetname (name);
+  p = fname + strlen (fname) - strlen (name);
+  while ((p = strchr (p, '/')))
+    {
+      *p = 0;
+      mkdir (fname MKDIR_MODE_PERMISSIVE);
+      *p++ = '/';
+    }
+  free (fname);
+}
+
+
+/****************
+ * Copy the option file skeleton to the given directory.
+ */
+static int
+copy_file (const char *name)
+{
+  char *srcname, *dstname;
+  FILE *srcfp, *dstfp;
+  int tried_mkdir = 0;
+  char buffer[4096];
+
+  if (verbose > 1)
+    inf ("copying '%s'", name);
+
+  srcname = make_sourcename (name);
+  dstname = make_targetname (name);
+
+  srcfp = fopen (srcname, "rb");
+  if (!srcfp)
+    {
+      err ("failed to open '%s': %s\n", srcname, strerror (errno));
+      free (srcname);
+      free (dstname);
+      return 1;
+    }
+
+ again:
+  dstfp = fopen (dstname, "wb");
+  if (!dstfp)
+    {
+      if (!tried_mkdir && errno == ENOENT && strchr (name, '/'))
+        {
+          tried_mkdir = 1;
+          make_dirs (name);
+          goto again;
+        }
+
+      err ("failed to create '%s': %s\n", dstname, strerror (errno));
+      fclose (srcfp);
+      free (srcname);
+      free (dstname);
+      return 1;
+    }
+
+  while (!feof (srcfp))
+    {
+      size_t n;
+
+      n = fread (buffer, 1, sizeof buffer, srcfp);
+      if (n < sizeof buffer && ferror (srcfp))
+        {
+          err ("error reading '%s'\n", srcname);
+          fclose (srcfp);
+          fclose (dstfp);
+          free (srcname);
+          free (dstname);
+          return 1;
+        }
+
+      errno = 0;
+      if (fwrite (buffer, 1, n, dstfp) != n)
+        {
+          err ("error writing to '%s': %s\n", dstname, strerror (errno));
+          fclose (srcfp);
+          fclose (dstfp);
+          free (srcname);
+          free (dstname);
+          return 1;
+        }
+    }
+
+  if (fflush (dstfp) == EOF)
+    {
+      err ("error writing to '%s': %s\n", dstname, strerror (errno));
+      fclose (srcfp);
+      fclose (dstfp);
+      free (srcname);
+      free (dstname);
+      return 1;
+    }
+  if (fclose (dstfp) == EOF)
+    {
+      err ("error closing '%s': %s\n", dstname, strerror (errno));
+      fclose (srcfp);
+      fclose (dstfp);
+      free (srcname);
+      free (dstname);
+      return 1;
+    }
+
+  fclose  (srcfp);
+
+  free (srcname);
+  free (dstname);
+  return 0;
+}
+
+
+/* Copy files which contain one '*' wildcard. */
+static int
+wildcard_copy_file (const char *name)
+{
+  int res = 0;
+  char *fname;
+  size_t srcpos;
+
+  if (verbose > 1)
+    inf ("globing '%s'", name);
+
+  fname = make_sourcename (name);
+  srcpos = strlen (fname) - strlen (name);
+
+#if _WIN32
+  {
+    HANDLE hd = INVALID_HANDLE_VALUE;
+    WIN32_FIND_DATAA fi;
+    char *p, *tail;
+    char *buffer = NULL;
+
+    p = strchr (fname, '*');
+    assert (p);
+    tail = strchr (p, '/');
+    if (tail)
+      *tail++ = 0;
+
+    unfix_backslashes (fname);
+    hd = FindFirstFileA (fname, &fi);
+    fix_backslashes (fname);
+
+    p = strrchr (fname, '/');
+    if (p)
+      *p = 0;
+
+    if (hd != INVALID_HANDLE_VALUE)
+      {
+        do
+          {
+            if (!strcmp (fi.cFileName, "." ) || !strcmp (fi.cFileName, ".."))
+              ;
+            else
+              {
+                free (buffer);
+                buffer = xmalloc (strlen (fname) + 1
+                                  + strlen (fi.cFileName) + 1
+                                  + (tail? strlen (tail):0) + 1);
+                strcpy (buffer, fname);
+                strcat (buffer, "/");
+                strcat (buffer, fi.cFileName);
+                if (tail)
+                  {
+                    strcat (buffer, "/");
+                    strcat (buffer, tail);
+                  }
+                if (!access (buffer, F_OK))
+                  if (copy_file (buffer + srcpos))
+                    {
+                      res = 1;
+                      goto leave;
+                    }
+
+              }
+        }
+        while (FindNextFileA (hd, &fi));
+      leave:
+        free (buffer);
+        FindClose (hd);
+      }
+  }
+#endif /*_WIN32*/
+
+  free (fname);
+  return res;
+}
+
+
+/* Copy all files to the target directory.  */
+static int
+copy_all_files (void)
+{
+  int idx;
+  const char *name;
+
+  inf ("copying files to '%s'", target_dir);
+
+  for (idx=0; (name = filelist[idx]); idx++)
+    {
+      if (strchr (name, '*'))
+        {
+          if (wildcard_copy_file (name))
+            return 1;
+        }
+      else if (copy_file (name))
+        return 1;
+    }
+  return 0;
+}
+
+
+/* Create the new home directory.  */
+static int
+make_home_dir (void)
+{
+  char *name;
+
+  name = make_targetname ("home");
+  if (mkdir (name MKDIR_MODE_PRIVATE))
+    {
+      if (errno == EEXIST)
+        inf ("portable home directory '%s' already exists - fine", name);
+      else
+        {
+          err ("error creating portable home directory '%s': %s",
+               name, strerror (errno));
+          free (name);
+          return 1;
+        }
+    }
+  else
+    inf ("portable home directory '%s' created", name);
+  free (name);
+  return 0;
+}
+
+
+
+/* Write the gpgconf.ctl file which is used by GnuPG to put itself
+   into portable mode.  */
+static int
+write_ctl_file (void)
+{
+  char *name;
+  FILE *fp;
+
+  name = make_targetname ("gpgconf.ctl");
+  fp = fopen (name, "wb");
+  if (!fp)
+    {
+      err ("failed to create '%s': %s\n", name, strerror (errno));
+      free (name);
+      return 1;
+    }
+
+  fprintf (fp,
+           "# The presence of this file switches GnuPG into portable mode.\n"
+           "#\n"
+           "# Install type is: %s\n"
+           "# (created by %s version %s)\n",
+           install_name, PGM, VERSION);
+
+   if (fflush (fp) == EOF)
+    {
+      err ("error writing to '%s': %s\n", name, strerror (errno));
+      fclose (fp);
+      free (name);
+      return 1;
+    }
+  if (fclose (fp) == EOF)
+    {
+      err ("error closing '%s': %s\n", name, strerror (errno));
+      free (name);
+      return 1;
+    }
+
+  free (name);
+  return 0;
+}
+
+
+static void
+usage (int mode)
+{
+  FILE *fp = mode > 0? stderr : stdout;
+
+  if (mode <= 0)
+    fputs (PGM " "VERSION"\n"
+           "Copyright (C) 2013 g10 Code GmbH\n"
+           "License GPLv3+: GNU GPL version 3 or later "
+           "<http://gnu.org/licenses/gpl.html>.\n"
+           "This is free software: you are free to change "
+           "and redistribute it.\n"
+           "There is NO WARRANTY, to the extent permitted by law.\n\n",
+           fp);
+
+  if (mode < 0)
+    exit (0);
+
+  fputs ("Usage: mkportable [OPTIONS] TARGETDIR\n", fp);
+  if (mode > 0)
+    exit (1);
+
+  fputs ("Create a portable version of Gpg4win by copying the required\n"
+         "files to TARGETDIR\n"
+         "\n"
+         "Options:\n"
+         "  --vanilla   create a bare GnuPG version [default]\n"
+         "  --light     create a light version\n"
+         "  --full      create a full version\n"
+         "  --verbose   enable extra informational output\n"
+         "  --force     force installation to a non-empty directory\n"
+         "  --version   print version of this program and exit\n"
+         "  --help      print this help and exit\n",
+         fp);
+
+  exit (0);
+}
+
+int
+main (int argc, char **argv)
+{
+  int last_argc = -1;
+  int force = 0;
+
+  if (argc)
+    {
+      argc--; argv++;
+    }
+
+  while (argc && last_argc != argc )
+    {
+      last_argc = argc;
+      if (!strcmp (*argv, "--"))
+        {
+          argc--; argv++;
+          break;
+        }
+      else if (!strcmp (*argv, "--version"))
+        usage (-1);
+      else if (!strcmp (*argv, "--help"))
+        usage (0);
+      else if (!strcmp (*argv, "--verbose"))
+        {
+          verbose++;
+          argc--; argv++;
+        }
+      else if (!strcmp (*argv, "--force"))
+        {
+          force = 1;
+          argc--; argv++;
+        }
+      else if (!strcmp (*argv, "--vanilla"))
+        {
+          install_type = iVANILLA;
+          argc--; argv++;
+        }
+      else if (!strcmp (*argv, "--light"))
+        {
+          install_type = iLIGHT;
+          argc--; argv++;
+        }
+      else if (!strcmp (*argv, "--full"))
+        {
+          install_type = iFULL;
+          argc--; argv++;
+        }
+      else if (!strncmp (*argv, "--", 2))
+        die ("unknown option '%s'", *argv);
+    }
+
+  if (argc != 1 || !*argv[0])
+    usage (1);
+  target_dir = fix_backslashes (argv[0]);
+
+  inf ("source directory is '%s'", get_sourcedir ());
+  inf ("target directory is '%s'", target_dir);
+
+  switch (install_type)
+    {
+    case iVANILLA: filelist = vanilla_files; install_name = "vanilla"; break;
+    case iLIGHT:   filelist = light_files;   install_name = "light"; break;
+    case iFULL:    filelist = full_files;    install_name = "full"; break;
+    default:  assert (!"bug");
+    }
+
+  if (check_target_dir (force))
+    return 1;
+
+  if (check_all_files ())
+    return 1;
+
+  if (copy_all_files ())
+    return 1;
+
+  if (make_home_dir ())
+    return 1;
+
+  if (write_ctl_file ())
+    return 1;
+
+  inf ("ready");
+
+  return 0;
+}
index 843f5b0..82b93af 100644 (file)
@@ -34,6 +34,7 @@ Section "-un.gpg4win"
   Delete "$INSTDIR\sha1sum.exe"
   Delete "$INSTDIR\sha256sum.exe"
   Delete "$INSTDIR\md5sum.exe"
+  Delete "$INSTDIR\mkportable.exe"
 
   # Delete the runtime libarries
   Delete "$INSTDIR\pub\libstdc++-6.dll"