Mercurial > vim
annotate nsis/gvim.nsi @ 5729:b5cc3a0729b1
Added tag v7-4-209 for changeset bb402c49379d
author | Bram Moolenaar <bram@vim.org> |
---|---|
date | Wed, 19 Mar 2014 17:41:24 +0100 |
parents | 359743c1f59a |
children | edfa81ea1711 |
rev | line source |
---|---|
7 | 1 # NSIS file to create a self-installing exe for Vim. |
2 # It requires NSIS version 2.0 or later. | |
2439 | 3 # Last Change: 2010 Jul 30 |
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." | |
41 DirText "Choose a directory to install Vim (must end in 'vim')" | |
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 StrCpy $0 $INSTDIR 3 -3 | |
139 StrCmp $0 "vim" PathGood | |
140 MessageBox MB_OK "The path must end in 'vim'." | |
141 Abort | |
142 PathGood: | |
143 FunctionEnd | |
144 | |
145 Function .onInstSuccess | |
146 WriteUninstaller vim${VER_MAJOR}${VER_MINOR}\uninstall-gui.exe | |
147 MessageBox MB_YESNO|MB_ICONQUESTION \ | |
1618 | 148 "The installation process has been successful. Happy Vimming! \ |
7 | 149 $\n$\n Do you want to see the README file now?" IDNO NoReadme |
150 Exec '$0\gvim.exe -R "$0\README.txt"' | |
151 NoReadme: | |
152 FunctionEnd | |
153 | |
154 Function .onInstFailed | |
155 MessageBox MB_OK|MB_ICONEXCLAMATION "Installation failed. Better luck next time." | |
156 FunctionEnd | |
157 | |
158 Function un.onUnInstSuccess | |
159 MessageBox MB_OK|MB_ICONINFORMATION \ | |
160 "Vim ${VER_MAJOR}.${VER_MINOR} has been (partly) removed from your system" | |
161 FunctionEnd | |
162 | |
163 Function un.GetParent | |
164 Exch $0 ; old $0 is on top of stack | |
165 Push $1 | |
166 Push $2 | |
167 StrCpy $1 -1 | |
168 loop: | |
169 StrCpy $2 $0 1 $1 | |
170 StrCmp $2 "" exit | |
171 StrCmp $2 "\" exit | |
172 IntOp $1 $1 - 1 | |
173 Goto loop | |
174 exit: | |
175 StrCpy $0 $0 $1 | |
176 Pop $2 | |
177 Pop $1 | |
178 Exch $0 ; put $0 on top of stack, restore $0 to original value | |
179 FunctionEnd | |
180 | |
181 ########################################################## | |
182 Section "Vim executables and runtime files" | |
183 SectionIn 1 2 3 | |
184 | |
185 # we need also this here if the user changes the instdir | |
186 StrCpy $0 "$INSTDIR\vim${VER_MAJOR}${VER_MINOR}" | |
187 | |
188 SetOutPath $0 | |
189 File /oname=gvim.exe ${VIMSRC}\gvim_ole.exe | |
190 File /oname=install.exe ${VIMSRC}\installw32.exe | |
191 File /oname=uninstal.exe ${VIMSRC}\uninstalw32.exe | |
192 File ${VIMSRC}\vimrun.exe | |
193 File /oname=xxd.exe ${VIMSRC}\xxdw32.exe | |
194 File ${VIMTOOLS}\diff.exe | |
195 File ${VIMRT}\vimtutor.bat | |
196 File ${VIMRT}\README.txt | |
197 File ..\uninstal.txt | |
198 File ${VIMRT}\*.vim | |
199 File ${VIMRT}\rgb.txt | |
200 | |
201 SetOutPath $0\colors | |
202 File ${VIMRT}\colors\*.* | |
203 | |
204 SetOutPath $0\compiler | |
205 File ${VIMRT}\compiler\*.* | |
206 | |
207 SetOutPath $0\doc | |
208 File ${VIMRT}\doc\*.txt | |
209 File ${VIMRT}\doc\tags | |
210 | |
211 SetOutPath $0\ftplugin | |
212 File ${VIMRT}\ftplugin\*.* | |
213 | |
214 SetOutPath $0\indent | |
215 File ${VIMRT}\indent\*.* | |
216 | |
217 SetOutPath $0\macros | |
218 File ${VIMRT}\macros\*.* | |
219 | |
220 SetOutPath $0\plugin | |
221 File ${VIMRT}\plugin\*.* | |
222 | |
801 | 223 SetOutPath $0\autoload |
224 File ${VIMRT}\autoload\*.* | |
225 | |
827 | 226 SetOutPath $0\autoload\xml |
227 File ${VIMRT}\autoload\xml\*.* | |
228 | |
7 | 229 SetOutPath $0\syntax |
230 File ${VIMRT}\syntax\*.* | |
231 | |
799 | 232 SetOutPath $0\spell |
233 File ${VIMRT}\spell\*.txt | |
234 File ${VIMRT}\spell\*.vim | |
235 File ${VIMRT}\spell\*.spl | |
236 File ${VIMRT}\spell\*.sug | |
237 | |
7 | 238 SetOutPath $0\tools |
239 File ${VIMRT}\tools\*.* | |
240 | |
241 SetOutPath $0\tutor | |
242 File ${VIMRT}\tutor\*.* | |
243 SectionEnd | |
244 | |
245 ########################################################## | |
246 Section "Vim console program (vim.exe)" | |
247 SectionIn 1 3 | |
248 | |
249 SetOutPath $0 | |
250 ReadRegStr $R0 HKLM \ | |
251 "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion | |
252 IfErrors 0 lbl_winnt | |
5128
3dafc80e781b
updated for version 7.3.1307
Bram Moolenaar <bram@vim.org>
parents:
2577
diff
changeset
|
253 # Windows 95/98/ME: not supported |
7 | 254 Goto lbl_done |
255 lbl_winnt: | |
5134
b49784c49d53
updated for version 7.3.1310
Bram Moolenaar <bram@vim.org>
parents:
5128
diff
changeset
|
256 # Windows NT/2000/XP and later |
7 | 257 File /oname=vim.exe ${VIMSRC}\vimw32.exe |
258 lbl_done: | |
259 StrCpy $2 "$2 vim view vimdiff" | |
260 SectionEnd | |
261 | |
262 ########################################################## | |
263 Section "Create .bat files for command line use" | |
264 SectionIn 3 | |
265 | |
266 StrCpy $1 "$1 -create-batfiles $2" | |
267 SectionEnd | |
268 | |
269 ########################################################## | |
270 Section "Create icons on the Desktop" | |
271 SectionIn 1 3 | |
272 | |
273 StrCpy $1 "$1 -install-icons" | |
274 SectionEnd | |
275 | |
276 ########################################################## | |
277 Section "Add Vim to the Start Menu" | |
278 SectionIn 1 3 | |
279 | |
280 StrCpy $1 "$1 -add-start-menu" | |
281 SectionEnd | |
282 | |
283 ########################################################## | |
284 Section "Add an Edit-with-Vim context menu entry" | |
285 SectionIn 1 3 | |
286 | |
287 # Be aware of this sequence of events: | |
288 # - user uninstalls Vim, gvimext.dll can't be removed (it's in use) and | |
289 # is scheduled to be removed at next reboot. | |
290 # - user installs Vim in same directory, gvimext.dll still exists. | |
291 # If we now skip installing gvimext.dll, it will disappear at the next | |
292 # reboot. Thus when copying gvimext.dll fails always schedule it to be | |
293 # installed at the next reboot. Can't use UpgradeDLL! | |
294 # We don't ask the user to reboot, the old dll will keep on working. | |
295 SetOutPath $0 | |
296 ClearErrors | |
297 SetOverwrite try | |
2217
120502692d82
Improve the MS-Windows installer.
Bram Moolenaar <bram@vim.org>
parents:
2154
diff
changeset
|
298 ${If} ${RunningX64} |
120502692d82
Improve the MS-Windows installer.
Bram Moolenaar <bram@vim.org>
parents:
2154
diff
changeset
|
299 File /oname=gvimext.dll ${VIMSRC}\GvimExt\gvimext64.dll |
120502692d82
Improve the MS-Windows installer.
Bram Moolenaar <bram@vim.org>
parents:
2154
diff
changeset
|
300 ${Else} |
120502692d82
Improve the MS-Windows installer.
Bram Moolenaar <bram@vim.org>
parents:
2154
diff
changeset
|
301 File /oname=gvimext.dll ${VIMSRC}\GvimExt\gvimext.dll |
120502692d82
Improve the MS-Windows installer.
Bram Moolenaar <bram@vim.org>
parents:
2154
diff
changeset
|
302 ${EndIf} |
7 | 303 IfErrors 0 GvimExtDone |
304 | |
305 # Can't copy gvimext.dll, create it under another name and rename it on | |
306 # next reboot. | |
307 GetTempFileName $3 $0 | |
2217
120502692d82
Improve the MS-Windows installer.
Bram Moolenaar <bram@vim.org>
parents:
2154
diff
changeset
|
308 ${If} ${RunningX64} |
120502692d82
Improve the MS-Windows installer.
Bram Moolenaar <bram@vim.org>
parents:
2154
diff
changeset
|
309 File /oname=$3 ${VIMSRC}\GvimExt\gvimext64.dll |
120502692d82
Improve the MS-Windows installer.
Bram Moolenaar <bram@vim.org>
parents:
2154
diff
changeset
|
310 ${Else} |
120502692d82
Improve the MS-Windows installer.
Bram Moolenaar <bram@vim.org>
parents:
2154
diff
changeset
|
311 File /oname=$3 ${VIMSRC}\GvimExt\gvimext.dll |
120502692d82
Improve the MS-Windows installer.
Bram Moolenaar <bram@vim.org>
parents:
2154
diff
changeset
|
312 ${EndIf} |
7 | 313 Rename /REBOOTOK $3 $0\gvimext.dll |
314 | |
315 GvimExtDone: | |
316 SetOverwrite lastused | |
317 | |
318 # We don't have a separate entry for the "Open With..." menu, assume | |
319 # the user wants either both or none. | |
320 StrCpy $1 "$1 -install-popup -install-openwith" | |
321 SectionEnd | |
322 | |
323 ########################################################## | |
324 Section "Create a _vimrc if it doesn't exist" | |
325 SectionIn 1 3 | |
326 | |
327 StrCpy $1 "$1 -create-vimrc" | |
328 SectionEnd | |
329 | |
330 ########################################################## | |
331 Section "Create plugin directories in HOME or VIM" | |
332 SectionIn 1 3 | |
333 | |
334 StrCpy $1 "$1 -create-directories home" | |
335 SectionEnd | |
336 | |
337 ########################################################## | |
338 Section "Create plugin directories in VIM" | |
339 SectionIn 3 | |
340 | |
341 StrCpy $1 "$1 -create-directories vim" | |
342 SectionEnd | |
343 | |
344 ########################################################## | |
345 Section "VisVim Extension for MS Visual Studio" | |
346 SectionIn 3 | |
347 | |
348 SetOutPath $0 | |
349 !insertmacro UpgradeDLL "${VIMSRC}\VisVim\VisVim.dll" "$0\VisVim.dll" "$0" | |
350 File ${VIMSRC}\VisVim\README_VisVim.txt | |
351 SectionEnd | |
352 | |
353 ########################################################## | |
354 !ifdef HAVE_NLS | |
355 Section "Native Language Support" | |
356 SectionIn 1 3 | |
357 | |
358 SetOutPath $0\lang | |
359 File /r ${VIMRT}\lang\*.* | |
360 SetOutPath $0\keymap | |
361 File ${VIMRT}\keymap\README.txt | |
362 File ${VIMRT}\keymap\*.vim | |
363 SetOutPath $0 | |
364 File ${VIMRT}\libintl.dll | |
365 SectionEnd | |
366 !endif | |
367 | |
368 ########################################################## | |
369 Section -call_install_exe | |
370 SetOutPath $0 | |
371 ExecWait "$0\install.exe $1" | |
372 SectionEnd | |
373 | |
374 ########################################################## | |
375 Section -post | |
376 BringToFront | |
377 SectionEnd | |
378 | |
379 ########################################################## | |
380 Section Uninstall | |
381 # Apparently $INSTDIR is set to the directory where the uninstaller is | |
382 # created. Thus the "vim61" directory is included in it. | |
383 StrCpy $0 "$INSTDIR" | |
384 | |
385 # If VisVim was installed, unregister the DLL. | |
386 IfFileExists "$0\VisVim.dll" Has_VisVim No_VisVim | |
387 Has_VisVim: | |
388 ExecWait "regsvr32.exe /u /s $0\VisVim.dll" | |
389 | |
390 No_VisVim: | |
391 | |
392 # delete the context menu entry and batch files | |
393 ExecWait "$0\uninstal.exe -nsis" | |
394 | |
395 # We may have been put to the background when uninstall did something. | |
396 BringToFront | |
397 | |
398 # ask the user if the Vim version dir must be removed | |
399 MessageBox MB_YESNO|MB_ICONQUESTION \ | |
400 "Would you like to delete $0?$\n \ | |
401 $\nIt contains the Vim executables and runtime files." IDNO NoRemoveExes | |
402 | |
403 Delete /REBOOTOK $0\*.dll | |
404 ClearErrors | |
405 # Remove everything but *.dll files. Avoids that | |
406 # a lot remains when gvimext.dll cannot be deleted. | |
879 | 407 RMDir /r $0\autoload |
7 | 408 RMDir /r $0\colors |
409 RMDir /r $0\compiler | |
410 RMDir /r $0\doc | |
411 RMDir /r $0\ftplugin | |
412 RMDir /r $0\indent | |
413 RMDir /r $0\macros | |
414 RMDir /r $0\plugin | |
879 | 415 RMDir /r $0\spell |
7 | 416 RMDir /r $0\syntax |
417 RMDir /r $0\tools | |
418 RMDir /r $0\tutor | |
419 RMDir /r $0\VisVim | |
420 RMDir /r $0\lang | |
421 RMDir /r $0\keymap | |
422 Delete $0\*.exe | |
423 Delete $0\*.bat | |
424 Delete $0\*.vim | |
425 Delete $0\*.txt | |
426 | |
427 IfErrors ErrorMess NoErrorMess | |
428 ErrorMess: | |
429 MessageBox MB_OK|MB_ICONEXCLAMATION \ | |
430 "Some files in $0 have not been deleted!$\nYou must do it manually." | |
431 NoErrorMess: | |
432 | |
433 # No error message if the "vim62" directory can't be removed, the | |
434 # gvimext.dll may still be there. | |
435 RMDir $0 | |
436 | |
437 NoRemoveExes: | |
438 # get the parent dir of the installation | |
439 Push $INSTDIR | |
440 Call un.GetParent | |
441 Pop $0 | |
442 StrCpy $1 $0 | |
443 | |
444 # if a plugin dir was created at installation ask the user to remove it | |
445 # first look in the root of the installation then in HOME | |
446 IfFileExists $1\vimfiles AskRemove 0 | |
447 ReadEnvStr $1 "HOME" | |
448 StrCmp $1 "" NoRemove 0 | |
449 | |
450 IfFileExists $1\vimfiles 0 NoRemove | |
451 | |
452 AskRemove: | |
453 MessageBox MB_YESNO|MB_ICONQUESTION \ | |
2468
7f578da7edb2
Update version.h for 7.3c -> 7.3d.
Bram Moolenaar <bram@vim.org>
parents:
2465
diff
changeset
|
454 "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
|
455 $\nCAREFUL: If you have created something there that you want to keep, click No" IDNO Fin |
7 | 456 RMDir /r $1\vimfiles |
457 NoRemove: | |
458 | |
459 # ask the user if the Vim root dir must be removed | |
460 MessageBox MB_YESNO|MB_ICONQUESTION \ | |
461 "Would you like to remove $0?$\n \ | |
462 $\nIt contains your Vim configuration files!" IDNO NoDelete | |
463 RMDir /r $0 ; skipped if no | |
464 NoDelete: | |
465 | |
466 Fin: | |
467 Call un.onUnInstSuccess | |
468 | |
469 SectionEnd |