Mercurial > vim
annotate nsis/gvim.nsi @ 6973:7b35ee02b3c5 v7.4.804
patch 7.4.804
Problem: Xxd doesn't have a license notice.
Solution: Add license as indicated by Juergen.
author | Bram Moolenaar <bram@vim.org> |
---|---|
date | Tue, 04 Aug 2015 17:29:07 +0200 |
parents | edfa81ea1711 |
children | 357b7bd8d612 |
rev | line source |
---|---|
7 | 1 # NSIS file to create a self-installing exe for Vim. |
2 # It requires NSIS version 2.0 or later. | |
6343 | 3 # Last Change: 2014 Nov 5 |
7 | 4 |
5 # WARNING: if you make changes to this script, look out for $0 to be valid, | |
6 # because uninstall deletes most files in $0. | |
7 | |
5128
3dafc80e781b
updated for version 7.3.1307
Bram Moolenaar <bram@vim.org>
parents:
2577
diff
changeset
|
8 # Location of gvim_ole.exe, vimw32.exe, GvimExt/*, etc. |
7 | 9 !define VIMSRC "..\src" |
10 | |
11 # Location of runtime files | |
12 !define VIMRT ".." | |
13 | |
14 # Location of extra tools: diff.exe | |
15 !define VIMTOOLS ..\.. | |
16 | |
17 # Comment the next line if you don't have UPX. | |
18 # Get it at http://upx.sourceforge.net | |
19 !define HAVE_UPX | |
20 | |
21 # comment the next line if you do not want to add Native Language Support | |
22 !define HAVE_NLS | |
23 | |
24 !define VER_MAJOR 7 | |
5294 | 25 !define VER_MINOR 4 |
7 | 26 |
27 # ----------- No configurable settings below this line ----------- | |
28 | |
29 !include UpgradeDLL.nsh # for VisVim.dll | |
2217
120502692d82
Improve the MS-Windows installer.
Bram Moolenaar <bram@vim.org>
parents:
2154
diff
changeset
|
30 !include LogicLib.nsh |
120502692d82
Improve the MS-Windows installer.
Bram Moolenaar <bram@vim.org>
parents:
2154
diff
changeset
|
31 !include x64.nsh |
7 | 32 |
33 Name "Vim ${VER_MAJOR}.${VER_MINOR}" | |
34 OutFile gvim${VER_MAJOR}${VER_MINOR}.exe | |
35 CRCCheck force | |
36 SetCompressor lzma | |
37 SetDatablockOptimize on | |
2217
120502692d82
Improve the MS-Windows installer.
Bram Moolenaar <bram@vim.org>
parents:
2154
diff
changeset
|
38 RequestExecutionLevel highest |
7 | 39 |
40 ComponentText "This will install Vim ${VER_MAJOR}.${VER_MINOR} on your computer." | |
6343 | 41 DirText "Choose a directory to install Vim (should contain 'vim')" |
7 | 42 Icon icons\vim_16c.ico |
5134
b49784c49d53
updated for version 7.3.1310
Bram Moolenaar <bram@vim.org>
parents:
5128
diff
changeset
|
43 # NSIS2 uses a different strategy with six different images in a strip... |
7 | 44 #EnabledBitmap icons\enabled.bmp |
45 #DisabledBitmap icons\disabled.bmp | |
46 UninstallText "This will uninstall Vim ${VER_MAJOR}.${VER_MINOR} from your system." | |
47 UninstallIcon icons\vim_uninst_16c.ico | |
48 | |
49 # On NSIS 2 using the BGGradient causes trouble on Windows 98, in combination | |
50 # with the BringToFront. | |
51 # BGGradient 004000 008200 FFFFFF | |
52 LicenseText "You should read the following before installing:" | |
53 LicenseData ${VIMRT}\doc\uganda.nsis.txt | |
54 | |
55 !ifdef HAVE_UPX | |
56 !packhdr temp.dat "upx --best --compress-icons=1 temp.dat" | |
57 !endif | |
58 | |
5134
b49784c49d53
updated for version 7.3.1310
Bram Moolenaar <bram@vim.org>
parents:
5128
diff
changeset
|
59 SetCompressor /SOLID lzma |
b49784c49d53
updated for version 7.3.1310
Bram Moolenaar <bram@vim.org>
parents:
5128
diff
changeset
|
60 XPStyle on |
b49784c49d53
updated for version 7.3.1310
Bram Moolenaar <bram@vim.org>
parents:
5128
diff
changeset
|
61 |
7 | 62 # This adds '\vim' to the user choice automagically. The actual value is |
63 # obtained below with ReadINIStr. | |
64 InstallDir "$PROGRAMFILES\Vim" | |
65 | |
66 # Types of installs we can perform: | |
67 InstType Typical | |
68 InstType Minimal | |
69 InstType Full | |
70 | |
71 SilentInstall normal | |
72 | |
73 # These are the pages we use | |
74 Page license | |
75 Page components | |
76 Page directory "" "" CheckInstallDir | |
77 Page instfiles | |
78 UninstPage uninstConfirm | |
79 UninstPage instfiles | |
80 | |
81 ########################################################## | |
82 # Functions | |
83 | |
84 Function .onInit | |
85 MessageBox MB_YESNO|MB_ICONQUESTION \ | |
86 "This will install Vim ${VER_MAJOR}.${VER_MINOR} on your computer.$\n Continue?" \ | |
87 IDYES NoAbort | |
88 Abort ; causes installer to quit. | |
89 NoAbort: | |
90 | |
91 # run the install program to check for already installed versions | |
92 SetOutPath $TEMP | |
93 File /oname=install.exe ${VIMSRC}\installw32.exe | |
94 ExecWait "$TEMP\install.exe -uninstall-check" | |
95 Delete $TEMP\install.exe | |
96 | |
97 # We may have been put to the background when uninstall did something. | |
98 BringToFront | |
99 | |
100 # Install will have created a file for us that contains the directory where | |
101 # we should install. This is $VIM if it's set. This appears to be the only | |
102 # way to get the value of $VIM here!? | |
103 ReadINIStr $INSTDIR $TEMP\vimini.ini vimini dir | |
104 Delete $TEMP\vimini.ini | |
105 | |
106 # If ReadINIStr failed or did not find a path: use the default dir. | |
107 StrCmp $INSTDIR "" 0 IniOK | |
108 StrCpy $INSTDIR "$PROGRAMFILES\Vim" | |
109 IniOK: | |
110 | |
111 # Should check for the value of $VIM and use it. Unfortunately I don't know | |
112 # how to obtain the value of $VIM | |
113 # IfFileExists "$VIM" 0 No_Vim | |
114 # StrCpy $INSTDIR "$VIM" | |
115 # No_Vim: | |
116 | |
117 # User variables: | |
118 # $0 - holds the directory the executables are installed to | |
119 # $1 - holds the parameters to be passed to install.exe. Starts with OLE | |
120 # registration (since a non-OLE gvim will not complain, and we want to | |
121 # always register an OLE gvim). | |
122 # $2 - holds the names to create batch files for | |
123 StrCpy $0 "$INSTDIR\vim${VER_MAJOR}${VER_MINOR}" | |
124 StrCpy $1 "-register-OLE" | |
801 | 125 StrCpy $2 "gvim evim gview gvimdiff vimtutor" |
7 | 126 |
127 FunctionEnd | |
128 | |
129 Function .onUserAbort | |
130 MessageBox MB_YESNO|MB_ICONQUESTION "Abort install?" IDYES NoCancelAbort | |
131 Abort ; causes installer to not quit. | |
132 NoCancelAbort: | |
133 FunctionEnd | |
134 | |
135 # We only accept the directory if it ends in "vim". Using .onVerifyInstDir has | |
136 # the disadvantage that the browse dialog is difficult to use. | |
137 Function CheckInstallDir | |
138 FunctionEnd | |
139 | |
140 Function .onInstSuccess | |
141 WriteUninstaller vim${VER_MAJOR}${VER_MINOR}\uninstall-gui.exe | |
142 MessageBox MB_YESNO|MB_ICONQUESTION \ | |
1618 | 143 "The installation process has been successful. Happy Vimming! \ |
7 | 144 $\n$\n Do you want to see the README file now?" IDNO NoReadme |
145 Exec '$0\gvim.exe -R "$0\README.txt"' | |
146 NoReadme: | |
147 FunctionEnd | |
148 | |
149 Function .onInstFailed | |
150 MessageBox MB_OK|MB_ICONEXCLAMATION "Installation failed. Better luck next time." | |
151 FunctionEnd | |
152 | |
153 Function un.onUnInstSuccess | |
154 MessageBox MB_OK|MB_ICONINFORMATION \ | |
155 "Vim ${VER_MAJOR}.${VER_MINOR} has been (partly) removed from your system" | |
156 FunctionEnd | |
157 | |
158 Function un.GetParent | |
159 Exch $0 ; old $0 is on top of stack | |
160 Push $1 | |
161 Push $2 | |
162 StrCpy $1 -1 | |
163 loop: | |
164 StrCpy $2 $0 1 $1 | |
165 StrCmp $2 "" exit | |
166 StrCmp $2 "\" exit | |
167 IntOp $1 $1 - 1 | |
168 Goto loop | |
169 exit: | |
170 StrCpy $0 $0 $1 | |
171 Pop $2 | |
172 Pop $1 | |
173 Exch $0 ; put $0 on top of stack, restore $0 to original value | |
174 FunctionEnd | |
175 | |
176 ########################################################## | |
177 Section "Vim executables and runtime files" | |
178 SectionIn 1 2 3 | |
179 | |
180 # we need also this here if the user changes the instdir | |
181 StrCpy $0 "$INSTDIR\vim${VER_MAJOR}${VER_MINOR}" | |
182 | |
183 SetOutPath $0 | |
184 File /oname=gvim.exe ${VIMSRC}\gvim_ole.exe | |
185 File /oname=install.exe ${VIMSRC}\installw32.exe | |
186 File /oname=uninstal.exe ${VIMSRC}\uninstalw32.exe | |
187 File ${VIMSRC}\vimrun.exe | |
188 File /oname=xxd.exe ${VIMSRC}\xxdw32.exe | |
189 File ${VIMTOOLS}\diff.exe | |
190 File ${VIMRT}\vimtutor.bat | |
191 File ${VIMRT}\README.txt | |
192 File ..\uninstal.txt | |
193 File ${VIMRT}\*.vim | |
194 File ${VIMRT}\rgb.txt | |
195 | |
196 SetOutPath $0\colors | |
197 File ${VIMRT}\colors\*.* | |
198 | |
199 SetOutPath $0\compiler | |
200 File ${VIMRT}\compiler\*.* | |
201 | |
202 SetOutPath $0\doc | |
203 File ${VIMRT}\doc\*.txt | |
204 File ${VIMRT}\doc\tags | |
205 | |
206 SetOutPath $0\ftplugin | |
207 File ${VIMRT}\ftplugin\*.* | |
208 | |
209 SetOutPath $0\indent | |
210 File ${VIMRT}\indent\*.* | |
211 | |
212 SetOutPath $0\macros | |
213 File ${VIMRT}\macros\*.* | |
214 | |
215 SetOutPath $0\plugin | |
216 File ${VIMRT}\plugin\*.* | |
217 | |
801 | 218 SetOutPath $0\autoload |
219 File ${VIMRT}\autoload\*.* | |
220 | |
827 | 221 SetOutPath $0\autoload\xml |
222 File ${VIMRT}\autoload\xml\*.* | |
223 | |
7 | 224 SetOutPath $0\syntax |
225 File ${VIMRT}\syntax\*.* | |
226 | |
799 | 227 SetOutPath $0\spell |
228 File ${VIMRT}\spell\*.txt | |
229 File ${VIMRT}\spell\*.vim | |
230 File ${VIMRT}\spell\*.spl | |
231 File ${VIMRT}\spell\*.sug | |
232 | |
7 | 233 SetOutPath $0\tools |
234 File ${VIMRT}\tools\*.* | |
235 | |
236 SetOutPath $0\tutor | |
237 File ${VIMRT}\tutor\*.* | |
238 SectionEnd | |
239 | |
240 ########################################################## | |
241 Section "Vim console program (vim.exe)" | |
242 SectionIn 1 3 | |
243 | |
244 SetOutPath $0 | |
245 ReadRegStr $R0 HKLM \ | |
246 "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion | |
247 IfErrors 0 lbl_winnt | |
5128
3dafc80e781b
updated for version 7.3.1307
Bram Moolenaar <bram@vim.org>
parents:
2577
diff
changeset
|
248 # Windows 95/98/ME: not supported |
7 | 249 Goto lbl_done |
250 lbl_winnt: | |
5134
b49784c49d53
updated for version 7.3.1310
Bram Moolenaar <bram@vim.org>
parents:
5128
diff
changeset
|
251 # Windows NT/2000/XP and later |
7 | 252 File /oname=vim.exe ${VIMSRC}\vimw32.exe |
253 lbl_done: | |
254 StrCpy $2 "$2 vim view vimdiff" | |
255 SectionEnd | |
256 | |
257 ########################################################## | |
258 Section "Create .bat files for command line use" | |
259 SectionIn 3 | |
260 | |
261 StrCpy $1 "$1 -create-batfiles $2" | |
262 SectionEnd | |
263 | |
264 ########################################################## | |
265 Section "Create icons on the Desktop" | |
266 SectionIn 1 3 | |
267 | |
268 StrCpy $1 "$1 -install-icons" | |
269 SectionEnd | |
270 | |
271 ########################################################## | |
272 Section "Add Vim to the Start Menu" | |
273 SectionIn 1 3 | |
274 | |
275 StrCpy $1 "$1 -add-start-menu" | |
276 SectionEnd | |
277 | |
278 ########################################################## | |
279 Section "Add an Edit-with-Vim context menu entry" | |
280 SectionIn 1 3 | |
281 | |
282 # Be aware of this sequence of events: | |
283 # - user uninstalls Vim, gvimext.dll can't be removed (it's in use) and | |
284 # is scheduled to be removed at next reboot. | |
285 # - user installs Vim in same directory, gvimext.dll still exists. | |
286 # If we now skip installing gvimext.dll, it will disappear at the next | |
287 # reboot. Thus when copying gvimext.dll fails always schedule it to be | |
288 # installed at the next reboot. Can't use UpgradeDLL! | |
289 # We don't ask the user to reboot, the old dll will keep on working. | |
290 SetOutPath $0 | |
291 ClearErrors | |
292 SetOverwrite try | |
2217
120502692d82
Improve the MS-Windows installer.
Bram Moolenaar <bram@vim.org>
parents:
2154
diff
changeset
|
293 ${If} ${RunningX64} |
120502692d82
Improve the MS-Windows installer.
Bram Moolenaar <bram@vim.org>
parents:
2154
diff
changeset
|
294 File /oname=gvimext.dll ${VIMSRC}\GvimExt\gvimext64.dll |
120502692d82
Improve the MS-Windows installer.
Bram Moolenaar <bram@vim.org>
parents:
2154
diff
changeset
|
295 ${Else} |
120502692d82
Improve the MS-Windows installer.
Bram Moolenaar <bram@vim.org>
parents:
2154
diff
changeset
|
296 File /oname=gvimext.dll ${VIMSRC}\GvimExt\gvimext.dll |
120502692d82
Improve the MS-Windows installer.
Bram Moolenaar <bram@vim.org>
parents:
2154
diff
changeset
|
297 ${EndIf} |
7 | 298 IfErrors 0 GvimExtDone |
299 | |
300 # Can't copy gvimext.dll, create it under another name and rename it on | |
301 # next reboot. | |
302 GetTempFileName $3 $0 | |
2217
120502692d82
Improve the MS-Windows installer.
Bram Moolenaar <bram@vim.org>
parents:
2154
diff
changeset
|
303 ${If} ${RunningX64} |
120502692d82
Improve the MS-Windows installer.
Bram Moolenaar <bram@vim.org>
parents:
2154
diff
changeset
|
304 File /oname=$3 ${VIMSRC}\GvimExt\gvimext64.dll |
120502692d82
Improve the MS-Windows installer.
Bram Moolenaar <bram@vim.org>
parents:
2154
diff
changeset
|
305 ${Else} |
120502692d82
Improve the MS-Windows installer.
Bram Moolenaar <bram@vim.org>
parents:
2154
diff
changeset
|
306 File /oname=$3 ${VIMSRC}\GvimExt\gvimext.dll |
120502692d82
Improve the MS-Windows installer.
Bram Moolenaar <bram@vim.org>
parents:
2154
diff
changeset
|
307 ${EndIf} |
7 | 308 Rename /REBOOTOK $3 $0\gvimext.dll |
309 | |
310 GvimExtDone: | |
311 SetOverwrite lastused | |
312 | |
313 # We don't have a separate entry for the "Open With..." menu, assume | |
314 # the user wants either both or none. | |
315 StrCpy $1 "$1 -install-popup -install-openwith" | |
316 SectionEnd | |
317 | |
318 ########################################################## | |
319 Section "Create a _vimrc if it doesn't exist" | |
320 SectionIn 1 3 | |
321 | |
322 StrCpy $1 "$1 -create-vimrc" | |
323 SectionEnd | |
324 | |
325 ########################################################## | |
326 Section "Create plugin directories in HOME or VIM" | |
327 SectionIn 1 3 | |
328 | |
329 StrCpy $1 "$1 -create-directories home" | |
330 SectionEnd | |
331 | |
332 ########################################################## | |
333 Section "Create plugin directories in VIM" | |
334 SectionIn 3 | |
335 | |
336 StrCpy $1 "$1 -create-directories vim" | |
337 SectionEnd | |
338 | |
339 ########################################################## | |
340 Section "VisVim Extension for MS Visual Studio" | |
341 SectionIn 3 | |
342 | |
343 SetOutPath $0 | |
344 !insertmacro UpgradeDLL "${VIMSRC}\VisVim\VisVim.dll" "$0\VisVim.dll" "$0" | |
345 File ${VIMSRC}\VisVim\README_VisVim.txt | |
346 SectionEnd | |
347 | |
348 ########################################################## | |
349 !ifdef HAVE_NLS | |
350 Section "Native Language Support" | |
351 SectionIn 1 3 | |
352 | |
353 SetOutPath $0\lang | |
354 File /r ${VIMRT}\lang\*.* | |
355 SetOutPath $0\keymap | |
356 File ${VIMRT}\keymap\README.txt | |
357 File ${VIMRT}\keymap\*.vim | |
358 SetOutPath $0 | |
359 File ${VIMRT}\libintl.dll | |
360 SectionEnd | |
361 !endif | |
362 | |
363 ########################################################## | |
364 Section -call_install_exe | |
365 SetOutPath $0 | |
366 ExecWait "$0\install.exe $1" | |
367 SectionEnd | |
368 | |
369 ########################################################## | |
370 Section -post | |
371 BringToFront | |
372 SectionEnd | |
373 | |
374 ########################################################## | |
375 Section Uninstall | |
376 # Apparently $INSTDIR is set to the directory where the uninstaller is | |
377 # created. Thus the "vim61" directory is included in it. | |
378 StrCpy $0 "$INSTDIR" | |
379 | |
380 # If VisVim was installed, unregister the DLL. | |
381 IfFileExists "$0\VisVim.dll" Has_VisVim No_VisVim | |
382 Has_VisVim: | |
383 ExecWait "regsvr32.exe /u /s $0\VisVim.dll" | |
384 | |
385 No_VisVim: | |
386 | |
387 # delete the context menu entry and batch files | |
388 ExecWait "$0\uninstal.exe -nsis" | |
389 | |
390 # We may have been put to the background when uninstall did something. | |
391 BringToFront | |
392 | |
393 # ask the user if the Vim version dir must be removed | |
394 MessageBox MB_YESNO|MB_ICONQUESTION \ | |
395 "Would you like to delete $0?$\n \ | |
396 $\nIt contains the Vim executables and runtime files." IDNO NoRemoveExes | |
397 | |
398 Delete /REBOOTOK $0\*.dll | |
399 ClearErrors | |
400 # Remove everything but *.dll files. Avoids that | |
401 # a lot remains when gvimext.dll cannot be deleted. | |
879 | 402 RMDir /r $0\autoload |
7 | 403 RMDir /r $0\colors |
404 RMDir /r $0\compiler | |
405 RMDir /r $0\doc | |
406 RMDir /r $0\ftplugin | |
407 RMDir /r $0\indent | |
408 RMDir /r $0\macros | |
409 RMDir /r $0\plugin | |
879 | 410 RMDir /r $0\spell |
7 | 411 RMDir /r $0\syntax |
412 RMDir /r $0\tools | |
413 RMDir /r $0\tutor | |
414 RMDir /r $0\VisVim | |
415 RMDir /r $0\lang | |
416 RMDir /r $0\keymap | |
417 Delete $0\*.exe | |
418 Delete $0\*.bat | |
419 Delete $0\*.vim | |
420 Delete $0\*.txt | |
421 | |
422 IfErrors ErrorMess NoErrorMess | |
423 ErrorMess: | |
424 MessageBox MB_OK|MB_ICONEXCLAMATION \ | |
425 "Some files in $0 have not been deleted!$\nYou must do it manually." | |
426 NoErrorMess: | |
427 | |
428 # No error message if the "vim62" directory can't be removed, the | |
429 # gvimext.dll may still be there. | |
430 RMDir $0 | |
431 | |
432 NoRemoveExes: | |
433 # get the parent dir of the installation | |
434 Push $INSTDIR | |
435 Call un.GetParent | |
436 Pop $0 | |
437 StrCpy $1 $0 | |
438 | |
439 # if a plugin dir was created at installation ask the user to remove it | |
440 # first look in the root of the installation then in HOME | |
441 IfFileExists $1\vimfiles AskRemove 0 | |
442 ReadEnvStr $1 "HOME" | |
443 StrCmp $1 "" NoRemove 0 | |
444 | |
445 IfFileExists $1\vimfiles 0 NoRemove | |
446 | |
447 AskRemove: | |
448 MessageBox MB_YESNO|MB_ICONQUESTION \ | |
2468
7f578da7edb2
Update version.h for 7.3c -> 7.3d.
Bram Moolenaar <bram@vim.org>
parents:
2465
diff
changeset
|
449 "Remove all files in your $1\vimfiles directory?$\n \ |
2449
943280505f72
Fix that uninstaller isn't found on 64-bit Windows.
Bram Moolenaar <bram@vim.org>
parents:
2439
diff
changeset
|
450 $\nCAREFUL: If you have created something there that you want to keep, click No" IDNO Fin |
7 | 451 RMDir /r $1\vimfiles |
452 NoRemove: | |
453 | |
454 # ask the user if the Vim root dir must be removed | |
455 MessageBox MB_YESNO|MB_ICONQUESTION \ | |
456 "Would you like to remove $0?$\n \ | |
457 $\nIt contains your Vim configuration files!" IDNO NoDelete | |
458 RMDir /r $0 ; skipped if no | |
459 NoDelete: | |
460 | |
461 Fin: | |
462 Call un.onUnInstSuccess | |
463 | |
464 SectionEnd |