diff options
author | Bram Moolenaar <Bram@vim.org> | 2018-12-21 16:22:50 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2018-12-21 16:22:50 +0100 |
commit | af610b8e66a7fefcb8db07ee65686f51e1cb288a (patch) | |
tree | 2db9d76d99aa2cae6cdc7997da4c4d3e5d3e195a /nsis | |
parent | d155d7a8519987361169459b8d464ae1caef5e9c (diff) |
patch 8.1.0616: NSIS installer is outdatedv8.1.0616
Problem: NSIS installer is outdated.
Solution: Use modern syntax, MUI2 and make it work better. Add translations.
(Ken Takata, closes #3501)
Diffstat (limited to 'nsis')
-rw-r--r-- | nsis/gvim.nsi | 1136 | ||||
-rw-r--r-- | nsis/icons/header.bmp | bin | 0 -> 102654 bytes | |||
-rw-r--r-- | nsis/icons/header.svg | 265 | ||||
-rw-r--r-- | nsis/icons/un_header.bmp | bin | 0 -> 102654 bytes | |||
-rw-r--r-- | nsis/icons/uninstall.bmp | bin | 0 -> 618006 bytes | |||
-rw-r--r-- | nsis/icons/welcome.bmp | bin | 0 -> 618006 bytes | |||
-rw-r--r-- | nsis/icons/welcome.svg | 268 | ||||
-rw-r--r-- | nsis/lang/danish.nsi | 175 | ||||
-rw-r--r-- | nsis/lang/dutch.nsi | 281 | ||||
-rw-r--r-- | nsis/lang/english.nsi | 280 | ||||
-rw-r--r-- | nsis/lang/german.nsi | 280 | ||||
-rw-r--r-- | nsis/lang/italian.nsi | 290 | ||||
-rw-r--r-- | nsis/lang/japanese.nsi | 287 | ||||
-rw-r--r-- | nsis/lang/simpchinese.nsi | 277 | ||||
-rw-r--r-- | nsis/lang/tradchinese.nsi | 278 |
15 files changed, 3514 insertions, 303 deletions
diff --git a/nsis/gvim.nsi b/nsis/gvim.nsi index 55bb4ce007..12a55bb611 100644 --- a/nsis/gvim.nsi +++ b/nsis/gvim.nsi @@ -1,7 +1,9 @@ # NSIS file to create a self-installing exe for Vim. -# It requires NSIS version 2.0 or later. +# It requires NSIS version 3.0 or later. # Last Change: 2014 Nov 5 +Unicode true + # WARNING: if you make changes to this script, look out for $0 to be valid, # because uninstall deletes most files in $0. @@ -31,171 +33,288 @@ # Get it at https://upx.github.io/ !define HAVE_UPX -# comment the next line if you do not want to add Native Language Support +# Comment the next line if you do not want to add Native Language Support !define HAVE_NLS +# Uncomment the next line if you want to include VisVim extension: +#!define HAVE_VIS_VIM + +# Comment the following line to create a multilanguage installer: +!define HAVE_MULTI_LANG + +# Uncomment the next line if you want to create a 64-bit installer. +#!define WIN64 + !include gvim_version.nsh # for version number # ----------- No configurable settings below this line ----------- -!include UpgradeDLL.nsh # for VisVim.dll -!include LogicLib.nsh -!include x64.nsh - -Name "Vim ${VER_MAJOR}.${VER_MINOR}" +!include "Library.nsh" # For DLL install +!ifdef HAVE_VIS_VIM + !include "UpgradeDLL.nsh" # for VisVim.dll +!endif +!include "LogicLib.nsh" +!include "MUI2.nsh" +!include "nsDialogs.nsh" +!include "Sections.nsh" +!include "x64.nsh" + +!define PRODUCT "Vim ${VER_MAJOR}.${VER_MINOR}" +!define UNINST_REG_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall" +!define UNINST_REG_KEY_VIM "${UNINST_REG_KEY}\${PRODUCT}" + +!ifdef WIN64 +Name "${PRODUCT} (x64)" +!else +Name "${PRODUCT}" +!endif OutFile gvim${VER_MAJOR}${VER_MINOR}.exe CRCCheck force SetCompressor /SOLID lzma +SetCompressorDictSize 64 +ManifestDPIAware true SetDatablockOptimize on RequestExecutionLevel highest -XPStyle on - -ComponentText "This will install Vim ${VER_MAJOR}.${VER_MINOR} on your computer." -DirText "Choose a directory to install Vim (should contain 'vim')" -Icon icons\vim_16c.ico -# NSIS2 uses a different strategy with six different images in a strip... -#EnabledBitmap icons\enabled.bmp -#DisabledBitmap icons\disabled.bmp -UninstallText "This will uninstall Vim ${VER_MAJOR}.${VER_MINOR} from your system." -UninstallIcon icons\vim_uninst_16c.ico - -# On NSIS 2 using the BGGradient causes trouble on Windows 98, in combination -# with the BringToFront. -# BGGradient 004000 008200 FFFFFF -LicenseText "You should read the following before installing:" -LicenseData ${VIMRT}\doc\uganda.nsis.txt !ifdef HAVE_UPX !packhdr temp.dat "upx --best --compress-icons=1 temp.dat" !endif -# This adds '\vim' to the user choice automagically. The actual value is -# obtained below with ReadINIStr. +!ifdef WIN64 +!define BIT 64 +!else +!define BIT 32 +!endif + +########################################################## +# MUI2 settings + +!define MUI_ABORTWARNING +!define MUI_UNABORTWARNING + +!define MUI_ICON "icons\vim_16c.ico" +!define MUI_UNICON "icons\vim_uninst_16c.ico" + +# Show all languages, despite user's codepage: +!define MUI_LANGDLL_ALLLANGUAGES +!define MUI_LANGDLL_REGISTRY_ROOT "HKCU" +!define MUI_LANGDLL_REGISTRY_KEY "Software\Vim" +!define MUI_LANGDLL_REGISTRY_VALUENAME "Installer Language" + +!define MUI_WELCOMEFINISHPAGE_BITMAP "icons\welcome.bmp" +!define MUI_UNWELCOMEFINISHPAGE_BITMAP "icons\uninstall.bmp" +!define MUI_HEADERIMAGE +!define MUI_HEADERIMAGE_BITMAP "icons\header.bmp" +!define MUI_HEADERIMAGE_UNBITMAP "icons\un_header.bmp" + +!define MUI_WELCOMEFINISHPAGE_BITMAP_STRETCH "AspectFitHeight" +!define MUI_UNWELCOMEFINISHPAGE_BITMAP_STRETCH "AspectFitHeight" +!define MUI_HEADERIMAGE_BITMAP_STRETCH "AspectFitHeight" +!define MUI_HEADERIMAGE_UNBITMAP_STRETCH "AspectFitHeight" + +!define MUI_COMPONENTSPAGE_SMALLDESC +!define MUI_LICENSEPAGE_CHECKBOX +!define MUI_FINISHPAGE_RUN "$0\gvim.exe" +!define MUI_FINISHPAGE_RUN_TEXT $(str_show_readme) +!define MUI_FINISHPAGE_RUN_PARAMETERS "-R $\"$0\README.txt$\"" + +# This adds '\Vim' to the user choice automagically. The actual value is +# obtained below with CheckOldVim. +!ifdef WIN64 +InstallDir "$PROGRAMFILES64\Vim" +!else InstallDir "$PROGRAMFILES\Vim" +!endif # Types of installs we can perform: -InstType Typical -InstType Minimal -InstType Full +InstType $(str_type_typical) +InstType $(str_type_minimal) +InstType $(str_type_full) SilentInstall normal -# These are the pages we use -Page license -Page components -Page custom SetCustom ValidateCustom ": _vimrc setting" -Page directory "" "" CheckInstallDir -Page instfiles -UninstPage uninstConfirm -UninstPage instfiles - -# Reserve files -# Needed for showing the _vimrc setting page faster. -ReserveFile /plugin InstallOptions.dll -ReserveFile vimrc.ini +# General custom functions for MUI2: +#!define MUI_CUSTOMFUNCTION_ABORT VimOnUserAbort +#!define MUI_CUSTOMFUNCTION_UNABORT un.VimOnUserAbort + +# Installer pages +!insertmacro MUI_PAGE_WELCOME +!insertmacro MUI_PAGE_LICENSE "${VIMRT}\doc\uganda.nsis.txt" +!insertmacro MUI_PAGE_COMPONENTS +Page custom SetCustom ValidateCustom +#!define MUI_PAGE_CUSTOMFUNCTION_LEAVE VimFinalCheck +!insertmacro MUI_PAGE_DIRECTORY +!insertmacro MUI_PAGE_INSTFILES +!define MUI_FINISHPAGE_NOREBOOTSUPPORT +!insertmacro MUI_PAGE_FINISH + +# Uninstaller pages: +!insertmacro MUI_UNPAGE_CONFIRM +#!define MUI_PAGE_CUSTOMFUNCTION_LEAVE un.VimCheckRunning +!insertmacro MUI_UNPAGE_COMPONENTS +!insertmacro MUI_UNPAGE_INSTFILES +!define MUI_FINISHPAGE_NOREBOOTSUPPORT +!insertmacro MUI_UNPAGE_FINISH ########################################################## -# Functions - -Function .onInit - MessageBox MB_YESNO|MB_ICONQUESTION \ - "This will install Vim ${VER_MAJOR}.${VER_MINOR} on your computer.$\n Continue?" \ - /SD IDYES \ - IDYES NoAbort - Abort ; causes installer to quit. - NoAbort: - - # run the install program to check for already installed versions - SetOutPath $TEMP - File /oname=install.exe ${VIMSRC}\installw32.exe - ExecWait "$TEMP\install.exe -uninstall-check" - Delete $TEMP\install.exe - - # We may have been put to the background when uninstall did something. - BringToFront - - # Install will have created a file for us that contains the directory where - # we should install. This is $VIM if it's set. This appears to be the only - # way to get the value of $VIM here!? - ReadINIStr $INSTDIR $TEMP\vimini.ini vimini dir - Delete $TEMP\vimini.ini - - # If ReadINIStr failed or did not find a path: use the default dir. - StrCmp $INSTDIR "" 0 IniOK - StrCpy $INSTDIR "$PROGRAMFILES\Vim" - IniOK: - - # Should check for the value of $VIM and use it. Unfortunately I don't know - # how to obtain the value of $VIM - # IfFileExists "$VIM" 0 No_Vim - # StrCpy $INSTDIR "$VIM" - # No_Vim: - - # User variables: - # $0 - holds the directory the executables are installed to - # $1 - holds the parameters to be passed to install.exe. Starts with OLE - # registration (since a non-OLE gvim will not complain, and we want to - # always register an OLE gvim). - # $2 - holds the names to create batch files for - StrCpy $0 "$INSTDIR\vim${VER_MAJOR}${VER_MINOR}" - StrCpy $1 "-register-OLE" - StrCpy $2 "gvim evim gview gvimdiff vimtutor" +# Languages Files + +!insertmacro MUI_RESERVEFILE_LANGDLL +!include "lang\english.nsi" + +# Include support for other languages: +!ifdef HAVE_MULTI_LANG + !include "lang\danish.nsi" + !include "lang\dutch.nsi" + !include "lang\german.nsi" + !include "lang\italian.nsi" + !include "lang\japanese.nsi" + !include "lang\simpchinese.nsi" + !include "lang\tradchinese.nsi" +!endif - # Extract InstallOptions files - # $PLUGINSDIR will automatically be removed when the installer closes - InitPluginsDir - File /oname=$PLUGINSDIR\vimrc.ini "vimrc.ini" -FunctionEnd -Function .onUserAbort - MessageBox MB_YESNO|MB_ICONQUESTION "Abort install?" IDYES NoCancelAbort - Abort ; causes installer to not quit. - NoCancelAbort: -FunctionEnd +# Global variables +Var vim_dialog +Var vim_nsd_compat +Var vim_nsd_keymap +Var vim_nsd_mouse +Var vim_compat_stat +Var vim_keymap_stat +Var vim_mouse_stat -# We only accept the directory if it ends in "vim". Using .onVerifyInstDir has -# the disadvantage that the browse dialog is difficult to use. -Function CheckInstallDir -FunctionEnd -Function .onInstSuccess - WriteUninstaller vim${VER_MAJOR}${VER_MINOR}\uninstall-gui.exe - MessageBox MB_YESNO|MB_ICONQUESTION \ - "The installation process has been successful. Happy Vimming! \ - $\n$\n Do you want to see the README file now?" IDNO NoReadme - Exec '$0\gvim.exe -R "$0\README.txt"' - NoReadme: -FunctionEnd - -Function .onInstFailed - MessageBox MB_OK|MB_ICONEXCLAMATION "Installation failed. Better luck next time." -FunctionEnd +# Reserve files +ReserveFile ${VIMSRC}\installw32.exe -Function un.onUnInstSuccess - MessageBox MB_OK|MB_ICONINFORMATION \ - "Vim ${VER_MAJOR}.${VER_MINOR} has been (partly) removed from your system" -FunctionEnd +########################################################## +# Functions -Function un.GetParent +# Get parent directory +# Share this function both on installer and uninstaller +!macro GetParent un +Function ${un}GetParent Exch $0 ; old $0 is on top of stack Push $1 Push $2 StrCpy $1 -1 - loop: + ${Do} StrCpy $2 $0 1 $1 - StrCmp $2 "" exit - StrCmp $2 "\" exit + ${If} $2 == "" + ${OrIf} $2 == "\" + ${ExitDo} + ${EndIf} IntOp $1 $1 - 1 - Goto loop - exit: - StrCpy $0 $0 $1 - Pop $2 - Pop $1 - Exch $0 ; put $0 on top of stack, restore $0 to original value + ${Loop} + StrCpy $0 $0 $1 + Pop $2 + Pop $1 + Exch $0 ; put $0 on top of stack, restore $0 to original value +FunctionEnd +!macroend + +!insertmacro GetParent "" +!insertmacro GetParent "un." + +# Check if Vim is already installed. +# return: Installed directory. If not found, it will be empty. +Function CheckOldVim + Push $0 + Push $R0 + Push $R1 + Push $R2 + + ${If} ${RunningX64} + SetRegView 64 + ${EndIf} + + ClearErrors + StrCpy $0 "" # Installed directory + StrCpy $R0 0 # Sub-key index + StrCpy $R1 "" # Sub-key + ${Do} + # Eumerate the sub-key: + EnumRegKey $R1 HKLM ${UNINST_REG_KEY} $R0 + + # Stop if no more sub-key: + ${If} ${Errors} + ${OrIf} $R1 == "" + ${ExitDo} + ${EndIf} + + # Move to the next sub-key: + IntOp $R0 $R0 + 1 + + # Check if the key is Vim uninstall key or not: + StrCpy $R2 $R1 4 + ${If} $R2 S!= "Vim " + ${Continue} + ${EndIf} + + # Verifies required sub-keys: + ReadRegStr $R2 HKLM "${UNINST_REG_KEY}\$R1" "DisplayName" + ${If} ${Errors} + ${OrIf} $R2 == "" + ${Continue} + ${EndIf} + + ReadRegStr $R2 HKLM "${UNINST_REG_KEY}\$R1" "UninstallString" + ${If} ${Errors} + ${OrIf} $R2 == "" + ${Continue} + ${EndIf} + + # Found + Push $R2 + call GetParent + call GetParent + Pop $0 # Vim directory + ${ExitDo} + + ${Loop} + + ${If} ${RunningX64} + SetRegView lastused + ${EndIf} + + Pop $R2 + Pop $R1 + Pop $R0 + Exch $0 # put $0 on top of stack, restore $0 to original value FunctionEnd ########################################################## -Section "Vim executables and runtime files" +Section "$(str_section_old_ver)" id_section_old_ver + SectionIn 1 2 3 RO + + # run the install program to check for already installed versions + SetOutPath $TEMP + File /oname=install.exe ${VIMSRC}\installw32.exe + DetailPrint "$(str_msg_uninstalling)" + ${Do} + nsExec::Exec "$TEMP\install.exe -uninstall-check" + Pop $3 + + call CheckOldVim + Pop $3 + ${If} $3 == "" + ${ExitDo} + ${Else} + # It seems that the old version is still remaining. + # TODO: Should we show a warning and run the uninstaller again? + + ${ExitDo} # Just ignore for now. + ${EndIf} + ${Loop} + Delete $TEMP\install.exe + Delete $TEMP\vimini.ini # install.exe creates this, but we don't need it. + + # We may have been put to the background when uninstall did something. + BringToFront +SectionEnd + +########################################################## +Section "$(str_section_exe)" id_section_exe SectionIn 1 2 3 RO # we need also this here if the user changes the instdir @@ -215,7 +334,7 @@ Section "Vim executables and runtime files" File ${VIMRT}\rgb.txt File ${VIMTOOLS}\diff.exe - File ${VIMTOOLS}\winpty32.dll + File ${VIMTOOLS}\winpty${BIT}.dll File ${VIMTOOLS}\winpty-agent.exe SetOutPath $0\colors @@ -299,120 +418,63 @@ Section "Vim executables and runtime files" SectionEnd ########################################################## -Section "Vim console program (vim.exe)" +Section "$(str_section_console)" id_section_console SectionIn 1 3 SetOutPath $0 - ReadRegStr $R0 HKLM \ - "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion - IfErrors 0 lbl_winnt - # Windows 95/98/ME: not supported - Goto lbl_done - lbl_winnt: - # Windows NT/2000/XP and later - File /oname=vim.exe ${VIMSRC}\vimw32.exe - lbl_done: + File /oname=vim.exe ${VIMSRC}\vimw32.exe StrCpy $2 "$2 vim view vimdiff" SectionEnd ########################################################## -Section "Create .bat files for command line use" +Section "$(str_section_batch)" id_section_batch SectionIn 3 StrCpy $1 "$1 -create-batfiles $2" SectionEnd ########################################################## -Section "Create icons on the Desktop" - SectionIn 1 3 +SectionGroup $(str_group_icons) id_group_icons + Section "$(str_section_desktop)" id_section_desktop + SectionIn 1 3 - StrCpy $1 "$1 -install-icons" -SectionEnd + StrCpy $1 "$1 -install-icons" + SectionEnd -########################################################## -Section "Add Vim to the Start Menu" - SectionIn 1 3 + Section "$(str_section_start_menu)" id_section_startmenu + SectionIn 1 3 - StrCpy $1 "$1 -add-start-menu" -SectionEnd + StrCpy $1 "$1 -add-start-menu" + SectionEnd +SectionGroupEnd ########################################################## -Section "Add an Edit-with-Vim context menu entry" +Section "$(str_section_edit_with)" id_section_editwith SectionIn 1 3 - # Be aware of this sequence of events: - # - user uninstalls Vim, gvimext.dll can't be removed (it's in use) and - # is scheduled to be removed at next reboot. - # - user installs Vim in same directory, gvimext.dll still exists. - # If we now skip installing gvimext.dll, it will disappear at the next - # reboot. Thus when copying gvimext.dll fails always schedule it to be - # installed at the next reboot. Can't use UpgradeDLL! - # We don't ask the user to reboot, the old dll will keep on working. SetOutPath $0 - ClearErrors - SetOverwrite try ${If} ${RunningX64} # Install 64-bit gvimext.dll into the GvimExt64 directory. SetOutPath $0\GvimExt64 ClearErrors - File /oname=gvimext.dll ${VIMSRC}\GvimExt\gvimext64.dll -!ifdef HAVE_NLS - File ${GETTEXT}\gettext64\libintl-8.dll - File ${GETTEXT}\gettext64\libiconv-2.dll -!endif - - IfErrors 0 GvimExt64Done - - # Can't copy gvimext.dll, create it under another name and rename it - # on next reboot. - GetTempFileName $3 $0\GvimExt64 - File /oname=$3 ${VIMSRC}\GvimExt\gvimext64.dll - Rename /REBOOTOK $3 $0\GvimExt64\gvimext.dll -!ifdef HAVE_NLS - GetTempFileName $3 $0\GvimExt64 - File /oname=$3 ${GETTEXT}\gettext64\libintl-8.dll - Rename /REBOOTOK $3 $0\GvimExt64\libintl-8.dll - GetTempFileName $3 $0\GvimExt64 - File /oname=$3 ${GETTEXT}\gettext64\libiconv-2.dll - Rename /REBOOTOK $3 $0\GvimExt64\libiconv-2.dll -!endif + !define LIBRARY_SHELL_EXTENSION + !define LIBRARY_X64 + !insertmacro InstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \ + "${VIMSRC}\GvimExt\gvimext64.dll" \ + "$0\GvimExt64\gvimext.dll" "$0" + !undef LIBRARY_X64 + !undef LIBRARY_SHELL_EXTENSION ${EndIf} - GvimExt64Done: - # Install 32-bit gvimext.dll into the GvimExt32 directory. SetOutPath $0\GvimExt32 ClearErrors - - File /oname=gvimext.dll ${VIMSRC}\GvimExt\gvimext.dll -!ifdef HAVE_NLS - File ${GETTEXT}\gettext32\libintl-8.dll - File ${GETTEXT}\gettext32\libiconv-2.dll - File ${GETTEXT}\gettext32\libgcc_s_sjlj-1.dll -!endif - - IfErrors 0 GvimExt32Done - - # Can't copy gvimext.dll, create it under another name and rename it on - # next reboot. - GetTempFileName $3 $0\GvimExt32 - File /oname=$3 ${VIMSRC}\GvimExt\gvimext.dll - Rename /REBOOTOK $3 $0\GvimExt32\gvimext.dll -!ifdef HAVE_NLS - GetTempFileName $3 $0\GvimExt32 - File /oname=$3 ${GETTEXT}\gettext32\libintl-8.dll - Rename /REBOOTOK $3 $0\GvimExt32\libintl-8.dll - GetTempFileName $3 $0\GvimExt32 - File /oname=$3 ${GETTEXT}\gettext32\libiconv-2.dll - Rename /REBOOTOK $3 $0\GvimExt32\libiconv-2.dll - GetTempFileName $3 $0\GvimExt32 - File /oname=$3 ${GETTEXT}\gettext32\libgcc_s_sjlj-1.dll - Rename /REBOOTOK $3 $0\GvimExt32\libgcc_s_sjlj-1.dll -!endif - - GvimExt32Done: - SetOverwrite lastused + !define LIBRARY_SHELL_EXTENSION + !insertmacro InstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \ + "${VIMSRC}\GvimExt\gvimext.dll" \ + "$0\GvimExt32\gvimext.dll" "$0" + !undef LIBRARY_SHELL_EXTENSION # We don't have a separate entry for the "Open With..." menu, assume # the user wants either both or none. @@ -420,130 +482,563 @@ Section "Add an Edit-with-Vim context menu entry" SectionEnd ########################################################## -Section "Create a _vimrc if it doesn't exist" sec_vimrc_id +Section "$(str_section_vim_rc)" id_section_vimrc SectionIn 1 3 StrCpy $1 "$1 -create-vimrc" -SectionEnd -########################################################## -Section "Create plugin directories in HOME or VIM" - SectionIn 1 3 + ${If} ${RunningX64} + SetRegView 64 + ${EndIf} + WriteRegStr HKLM "${UNINST_REG_KEY_VIM}" "vim_compat" "$vim_compat_stat" + WriteRegStr HKLM "${UNINST_REG_KEY_VIM}" "vim_keyremap" "$vim_keymap_stat" + WriteRegStr HKLM "${UNINST_REG_KEY_VIM}" "vim_mouse" "$vim_mouse_stat" + ${If} ${RunningX64} + SetRegView lastused + ${EndIf} + + ${If} $vim_compat_stat == "vi" + StrCpy $1 "$1 -vimrc-compat vi" + ${ElseIf} $vim_compat_stat == "vim" + StrCpy $1 "$1 -vimrc-compat vim" + ${ElseIf} $vim_compat_stat == "defaults" + StrCpy $1 "$1 -vimrc-compat defaults" + ${Else} + StrCpy $1 "$1 -vimrc-compat all" + ${EndIf} + + ${If} $vim_keymap_stat == "default" + StrCpy $1 "$1 -vimrc-remap no" + ${Else} + StrCpy $1 "$1 -vimrc-remap win" + ${EndIf} + + ${If} $vim_mouse_stat == "default" + StrCpy $1 "$1 -vimrc-behave default" + ${ElseIf} $vim_mouse_stat == "windows" + StrCpy $1 "$1 -vimrc-behave mswin" + ${Else} + StrCpy $1 "$1 -vimrc-behave unix" + ${EndIf} - StrCpy $1 "$1 -create-directories home" SectionEnd ########################################################## -Section "Create plugin directories in VIM" - SectionIn 3 +SectionGroup $(str_group_plugin) id_group_plugin + Section "$(str_section_plugin_home)" id_section_pluginhome + SectionIn 1 3 - StrCpy $1 "$1 -create-directories vim" -SectionEnd + StrCpy $1 "$1 -create-directories home" + SectionEnd + + Section "$(str_section_plugin_vim)" id_section_pluginvim + SectionIn 3 + + StrCpy $1 "$1 -create-directories vim" + SectionEnd +SectionGroupEnd ########################################################## -Section "VisVim Extension for MS Visual Studio" +!ifdef HAVE_VIS_VIM +Section "$(str_section_vis_vim)" id_section_visvim SectionIn 3 SetOutPath $0 !insertmacro UpgradeDLL "${VIMSRC}\VisVim\VisVim.dll" "$0\VisVim.dll" "$0" File ${VIMSRC}\VisVim\README_VisVim.txt SectionEnd +!endif ########################################################## !ifdef HAVE_NLS - Section "Native Language Support" - SectionIn 1 3 +Section "$(str_section_nls)" id_section_nls + SectionIn 1 3 - SetOutPath $0\lang - File /r ${VIMRT}\lang\*.* - SetOutPath $0\keymap - File ${VIMRT}\keymap\README.txt - File ${VIMRT}\keymap\*.vim - SetOutPath $0 - File ${GETTEXT}\gettext32\libintl-8.dll - File ${GETTEXT}\gettext32\libiconv-2.dll - #File /nonfatal ${VIMRT}\libwinpthread-1.dll - File /nonfatal ${GETTEXT}\gettext32\libgcc_s_sjlj-1.dll - SectionEnd + SetOutPath $0\lang + File /r ${VIMRT}\lang\*.* + SetOutPath $0\keymap + File ${VIMRT}\keymap\README.txt + File ${VIMRT}\keymap\*.vim + SetOutPath $0 + !insertmacro InstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \ + "${GETTEXT}\gettext${BIT}\libintl-8.dll" \ + "$0\libintl-8.dll" "$0" + !insertmacro InstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \ + "${GETTEXT}\gettext${BIT}\libiconv-2.dll" \ + "$0\libiconv-2.dll" "$0" + !if /FileExists "${GETTEXT}\gettext${BIT}\libgcc_s_sjlj-1.dll" + # Install libgcc_s_sjlj-1.dll only if it is needed. + !insertmacro InstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \ + "${GETTEXT}\gettext${BIT}\libgcc_s_sjlj-1.dll" \ + "$0\libgcc_s_sjlj-1.dll" "$0" + !endif + + ${If} ${SectionIsSelected} ${id_section_editwith} + ${If} ${RunningX64} + # Install DLLs for 64-bit gvimext.dll into the GvimExt64 directory. + SetOutPath $0\GvimExt64 + ClearErrors + !define LIBRARY_X64 + !insertmacro InstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \ + "${GETTEXT}\gettext64\libintl-8.dll" \ + "$0\GvimExt64\libintl-8.dll" "$0\GvimExt64" + !insertmacro InstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \ + "${GETTEXT}\gettext64\libiconv-2.dll" \ + "$0\GvimExt64\libiconv-2.dll" "$0\GvimExt64" + !undef LIBRARY_X64 + ${EndIf} + + # Install DLLs for 32-bit gvimext.dll into the GvimExt32 directory. + SetOutPath $0\GvimExt32 + ClearErrors + !insertmacro InstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \ + "${GETTEXT}\gettext32\libintl-8.dll" \ + "$0\GvimExt32\libintl-8.dll" "$0\GvimExt32" + !insertmacro InstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \ + "${GETTEXT}\gettext32\libiconv-2.dll" \ + "$0\GvimExt32\libiconv-2.dll" "$0\GvimExt32" + !if /FileExists "${GETTEXT}\gettext32\libgcc_s_sjlj-1.dll" + # Install libgcc_s_sjlj-1.dll only if it is needed. + !insertmacro InstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \ + "${GETTEXT}\gettext32\libgcc_s_sjlj-1.dll" \ + "$0\GvimExt32\libgcc_s_sjlj-1.dll" "$0\GvimExt32" + !endif + ${EndIf} +SectionEnd !endif ########################################################## Section -call_install_exe SetOutPath $0 - ExecWait "$0\install.exe $1" + DetailPrint "$(str_msg_registering)" + nsExec::Exec "$0\install.exe $1" + Pop $3 SectionEnd ########################################################## +!macro SaveSectionSelection section_id reg_value + ${If} ${SectionIsSelected} ${section_id} + WriteRegDWORD HKLM "${UNINST_REG_KEY_VIM}" ${reg_value} 1 + ${Else} + WriteRegDWORD HKLM "${UNINST_REG_KEY_VIM}" ${reg_value} 0 + ${EndIf} +!macroend + Section -post + + # Get estimated install size + SectionGetSize ${id_section_exe} $3 + ${If} ${SectionIsSelected} ${id_section_console} + SectionGetSize ${id_section_console} $4 + IntOp $3 $3 + $4 + ${EndIf} + ${If} ${SectionIsSelected} ${id_section_editwith} + SectionGetSize ${id_section_editwith} $4 + IntOp $3 $3 + $4 + ${EndIf} +!ifdef HAVE_VIS_VIM + ${If} ${SectionIsSelected} ${id_section_visvim} + SectionGetSize ${id_section_visvim} $4 + IntOp $3 $3 + $4 + ${EndIf} +!endif +!ifdef HAVE_NLS + ${If} ${SectionIsSelected} ${id_section_nls} + SectionGetSize ${id_section_nls} $4 + IntOp $3 $3 + $4 + ${EndIf} +!endif + + # Register EstimatedSize and AllowSilent. + # Other information will be set by the install.exe (dosinst.c). + ${If} ${RunningX64} + SetRegView 64 + ${EndIf} + WriteRegDWORD HKLM "${UNINST_REG_KEY_VIM}" "EstimatedSize" $3 + WriteRegDWORD HKLM "${UNINST_REG_KEY_VIM}" "AllowSilent" 1 + ${If} ${RunningX64} + SetRegView lastused + ${EndIf} + + # Store the selections to the registry. + ${If} ${RunningX64} + SetRegView 64 + ${EndIf} + !insertmacro SaveSectionSelection ${id_section_console} "select_console" + !insertmacro SaveSectionSelection ${id_section_batch} "select_batch" + !insertmacro SaveSectionSelection ${id_section_desktop} "select_desktop" + !insertmacro SaveSectionSelection ${id_section_startmenu} "select_startmenu" + !insertmacro SaveSectionSelection ${id_section_editwith} "select_editwith" + !insertmacro SaveSectionSelection ${id_section_vimrc} "select_vimrc" + !insertmacro SaveSectionSelection ${id_section_pluginhome} "select_pluginhome" + !insertmacro SaveSectionSelection ${id_section_pluginvim} "select_pluginvim" +!ifdef HAVE_VIS_VIM + !insertmacro SaveSectionSelection ${id_section_visvim} "select_visvim" +!endif +!ifdef HAVE_NLS + !insertmacro SaveSectionSelection ${id_section_nls} "select_nls" +!endif + ${If} ${RunningX64} + SetRegView lastused + ${EndIf} + BringToFront SectionEnd ########################################################## +!macro LoadSectionSelection section_id reg_value + ClearErrors + ReadRegDWORD $3 HKLM "${UNINST_REG_KEY_VIM}" ${reg_value} + ${IfNot} ${Errors} + ${If} $3 = 1 + !insertmacro SelectSection ${section_id} + ${Else} + !insertmacro UnselectSection ${section_id} + ${EndIf} + ${EndIf} +!macroend + +Function .onInit +!ifdef HAVE_MULTI_LANG + # Select a language (or read from the registry). + !insertmacro MUI_LANGDLL_DISPLAY +!endif + + # Check $VIM + ReadEnvStr $INSTDIR "VIM" + + call CheckOldVim + Pop $3 + ${If} $3 == "" + # No old versions of Vim found. Unselect and hide the section. + !insertmacro UnselectSection ${id_section_old_ver} + SectionSetInstTypes ${id_section_old_ver} 0 + SectionSetText ${id_section_old_ver} "" + ${Else} + ${If} $INSTDIR == "" + StrCpy $INSTDIR $3 + ${EndIf} + ${EndIf} + + # If did not find a path: use the default dir. + ${If} $INSTDIR == "" +!ifdef WIN64 + StrCpy $INSTDIR "$PROGRAMFILES64\Vim" +!else + StrCpy $INSTDIR "$PROGRAMFILES\Vim" +!endif + ${EndIf} + +# Load the selections from the registry (if any). + ${If} ${RunningX64} + SetRegView 64 + ${EndIf} + !insertmacro LoadSectionSelection ${id_section_console} "select_console" + !insertmacro LoadSectionSelection ${id_section_batch} "select_batch" + !insertmacro LoadSectionSelection ${id_section_desktop} "select_desktop" + !insertmacro LoadSectionSelection ${id_section_startmenu} "select_startmenu" + !insertmacro LoadSectionSelection ${id_section_editwith} "select_editwith" + !insertmacro LoadSectionSelection ${id_section_vimrc} "select_vimrc" + !insertmacro LoadSectionSelection ${id_section_pluginhome} "select_pluginhome" + !insertmacro LoadSectionSelection ${id_section_pluginvim} "select_pluginvim" +!ifdef HAVE_VIS_VIM + !insertmacro LoadSectionSelection ${id_section_visvim} "select_visvim" +!endif +!ifdef HAVE_NLS + !insertmacro LoadSectionSelection ${id_section_nls} "select_nls" +!endif + ${If} ${RunningX64} + SetRegView lastused + ${EndIf} + + # User variables: + # $0 - holds the directory the executables are installed to + # $1 - holds the parameters to be passed to install.exe. Starts with OLE + # registration (since a non-OLE gvim will not complain, and we want to + # always register an OLE gvim). + # $2 - holds the names to create batch files for + StrCpy $0 "$INSTDIR\vim${VER_MAJOR}${VER_MINOR}" + StrCpy $1 "-register-OLE" + StrCpy $2 "gvim evim gview gvimdiff vimtutor" +FunctionEnd + +Function .onInstSuccess + WriteUninstaller vim${VER_MAJOR}${VER_MINOR}\uninstall-gui.exe +FunctionEnd + +Function .onInstFailed + MessageBox MB_OK|MB_ICONEXCLAMATION "$(str_msg_install_fail)" /SD IDOK +FunctionEnd + +########################################################## Function SetCustom - # Display the InstallOptions dialog + # Display the _vimrc setting dialog using nsDialogs. # Check if a _vimrc should be created - SectionGetFlags ${sec_vimrc_id} $3 - IntOp $3 $3 & 1 - StrCmp $3 "1" +2 0 + ${IfNot} ${SectionIsSelected} ${id_section_vimrc} + Abort + ${EndIf} + + !insertmacro MUI_HEADER_TEXT \ + $(str_vimrc_page_title) $(str_vimrc_page_subtitle) + + nsDialogs::Create 1018 + Pop $vim_dialog + + ${If} $vim_dialog == error Abort + ${EndIf} + + ${If} ${RunningX64} + SetRegView 64 + ${EndIf} + + GetFunctionAddress $3 ValidateCustom + nsDialogs::OnBack $3 + + + # 1st group - Compatibility + ${NSD_CreateGroupBox} 0 0 100% 32% $(str_msg_compat_title) + Pop $3 + + ${NSD_CreateLabel} 5% 10% 35% 8% $(str_msg_compat_desc) + Pop $3 + ${NSD_CreateDropList} 18% 19% 75% 8% "" + Pop $vim_nsd_compat + ${NSD_CB_AddString} $vim_nsd_compat $(str_msg_compat_vi) + ${NSD_CB_AddString} $vim_nsd_compat $(str_msg_compat_vim) + ${NSD_CB_AddString} $vim_nsd_compat $(str_msg_compat_defaults) + ${NSD_CB_AddString} $vim_nsd_compat $(str_msg_compat_all) + + # Default selection + ${If} $vim_compat_stat == "" + ReadRegStr $3 HKLM "${UNINST_REG_KEY_VIM}" "vim_compat" + ${Else} + StrCpy $3 $vim_compat_stat + ${EndIf} + ${If} $3 == "defaults" + StrCpy $4 2 + ${ElseIf} $3 == "vim" + StrCpy $4 1 + ${ElseIf} $3 == "vi" + StrCpy $4 0 + ${Else} # default + StrCpy $4 3 + ${EndIf} + ${NSD_CB_SetSelectionIndex} $vim_nsd_compat $4 + + + # 2nd group - Key remapping + ${NSD_CreateGroupBox} 0 35% 100% 31% $(str_msg_keymap_title) + Pop $3 + + ${NSD_CreateLabel} 5% 45% 90% 8% $(str_msg_keymap_desc) + Pop $3 + ${NSD_CreateDropList} 38% 54% 55% 8% "" + Pop $vim_nsd_keymap + ${NSD_CB_AddString} $vim_nsd_keymap $(str_msg_keymap_default) + ${NSD_CB_AddString} $vim_nsd_keymap $(str_msg_keymap_windows) + + # Default selection + ${If} $vim_keymap_stat == "" + ReadRegStr $3 HKLM "${UNINST_REG_KEY_VIM}" "vim_keyremap" + ${Else} + StrCpy $3 $vim_keymap_stat + ${EndIf} + ${If} $3 == "windows" + StrCpy $4 1 + ${Else} # default + StrCpy $4 0 + ${EndIf} + ${NSD_CB_SetSelectionIndex} $vim_nsd_keymap $4 + - InstallOptions::dialog "$PLUGINSDIR\vimrc.ini" + # 3rd group - Mouse behavior + ${NSD_CreateGroupBox} 0 69% 100% 31% $(str_msg_mouse_title) Pop $3 + + ${NSD_CreateLabel} 5% 79% 90% 8% $(str_msg_mouse_desc) + Pop $3 + ${NSD_CreateDropList} 23% 87% 70% 8% "" + Pop $vim_nsd_mouse + ${NSD_CB_AddString} $vim_nsd_mouse $(str_msg_mouse_default) + ${NSD_CB_AddString} $vim_nsd_mouse $(str_msg_mouse_windows) + ${NSD_CB_AddString} $vim_nsd_mouse $(str_msg_mouse_unix) + + # Default selection + ${If} $vim_mouse_stat == "" + ReadRegStr $3 HKLM "${UNINST_REG_KEY_VIM}" "vim_mouse" + ${Else} + StrCpy $3 $vim_mouse_stat + ${EndIf} + ${If} $3 == "xterm" + StrCpy $4 2 + ${ElseIf} $3 == "windows" + StrCpy $4 1 + ${Else} # default + StrCpy $4 0 + ${EndIf} + ${NSD_CB_SetSelectionIndex} $vim_nsd_mouse $4 + + ${If} ${RunningX64} + SetRegView lastused + ${EndIf} + + nsDialogs::Show FunctionEnd Function ValidateCustom - ReadINIStr $3 "$PLUGINSDIR\vimrc.ini" "Field 2" "State" - StrCmp $3 "1" 0 +3 |