# NSIS file to create a self-installing exe for Vim.
# It requires NSIS version 3.0 or later.
# Last Change: 2024 Mar 20
Unicode true
# WARNING: if you make changes to this script, look out for $0 to be valid,
# because uninstall deletes most files in $0.
# Location of gvim_ole.exe, vimw32.exe, GvimExt/*, etc.
!ifndef VIMSRC
!define VIMSRC "..\src"
!endif
# Location of runtime files
!ifndef VIMRT
!define VIMRT ".."
!endif
# Location of extra tools: diff.exe, winpty{32|64}.dll, winpty-agent.exe, etc.
!ifndef VIMTOOLS
!define VIMTOOLS ..\..
!endif
# Location of gettext.
# It must contain two directories: gettext32 and gettext64.
# See README.txt for detail.
!ifndef GETTEXT
!define GETTEXT ${VIMRT}
!endif
# If you have UPX, use the switch /DHAVE_UPX=1 on the command line makensis.exe.
# This property will be set to 1. Get it at https://upx.github.io/
!ifndef HAVE_UPX
!define HAVE_UPX 0
!endif
# If you do not want to add Native Language Support, use the switch /DHAVE_NLS=0
# in the command line makensis.exe. This property will be set to 0.
!ifndef HAVE_NLS
!define HAVE_NLS 1
!endif
# To create an English-only the installer, use the switch /DHAVE_MULTI_LANG=0 on
# the command line makensis.exe. This property will be set to 0.
!ifndef HAVE_MULTI_LANG
!define HAVE_MULTI_LANG 1
!endif
# if you want to create a 64-bit the installer, use the switch /DWIN64=1 on
# the command line makensis.exe. This property will be set to 1.
!ifndef WIN64
!define WIN64 0
!endif
!include gvim_version.nsh # for version number
# Definition of Patch for Vim.
!ifndef PATCHLEVEL
!define PATCHLEVEL 0
!endif
# ----------- No configurable settings below this line -----------
!include "Library.nsh" # for DLL install
!include "LogicLib.nsh"
!include "MUI2.nsh"
!include "nsDialogs.nsh"
!include "Sections.nsh"
!include "x64.nsh"
# See https://nsis.sourceforge.io/LogicLib
;FileExists is already part of LogicLib, but returns true for directories
;as well as files
!macro _FileExists2 _a _b _t _f
!insertmacro _LOGICLIB_TEMP
StrCpy $_LOGICLIB_TEMP "0"
;if path is not blank, continue to next check
StrCmp `${_b}` `` +4 0
;if path exists, continue to next check (IfFileExists returns true if this
;is a directory)
IfFileExists `${_b}` `0` +3
;if path is not a directory, continue to confirm exists
IfFileExists `${_b}\*.*` +2 0
StrCpy $_LOGICLIB_TEMP "1" ;file exists
;now we have a definitive value - the file exists or it does not
StrCmp $_LOGICLIB_TEMP "1" `${_t}` `${_f}`
!macroend
!undef FileExists
!define FileExists `"" FileExists2`
!macro _DirExists _a _b _t _f
!insertmacro _LOGICLIB_TEMP
StrCpy $_LOGICLIB_TEMP "0"
;if path is not blank, continue to next check
StrCmp `${_b}` `` +3 0
;if directory exists, continue to confirm exists
IfFileExists `${_b}\*.*` 0 +2
StrCpy $_LOGICLIB_TEMP "1"
StrCmp $_LOGICLIB_TEMP "1" `${_t}` `${_f}`
!macroend
!define DirExists `"" DirExists`
!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}"
!if ${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
!if ${HAVE_UPX}
!packhdr temp.dat "upx --best --compress-icons=1 temp.dat"
!endif
!if ${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
# Always show dialog choice language
#!define MUI_LANGDLL_ALWAYSSHOW
!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