changeset 34630:250793f9b574

NSIS: Update nsis installer and nsis docs (#14256) Commit: https://github.com/vim/vim/commit/51c94b650632f17f23efba1de928442d3e859b7d Author: Restorer <69863286+RestorerZ@users.noreply.github.com> Date: Sun Mar 24 09:41:18 2024 +0000 NSIS: Update nsis installer and nsis docs (https://github.com/vim/vim/issues/14256) Signed-off-by: RestorerZ <restorer@mail2k.ru> Signed-off-by: Christian Brabandt <cb@256bit.org>
author Christian Brabandt <cb@256bit.org>
date Sun, 24 Mar 2024 10:45:03 +0100
parents 80a9b43d299b
children 255155503142
files nsis/README.txt nsis/gvim.nsi tools/rename.bat
diffstat 2 files changed, 83 insertions(+), 49 deletions(-) [+]
line wrap: on
line diff
--- a/nsis/README.txt
+++ b/nsis/README.txt
@@ -1,7 +1,7 @@
-This builds a one-click install for Vim for Win32 using the Nullsoft
+This builds a one-click install for Vim for MS Windows using the Nullsoft
 Installation System (NSIS), available at http://nsis.sourceforge.net/
 
-To build the installable .exe:
+To build the installable .exe file:
 
 1.  Unpack three archives:
 	PC sources
@@ -16,10 +16,9 @@ 2.  Go to the src directory and build:
 	install.exe,
 	uninstall.exe,
 	tee/tee.exe,
-	xxd/xxd.exe,
+	xxd/xxd.exe
 
-    Then execute tools/rename.bat to rename the executables. (mv command is
-    required.)
+    Then execute tools/rename.bat to rename the executables.
 
 3.  Go to the GvimExt directory and build gvimext.dll (or get it from a binary
     archive).  Both 64- and 32-bit versions are needed and should be placed
@@ -28,14 +27,22 @@ 3.  Go to the GvimExt directory and buil
 	32-bit: src/GvimExt/gvimext.dll
 
 4.  Get a "diff.exe" program.  If you skip this the built-in diff will always
-    be used (which is fine for most users).  If you do have your own
-    "diff.exe" put it in the "../.." directory (above the "vim91" directory,
-    it's the same for all Vim versions).
+    be used (which is fine for most users).
     You can find one in previous Vim versions or in this archive:
-	http://www.mossbayeng.com/~ron/vim/diffutils.tar.gz
+	https://www.mediafire.com/file/9edk4g3xvfgzby0/diff4Vim.zip/file
+    When will you have "diff.exe" put it in the "../.." directory (above the
+    "vim91" directory, it's the same for all Vim versions).  However, you can
+    specify another directory by passing /DVIMTOOLS=<dir> option to the
+    "makensis.exe" program via the command line.
 
-5.  Also put "winpty32.dll" and "winpty-agent.exe" in "../.." (above the "vim91"
-    directory).  This is required for the terminal window.
+5.  For the terminal window to work in Vim, the library winpty is required.
+    You can get it at the following url:
+	https://github.com/rprichard/winpty/releases/download/0.4.3/winpty-0.4.3-msvc2015.zip
+    For the 32-bit version, rename "winpty.dll" from ia32/bin to "winpty32.dll",
+    and for the 64-bit version — "winpty.dll" from x64/bin to "winpty64.dll".
+    Put the renamed file and "winpty-agent.exe" in "../.." (above the "vim91"
+    directory).  However, you can specify another directory by passing
+    /DVIMTOOLS=<dir> option to the "makensis.exe" program via the command line.
 
 6.  To use stronger encryption, add the Sodium library.  You can get it here:
 	https://github.com/jedisct1/libsodium/releases/download/1.0.19-RELEASE/libsodium-1.0.19-msvc.zip
@@ -43,10 +50,12 @@ 6.  To use stronger encryption, add the 
     path/to/libsodium/Win32/Release/v143/dynamic for the 32‐bit version or
     path/to/libsodium/X64/Release/v143/dynamic for the 64‐bit version in the
     "../.." directory (above the "vim91" directory, where "diff.exe" and
-    "winpty32.dll").
+    "winpty{32|64}.dll").
 
-7.  Do "make uganda.nsis.txt" in runtime/doc.  This requires sed, you may have
-    to do this on Unix.  Make sure the file is in DOS file format!
+7.  On MS Windows do "nmake.exe -f Make_mvc.mak uganda.nsis.txt" in runtime/doc.
+    On Unix-like system do "make runtime/doc/uganda.nsis.txt" in top directory
+    or "make uganda.nsis.txt" in runtime/doc, and be sure to convert the file
+    "uganda.nsis.txt" to DOS file format.
 
 8.  Get gettext and iconv DLLs from the following site:
 	https://github.com/mlocati/gettext-iconv-windows/releases
@@ -61,25 +70,39 @@ 8.  Get gettext and iconv DLLs from the 
 	    |	libiconv-2.dll
 	    |	libgcc_s_sjlj-1.dll
 	    |
-	    ` gettext64/
+	    + gettext64/
 		libintl-8.dll
 		libiconv-2.dll
 
-    The default <GETTEXT directory> is "..", however, you can change it by
-    passing /DGETTEXT=... option to the makensis command.
+    The default <GETTEXT directory> is "..", however, you can specify another
+    directory by passing /DGETTEXT=<dir> option to "makensis.exe" program via
+    the command line.
 
 
 Install NSIS if you didn't do that already.
-Also install UPX, if you want a compressed file.
-Download and include the ShellExecAsUser.dll Unicode version which can be
-sourced from: https://nsis.sourceforge.io/ShellExecAsUser_plug-in
+Download Unicode version the ShellExecAsUser plug-in for NSIS from:
+	https://nsis.sourceforge.io/ShellExecAsUser_plug-in
+and put ShellExecAsUser.dll to path\to\NSIS\Plugins\x86-unicode
 
 
 Unpack the images:
 	cd nsis
-	unzip icons.zip
+	unzip icons.zip or 7z x icons.zip (on Unix-like or MS Windows)
+	WinRar.exe x icons.zip (on MS Windows)
 
 Then build gvim.exe:
+	cd nsis
+	makensis.exe [options] gvim.nsi
 
-	cd nsis
-	makensis gvim.nsi
+Options (not mandatory):
+    /DVIMSRC=<dir>	— directory where location of gvim_ole.exe, vimw32.exe,
+			    GvimExt/*, etc.
+    /DVIMRT=<dir>	— directory where location of runtime files
+    /DVIMTOOLS=<dir>    — directory where location of extra tools: diff.exe,
+			    winpty{32|64}.dll, winpty-agent.exe, libsodium.dll
+    /DGETTEXT=<dir>     — directory where location of gettext libraries
+    /DHAVE_UPX=1	— additional compression of the installer.  UPX program
+			    must be installed.
+    /DHAVE_NLS=0	— do not add native language support
+    /DHAVE_MULTI_LANG=0 — to create an English-only the installer
+    /DWIN64=1		— to create a 64-bit the installer
--- a/nsis/gvim.nsi
+++ b/nsis/gvim.nsi
@@ -1,6 +1,6 @@
 # NSIS file to create a self-installing exe for Vim.
 # It requires NSIS version 3.0 or later.
-# Last Change:	2024 Mar 17
+# Last Change:	2024 Mar 18
 
 Unicode true
 
@@ -17,7 +17,7 @@ Unicode true
   !define VIMRT ".."
 !endif
 
-# Location of extra tools: diff.exe
+# Location of extra tools: diff.exe, winpty{32|64}.dll, winpty-agent.exe, etc.
 !ifndef VIMTOOLS
   !define VIMTOOLS ..\..
 !endif
@@ -29,29 +29,40 @@ Unicode true
   !define GETTEXT ${VIMRT}
 !endif
 
-# Comment the next line if you don't have UPX.
-# Get it at https://upx.github.io/
-!define HAVE_UPX
+# 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
 
-# Comment the next line if you do not want to add Native Language Support
-!define HAVE_NLS
+# 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
 
-# Comment the following line to create an English-only installer:
-!define HAVE_MULTI_LANG
-
-# Uncomment the next line if you want to create a 64-bit installer.
-#!define WIN64
+# 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
+# Definition of Patch for Vim.
 !ifndef PATCHLEVEL
   !define PATCHLEVEL 0
 !endif
 
 # ----------- No configurable settings below this line -----------
 
-!include "Library.nsh"		# For DLL install
+!include "Library.nsh"		# for DLL install
 !include "LogicLib.nsh"
 !include "MUI2.nsh"
 !include "nsDialogs.nsh"
@@ -93,7 +104,7 @@ Unicode true
 !define UNINST_REG_KEY	"Software\Microsoft\Windows\CurrentVersion\Uninstall"
 !define UNINST_REG_KEY_VIM  "${UNINST_REG_KEY}\${PRODUCT}"
 
-!ifdef WIN64
+!if ${WIN64}
 Name "${PRODUCT} (x64)"
 !else
 Name "${PRODUCT}"
@@ -106,11 +117,11 @@ ManifestDPIAware true
 SetDatablockOptimize on
 RequestExecutionLevel highest
 
-!ifdef HAVE_UPX
+!if ${HAVE_UPX}
   !packhdr temp.dat "upx --best --compress-icons=1 temp.dat"
 !endif
 
-!ifdef WIN64
+!if ${WIN64}
 !define BIT	64
 !else
 !define BIT	32
@@ -150,7 +161,7 @@ RequestExecutionLevel highest
 
 # This adds '\Vim' to the user choice automagically.  The actual value is
 # obtained below with CheckOldVim.
-!ifdef WIN64
+!if ${WIN64}
   !define DEFAULT_INSTDIR "$PROGRAMFILES64\Vim"
 !else
   !define DEFAULT_INSTDIR "$PROGRAMFILES\Vim"
@@ -194,7 +205,7 @@ Page custom SetCustom ValidateCustom
 !include "lang\english.nsi"
 
 # Include support for other languages:
-!ifdef HAVE_MULTI_LANG
+!if ${HAVE_MULTI_LANG}
     !include "lang\danish.nsi"
     !include "lang\dutch.nsi"
     !include "lang\german.nsi"
@@ -598,7 +609,7 @@ SectionGroup $(str_group_plugin) id_grou
 SectionGroupEnd
 
 ##########################################################
-!ifdef HAVE_NLS
+!if ${HAVE_NLS}
 Section "$(str_section_nls)" id_section_nls
 	SectionIn 1 3
 
@@ -688,7 +699,7 @@ Section -post
 	  SectionGetSize ${id_section_editwith} $4
 	  IntOp $3 $3 + $4
 	${EndIf}
-!ifdef HAVE_NLS
+!if ${HAVE_NLS}
 	${If} ${SectionIsSelected} ${id_section_nls}
 	  SectionGetSize ${id_section_nls} $4
 	  IntOp $3 $3 + $4
@@ -718,7 +729,7 @@ Section -post
 	!insertmacro SaveSectionSelection ${id_section_vimrc}      "select_vimrc"
 	!insertmacro SaveSectionSelection ${id_section_pluginhome} "select_pluginhome"
 	!insertmacro SaveSectionSelection ${id_section_pluginvim}  "select_pluginvim"
-!ifdef HAVE_NLS
+!if ${HAVE_NLS}
 	!insertmacro SaveSectionSelection ${id_section_nls}        "select_nls"
 !endif
 	${If} ${RunningX64}
@@ -751,7 +762,7 @@ SectionEnd
 !macroend
 
 Function .onInit
-!ifdef HAVE_MULTI_LANG
+!if ${HAVE_MULTI_LANG}
   # Select a language (or read from the registry).
   !insertmacro MUI_LANGDLL_DISPLAY
 !endif
@@ -789,7 +800,7 @@ Function .onInit
   !insertmacro LoadSectionSelection ${id_section_vimrc}      "select_vimrc"
   !insertmacro LoadSectionSelection ${id_section_pluginhome} "select_pluginhome"
   !insertmacro LoadSectionSelection ${id_section_pluginvim}  "select_pluginvim"
-!ifdef HAVE_NLS
+!if ${HAVE_NLS}
   !insertmacro LoadSectionSelection ${id_section_nls}        "select_nls"
 !endif
   # Load the default _vimrc settings from the registry (if any).
@@ -963,7 +974,7 @@ FunctionEnd
     !insertmacro MUI_DESCRIPTION_TEXT ${id_group_plugin}        $(str_desc_plugin)
     !insertmacro MUI_DESCRIPTION_TEXT ${id_section_pluginhome}  $(str_desc_plugin_home)
     !insertmacro MUI_DESCRIPTION_TEXT ${id_section_pluginvim}   $(str_desc_plugin_vim)
-!ifdef HAVE_NLS
+!if ${HAVE_NLS}
     !insertmacro MUI_DESCRIPTION_TEXT ${id_section_nls}         $(str_desc_nls)
 !endif
 !insertmacro MUI_FUNCTION_DESCRIPTION_END
@@ -973,7 +984,7 @@ FunctionEnd
 # Uninstaller Functions and Sections
 
 Function un.onInit
-!ifdef HAVE_MULTI_LANG
+!if ${HAVE_MULTI_LANG}
   # Get the language from the registry.
   !insertmacro MUI_UNGETLANGUAGE
 !endif
old mode 100644
new mode 100755