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