diff --git a/src/inst-gpg4win.nsi b/src/inst-gpg4win.nsi
index 3078d682..06f78044 100644
--- a/src/inst-gpg4win.nsi
+++ b/src/inst-gpg4win.nsi
@@ -1,141 +1,148 @@
# inst-gpg4win.nsi - Hidden section for common files. -*- coding: latin-1; -*-
# Copyright (C) 2006 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
# This is the very first section installed.
Section "-gpg4win" SEC_gpg4win
!ifdef SOURCES
SetOutPath "$INSTDIR"
File "${BUILD_DIR}/../gpg4win-${VERSION}.tar.bz2"
!else
Call KillOtherAppsOrWarn
StrCpy $is_update "0"
+
+# BEGIN MSI IGNORE
+# For MSI we ignore this.
+
# Start the slideshow.
SetDetailsPrint none
SetOutPath "$PLUGINSDIR\Slides"
File "${BUILD_DIR}/slideshow/slide1-gpgol.png"
File "${BUILD_DIR}/slideshow/slide2-gpgex.png"
#File "${BUILD_DIR}/slideshow/slide3-kleopatra.png"
File "${BUILD_DIR}/slideshow/slide4-summary.png"
File "${BUILD_DIR}/slideshow/slides.dat"
g4wihelp::slide_show /NOUNLOAD /CCOLOR=0x000000 "/auto=$PLUGINSDIR\Slides\slides.dat" /FIT=WIDTH
SetDetailsPrint both
SetOutPath "$INSTDIR"
+# END MSI IGNORE
# Uninstall an old version if found.
ClearErrors
ReadRegStr $0 SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\GPG4Win" "DisplayVersion"
IfErrors skip_uninst 0
StrCmp $0 "" skip_uninst
DetailPrint "$(T_UninstallingOldVersion)$0"
ReadRegStr $0 SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\GPG4Win" "UninstallString"
IfErrors skip_uninst 0
ReadRegStr $1 SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\GPG4Win" "InstallLocation"
IfErrors skip_uninst 0
ExecWait '$0 /S /UPDATE=1 _?=$1'
# Deleting here does not work?
StrCpy $is_update "1"
Delete /REBOOTOK "$1\gpg4win-uninstall.exe"
RmDir "$1"
SetOutPath "$INSTDIR\share\gpg4win"
skip_uninst:
SetOutPath "$INSTDIR\share\gpg4win"
File "${BUILD_DIR}/README.en.txt"
File "${BUILD_DIR}/README.de.txt"
+# BEGIN MSI IGNORE
File /oname=README.ar.txt "${BUILD_DIR}/README.en.txt"
File /oname=README.cz.txt "${BUILD_DIR}/README.en.txt"
File /oname=README.es.txt "${BUILD_DIR}/README.en.txt"
File /oname=README.fr.txt "${BUILD_DIR}/README.en.txt"
File /oname=README.it.txt "${BUILD_DIR}/README.en.txt"
File /oname=README.no.txt "${BUILD_DIR}/README.en.txt"
File /oname=README.pt.txt "${BUILD_DIR}/README.en.txt"
File /oname=README.ru.txt "${BUILD_DIR}/README.en.txt"
File /oname=README.zh_CN.txt "${BUILD_DIR}/README.en.txt"
File /oname=README.zh_TW.txt "${BUILD_DIR}/README.en.txt"
+# END MSI IGNORE
File "${BUILD_DIR}/HOWTO-SMIME.en.txt"
File "${BUILD_DIR}/HOWTO-SMIME.de.txt"
File "${BUILD_DIR}/versioninfo.txt"
# Write a version file.
DetailPrint "Opening VERSION file for writing"
FileOpen $0 "$INSTDIR\VERSION" w
FileWrite $0 "${PACKAGE}$\r$\n"
FileWrite $0 "${VERSION}$\r$\n"
FileClose $0
DetailPrint "VERSION closed"
# BEGIN MSI IGNORE
# Register the install directory for Gpg4win suite.
WriteRegStr SHCTX "Software\Gpg4win" "Install Directory" $INSTDIR
DetailPrint "Saved install directory in the registry"
# END MSI IGNORE
# We used to determine the language using a Registry entry.
# Although we don't want to delete the user's Lang Registry Setting
# because he might have have selected a different language than his
# default. We delete the global Lang of the installation.
DeleteRegValue SHCTX "Software\GNU\GnuPG" "Lang"
DetailPrint "Deleted obsolete Lang entry"
# This old key is required for GPGee. Please do not use in new
# applications.
# Note: We don't use it anymore so that gpgme decides what gpg to use
# For the new gpg4win we actually use gpg2.exe.
# To cope with old installations we actually remove this value.
# However we can only remove the SHCTX version not those set by
# the user under HKCU.
#WriteRegStr SHCTX "Software\GNU\GnuPG" "gpgProgram" "$INSTDIR\gpg.exe"
DeleteRegValue SHCTX "Software\GNU\GnuPG" "gpgProgram"
DetailPrint "Deleted obsolete gpgProgram value"
# Install gpg4win included tools
SetOutPath "$INSTDIR\bin"
File "${BUILD_DIR}/sha1sum.exe"
SetOutPath "$INSTDIR\bin"
File "${BUILD_DIR}/sha256sum.exe"
File "${BUILD_DIR}/md5sum.exe"
File "${BUILD_DIR}/mkportable.exe"
# Install the mingw32 runtime libraries. They are stored in the
# build directory with a different suffix, so that makensis does not
# list symbol names.
File /oname=libstdc++-6.dll "${BUILD_DIR}/libstdc++-6.dll-x"
File /oname=libgcc_s_sjlj-1.dll "${BUILD_DIR}/libgcc_s_sjlj-1.dll-x"
File /oname=libwinpthread-1.dll "${BUILD_DIR}/libwinpthread-1.dll-x"
!endif
SectionEnd
LangString DESC_Menu_gpg4win_readme ${LANG_ENGLISH} \
"General information on Gpg4win"
LangString DESC_Menu_gpg4win_howtosmime ${LANG_ENGLISH} \
"Instruction to configure S/MIME"
LangString DESC_Menu_gnupg_faq ${LANG_ENGLISH} \
"Show the Frequently Asked Questions document for GnuPG"
diff --git a/src/inst-sections.nsi b/src/inst-sections.nsi
index cb34c5e2..fd8abf29 100644
--- a/src/inst-sections.nsi
+++ b/src/inst-sections.nsi
@@ -1,1111 +1,1108 @@
# inst-sections.nsi - Installer for GPG4Win sections. -*- coding: latin-1; -*-
# Copyright (C) 2005, 2006, 2007, 2008, 2009 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, see .
!include "inst-gpg4win.nsi"
# The order of installation must be the same as the build order. You
# can use tsort on the info in configure.ac, or just check out
# gpg4win_build_list in config.nsi. The order determines also the
# order in the packages selection dialog.
!ifdef HAVE_PKG_BZIP2
!include "inst-bzip2.nsi"
!endif
!ifdef HAVE_PKG_LIBICONV
!include "inst-libiconv.nsi"
!endif
!ifdef HAVE_PKG_LIBTASN1
!include "inst-libtasn1.nsi"
!endif
!ifdef HAVE_PKG_BREEZE_ICONS
!include "inst-breeze-icons.nsi"
!endif
!ifdef HAVE_PKG_PKGCONFIG
!include "inst-pkgconfig.nsi"
!endif
!ifdef HAVE_PKG_W32PTH
!include "inst-w32pth.nsi"
!endif
!ifdef HAVE_PKG_ZLIB
!include "inst-zlib.nsi"
!endif
!ifdef HAVE_PKG_QTBASE
!include "inst-qtbase.nsi"
!endif
!ifdef HAVE_PKG_GETTEXT
!include "inst-gettext.nsi"
!endif
!ifdef HAVE_PKG_LIBPNG
!include "inst-libpng.nsi"
!endif
!ifdef HAVE_PKG_LIBASSUAN
!include "inst-libassuan.nsi"
!endif
!ifdef HAVE_PKG_LIBGPG_ERROR
!include "inst-libgpg-error.nsi"
!endif
!ifdef HAVE_PKG_LIBFFI
!include "inst-libffi.nsi"
!endif
!ifdef HAVE_PKG_GLIB
!include "inst-glib.nsi"
!endif
!ifdef HAVE_PKG_EXPAT
!include "inst-expat.nsi"
!endif
!ifdef HAVE_PKG_FREETYPE
!include "inst-freetype.nsi"
!endif
!ifdef HAVE_PKG_FONTCONFIG
!include "inst-fontconfig.nsi"
!endif
!ifdef HAVE_PKG_CAIRO
!include "inst-cairo.nsi"
!endif
!ifdef HAVE_PKG_PANGO
!include "inst-pango.nsi"
!endif
!ifdef HAVE_PKG_ATK
!include "inst-atk.nsi"
!endif
!ifdef HAVE_PKG_GDK_PIXBUF
!include "inst-gdk-pixbuf.nsi"
!endif
!ifdef HAVE_PKG_GTK_
!include "inst-gtk+.nsi"
!endif
!ifdef HAVE_PKG_PINENTRY
!include "inst-pinentry.nsi"
!endif
+# BEGIN MSI IGNORE
!ifdef HAVE_PKG_GNUPG_W32
!include "inst-gnupg-w32.nsi"
!endif
+# END MSI IGNORE
!ifdef HAVE_PKG_GPGME
!include "inst-gpgme.nsi"
!endif
!ifdef HAVE_PKG_QTTOOLS
!include "inst-qttools.nsi"
!endif
!ifdef HAVE_PKG_QTWINEXTRAS
!include "inst-qtwinextras.nsi"
!endif
!ifdef HAVE_PKG_BOOST
!include "inst-boost.nsi"
!endif
!ifdef HAVE_PKG_KCONFIG
!include "inst-kconfig.nsi"
!endif
!ifdef HAVE_PKG_KI18N
!include "inst-ki18n.nsi"
!endif
!ifdef HAVE_PKG_KWIDGETSADDONS
!include "inst-kwidgetsaddons.nsi"
!endif
!ifdef HAVE_PKG_KCOMPLETION
!include "inst-kcompletion.nsi"
!endif
!ifdef HAVE_PKG_KWINDOWSYSTEM
!include "inst-kwindowsystem.nsi"
!endif
!ifdef HAVE_PKG_KCOREADDONS
!include "inst-kcoreaddons.nsi"
!endif
!ifdef HAVE_PKG_KCODECS
!include "inst-kcodecs.nsi"
!endif
!ifdef HAVE_PKG_KCONFIGWIDGETS
!include "inst-kconfigwidgets.nsi"
!endif
!ifdef HAVE_PKG_KXMLGUI
!include "inst-kxmlgui.nsi"
!endif
!ifdef HAVE_PKG_KGUIADDONS
!include "inst-kguiaddons.nsi"
!endif
!ifdef HAVE_PKG_KMIME
!include "inst-kmime.nsi"
!endif
!ifdef HAVE_PKG_KDE_L10N
!include "inst-kde-l10n.nsi"
!endif
!ifdef HAVE_PKG_KICONTHEMES
!include "inst-kiconthemes.nsi"
!endif
!ifdef HAVE_PKG_KARCHIVE
!include "inst-karchive.nsi"
!endif
!ifdef HAVE_PKG_KCRASH
!include "inst-kcrash.nsi"
!endif
!ifdef HAVE_PKG_KITEMVIEWS
!include "inst-kitemviews.nsi"
!endif
!ifdef HAVE_PKG_KITEMMODELS
!include "inst-kitemmodels.nsi"
!endif
!ifdef HAVE_PKG_LIBKLEO
!include "inst-libkleo.nsi"
!endif
!ifdef HAVE_PKG_EXTRA_CMAKE_MODULES
!include "inst-extra-cmake-modules.nsi"
!endif
!ifdef HAVE_PKG_QTSVG
!include "inst-qtsvg.nsi"
!endif
!ifdef HAVE_PKG_QTTRANSLATIONS
!include "inst-qttranslations.nsi"
!endif
!ifdef HAVE_PKG_GPG4WIN_TOOLS
!include "inst-gpg4win-tools.nsi"
!endif
!ifdef HAVE_PKG_SCUTE
!include "inst-scute.nsi"
!endif
+!ifdef HAVE_PKG_PAPERKEY
+!include "inst-paperkey.nsi"
+!endif
+!ifdef HAVE_PKG_MAN_NOVICE_EN
+!include "inst-man_novice_en.nsi"
+!endif
+!ifdef HAVE_PKG_MAN_ADVANCED_EN
+!include "inst-man_advanced_en.nsi"
+!endif
+!ifdef HAVE_PKG_MAN_NOVICE_DE
+!include "inst-man_novice_de.nsi"
+!endif
+!ifdef HAVE_PKG_MAN_ADVANCED_DE
+!include "inst-man_advanced_de.nsi"
+!endif
# These are displayed in the selection dialog.
!ifdef HAVE_PKG_KLEOPATRA
!include "inst-kleopatra.nsi"
!endif
+# BEGIN MSI IGNORE
!ifdef HAVE_PKG_GPA
!include "inst-gpa.nsi"
!endif
+# END MSI IGNORE
!ifdef HAVE_PKG_GPGOL
!include "inst-gpgol.nsi"
!endif
!ifdef HAVE_PKG_GPGEX
!include "inst-gpgex.nsi"
!endif
-!ifdef HAVE_PKG_PAPERKEY
-!include "inst-paperkey.nsi"
-!endif
!ifdef HAVE_PKG_COMPENDIUM
!include "inst-compendium.nsi"
!endif
-!ifdef HAVE_PKG_MAN_NOVICE_EN
-!include "inst-man_novice_en.nsi"
-!endif
-!ifdef HAVE_PKG_MAN_ADVANCED_EN
-!include "inst-man_advanced_en.nsi"
-!endif
-!ifdef HAVE_PKG_MAN_NOVICE_DE
-!include "inst-man_novice_de.nsi"
-!endif
-!ifdef HAVE_PKG_MAN_ADVANCED_DE
-!include "inst-man_advanced_de.nsi"
-!endif
!include "inst-gpgme-browser.nsi"
!include "inst-final.nsi"
# We have to invoke the uninstallers in reverse order!
!ifdef HAVE_PKG_MAN_ADVANCED_DE
!include "uninst-man_advanced_de.nsi"
!endif
!ifdef HAVE_PKG_MAN_NOVICE_DE
!include "uninst-man_novice_de.nsi"
!endif
!ifdef HAVE_PKG_MAN_ADVANCED_EN
!include "uninst-man_advanced_en.nsi"
!endif
!ifdef HAVE_PKG_MAN_NOVICE_EN
!include "uninst-man_novice_en.nsi"
!endif
!ifdef HAVE_PKG_COMPENDIUM
!include "uninst-compendium.nsi"
!endif
!ifdef HAVE_PKG_PAPERKEY
!include "uninst-paperkey.nsi"
!endif
!ifdef HAVE_PKG_GPGEX
!include "uninst-gpgex.nsi"
!endif
!ifdef HAVE_PKG_GPGOL
!include "uninst-gpgol.nsi"
!endif
!ifdef HAVE_PKG_GPA
!include "uninst-gpa.nsi"
!endif
!ifdef HAVE_PKG_KLEOPATRA
!include "uninst-kleopatra.nsi"
!endif
!ifdef HAVE_PKG_GPGME
!include "uninst-gpgme.nsi"
!endif
!ifdef HAVE_PKG_GNUPG_W32
!include "uninst-gnupg-w32.nsi"
!endif
!ifdef HAVE_PKG_PINENTRY
!include "uninst-pinentry.nsi"
!endif
!ifdef HAVE_PKG_GNUTLS
!include "uninst-gnutls.nsi"
!endif
!ifdef HAVE_PKG_CURL
!include "uninst-curl.nsi"
!endif
!ifdef HAVE_PKG_GTK_
!include "uninst-gtk+.nsi"
!endif
!ifdef HAVE_PKG_GDK_PIXBUF
!include "uninst-gdk-pixbuf.nsi"
!endif
!ifdef HAVE_PKG_ATK
!include "uninst-atk.nsi"
!endif
!ifdef HAVE_PKG_PANGO
!include "uninst-pango.nsi"
!endif
!ifdef HAVE_PKG_CAIRO
!include "uninst-cairo.nsi"
!endif
!ifdef HAVE_PKG_FONTCONFIG
!include "uninst-fontconfig.nsi"
!endif
!ifdef HAVE_PKG_FREETYPE
!include "uninst-freetype.nsi"
!endif
!ifdef HAVE_PKG_EXPAT
!include "uninst-expat.nsi"
!endif
!ifdef HAVE_PKG_GLIB
!include "uninst-glib.nsi"
!endif
!ifdef HAVE_PKG_LIBFFI
!include "uninst-libffi.nsi"
!endif
!ifdef HAVE_PKG_LIBGPG_ERROR
!include "uninst-libgpg-error.nsi"
!endif
!ifdef HAVE_PKG_LIBASSUAN
!include "uninst-libassuan.nsi"
!endif
!ifdef HAVE_PKG_LIBPNG
!include "uninst-libpng.nsi"
!endif
!ifdef HAVE_PKG_GETTEXT
!include "uninst-gettext.nsi"
!endif
!ifdef HAVE_PKG_QTBASE
!include "uninst-qtbase.nsi"
!endif
!ifdef HAVE_PKG_ZLIB
!include "uninst-zlib.nsi"
!endif
!ifdef HAVE_PKG_W32PTH
!include "uninst-w32pth.nsi"
!endif
!ifdef HAVE_PKG_PKGCONFIG
!include "uninst-pkgconfig.nsi"
!endif
!ifdef HAVE_PKG_BREEZE_ICONS
!include "uninst-breeze-icons.nsi"
!endif
!ifdef HAVE_PKG_MAN_ADVANCED_DE
!include "uninst-man_advanced_de.nsi"
!endif
!ifdef HAVE_PKG_MAN_NOVICE_DE
!include "uninst-man_novice_de.nsi"
!endif
!ifdef HAVE_PKG_MAN_ADVANCED_EN
!include "uninst-man_advanced_en.nsi"
!endif
!ifdef HAVE_PKG_MAN_NOVICE_EN
!include "uninst-man_novice_en.nsi"
!endif
!ifdef HAVE_PKG_LIBICONV
!include "uninst-libiconv.nsi"
!endif
!ifdef HAVE_PKG_QTTOOLS
!include "uninst-qttools.nsi"
!endif
!ifdef HAVE_PKG_QTWINEXTRAS
!include "uninst-qtwinextras.nsi"
!endif
!ifdef HAVE_PKG_BOOST
!include "uninst-boost.nsi"
!endif
!ifdef HAVE_PKG_KCONFIG
!include "uninst-kconfig.nsi"
!endif
!ifdef HAVE_PKG_KI18N
!include "uninst-ki18n.nsi"
!endif
!ifdef HAVE_PKG_KWIDGETSADDONS
!include "uninst-kwidgetsaddons.nsi"
!endif
!ifdef HAVE_PKG_KCOMPLETION
!include "uninst-kcompletion.nsi"
!endif
!ifdef HAVE_PKG_KWINDOWSYSTEM
!include "uninst-kwindowsystem.nsi"
!endif
!ifdef HAVE_PKG_KCOREADDONS
!include "uninst-kcoreaddons.nsi"
!endif
!ifdef HAVE_PKG_KCODECS
!include "uninst-kcodecs.nsi"
!endif
!ifdef HAVE_PKG_KCONFIGWIDGETS
!include "uninst-kconfigwidgets.nsi"
!endif
!ifdef HAVE_PKG_KGUIADDONS
!include "uninst-kguiaddons.nsi"
!endif
!ifdef HAVE_PKG_KXMLGUI
!include "uninst-kxmlgui.nsi"
!endif
!ifdef HAVE_PKG_KICONTHEMES
!include "uninst-kiconthemes.nsi"
!endif
!ifdef HAVE_PKG_KARCHIVE
!include "uninst-karchive.nsi"
!endif
!ifdef HAVE_PKG_KCRASH
!include "uninst-kcrash.nsi"
!endif
!ifdef HAVE_PKG_KITEMVIEWS
!include "uninst-kitemviews.nsi"
!endif
!ifdef HAVE_PKG_KITEMMODELS
!include "uninst-kitemmodels.nsi"
!endif
!ifdef HAVE_PKG_KMIME
!include "uninst-kmime.nsi"
!endif
!ifdef HAVE_PKG_KDE_L10N
!include "uninst-kde-l10n.nsi"
!endif
!ifdef HAVE_PKG_LIBKLEO
!include "uninst-libkleo.nsi"
!endif
!ifdef HAVE_PKG_EXTRA_CMAKE_MODULES
!include "uninst-extra-cmake-modules.nsi"
!endif
!ifdef HAVE_PKG_BZIP2
!include "uninst-bzip2.nsi"
!endif
!ifdef HAVE_PKG_QTSVG
!include "uninst-qtsvg.nsi"
!endif
!ifdef HAVE_PKG_QTTRANSLATIONS
!include "uninst-qttranslations.nsi"
!endif
!ifdef HAVE_PKG_GPG4WIN_TOOLS
!include "uninst-gpg4win-tools.nsi"
!endif
!ifdef HAVE_PKG_SCUTE
!include "uninst-scute.nsi"
!endif
!include "uninst-gpg4win.nsi"
# Dependency Management
${MementoSectionDone}
Function CalcDefaults
!ifdef HAVE_PKG_KLEOPATRA
g4wihelp::config_fetch_bool "inst_kleopatra"
StrCmp $R0 "1" 0 calc_defaults_kleopatra_not_one
!insertmacro SelectSection ${SEC_kleopatra}
Goto calc_defaults_kleopatra_done
calc_defaults_kleopatra_not_one:
StrCmp $R0 "0" 0 calc_defaults_kleopatra_done
!insertmacro UnselectSection ${SEC_kleopatra}
calc_defaults_kleopatra_done:
!endif
!ifdef HAVE_PKG_GPGOL
g4wihelp::config_fetch_bool "inst_gpgol"
StrCmp $R0 "1" 0 calc_defaults_gpgol_not_one
!insertmacro SelectSection ${SEC_gpgol}
Goto calc_defaults_gpgol_done
calc_defaults_gpgol_not_one:
StrCmp $R0 "0" 0 calc_defaults_gpgol_done
!insertmacro UnselectSection ${SEC_gpgol}
calc_defaults_gpgol_done:
!endif
!ifdef HAVE_PKG_GPGEX
g4wihelp::config_fetch_bool "inst_gpgex"
StrCmp $R0 "1" 0 calc_defaults_gpgex_not_one
!insertmacro SelectSection ${SEC_gpgex}
Goto calc_defaults_gpgex_done
calc_defaults_gpgex_not_one:
StrCmp $R0 "0" 0 calc_defaults_gpgex_done
!insertmacro UnselectSection ${SEC_gpgex}
calc_defaults_gpgex_done:
!endif
!ifdef HAVE_PKG_PAPERKEY
g4wihelp::config_fetch_bool "inst_paperkey"
StrCmp $R0 "1" 0 calc_defaults_paperkey_not_one
!insertmacro SelectSection ${SEC_paperkey}
Goto calc_defaults_paperkey_done
calc_defaults_paperkey_not_one:
StrCmp $R0 "0" 0 calc_defaults_paperkey_done
!insertmacro UnselectSection ${SEC_paperkey}
calc_defaults_paperkey_done:
!endif
!ifdef HAVE_PKG_GPA
g4wihelp::config_fetch_bool "inst_gpa"
StrCmp $R0 "1" 0 calc_defaults_gpa_not_one
!insertmacro SelectSection ${SEC_gpa}
Goto calc_defaults_gpa_done
calc_defaults_gpa_not_one:
StrCmp $R0 "0" 0 calc_defaults_gpa_done
!insertmacro UnselectSection ${SEC_gpa}
calc_defaults_gpa_done:
!endif
!ifdef HAVE_PKG_COMPENDIUM
g4wihelp::config_fetch_bool "inst_compendium"
StrCmp $R0 "1" 0 calc_defaults_compendium_not_one
!insertmacro SelectSection ${SEC_compendium}
Goto calc_defaults_compendium_done
calc_defaults_compendium_not_one:
StrCmp $R0 "0" 0 calc_defaults_compendium_done
!insertmacro UnselectSection ${SEC_compendium}
calc_defaults_compendium_done:
!endif
!ifdef HAVE_PKG_MAN_NOVICE_DE
g4wihelp::config_fetch_bool "inst_man_novice_de"
StrCmp $R0 "1" 0 calc_defaults_man_novice_de_not_one
!insertmacro SelectSection ${SEC_man_novice_de}
Goto calc_defaults_man_novice_de_done
calc_defaults_man_novice_de_not_one:
StrCmp $R0 "0" 0 calc_defaults_man_novice_de_done
!insertmacro UnselectSection ${SEC_man_novice_de}
calc_defaults_man_novice_de_done:
!endif
!ifdef HAVE_PKG_MAN_NOVICE_EN
g4wihelp::config_fetch_bool "inst_man_novice_en"
StrCmp $R0 "1" 0 calc_defaults_man_novice_en_not_one
!insertmacro SelectSection ${SEC_man_novice_en}
Goto calc_defaults_man_novice_en_done
calc_defaults_man_novice_en_not_one:
StrCmp $R0 "0" 0 calc_defaults_man_novice_en_done
!insertmacro UnselectSection ${SEC_man_novice_en}
calc_defaults_man_novice_en_done:
!endif
!ifdef HAVE_PKG_MAN_ADVANCED_DE
g4wihelp::config_fetch_bool "inst_man_advanced_de"
StrCmp $R0 "1" 0 calc_defaults_man_advanced_de_not_one
!insertmacro SelectSection ${SEC_man_advanced_de}
Goto calc_defaults_man_advanced_de_done
calc_defaults_man_advanced_de_not_one:
StrCmp $R0 "0" 0 calc_defaults_man_advanced_de_done
!insertmacro UnselectSection ${SEC_man_advanced_de}
calc_defaults_man_advanced_de_done:
!endif
!ifdef HAVE_PKG_MAN_ADVANCED_EN
g4wihelp::config_fetch_bool "inst_man_advanced_en"
StrCmp $R0 "1" 0 calc_defaults_man_advanced_en_not_one
!insertmacro SelectSection ${SEC_man_advanced_en}
Goto calc_defaults_man_advanced_en_done
calc_defaults_man_advanced_en_not_one:
StrCmp $R0 "0" 0 calc_defaults_man_advanced_en_done
!insertmacro UnselectSection ${SEC_man_advanced_en}
calc_defaults_man_advanced_en_done:
!endif
# Check if minimal install was requested on the command line
StrCmp $is_minimal '1' select_minimal continue
select_minimal:
!insertmacro UnselectSection ${SEC_kleopatra}
!insertmacro UnselectSection ${SEC_gpgol}
!insertmacro UnselectSection ${SEC_gpgex}
!insertmacro UnselectSection ${SEC_gpa}
!insertmacro UnselectSection ${SEC_gpgme_browser}
!insertmacro UnselectSection ${SEC_compendium}
# We only do pinentry and gnupg-w32
!insertmacro SelectSection ${SEC_paperkey}
!insertmacro SelectSection ${SEC_gnupg_w32}
!insertmacro SelectSection ${SEC_pinentry}
continue:
# Check if browser integration was selected on the command line
# or in the ini
# You can either select the browser integration by adding
# inst_browser = true to a gpg4win.ini or adding a
# /WITH_BROWSER=1 command line switch to the installer.
g4wihelp::config_fetch_bool "inst_browser"
StrCmp $R0 "1" select_browser 0
StrCmp $with_browser '1' select_browser skip_browser
select_browser:
!insertmacro SelectSection ${SEC_gpgme_browser}
skip_browser:
FunctionEnd
Function CalcDepends
# This section could very well be autogenerated from the
# information in configure.ac. Note that it doesn't hurt to have
# stuff here for packages that we don't include.
# First clear all indirect dependencies.
!ifdef HAVE_PKG_LIBICONV
!insertmacro UnselectSection ${SEC_libiconv}
!endif
!ifdef HAVE_PKG_GETTEXT
!insertmacro UnselectSection ${SEC_gettext}
!endif
!ifdef HAVE_PKG_ZLIB
!insertmacro UnselectSection ${SEC_zlib}
!endif
!ifdef HAVE_PKG_LIBPNG
!insertmacro UnselectSection ${SEC_libpng}
!endif
!ifdef HAVE_PKG_PKGCONFIG
!insertmacro UnselectSection ${SEC_pkgconfig}
!endif
!ifdef HAVE_PKG_GLIB
!insertmacro UnselectSection ${SEC_glib}
!endif
!ifdef HAVE_PKG_ATK
!insertmacro UnselectSection ${SEC_atk}
!endif
!ifdef HAVE_PKG_PANGO
!insertmacro UnselectSection ${SEC_pango}
!endif
!ifdef HAVE_PKG_EXPAT
!insertmacro UnselectSection ${SEC_expat}
!endif
!ifdef HAVE_PKG_FREETYPE
!insertmacro UnselectSection ${SEC_freetype}
!endif
!ifdef HAVE_PKG_FONTCONFIG
!insertmacro UnselectSection ${SEC_fontconfig}
!endif
!ifdef HAVE_PKG_CAIRO
!insertmacro UnselectSection ${SEC_cairo}
!endif
!ifdef HAVE_PKG_GTK_
!insertmacro UnselectSection ${SEC_gtk_}
!endif
!ifdef HAVE_PKG_BZIP2
!insertmacro UnselectSection ${SEC_bzip2}
!endif
!ifdef HAVE_PKG_LIBGPG_ERROR
!insertmacro UnselectSection ${SEC_libgpg_error}
!endif
!ifdef HAVE_PKG_W32PTH
!insertmacro UnselectSection ${SEC_w32pth}
!endif
!ifdef HAVE_PKG_LIBASSUAN
!insertmacro UnselectSection ${SEC_libassuan}
!endif
-!ifdef HAVE_PKG_PINENTRY
- !insertmacro UnselectSection ${SEC_pinentry}
-!endif
!ifdef HAVE_PKG_GPGME
!insertmacro UnselectSection ${SEC_gpgme}
!endif
!ifdef HAVE_PKG_LIBGSASL
!insertmacro UnselectSection ${SEC_libgsasl}
!endif
!ifdef HAVE_PKG_LIBTASN1
!insertmacro UnselectSection ${SEC_libtasn1}
!endif
!ifdef HAVE_PKG_GNUTLS
!insertmacro UnselectSection ${SEC_gnutls}
!endif
!ifdef HAVE_PKG_CURL
!insertmacro UnselectSection ${SEC_curl}
!endif
!ifdef HAVE_PKG_QTBASE
!insertmacro UnselectSection ${SEC_qtbase}
!endif
!ifdef HAVE_PKG_QTTOOLS
!insertmacro UnselectSection ${SEC_qttools}
!endif
!ifdef HAVE_PKG_QTWINEXTRAS
!insertmacro UnselectSection ${SEC_qtwinextras}
!endif
!ifdef HAVE_PKG_BREEZE_ICONS
!insertmacro UnselectSection ${SEC_breeze_icons}
!endif
!ifdef HAVE_PKG_KCONFIG
!insertmacro UnselectSection ${SEC_kconfig}
!endif
!ifdef HAVE_PKG_KI18N
!insertmacro UnselectSection ${SEC_ki18n}
!endif
!ifdef HAVE_PKG_KWIDGETSADDONS
!insertmacro UnselectSection ${SEC_kwidgetsaddons}
!endif
!ifdef HAVE_PKG_KCOMPLETION
!insertmacro UnselectSection ${SEC_kcompletion}
!endif
!ifdef HAVE_PKG_KWINDOWSYSTEM
!insertmacro UnselectSection ${SEC_kwindowsystem}
!endif
!ifdef HAVE_PKG_KCOREADDONS
!insertmacro UnselectSection ${SEC_kcoreaddons}
!endif
!ifdef HAVE_PKG_KCODECS
!insertmacro UnselectSection ${SEC_kcodecs}
!endif
!ifdef HAVE_PKG_KCONFIGWIDGETS
!insertmacro UnselectSection ${SEC_kconfigwidgets}
!endif
!ifdef HAVE_PKG_KXMLGUI
!insertmacro UnselectSection ${SEC_kxmlgui}
!endif
!ifdef HAVE_PKG_KICONTHEMES
!insertmacro UnselectSection ${SEC_kiconthemes}
!endif
!ifdef HAVE_PKG_KARCHIVE
!insertmacro UnselectSection ${SEC_karchive}
!endif
!ifdef HAVE_PKG_KCRASH
!insertmacro UnselectSection ${SEC_kcrash}
!endif
!ifdef HAVE_PKG_KITEMVIEWS
!insertmacro UnselectSection ${SEC_kitemviews}
!endif
!ifdef HAVE_PKG_KITEMMODELS
!insertmacro UnselectSection ${SEC_kitemmodels}
!endif
!ifdef HAVE_PKG_KGUIADDONS
!insertmacro UnselectSection ${SEC_kguiaddons}
!endif
!ifdef HAVE_PKG_LIBKLEO
!insertmacro UnselectSection ${SEC_libkleo}
!endif
!ifdef HAVE_PKG_KMIME
!insertmacro UnselectSection ${SEC_kmime}
!endif
!ifdef HAVE_PKG_KDE_L10N
!insertmacro UnselectSection ${SEC_kde_l10n}
!endif
!ifdef HAVE_PKG_QTSVG
!insertmacro UnselectSection ${SEC_qtsvg}
!endif
!ifdef HAVE_PKG_QTTRANSLATIONS
!insertmacro UnselectSection ${SEC_qttranslations}
!endif
!ifdef HAVE_PKG_GPG4WIN_TOOLS
- !insertmacro UnselectSection ${SEC_gpg4win-tools}
-!endif
-!ifdef HAVE_PKG_SCUTE
- !insertmacro UnselectSection ${SEC_scute}
+ !insertmacro UnselectSection ${SEC_gpg4win_tools}
!endif
+# BEGIN MSI IGNORE
+# MSI pulls this in through the gnupg-w32 component.
# Always install gnupg2. This is also ensured by putting
# these packages in the RO section and enabling them by default, but
# it doesn't harm to add it explicitely here as well.
# TODO: Handle newer / other gnupg versions
!insertmacro SelectSection ${SEC_gnupg_w32}
# Then enable all dependencies, mostly in reverse build list order!
# First the explicitely installed packages.
+# END MSI IGNORE
!ifdef HAVE_PKG_PAPERKEY
!insertmacro SectionFlagIsSet ${SEC_paperkey} \
${SF_SELECTED} have_paperkey skip_paperkey
have_paperkey:
# All dependencies are linked in statically.
skip_paperkey:
!endif
!ifdef HAVE_PKG_GPGEX
!insertmacro SectionFlagIsSet ${SEC_gpgex} \
${SF_SELECTED} have_gpgex skip_gpgex
have_gpgex:
# This is not a build dependency, but it is a run-time dependency.
!insertmacro SectionFlagIsSet ${SEC_gpa} \
${SF_SELECTED} skipa_gpgex_dep_kleopatra need_gpgex_dep_kleopatra
need_gpgex_dep_kleopatra:
!insertmacro SelectSection ${SEC_kleopatra}
skipa_gpgex_dep_kleopatra:
# Other dependencies are linked in statically.
skip_gpgex:
!endif
!ifdef HAVE_PKG_GPGOL
!insertmacro SectionFlagIsSet ${SEC_gpgol} \
${SF_SELECTED} have_gpgol skip_gpgol
have_gpgol:
!insertmacro SelectSection ${SEC_gpgme}
!insertmacro SelectSection ${SEC_gpg4win_tools}
# This is not a build dependency, but it is a run-time dependency.
!insertmacro SectionFlagIsSet ${SEC_gpa} \
${SF_SELECTED} skipa_gpgol_dep_kleopatra need_gpgol_dep_kleopatra
need_gpgol_dep_kleopatra:
!insertmacro SelectSection ${SEC_kleopatra}
skipa_gpgol_dep_kleopatra:
skip_gpgol:
!endif
!ifdef HAVE_PKG_KLEOPATRA
!ifndef SOURCES
${IfNot} ${AtLeastWin7}
# Disable Kleo for Windows below 7
SectionSetFlags ${SEC_kleopatra} 16
!insertmacro SelectSection ${SEC_gpa}
${Endif}
!endif
!insertmacro SectionFlagIsSet ${SEC_kleopatra} ${SF_SELECTED} have_kleopatra skip_kleopatra
have_kleopatra:
!insertmacro SelectSection ${SEC_gpgme}
!insertmacro SelectSection ${SEC_compendium}
!insertmacro SelectSection ${SEC_qtbase}
!insertmacro SelectSection ${SEC_breeze_icons}
!insertmacro SelectSection ${SEC_kconfig}
!insertmacro SelectSection ${SEC_ki18n}
!insertmacro SelectSection ${SEC_kwidgetsaddons}
!insertmacro SelectSection ${SEC_kcompletion}
!insertmacro SelectSection ${SEC_kwindowsystem}
!insertmacro SelectSection ${SEC_kcoreaddons}
!insertmacro SelectSection ${SEC_kcodecs}
!insertmacro SelectSection ${SEC_kconfigwidgets}
!insertmacro SelectSection ${SEC_kxmlgui}
!insertmacro SelectSection ${SEC_kitemviews}
!insertmacro SelectSection ${SEC_kitemmodels}
!insertmacro SelectSection ${SEC_kiconthemes}
!insertmacro SelectSection ${SEC_karchive}
!insertmacro SelectSection ${SEC_kcrash}
!insertmacro SelectSection ${SEC_kguiaddons}
!insertmacro SelectSection ${SEC_qtsvg}
!insertmacro SelectSection ${SEC_qttranslations}
!insertmacro SelectSection ${SEC_kmime}
!insertmacro SelectSection ${SEC_kde_l10n}
!insertmacro SelectSection ${SEC_libkleo}
!insertmacro SelectSection ${SEC_qttools}
!insertmacro SelectSection ${SEC_qtwinextras}
!insertmacro SelectSection ${SEC_boost}
!insertmacro SelectSection ${SEC_extra-cmake-modules}
skip_kleopatra:
!endif
-!ifdef HAVE_PKG_GNUPG_W32
- !insertmacro SectionFlagIsSet ${SEC_gnupg_w32} ${SF_SELECTED} have_gnupg_w32 skip_gnupg_w32
- have_gnupg_w32:
- !insertmacro SelectSection ${SEC_pinentry}
- !insertmacro SelectSection ${SEC_scute}
- skip_gnupg_w32:
-!endif
-
+# BEGIN MSI IGNORE
!ifdef HAVE_PKG_GPA
!insertmacro SectionFlagIsSet ${SEC_gpa} ${SF_SELECTED} have_gpa skip_gpa
have_gpa:
!insertmacro SelectSection ${SEC_libiconv}
!insertmacro SelectSection ${SEC_gettext}
!insertmacro SelectSection ${SEC_zlib}
!insertmacro SelectSection ${SEC_gtk_}
!insertmacro SelectSection ${SEC_libpng}
!insertmacro SelectSection ${SEC_glib}
!insertmacro SelectSection ${SEC_gpgme}
skip_gpa:
!endif
+# END MSI IGNORE
!insertmacro SectionFlagIsSet ${SEC_gpgme_browser} ${SF_SELECTED} have_gpgme_browser skip_gpgme_browser
have_gpgme_browser:
!insertmacro SelectSection ${SEC_gpgme}
skip_gpgme_browser:
# Now the implicitely installed packages.
!ifdef HAVE_PKG_GPGME
!insertmacro SectionFlagIsSet ${SEC_gpgme} \
${SF_SELECTED} have_gpgme skip_gpgme
have_gpgme:
# GPGME does not depend on gnupg2. Do this in the
# actual application instead.
!insertmacro SelectSection ${SEC_libgpg_error}
!insertmacro SelectSection ${SEC_libassuan}
!ifdef HAVE_PKG_QTBASE
!insertmacro SelectSection ${SEC_qtbase}
!endif
skip_gpgme:
!endif
!ifdef HAVE_PKG_PINENTRY
!insertmacro SectionFlagIsSet ${SEC_pinentry} \
${SF_SELECTED} have_pinentry skip_pinentry
have_pinentry:
!insertmacro SelectSection ${SEC_libiconv}
!insertmacro SelectSection ${SEC_libgpg_error}
!insertmacro SelectSection ${SEC_libassuan}
!ifdef HAVE_PKG_QTBASE
!insertmacro SelectSection ${SEC_qtbase}
!endif
+# BEGIN MSI IGNORE
!ifdef HAVE_PKG_GTK_
!insertmacro SelectSection ${SEC_gtk_}
!endif
+# END MSI IGNORE
skip_pinentry:
!endif
!ifdef HAVE_PKG_QTBASE
!ifndef SOURCES
${IfNot} ${AtLeastWin7}
# Disable qt for Windows below 7
!insertmacro UnSelectSection ${SEC_qtbase}
${Endif}
!endif
!insertmacro SectionFlagIsSet ${SEC_qtbase} \
${SF_SELECTED} have_qt skip_qt
have_qt:
!insertmacro SelectSection ${SEC_libpng}
!insertmacro SelectSection ${SEC_zlib}
!insertmacro SelectSection ${SEC_qttranslations}
skip_qt:
!endif
!ifdef HAVE_PKG_LIBASSUAN
!insertmacro SectionFlagIsSet ${SEC_libassuan} ${SF_SELECTED} have_libassuan skip_libassuan
have_libassuan:
!insertmacro SelectSection ${SEC_libgpg_error}
!insertmacro SelectSection ${SEC_w32pth}
skip_libassuan:
!endif
# Package "w32pth" has no dependencies.
!ifdef HAVE_PKG_LIBGPG_ERROR
!insertmacro SectionFlagIsSet ${SEC_libgpg_error} ${SF_SELECTED} have_libgpg_error skip_libgpg_error
have_libgpg_error:
!insertmacro SelectSection ${SEC_libiconv}
!insertmacro SelectSection ${SEC_gettext}
skip_libgpg_error:
!endif
# Package "bzip2" has no dependencies.
!ifdef HAVE_PKG_GTK_
!insertmacro SectionFlagIsSet ${SEC_gtk_} \
${SF_SELECTED} have_gtk_ skip_gtk_
have_gtk_:
!insertmacro SelectSection ${SEC_libiconv}
!insertmacro SelectSection ${SEC_gettext}
!insertmacro SelectSection ${SEC_pkgconfig}
!insertmacro SelectSection ${SEC_atk}
!insertmacro SelectSection ${SEC_pango}
!insertmacro SelectSection ${SEC_glib}
!insertmacro SelectSection ${SEC_cairo}
skip_gtk_:
!endif
!ifdef HAVE_PKG_CAIRO
!insertmacro SectionFlagIsSet ${SEC_cairo} \
${SF_SELECTED} have_cairo skip_cairo
have_cairo:
!insertmacro SelectSection ${SEC_glib}
!insertmacro SelectSection ${SEC_pkgconfig}
!insertmacro SelectSection ${SEC_expat}
!insertmacro SelectSection ${SEC_freetype}
!insertmacro SelectSection ${SEC_fontconfig}
skip_cairo:
!endif
!ifdef HAVE_PKG_FONTCONFIG
!insertmacro SectionFlagIsSet ${SEC_fontconfig} \
${SF_SELECTED} have_fontconfig skip_fontconfig
have_fontconfig:
!insertmacro SelectSection ${SEC_pkgconfig}
!insertmacro SelectSection ${SEC_freetype}
skip_fontconfig:
!endif
!ifdef HAVE_PKG_FREETYPE
!insertmacro SectionFlagIsSet ${SEC_freetype} \
${SF_SELECTED} have_freetype skip_freetype
have_freetype:
!insertmacro SelectSection ${SEC_pkgconfig}
!insertmacro SelectSection ${SEC_expat}
skip_freetype:
!endif
# Package "expat" has no dependencies.
!ifdef HAVE_PKG_PANGO
!insertmacro SectionFlagIsSet ${SEC_pango} \
${SF_SELECTED} have_pango skip_pango
have_pango:
!insertmacro SelectSection ${SEC_glib}
!insertmacro SelectSection ${SEC_pkgconfig}
skip_pango:
!endif
!ifdef HAVE_PKG_ATK
!insertmacro SectionFlagIsSet ${SEC_atk} \
${SF_SELECTED} have_atk skip_atk
have_atk:
!insertmacro SelectSection ${SEC_glib}
!insertmacro SelectSection ${SEC_pkgconfig}
skip_atk:
!endif
!ifdef HAVE_PKG_GLIB
!insertmacro SectionFlagIsSet ${SEC_glib} \
${SF_SELECTED} have_glib skip_glib
have_glib:
!insertmacro SelectSection ${SEC_libiconv}
!insertmacro SelectSection ${SEC_gettext}
!insertmacro SelectSection ${SEC_pkgconfig}
skip_glib:
!endif
# Package "pkgconfig" has no dependencies.
!ifdef HAVE_PKG_LIBPNG
!insertmacro SectionFlagIsSet ${SEC_libpng} \
${SF_SELECTED} have_libpng skip_libpng
have_libpng:
!insertmacro SelectSection ${SEC_pkgconfig}
skip_libpng:
!endif
# Package "zlib" has no dependencies.
!ifdef HAVE_PKG_GETTEXT
!insertmacro SectionFlagIsSet ${SEC_gettext} \
${SF_SELECTED} have_gettext skip_gettext
have_gettext:
!insertmacro SelectSection ${SEC_libiconv}
skip_gettext:
!endif
# Package "libiconv" has no dependencies.
FunctionEnd
Function .onInstFailed
Delete $TEMP\gpgspltmp.wav
FunctionEnd
Function .onInstSuccess
${MementoSectionSave}
Delete $TEMP\gpgspltmp.wav
FunctionEnd
Function .onSelChange
Call CalcDepends
FunctionEnd
# Note used anymore:
# This function is run from the finish page.
#Function RunOnFinish
#!ifdef HAVE_PKG_GPA
# SectionGetFlags ${SEC_gpa} $R0
# IntOp $R0 $R0 & ${SF_SELECTED}
# IntCmp $R0 ${SF_SELECTED} 0 no_gpa_avail
# Exec "$INSTDIR\gpa.exe"
# Return
# no_gpa_avail:
#!endif
# MessageBox MB_OK "$(T_NoKeyManager)"
#FunctionEnd
# This also must be in a central place. Also Urgs.
Section "-startmenu"
UserInfo::GetAccountType
Pop $1
StrCmp $1 "Admin" is_admin is_no_admin
is_admin:
SetShellVarContext all
is_no_admin:
# NOT SetOutPath.
StrCpy $OUTDIR "%HOMEDRIVE%%HOMEPATH%"
# Check if the start menu entries where requested.
g4wihelp::config_fetch_bool "inst_start_menu"
StrCmp $R0 "0" no_start_menu
!ifdef HAVE_PKG_GPA
SectionGetFlags ${SEC_gpa} $R0
IntOp $R0 $R0 & ${SF_SELECTED}
IntCmp $R0 ${SF_SELECTED} 0 no_gpa_menu
CreateShortCut "$SMPROGRAMS\GPA.lnk" \
"$INSTDIR\bin\gpa.exe" \
"" "" "" SW_SHOWNORMAL "" $(DESC_Menu_gpa)
no_gpa_menu:
!endif
!ifdef HAVE_PKG_KLEOPATRA
SectionGetFlags ${SEC_kleopatra} $R0
IntOp $R0 $R0 & ${SF_SELECTED}
IntCmp $R0 ${SF_SELECTED} 0 no_kleopatra_menu
CreateShortCut "$SMPROGRAMS\Kleopatra.lnk" \
"$INSTDIR\bin\kleopatra.exe" \
"" "$INSTDIR\bin\kleopatra.exe" "" SW_SHOWNORMAL "" $(DESC_Menu_kleopatra)
no_kleopatra_menu:
!endif
no_start_menu:
# Check if the desktop entries where requested.
g4wihelp::config_fetch_bool "inst_desktop"
StrCmp $R0 "0" no_desktop
!ifdef HAVE_PKG_GPA
SectionGetFlags ${SEC_gpa} $R0
IntOp $R0 $R0 & ${SF_SELECTED}
IntCmp $R0 ${SF_SELECTED} 0 no_gpa_desktop
StrCmp $is_update '1' no_gpa_desktop
CreateShortCut "$DESKTOP\GPA.lnk" \
"$INSTDIR\bin\gpa.exe" \
"" "" "" SW_SHOWNORMAL "" $(DESC_Menu_gpa)
no_gpa_desktop:
!endif
!ifdef HAVE_PKG_KLEOPATRA
SectionGetFlags ${SEC_kleopatra} $R0
IntOp $R0 $R0 & ${SF_SELECTED}
IntCmp $R0 ${SF_SELECTED} 0 no_kleopatra_desktop
StrCmp $is_update '1' no_kleopatra_desktop
CreateShortCut "$DESKTOP\Kleopatra.lnk" \
"$INSTDIR\bin\kleopatra.exe" \
"" "$INSTDIR\bin\kleopatra.exe" "" SW_SHOWNORMAL "" $(DESC_Menu_kleopatra)
no_kleopatra_desktop:
!endif
no_desktop:
SectionEnd
diff --git a/src/make-msi.pl b/src/make-msi.pl
index bdfb9968..a84800b0 100644
--- a/src/make-msi.pl
+++ b/src/make-msi.pl
@@ -1,1719 +1,1743 @@
#! /usr/bin/perl -w
# make-msi.pl - MSI Installer for Gpg4win.
# Copyright (C) 2007, 2019 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
# FIXME: Here is how to support multiple languages in one MSI package,
# using an undocumented feature: Create one MSI package in each
# language, then create transformations:
# MsiTran.Exe -g foo.en.msi foo.de.msi language.de.mst
# Embed these transformations:
# CScript.exe WiSubStg.vbs foo.en.msi language.de.mst 1031
# Change the summmary informations attribute (with Orca):
# Languages = 1033, 1031
# Primary language must come first!
# http://www.installsite.org/pages/de/artikel/embeddedlang/index.htm
# http://forum.installsite.net/index.php?showtopic=16734
use strict;
use warnings;
use diagnostics;
# Default language.
$::lang = 'en';
sub fail
{
print STDERR $_[0] . "\n";
exit 1;
}
# We use a new product and package code for every build (using pseudo
# components), but a single constant upgrade code for all versions.
# Note that Windows installer ignores the build part of the version
# number (only the first three components are used).
#
# FIXME: Build upgrade table.
#
# We take a simplified view: Each file corresponds to exactly one
# component. This means we need to generate GUIDs for these
# components and remember them from one installer version to the next.
# We do this automatically by means of a support file, make-msi.guids.
%::guid = ();
$::guid_file = 'make-msi.guids';
$::guid_changed = 0;
sub fetch_guids
{
# FIXME: Check if file exists.
open (FILE, "<$::guid_file") or return;
while ()
{
next if (/^#/);
if (/(\S+)\s+(.+)\s*\r?\n$/)
{
$::guid{$2} = $1;
}
}
close (FILE);
}
sub store_guids
{
# FIXME: Maybe allow to forget unused GUIDs.
return if (not $::guid_changed);
print STDERR "GUID list stored in $::guid_file changed, please commit!\n";
open (FILE, ">$::guid_file.bak") or die;
print FILE "# This is an automatically generated file. DO NOT EDIT.\n";
foreach my $file (sort keys %::guid)
{
print FILE "$::guid{$file} $file\n";
}
close FILE;
rename "$::guid_file.bak", $::guid_file or die;
}
sub get_guid
{
my ($file) = @_;
my $guid;
if (defined $::guid{$file})
{
return $::guid{$file};
}
# Need to generate a new GUID.
$::guid_changed = 1;
$guid = uc `uuidgen`;
chomp $guid;
$::guid{$file} = $guid;
return $guid;
}
$::files_file = '';
# We store the list of included files for temporary packaging, in case
# WiX needs to be run on a different system.
sub store_files
{
my ($parser) = @_;
return if ($::files_file eq '');
open (FILE, ">$::files_file") or die;
foreach my $name (@{$parser->{pkg_list}})
{
my $pkg = $parser->{pkgs}->{$name};
next if ($#{$pkg->{files}} == -1);
print FILE (join ("\n", map { "src/" . ($_->{source}) }
@{$pkg->{files}})). "\n";
}
close FILE;
}
sub lang_to_lcid
{
my ($lang) = @_;
if ($lang eq 'en')
{
return 1033;
}
elsif ($lang eq 'de')
{
return 1031;
}
elsif ($lang eq 'ar')
{
return 1025;
}
elsif ($lang eq 'es')
{
return 3082;
}
elsif ($lang eq 'fr')
{
return 1036;
}
elsif ($lang eq 'ru')
{
return 1049;
}
else
{
fail "language $lang not supported";
}
}
# NSIS parser
# The parser data structure contains the following members:
#
# pre_depth: The current nesting depth of preprocessor conditionals.
# pre_true: Depth of the last preprocessor conditional that was true.
# pre_symbols: A hash of defined preprocessor symbols.
# po: A hash of languages, each a hash of translated strings.
# outpath: the current output path.
# includedirs: An array of include directories to search through.
# A couple of variables you can set:
$::nsis_parser_warn = 1;
$::nsis_parser_debug = 0;
$::nsis_level_default = 1;
$::nsis_level_optional = 1000;
$::nsis_level_hidden = 2000;
# Evaluate an expression.
sub nsis_eval
{
my ($parser, $file, $expr) = @_;
my $val = $expr;
# Resolve outer double quotes, if any.
if ($val =~ m/^"/)
{
if (not $val =~ s/^"(.*)"$/$1/)
{
fail "$file:$.: unmatched quote in expression: $expr";
}
}
my $iter = 0;
while ($val =~ m/\$\{([^}]*)\}/)
{
my $varname = $1;
my $varvalue;
if (exists $parser->{pre_symbols}->{$varname})
{
$varvalue = $parser->{pre_symbols}->{$varname};
}
else
{
fail "$file:$.: undefined variable $varname in expression: $expr";
}
$val =~ s/\$\{$varname\}/$varvalue/g;
$iter++;
if ($iter > 100)
{
fail "$file:$.: too many variable expansions in expression: $expr";
}
}
# # FIXME: For now.
# if ($expr =~ m/\$/ or $expr !~ m/^\"/)
# {
# return $expr;
# }
# $val = eval $expr;
return $val;
}
# Retrieve an evaluated symbol
sub nsis_fetch
{
my ($parser, $symname) = @_;
return undef if (not exists $parser->{pre_symbols}->{$symname});
return nsis_eval ($parser, '', $parser->{pre_symbols}->{$symname});
}
# Evaluate an expression.
sub nsis_translate
{
my ($parser, $file, $expr) = @_;
my $val = $expr;
my $iter = 0;
while ($val =~ m/\$\((.*)\)/)
{
my $var = $1;
if (exists $parser->{po}->{$::lang}->{$1})
{
my $subst = $parser->{po}->{$::lang}->{$1};
$val =~ s/\$\($var\)/$subst/g;
}
else
{
fail "$file:$.: no translation for $val to language $::lang";
}
$iter++;
if ($iter > 100)
{
fail "$file:$.: too deep nesting of translations";
}
}
# Resolve outer double quotes, if any.
$val =~ s/^"(.*)"$/$1/;
$val =~ s/\$\r/\r/g;
$val =~ s/\$\n/\n/g;
$val =~ s/\$\"/"/g;
return $val;
}
# Low level line input.
sub nsis_get_line
{
my ($file) = @_;
my $line = '';
while (<$file>)
{
$line = $line . $_;
# Strip leading whitespace.
$line =~ s/^\s*//;
# Strip newline and trailing whitespace.
$line =~ s/\s*\r?\n$//;
# Combine multiple lines connected with backslashes.
if ($line =~ m/^(.*)\\$/)
{
$line = $1 . ' ';
next;
}
$_ = $line;
last;
}
# Now break up the line into
return $_;
}
# Tokenize the NSIS line.
sub nsis_tokenize
{
my ($file, $line) = @_;
my @tokens;
my @line = split ('', $line);
my $idx = 0;
while ($idx <= $#line)
{
# The beginning of the current partial token.
my $token = $idx;
if ($line[$idx] eq '"')
{
$idx++;
# Skip until end of string, indicated by double quote that
# is not part of the $\" string.
while ($idx <= $#line)
{
if (substr ($line, $idx, 3) eq '$\\"')
{
$idx += 3;
}
else
{
last if ($line[$idx] eq '"');
$idx++;
}
}
fail "$file:$.:$idx: unterminated string from position $token"
if ($idx > $#line);
$idx++;
fail "$file:$.:$idx: strings not separated"
if ($idx <= $#line and $line[$idx] !~ m/\s/);
}
elsif ($line[$idx] eq '\'')
{
$idx++;
# Skip until end of string, indicated by a single quote.
while ($idx <= $#line)
{
last if ($line[$idx] eq '\'');
$idx++;
}
fail "$file:$.:$idx: unterminated string from position $token"
if ($idx > $#line);
$idx++;
fail "$file:$.:$idx: strings not separated"
if ($idx <= $#line and $line[$idx] !~ m/\s/);
}
else
{
# Skip until end of token indicated by whitespace.
while ($idx <= $#line)
{
fail "$file:$.:$idx: invalid character"
if ($line[$idx] eq '"');
last if ($line[$idx] =~ m/\s/);
$idx++;
}
}
push @tokens, substr ($line, $token, $idx - $token);
# Skip white space between arguments.
while ($idx <= $#line and $line[$idx] =~ m/\s/)
{
$idx++;
}
}
return @tokens;
}
# We suppress some warnings after first time.
%::warn = ();
# Parse the NSIS line.
sub nsis_parse_line
{
my ($parser, $file, $line) = @_;
# We first tokenize the line.
my @tokens = nsis_tokenize ($file, $line);
# We handle preprocessing directives here.
print STDERR "Tokens: " . join (" AND ", @tokens) . "\n"
if $::nsis_parser_debug;
# We have special code dealing with ignored areas.
if ($parser->{pre_depth} > $parser->{pre_true})
{
if ($tokens[0] eq '!ifdef' or $tokens[0] eq '!ifndef')
{
fail "$file:$.: syntax error" if $#tokens != 1;
$parser->{pre_depth}++;
}
elsif ($tokens[0] eq '!else')
{
fail "$file:$.: stray !else" if $parser->{pre_depth} == 0;
if ($parser->{pre_depth} == $parser->{pre_true} + 1)
{
$parser->{pre_true}++;
}
}
elsif ($tokens[0] eq '!endif')
{
fail "$file:$.: syntax error" if $#tokens != 0;
fail "$file:$.: stray !endif" if $parser->{pre_depth} == 0;
$parser->{pre_depth}--;
}
elsif ($tokens[0] eq '!macro')
{
fail "$file:$.: syntax error" if $#tokens < 1;
# FIXME: We do not support macros at this point, although
# support would not be too hard to add. Instead, we just
# ignore their definition so it does not throw us off.
print STDERR
"$file:$.: warning: ignoring macro $tokens[1]\n"
if $::nsis_parser_warn;
$parser->{pre_depth}++;
}
elsif ($tokens[0] eq '!macroend')
{
# FIXME: See !macro.
fail "$file:$.: stray !macroend" if $parser->{pre_depth} == 0;
$parser->{pre_depth}--;
}
}
else
{
# This is the parser for areas not ignored.
if ($tokens[0] eq '!define')
{
if ($#tokens == 1)
{
# FIXME: Maybe define to 1?
$parser->{pre_symbols}->{$tokens[1]} = '';
}
elsif ($#tokens == 2)
{
$parser->{pre_symbols}->{$tokens[1]} =
nsis_eval ($parser, $file, $tokens[2]);
}
else
{
fail "$file:$.: syntax error";
}
}
elsif ($tokens[0] eq '!undef')
{
fail "$file:$.: syntax error" if $#tokens != 1;
delete $parser->{pre_symbols}->{$tokens[1]};
}
elsif ($tokens[0] eq '!ifdef')
{
fail "$file:$.: syntax error" if $#tokens != 1;
if (exists $parser->{pre_symbols}->{$tokens[1]})
{
$parser->{pre_true}++;
}
$parser->{pre_depth}++;
}
elsif ($tokens[0] eq '!ifndef')
{
fail "$file:$.: syntax error" if $#tokens != 1;
if (not exists $parser->{pre_symbols}->{$tokens[1]})
{
$parser->{pre_true}++;
}
$parser->{pre_depth}++;
}
elsif ($tokens[0] eq '!else')
{
fail "$file:$.: stray !else" if $parser->{pre_depth} == 0;
if ($parser->{pre_depth} == $parser->{pre_true})
{
$parser->{pre_true}--;
}
elsif ($parser->{pre_depth} == $parser->{pre_true} + 1)
{
$parser->{pre_true}++;
}
}
elsif ($tokens[0] eq '!endif')
{
fail "$file:$.: syntax error" if $#tokens != 0;
fail "$file:$.: stray !endif" if $parser->{pre_depth} == 0;
if ($parser->{pre_depth} == $parser->{pre_true})
{
$parser->{pre_true}--;
}
$parser->{pre_depth}--;
}
elsif ($tokens[0] eq '!include')
{
fail "$file:$.: syntax error" if $#tokens != 1;
if ($tokens[1] eq 'Memento.nsh')
{
print STDERR "Skipping $tokens[1]\n"
if $::nsis_parser_debug;
}
else
{ print STDERR "Including $tokens[1]\n"
if $::nsis_parser_debug;
my $filename = nsis_eval ($parser, $file, $tokens[1]);
# Recursion.
nsis_parse_file ($parser, $filename);
}
}
elsif ($tokens[0] eq '!macro')
{
fail "$file:$.: syntax error" if $#tokens < 1;
# FIXME: We do not support macros at this point, although
# support would not be too hard to add. Instead, we just
# ignore their definition so it does not throw us off.
print STDERR
"$file:$.: warning: ignoring macro $tokens[1]\n"
if $::nsis_parser_warn;
$parser->{pre_depth}++;
}
elsif ($tokens[0] eq '!macroend')
{
# FIXME: See !macro.
fail "$file:$.: stray !macroend" if $parser->{pre_depth} == 0;
$parser->{pre_depth}--;
}
elsif ($tokens[0] eq '!cd' or $tokens[0] eq '!addplugindir')
{
if (not exists $::warn{"directive-$tokens[0]"})
{
print STDERR
"$file:$.: warning: ignoring $tokens[0] directive\n"
if $::nsis_parser_warn;
}
$::warn{"directive-$tokens[0]"}++;
}
elsif ($tokens[0] eq '!addincludedir')
{
fail "$file:$.: syntax error" if $#tokens != 1;
my $dir = nsis_eval ($parser, $file, $tokens[1]);
unshift @{$parser->{includedirs}}, $dir;
}
elsif ($tokens[0] =~ m/^\!/ and $tokens[0] ne '!insertmacro')
{
# Note: It is essential that some !insertmacro invocations are
# not expanded, namely those of SelectSection and UnselectSection,
# which are used to track dependencies in Gpg4win.
fail "$file:$.: compiler directive $tokens[0] not implemented";
}
else
{
# Main processing routine. This is specific to the backend
# and probably package.
gpg4win_nsis_stubs ($parser, $file, @tokens);
}
}
}
# Parse the NSIS file.
sub nsis_parse_file
{
my ($parser, $file) = @_;
my $handle;
if ($file eq '-')
{
$. = 0;
$handle = *STDIN;
}
else
{
if (not -e $file and 1)
{
# Search for include file. Note: We do not change
# directories, but that is OK for us. Also, we want to
# avoid the system header files, as we don't control what
# constructs they use, and in fact we want to treat their
# macros and functions as atoms.
my @includedirs = @{$parser->{includedirs}};
my $dir;
foreach $dir (@includedirs)
{
if (-e $dir . '/' . $file)
{
$file = $dir . '/' . $file;
last;
}
}
}
if (not open ($handle, "<$file"))
{
print STDERR "$file:$.: warning: "
. "can not open include file $file: $!\n"
if $::nsis_parser_warn;
return;
}
}
my $incomment = 0;
while (defined nsis_get_line ($handle))
{
$.++ if ($file eq '-');
# Check for our block comment
if ($_ =~ m/^# BEGIN MSI IGNORE.*/)
{
$incomment = 1;
}
elsif ($_ =~ m/^# END MSI IGNORE.*/)
{
$incomment = 0;
}
next if $incomment;
# Skip comment lines.
next if $_ =~ m/^#/;
# Skip empty lines.
next if $_ =~ m/^$/;
nsis_parse_line ($parser, $file, $_);
}
if ($incomment) {
fail "$file:$.: error: Missing # END MSI IGNORE marker.\n";
}
close $handle if ($file ne '-');
}
# The Gpg4win stubs for the MSI backend to the NSIS converter.
# Gpg4win specific state in $parser:
# pkg: the current package (a hash reference), corresponds to certain sections.
# pkgs: a hash ref of all packages encountered indexed by their frobbed name.
# pkg_list: the order of packages (as frobbed names).
# state: specifies a state for special parsing of certain parts.
# dep_name: the current package for which we list dependencies (- for none)
# Ignored packages:
-%::ignored_pkgs = ("gpa", "gtk_", "glib", "expat", "gdk_pixbuf", "cairo", "fontconfig");
+%::ignored_pkgs = ("gpa", "gtk_", "glib", "expat", "gdk_pixbuf",
+ "cairo", "fontconfig", "atk", "zlib", "libpng",
+ "freetype", "libffi", "pango");
sub gpg4win_nsis_stubs
{
my ($parser, $file, $command, @args) = @_;
$parser->{state} = "" if not defined $parser->{state};
if ($parser->{state} =~ m/^ignore-until-(.*)$/)
{
undef $parser->{state} if ($command eq $1);
}
# Section support.
#
# We parse SetOutPath and File directives in sections.
# Everything else is ignored.
elsif ($parser->{state} eq ''
and ($command eq 'Section' or $command eq '${MementoSection}'
or $command eq '${MementoUnselectedSection}'))
{
my $idx = 0;
# Default install level for MSI is 3.
my $level = $::nsis_level_default;
my $hidden = 0;
if ($command eq '${MementoUnselectedSection}')
{
# Default install level for MSI is 3.
$level = $::nsis_level_optional;
}
# Check for options first.
return if ($idx > $#args);
if ($args[$idx] eq '/o')
{
# Default install level for MSI is 3.
$level = $::nsis_level_optional;
$idx++;
}
return if ($idx > $#args);
my $title = nsis_eval ($parser, $file, $args[$idx++]);
# Check for hidden flag.
if (substr ($title, 0, 1) eq '-')
{
# Hidden packages are dependency tracked and never
# installed by default unless required.
$level = $::nsis_level_hidden;
$hidden = 1;
substr ($title, 0, 1) = '';
}
# We only pay attention to special sections and those which
# have a section index defined.
if ($title eq 'startmenu')
{
# The special startmenu section contains all our shortcuts.\
$parser->{state} = 'section-startmenu';
return;
}
elsif ($idx > $#args)
{
return;
}
# Finally we can get the frobbed name of the package.
my $name = $args[$idx++];
$name =~ s/^SEC_//;
my $pkg = \%{$parser->{pkgs}->{$name}};
# Check for ignored packages
foreach my $ignored (%::ignored_pkgs)
{
if ($name eq $ignored)
{
print STDERR "Ignoring package: " . $name . "\n"
if $::nsis_parser_debug;
return;
}
}
$pkg->{name} = $name;
# Replace - in names to avoid errors with identifies
$pkg->{name} =~ s/-/_/g;
$pkg->{title} = $title;
$pkg->{level} = $level;
$pkg->{hidden} = $hidden;
$pkg->{features} = '';
# Remember the order of sections included.
push @{$parser->{pkg_list}}, $name;
$parser->{pkg} = $pkg;
$parser->{state} = 'in-section';
}
elsif ($parser->{state} eq 'in-section')
{
if ($command eq 'SectionEnd' or $command eq '${MementoSectionEnd}')
{
delete $parser->{pkg};
undef $parser->{state};
}
elsif ($command eq 'SetOutPath')
{
fail "$file:$.: syntax error" if ($#args != 0);
my $outpath = $args[0];
# if (not $outpath =~ s/^"\$INSTDIR\\?(.*)"$/$1/)
if ($outpath =~ m/^"\$INSTDIR\\?(.*)"$/)
{
$parser->{outpath} = $1;
}
elsif ($outpath =~ m/^"\$APPDATA\\?(.*)"$/)
{
$parser->{outpath} = "%CommonAppDataFolder%\\" . $1;
}
elsif ($outpath =~ m/^"\$TEMP\\?(.*)"$/)
{
$parser->{outpath} = "%TEMP%\\" . $1;
}
elsif ($outpath =~ m/^"\$PLUGINSDIR\\?(.*)"$/)
{
$parser->{outpath} = "REMOVE_ME\\" . $1;
}
else
{
fail "$file:$.: unsupported out path: $args[0]";
}
}
elsif ($command eq 'File')
{
my $idx = 0;
my $target;
fail "$file:$.: not supported" if ($#args < 0 || $#args > 1);
if ($#args == 1)
{
if ($args[0] eq '/nonfatal')
{
print STDERR "$file:$.: warning: skipping non-fatal file $args[1]\n"
if $::nsis_parser_warn;
return;
}
$target = $args[0];
if (not $target =~ s,^/oname=(.*)$,$1,)
{
fail "$file:$.: syntax error";
}
# Temp files are due to overwrite attempts, which are
# handled automatically by the Windows Installer. Ignore
# them here.
return if $target =~ m/\.tmp$/;
$idx++;
}
my $source = nsis_eval ($parser, $file, $args[$idx]);
if (not defined $target)
{
$target = $source;
$target =~ s,^.*/([^/\\]+)$,$1,;
}
push @{$parser->{pkg}->{files}}, { source => $source,
dir => $parser->{outpath},
target => $target };
}
elsif ($command eq 'WriteRegStr')
{
fail "$file:$.: not supported" if ($#args != 3);
my $root = $args[0];
my $key = $args[1];
$key =~ s/^"(.*)"$/$1/;
my $name = $args[2];
$name =~ s/^"(.*)"$/$1/;
my $value = $args[3];
$value =~ s/^"(.*)"$/$1/;
$value =~ s/\$INSTDIR\\?/\[INSTDIR\]/g;
push (@{$parser->{pkg}->{registry}},
{ root => $root, key => $key, name => $name,
value => $value, type => 'string' });
}
}
# Start menu shortcuts support.
elsif ($parser->{state} eq 'section-startmenu')
{
if ($command eq 'SectionEnd' or $command eq '${MementoSectionEnd}')
{
undef $parser->{state};
}
elsif ($command eq 'CreateShortCut')
{
fail "$file:$.: not supported" if ($#args != 7);
# The link may contains a translatable string.
my $link = $args[0];
# We filter for startmenu shortcuts, as the others are
# just more of the same. Equivalently, we could filter
# for a block between two labels.
return if ($link !~ m/STARTMENU_FOLDER/);
# Take the base name of the link.
# FIXME: We want the manuals in a subdirectory.
$link =~ s/^.*\\([^\\]*)\"$/$1/;
$link =~ s/\.lnk$//;
my $target = nsis_eval ($parser, $file, $args[1]);
$target =~ s/^\$INSTDIR\\//;
my $icon = $args[3];
$icon =~ s/^"(.*)"$/$1/;
$icon =~ s/^\$INSTDIR\\/[INSTDIR]/;
$icon = nsis_eval ($parser, $file, $icon);
my $icon_idx = nsis_eval ($parser, $file, $args[4]);
fail "$file:$.: not supported" if ($icon_idx ne '');
# The description contains a translatable string.
my $description = $args[7];
$parser->{shortcuts}->{$target} = { link => $link,
target => $target,
icon => $icon,
description => $description };
}
}
# LangString support.
#
# LangString directives must be stated at the top-level of the file.
elsif ($parser->{state} eq '' and $command eq 'LangString')
{
fail "$file:$.: syntax error" if ($#args != 2);
my $lang = $args[1];
$lang =~ s/^\$\{LANG_(\w*)\}$/$1/;
if ($lang eq 'ENGLISH')
{
$lang = 'en';
}
elsif ($lang eq 'GERMAN')
{
$lang = 'de';
}
elsif ($lang eq 'ARABIC')
{
$lang = 'ar';
}
elsif ($lang eq 'SPANISH')
{
$lang = 'es';
}
elsif ($lang eq 'FRENCH')
{
$lang = 'fr';
}
elsif ($lang eq 'RUSSIAN')
{
$lang = 'ru';
}
elsif ($lang eq 'PORTUGUESE')
{
$lang = 'pt';
}
elsif ($lang eq 'CZECH')
{
$lang = 'cz';
}
elsif ($lang eq 'ITALIAN')
{
$lang = 'it';
}
elsif ($lang eq 'SIMPCHINESE')
{
$lang = 'zh_CN';
}
elsif ($lang eq 'TRADCHINESE')
{
$lang = 'zh_TW';
}
elsif ($lang eq 'NORWEGIAN')
{
$lang = 'no';
}
elsif ($lang eq 'DUTCH')
{
$lang = 'nl';
}
else
{
fail "$file:$.: unsupported language ID $args[1]";
}
$parser->{po}->{$lang}->{$args[0]} = $args[2];
}
# Function support.
#
# Most functions are ignored. Some are of special interest and
# are parsed separately.
elsif ($parser->{state} eq '' and $command eq 'Function')
{
fail "$file:$.: syntax error" if ($#args != 0);
if ($args[0] eq 'CalcDepends')
{
$parser->{state} = 'function-calc-depends';
}
elsif ($args[0] eq 'CalcDefaults')
{
$parser->{state} = 'function-calc-defaults';
}
else
{
# Functions we do not find interesting are skipped.
print STDERR
"$file:$.: warning: ignoring function $args[0]\n"
if $::nsis_parser_warn;
delete $parser->{dep_name};
$parser->{state} = 'ignore-until-FunctionEnd';
}
}
# Function calc-depends.
#
# This function gathers information about dependencies between
# features. Features are identified by their frobbed names. The
# format is as such: First, a couple of UnselectSection macros,
# one for each dependency. Then SelectSection invocations for all
# packages which should always be installed (mandatory), followed
# by one block for each feature, consisting of a label "have_FOO:"
# where FOO is the frobbed package name (in lowercase, usually),
# followed by SelectSection invocations, one for each dependency,
# and finally a "skip_FOO:" label to finish the block.
#
# The order of these statements and blocks must be so that a single pass
# through the list is sufficient to resolve all dependencies, that means
# in pre-fix order.
elsif ($parser->{state} eq 'function-calc-depends')
{
if ($command eq 'FunctionEnd')
{
undef $parser->{state};
}
elsif ($command =~ m/^have_(.*):$/)
{
$parser->{dep_name} = $1;
$parser->{pkgs}->{$1}->{deps} = {};
}
elsif ($command eq '!insertmacro')
{
fail "$file:$.: syntax error" if $#args < 0;
if ($args[0] eq 'SelectSection')
{
fail "$file:$.: syntax error" if $#args != 1;
my $name = $args[1];
$name =~ s/^\$\{SEC_(.*)\}$/$1/;
if (not exists $parser->{dep_name})
{
# A stray SelectSection chooses defaults.
$parser->{pkgs}->{$name}->{features} .=
" Absent='disallow'";
}
else
{
my $dep_name = $parser->{dep_name};
print STDERR "DEP: Add " . $name . " as a dependency for " .
$dep_name . "\n" if $::nsis_parser_debug;
# Add $name as a dependency for $dep_name.
$parser->{pkgs}->{$dep_name}->{deps}->{$name} = 1;
}
}
}
elsif ($command =~ m/^skip_(.*):$/)
{
fail "$file:$.: stray skip_FOO label"
if not exists $parser->{dep_name};
my $dep_name = $parser->{dep_name};
my $dep_pkg = $parser->{pkgs}->{$dep_name};
# We resolve indirect dependencies right now. This works
# because dependencies are required to be listed in
# pre-fix order.
foreach my $name (keys %{$parser->{pkgs}})
{
my $pkg = $parser->{pkgs}->{$name};
# Check if $dep_name is a dependency for $name.
if (exists $pkg->{deps}->{$dep_name})
{
# Add all dependencies of $dep_name to $name.
foreach my $dep (keys %{$dep_pkg->{deps}})
{
$pkg->{deps}->{$dep} = $pkg->{deps}->{$dep_name} + 1
if (not defined $pkg->{deps}->{$dep});
}
}
}
delete $parser->{dep_name};
}
}
# Function calc-depends.
#
# Format:
# g4wihelp::config_fetch_bool "inst_FOO"
elsif ($parser->{state} eq 'function-calc-defaults')
{
if ($command eq 'FunctionEnd')
{
undef $parser->{state};
}
elsif ($command eq 'g4wihelp::config_fetch_bool')
{
fail "$file:$.: syntax error" if $#args != 0;
if ($args[0] !~ m/^"inst_(.*)"$/)
{
fail "$file:$.: syntax error";
}
$parser->{pkgs}->{$1}->{ini_inst} = 1;
}
}
}
# MSI generator.
# Simple indentation tracking, for pretty printing.
$::level = 0;
sub dump_all
{
my ($parser) = @_;
my $pkgname;
# A running count for files within each feature.
my $fileidx;
# A running count for registry settings within each feature.
my $regidx;
# A running count for directories throughout the whole file.
my $diridx = 0;
# The current directory.
my $cdir = '';
foreach $pkgname (@{$parser->{pkg_list}})
{
my $pkg = $parser->{pkgs}->{$pkgname};
$fileidx = 0;
foreach my $file (@{$pkg->{files}})
{
if ($cdir ne $file->{dir})
{
# We need to change the directory. We weed out empty
# path elements, which also takes care of leading slashes.
my @cdir = grep (!/^$/, split (/\\/, $cdir));
my @ndir = grep (!/^$/, split (/\\/, $file->{dir}));
my $min;
my $i;
$min = $#cdir;
$min = $#ndir if ($#ndir < $min);
for ($i = 0; $i <= $min; $i++)
{
last if ($cdir[$i] ne $ndir[$i])
}
my $j;
for ($j = $i; $j <= $#cdir; $j++)
{
$::level -= 2;
print ' ' x $::level
. "\n";
}
for ($j = $i; $j <= $#ndir; $j++)
{
print ' ' x $::level
. "\n";
$diridx++;
$::level += 2;
}
$cdir = $file->{dir};
}
my $targetfull;
if ($file->{dir} ne '')
{
$targetfull = $file->{dir} . '\\' . $file->{target};
}
else
{
$targetfull = $file->{target};
}
print ' ' x $::level
. "\n";
my $sourcefull;
$sourcefull = $file->{source};
$sourcefull =~ s/playground\/install-ex/\$(var.InstDirEx)/;
$sourcefull =~ s/playground\/install/\$(var.InstDir)/;
$sourcefull =~ s/\.\//\$(var.SrcDir)\//;
$sourcefull =~ s/\//\\/g;
print ' ' x $::level
. " \n";
# Does not help to avoid the warnings: DefaultLanguage='1033'.
# EXCEPTIONS:
if ($targetfull eq 'gpgol.dll')
{
print ' ' x $::level
. " \n";
}
if ($targetfull eq 'gpgex.dll')
{
print ' ' x $::level
. " \n";
}
# Create shortcuts.
if (defined $parser->{shortcuts}->{$targetfull})
{
my $shortcut = $parser->{shortcuts}->{$targetfull};
my $extra = '';
if (exists $shortcut->{description})
{
my $desc = nsis_translate ($parser, '',
$shortcut->{description});
$extra .= " Description='$desc'";
}
# FIXME: WiX wants the icon to be known at compile time, so it needs a
# source file, not a target file name.
# if ($shortcut->{icon} ne '')
# {
# $extra .= " Icon='sm_$pkg->{name}_${fileidx}_icon'";
# }
# FIXME: Note that the link name should better not
# change, or it is not correctly replaced on updates.
my $link = nsis_translate ($parser, '', $shortcut->{link});
print ' ' x $::level
. " {icon} eq '')
# {
print "/>\n";
# }
# else
# {
# print ">\n";
# print ' ' x $::level
# . " {icon}'/>\n";
# print ' ' x $::level
# . " \n";
# }
# Can't make these optional, so we don't do this.
# print ' ' x $::level
# . " \n";
}
print ' ' x $::level
. " \n";
if (defined $parser->{shortcuts}->{$targetfull})
{
# http://www.mail-archive.com/wix-users@lists.sourceforge.net/msg02746.html
# -sice:ICE64
print ' ' x $::level
. " \n";
}
# EXCEPTIONS:
# We use $targetfull because there is also a gpg.exe in pub\.
if ($targetfull eq 'gpg.exe')
{
print ' ' x $::level
. " \n";
}
elsif ($targetfull eq 'gpgol.dll')
{
print ' ' x $::level
. " \n";
print ' ' x $::level
. " \n";
}
elsif ($targetfull eq 'gpgex.dll')
{
print ' ' x $::level
. " \n";
print ' ' x $::level
. " \n";
print ' ' x $::level
. " \n";
print ' ' x $::level
. " \n";
}
elsif ($targetfull eq 'gpgee.dll')
{
print STDERR "ERR: run heat.exe on gpgee.dll and add info\n";
exit 1;
}
print ' ' x $::level
. "\n";
$fileidx++;
}
$regidx = 0;
foreach my $reg (@{$pkg->{registry}})
{
my $target;
my $root;
if ($reg->{root} eq 'SHCTX')
{
$root = 'HKMU';
}
else
{
$root = $reg->{root};
}
my $localValue;
# Some values need to be translated, like descriptions.
if ($reg->{value} =~ m/^\$/)
{
$localValue = nsis_translate ($parser, '', $reg->{value});
}
else
{
$localValue = $reg->{value};
}
$target = '/REGISTRY/' . $reg->{root} . '/' . $reg->{key}
. '/' . $reg->{name};
my $namepart="";
if ($reg->{name} ne "")
{
$namepart = "Name='$reg->{name}' ";
}
print ' ' x $::level
. "\n";
print ' ' x $::level
. " \n";
print ' ' x $::level
. "\n";
$regidx++;
}
}
my @cdir = grep (!/^$/, split (/\\/, $cdir));
my $j;
for ($j = 0; $j <= $#cdir; $j++)
{
$::level -= 2;
print ' ' x $::level
. "\n";
}
}
sub dump_meat
{
my ($pkg) = @_;
my $fileidx;
my $regidx;
$fileidx = 0;
foreach my $file (@{$pkg->{files}})
{
print ' ' x $::level
. " \n";
$fileidx++;
}
$regidx = 0;
foreach my $reg (@{$pkg->{registry}})
{
print ' ' x $::level
. " \n";
$regidx++;
}
}
sub dump_all2
{
my ($parser) = @_;
my $pkgname;
foreach $pkgname (@{$parser->{pkg_list}})
{
my $pkg = $parser->{pkgs}->{$pkgname};
my $features;
next if $pkg->{hidden};
$features = $pkg->{features};
# $features .= " Display='hidden'" if $pkg->{hidden};
$features .= " Description='$pkg->{description}'"
if $pkg->{description};
my $title = nsis_translate ($parser, '', $pkg->{title});
print ' ' x $::level
. "\n";
if ($pkg->{ini_inst})
{
my $uc_pkgname = uc ($pkgname);
print ' ' x $::level
. ""
. "INST_$uc_pkgname = \"true\"\n";
print ' ' x $::level
. ""
. "INST_$uc_pkgname = \"false\"\n";
}
dump_meat ($pkg);
foreach my $dep (keys %{$pkg->{deps}})
{
$dep =~ s/-/_/g;
my $deppkg = $parser->{pkgs}->{$dep};
# We use Level=1 because with InstallDefault followParent
# the Level seems to specify some sort of minimum install
# level or something (FIXME: confirm this).
print ' ' x $::level
. " {name}_$dep' "
. "Level='1' Display='hidden' "
. "InstallDefault='followParent'>\n";
$::level += 2;
dump_meat ($deppkg);
$::level -= 2;
print ' ' x $::level
. " \n";
}
print ' ' x $::level
. "\n";
}
}
# Just so that it is defined.
$. = 0;
my %parser = ( pre_depth => 0, pre_true => 0 );
my $parser = \%parser;
fetch_guids ();
while ($#ARGV >= 0 and $ARGV[0] =~ m/^-/)
{
my $opt = shift @ARGV;
if ($opt =~ m/^--guids$/)
{
$::guid_file = shift @ARGV;
}
elsif ($opt =~ m/^--manifest$/)
{
$::files_file = shift @ARGV;
}
elsif ($opt =~ m/^-D([^=]*)=(.*)$/)
{
$parser->{pre_symbols}->{$1} = $2;
}
elsif ($opt =~ m/^-L(.*)$/)
{
$::lang = $1;
# Test if it is supported.
lang_to_lcid ($::lang);
}
elsif ($opt eq '--usage')
{
print STDERR "Usage: $0 [-DNAME=VALUE...] NSIFILE\n";
print STDERR "Use --help or -h for more information.\n";
exit 1;
}
elsif ($opt eq '-h' or $opt eq '--help')
{
print STDERR "Usage: $0 [-DNAME=VALUE...] NSIFILE\n";
print STDERR "Convert the .nsi file NSIFILE to a WiX source file.\n";
print STDERR "Options:\n";
print STDERR " --guids NAME Save GUIDs into file NAME (default: $::guid_file)\n";
print STDERR " --manifest NAME Save included files into file NAME (default: $::files_file)\n";
print STDERR " -DNAME=VALUE Define preprocessor symbol NAME to VALUE\n";
print STDERR " -LLANG Build installer for language LANG (default: $::lang)\n";
print STDERR "\n";
print STDERR " -h|--help Print this help and exit\n";
exit 0;
}
else
{
print STDERR "$0: unknown option $opt\n";
print STDERR "Usage: $0 [-DNAME=VALUE...] NSIFILE\n";
print STDERR "Use --help or -h for more information.\n";
exit 1;
}
}
if ($#ARGV < 0)
{
nsis_parse_file ($parser, '-');
}
else
{
nsis_parse_file ($parser, $ARGV[0]);
}
# Add exceptions.
# ===============
$parser->{pkgs}->{gnupg}->{deps}->{gpg4win} = 1;
# For debugging:
# use Data::Dumper;
# print Dumper ($parser);
# exit;
# Dump the gathered information.
# ==============================
my $BUILD_FILEVERSION = nsis_fetch ($parser, '_BUILD_FILEVERSION');
my $product_id = get_guid ("/PRODUCT/$BUILD_FILEVERSION");
my $upgrade_code = get_guid ("/UPGRADE/1");
my $INSTALL_DIR = nsis_fetch ($parser, 'INSTALL_DIR');
my $lcid = lang_to_lcid ($::lang);
+# Replacement regex for components:
+# :'<,'>s/.*Component: \(.*\) does not.*/ /
+
print <
= 601)]]>
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
EOF
foreach my $pkgname (@{$parser->{pkg_list}})
{
if (exists $parser->{pkgs}->{$pkgname}->{ini_inst})
{
my $uc_pkgname = uc ($pkgname);
print <
EOF
}
}
print <
EOF
$::level = 12;
dump_all ($parser);
print <
EOF
if (scalar keys %{$parser->{shortcuts}})
{
my $name = nsis_fetch ($parser, 'PRETTY_PACKAGE');
print <
EOF
}
#print <
#EOF
print <
EOF
$::level = 6;
dump_all2 ($parser);
#
# Removed this, because it is not localized:
#
print <
EOF
# Post-processing: We need to remember the GUIDs for later reuse, and
# we remember the files we need in case we want to transfer them to a
# different machine for invocation of WiX.
store_guids ();
store_files ($parser);