Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1 | # NSIS file to create a self-installing exe for Vim. |
| 2 | # It requires NSIS version 2.0 or later. |
Bram Moolenaar | 0434482 | 2014-11-05 18:18:17 +0100 | [diff] [blame] | 3 | # Last Change: 2014 Nov 5 |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 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 | |
Bram Moolenaar | ba46075 | 2013-07-04 22:35:01 +0200 | [diff] [blame] | 8 | # Location of gvim_ole.exe, vimw32.exe, GvimExt/*, etc. |
Bram Moolenaar | 286eacd | 2016-01-16 18:05:50 +0100 | [diff] [blame] | 9 | !ifndef VIMSRC |
| 10 | !define VIMSRC "..\src" |
| 11 | !endif |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 12 | |
| 13 | # Location of runtime files |
Bram Moolenaar | 286eacd | 2016-01-16 18:05:50 +0100 | [diff] [blame] | 14 | !ifndef VIMRT |
| 15 | !define VIMRT ".." |
| 16 | !endif |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 17 | |
| 18 | # Location of extra tools: diff.exe |
Bram Moolenaar | 286eacd | 2016-01-16 18:05:50 +0100 | [diff] [blame] | 19 | !ifndef VIMTOOLS |
| 20 | !define VIMTOOLS ..\.. |
| 21 | !endif |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 22 | |
Bram Moolenaar | 6199d43 | 2017-10-14 19:05:44 +0200 | [diff] [blame] | 23 | # Location of gettext. |
| 24 | # It must contain two directories: gettext32 and gettext64. |
| 25 | # See README.txt for detail. |
| 26 | !ifndef GETTEXT |
| 27 | !define GETTEXT ${VIMRT} |
| 28 | !endif |
| 29 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 30 | # Comment the next line if you don't have UPX. |
Bram Moolenaar | 6199d43 | 2017-10-14 19:05:44 +0200 | [diff] [blame] | 31 | # Get it at https://upx.github.io/ |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 32 | !define HAVE_UPX |
| 33 | |
| 34 | # comment the next line if you do not want to add Native Language Support |
| 35 | !define HAVE_NLS |
| 36 | |
Bram Moolenaar | 6c7b444 | 2016-01-02 15:44:32 +0100 | [diff] [blame] | 37 | !include gvim_version.nsh # for version number |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 38 | |
| 39 | # ----------- No configurable settings below this line ----------- |
| 40 | |
| 41 | !include UpgradeDLL.nsh # for VisVim.dll |
Bram Moolenaar | 442b422 | 2010-05-24 21:34:22 +0200 | [diff] [blame] | 42 | !include LogicLib.nsh |
| 43 | !include x64.nsh |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 44 | |
| 45 | Name "Vim ${VER_MAJOR}.${VER_MINOR}" |
| 46 | OutFile gvim${VER_MAJOR}${VER_MINOR}.exe |
| 47 | CRCCheck force |
Bram Moolenaar | 286eacd | 2016-01-16 18:05:50 +0100 | [diff] [blame] | 48 | SetCompressor /SOLID lzma |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 49 | SetDatablockOptimize on |
Bram Moolenaar | 442b422 | 2010-05-24 21:34:22 +0200 | [diff] [blame] | 50 | RequestExecutionLevel highest |
Bram Moolenaar | 286eacd | 2016-01-16 18:05:50 +0100 | [diff] [blame] | 51 | XPStyle on |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 52 | |
| 53 | ComponentText "This will install Vim ${VER_MAJOR}.${VER_MINOR} on your computer." |
Bram Moolenaar | 0434482 | 2014-11-05 18:18:17 +0100 | [diff] [blame] | 54 | DirText "Choose a directory to install Vim (should contain 'vim')" |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 55 | Icon icons\vim_16c.ico |
Bram Moolenaar | 266411a | 2013-07-05 20:01:32 +0200 | [diff] [blame] | 56 | # NSIS2 uses a different strategy with six different images in a strip... |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 57 | #EnabledBitmap icons\enabled.bmp |
| 58 | #DisabledBitmap icons\disabled.bmp |
| 59 | UninstallText "This will uninstall Vim ${VER_MAJOR}.${VER_MINOR} from your system." |
| 60 | UninstallIcon icons\vim_uninst_16c.ico |
| 61 | |
| 62 | # On NSIS 2 using the BGGradient causes trouble on Windows 98, in combination |
| 63 | # with the BringToFront. |
| 64 | # BGGradient 004000 008200 FFFFFF |
| 65 | LicenseText "You should read the following before installing:" |
| 66 | LicenseData ${VIMRT}\doc\uganda.nsis.txt |
| 67 | |
| 68 | !ifdef HAVE_UPX |
| 69 | !packhdr temp.dat "upx --best --compress-icons=1 temp.dat" |
| 70 | !endif |
| 71 | |
| 72 | # This adds '\vim' to the user choice automagically. The actual value is |
| 73 | # obtained below with ReadINIStr. |
| 74 | InstallDir "$PROGRAMFILES\Vim" |
| 75 | |
| 76 | # Types of installs we can perform: |
| 77 | InstType Typical |
| 78 | InstType Minimal |
| 79 | InstType Full |
| 80 | |
| 81 | SilentInstall normal |
| 82 | |
| 83 | # These are the pages we use |
| 84 | Page license |
| 85 | Page components |
| 86 | Page directory "" "" CheckInstallDir |
| 87 | Page instfiles |
| 88 | UninstPage uninstConfirm |
| 89 | UninstPage instfiles |
| 90 | |
| 91 | ########################################################## |
| 92 | # Functions |
| 93 | |
| 94 | Function .onInit |
| 95 | MessageBox MB_YESNO|MB_ICONQUESTION \ |
| 96 | "This will install Vim ${VER_MAJOR}.${VER_MINOR} on your computer.$\n Continue?" \ |
Bram Moolenaar | a1bd86e | 2017-06-24 15:11:01 +0200 | [diff] [blame] | 97 | /SD IDYES \ |
| 98 | IDYES NoAbort |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 99 | Abort ; causes installer to quit. |
| 100 | NoAbort: |
| 101 | |
| 102 | # run the install program to check for already installed versions |
| 103 | SetOutPath $TEMP |
| 104 | File /oname=install.exe ${VIMSRC}\installw32.exe |
| 105 | ExecWait "$TEMP\install.exe -uninstall-check" |
| 106 | Delete $TEMP\install.exe |
| 107 | |
| 108 | # We may have been put to the background when uninstall did something. |
| 109 | BringToFront |
| 110 | |
| 111 | # Install will have created a file for us that contains the directory where |
| 112 | # we should install. This is $VIM if it's set. This appears to be the only |
| 113 | # way to get the value of $VIM here!? |
| 114 | ReadINIStr $INSTDIR $TEMP\vimini.ini vimini dir |
| 115 | Delete $TEMP\vimini.ini |
| 116 | |
| 117 | # If ReadINIStr failed or did not find a path: use the default dir. |
| 118 | StrCmp $INSTDIR "" 0 IniOK |
| 119 | StrCpy $INSTDIR "$PROGRAMFILES\Vim" |
| 120 | IniOK: |
| 121 | |
| 122 | # Should check for the value of $VIM and use it. Unfortunately I don't know |
| 123 | # how to obtain the value of $VIM |
| 124 | # IfFileExists "$VIM" 0 No_Vim |
| 125 | # StrCpy $INSTDIR "$VIM" |
| 126 | # No_Vim: |
| 127 | |
| 128 | # User variables: |
| 129 | # $0 - holds the directory the executables are installed to |
| 130 | # $1 - holds the parameters to be passed to install.exe. Starts with OLE |
| 131 | # registration (since a non-OLE gvim will not complain, and we want to |
| 132 | # always register an OLE gvim). |
| 133 | # $2 - holds the names to create batch files for |
| 134 | StrCpy $0 "$INSTDIR\vim${VER_MAJOR}${VER_MINOR}" |
| 135 | StrCpy $1 "-register-OLE" |
Bram Moolenaar | 7fcab2a | 2006-03-25 21:46:12 +0000 | [diff] [blame] | 136 | StrCpy $2 "gvim evim gview gvimdiff vimtutor" |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 137 | |
| 138 | FunctionEnd |
| 139 | |
| 140 | Function .onUserAbort |
| 141 | MessageBox MB_YESNO|MB_ICONQUESTION "Abort install?" IDYES NoCancelAbort |
| 142 | Abort ; causes installer to not quit. |
| 143 | NoCancelAbort: |
| 144 | FunctionEnd |
| 145 | |
| 146 | # We only accept the directory if it ends in "vim". Using .onVerifyInstDir has |
| 147 | # the disadvantage that the browse dialog is difficult to use. |
| 148 | Function CheckInstallDir |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 149 | FunctionEnd |
| 150 | |
| 151 | Function .onInstSuccess |
| 152 | WriteUninstaller vim${VER_MAJOR}${VER_MINOR}\uninstall-gui.exe |
| 153 | MessageBox MB_YESNO|MB_ICONQUESTION \ |
Bram Moolenaar | f233048 | 2008-06-24 20:19:36 +0000 | [diff] [blame] | 154 | "The installation process has been successful. Happy Vimming! \ |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 155 | $\n$\n Do you want to see the README file now?" IDNO NoReadme |
| 156 | Exec '$0\gvim.exe -R "$0\README.txt"' |
| 157 | NoReadme: |
| 158 | FunctionEnd |
| 159 | |
| 160 | Function .onInstFailed |
| 161 | MessageBox MB_OK|MB_ICONEXCLAMATION "Installation failed. Better luck next time." |
| 162 | FunctionEnd |
| 163 | |
| 164 | Function un.onUnInstSuccess |
| 165 | MessageBox MB_OK|MB_ICONINFORMATION \ |
| 166 | "Vim ${VER_MAJOR}.${VER_MINOR} has been (partly) removed from your system" |
| 167 | FunctionEnd |
| 168 | |
| 169 | Function un.GetParent |
| 170 | Exch $0 ; old $0 is on top of stack |
| 171 | Push $1 |
| 172 | Push $2 |
| 173 | StrCpy $1 -1 |
| 174 | loop: |
| 175 | StrCpy $2 $0 1 $1 |
| 176 | StrCmp $2 "" exit |
| 177 | StrCmp $2 "\" exit |
| 178 | IntOp $1 $1 - 1 |
| 179 | Goto loop |
| 180 | exit: |
| 181 | StrCpy $0 $0 $1 |
| 182 | Pop $2 |
| 183 | Pop $1 |
| 184 | Exch $0 ; put $0 on top of stack, restore $0 to original value |
| 185 | FunctionEnd |
| 186 | |
| 187 | ########################################################## |
| 188 | Section "Vim executables and runtime files" |
Bram Moolenaar | 49150a4 | 2017-09-17 21:00:03 +0200 | [diff] [blame] | 189 | SectionIn 1 2 3 RO |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 190 | |
| 191 | # we need also this here if the user changes the instdir |
| 192 | StrCpy $0 "$INSTDIR\vim${VER_MAJOR}${VER_MINOR}" |
| 193 | |
| 194 | SetOutPath $0 |
| 195 | File /oname=gvim.exe ${VIMSRC}\gvim_ole.exe |
| 196 | File /oname=install.exe ${VIMSRC}\installw32.exe |
| 197 | File /oname=uninstal.exe ${VIMSRC}\uninstalw32.exe |
| 198 | File ${VIMSRC}\vimrun.exe |
Bram Moolenaar | fec246d | 2016-08-28 18:47:14 +0200 | [diff] [blame] | 199 | File /oname=tee.exe ${VIMSRC}\teew32.exe |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 200 | File /oname=xxd.exe ${VIMSRC}\xxdw32.exe |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 201 | File ${VIMRT}\vimtutor.bat |
| 202 | File ${VIMRT}\README.txt |
| 203 | File ..\uninstal.txt |
| 204 | File ${VIMRT}\*.vim |
| 205 | File ${VIMRT}\rgb.txt |
| 206 | |
Bram Moolenaar | 98ebd2b | 2017-08-19 13:29:19 +0200 | [diff] [blame] | 207 | File ${VIMTOOLS}\diff.exe |
| 208 | File ${VIMTOOLS}\winpty32.dll |
| 209 | File ${VIMTOOLS}\winpty-agent.exe |
| 210 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 211 | SetOutPath $0\colors |
| 212 | File ${VIMRT}\colors\*.* |
| 213 | |
| 214 | SetOutPath $0\compiler |
| 215 | File ${VIMRT}\compiler\*.* |
| 216 | |
| 217 | SetOutPath $0\doc |
| 218 | File ${VIMRT}\doc\*.txt |
| 219 | File ${VIMRT}\doc\tags |
| 220 | |
| 221 | SetOutPath $0\ftplugin |
| 222 | File ${VIMRT}\ftplugin\*.* |
| 223 | |
| 224 | SetOutPath $0\indent |
| 225 | File ${VIMRT}\indent\*.* |
| 226 | |
| 227 | SetOutPath $0\macros |
| 228 | File ${VIMRT}\macros\*.* |
Bram Moolenaar | c35e4cb | 2017-09-06 21:43:10 +0200 | [diff] [blame] | 229 | SetOutPath $0\macros\hanoi |
| 230 | File ${VIMRT}\macros\hanoi\*.* |
| 231 | SetOutPath $0\macros\life |
| 232 | File ${VIMRT}\macros\life\*.* |
| 233 | SetOutPath $0\macros\maze |
| 234 | File ${VIMRT}\macros\maze\*.* |
| 235 | SetOutPath $0\macros\urm |
| 236 | File ${VIMRT}\macros\urm\*.* |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 237 | |
Bram Moolenaar | c7baa43 | 2016-04-26 17:34:44 +0200 | [diff] [blame] | 238 | SetOutPath $0\pack\dist\opt\dvorak\dvorak |
| 239 | File ${VIMRT}\pack\dist\opt\dvorak\dvorak\*.* |
| 240 | SetOutPath $0\pack\dist\opt\dvorak\plugin |
| 241 | File ${VIMRT}\pack\dist\opt\dvorak\plugin\*.* |
| 242 | |
| 243 | SetOutPath $0\pack\dist\opt\editexisting\plugin |
| 244 | File ${VIMRT}\pack\dist\opt\editexisting\plugin\*.* |
| 245 | |
| 246 | SetOutPath $0\pack\dist\opt\justify\plugin |
| 247 | File ${VIMRT}\pack\dist\opt\justify\plugin\*.* |
| 248 | |
| 249 | SetOutPath $0\pack\dist\opt\matchit\doc |
| 250 | File ${VIMRT}\pack\dist\opt\matchit\doc\*.* |
| 251 | SetOutPath $0\pack\dist\opt\matchit\plugin |
| 252 | File ${VIMRT}\pack\dist\opt\matchit\plugin\*.* |
| 253 | |
| 254 | SetOutPath $0\pack\dist\opt\shellmenu\plugin |
| 255 | File ${VIMRT}\pack\dist\opt\shellmenu\plugin\*.* |
| 256 | |
| 257 | SetOutPath $0\pack\dist\opt\swapmouse\plugin |
| 258 | File ${VIMRT}\pack\dist\opt\swapmouse\plugin\*.* |
| 259 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 260 | SetOutPath $0\plugin |
| 261 | File ${VIMRT}\plugin\*.* |
| 262 | |
Bram Moolenaar | 7fcab2a | 2006-03-25 21:46:12 +0000 | [diff] [blame] | 263 | SetOutPath $0\autoload |
| 264 | File ${VIMRT}\autoload\*.* |
| 265 | |
Bram Moolenaar | 18144c8 | 2006-04-12 21:52:12 +0000 | [diff] [blame] | 266 | SetOutPath $0\autoload\xml |
| 267 | File ${VIMRT}\autoload\xml\*.* |
| 268 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 269 | SetOutPath $0\syntax |
| 270 | File ${VIMRT}\syntax\*.* |
| 271 | |
Bram Moolenaar | c01140a | 2006-03-24 22:21:52 +0000 | [diff] [blame] | 272 | SetOutPath $0\spell |
| 273 | File ${VIMRT}\spell\*.txt |
| 274 | File ${VIMRT}\spell\*.vim |
| 275 | File ${VIMRT}\spell\*.spl |
| 276 | File ${VIMRT}\spell\*.sug |
| 277 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 278 | SetOutPath $0\tools |
| 279 | File ${VIMRT}\tools\*.* |
| 280 | |
| 281 | SetOutPath $0\tutor |
| 282 | File ${VIMRT}\tutor\*.* |
| 283 | SectionEnd |
| 284 | |
| 285 | ########################################################## |
| 286 | Section "Vim console program (vim.exe)" |
| 287 | SectionIn 1 3 |
| 288 | |
| 289 | SetOutPath $0 |
| 290 | ReadRegStr $R0 HKLM \ |
| 291 | "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion |
| 292 | IfErrors 0 lbl_winnt |
Bram Moolenaar | ba46075 | 2013-07-04 22:35:01 +0200 | [diff] [blame] | 293 | # Windows 95/98/ME: not supported |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 294 | Goto lbl_done |
| 295 | lbl_winnt: |
Bram Moolenaar | 266411a | 2013-07-05 20:01:32 +0200 | [diff] [blame] | 296 | # Windows NT/2000/XP and later |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 297 | File /oname=vim.exe ${VIMSRC}\vimw32.exe |
| 298 | lbl_done: |
| 299 | StrCpy $2 "$2 vim view vimdiff" |
| 300 | SectionEnd |
| 301 | |
| 302 | ########################################################## |
| 303 | Section "Create .bat files for command line use" |
| 304 | SectionIn 3 |
| 305 | |
| 306 | StrCpy $1 "$1 -create-batfiles $2" |
| 307 | SectionEnd |
| 308 | |
| 309 | ########################################################## |
| 310 | Section "Create icons on the Desktop" |
| 311 | SectionIn 1 3 |
| 312 | |
| 313 | StrCpy $1 "$1 -install-icons" |
| 314 | SectionEnd |
| 315 | |
| 316 | ########################################################## |
| 317 | Section "Add Vim to the Start Menu" |
| 318 | SectionIn 1 3 |
| 319 | |
| 320 | StrCpy $1 "$1 -add-start-menu" |
| 321 | SectionEnd |
| 322 | |
| 323 | ########################################################## |
| 324 | Section "Add an Edit-with-Vim context menu entry" |
| 325 | SectionIn 1 3 |
| 326 | |
| 327 | # Be aware of this sequence of events: |
| 328 | # - user uninstalls Vim, gvimext.dll can't be removed (it's in use) and |
| 329 | # is scheduled to be removed at next reboot. |
| 330 | # - user installs Vim in same directory, gvimext.dll still exists. |
| 331 | # If we now skip installing gvimext.dll, it will disappear at the next |
| 332 | # reboot. Thus when copying gvimext.dll fails always schedule it to be |
| 333 | # installed at the next reboot. Can't use UpgradeDLL! |
| 334 | # We don't ask the user to reboot, the old dll will keep on working. |
| 335 | SetOutPath $0 |
| 336 | ClearErrors |
| 337 | SetOverwrite try |
Bram Moolenaar | 6199d43 | 2017-10-14 19:05:44 +0200 | [diff] [blame] | 338 | |
Bram Moolenaar | 442b422 | 2010-05-24 21:34:22 +0200 | [diff] [blame] | 339 | ${If} ${RunningX64} |
Bram Moolenaar | 6199d43 | 2017-10-14 19:05:44 +0200 | [diff] [blame] | 340 | # Install 64-bit gvimext.dll into the GvimExt64 directory. |
| 341 | SetOutPath $0\GvimExt64 |
| 342 | ClearErrors |
Bram Moolenaar | 442b422 | 2010-05-24 21:34:22 +0200 | [diff] [blame] | 343 | File /oname=gvimext.dll ${VIMSRC}\GvimExt\gvimext64.dll |
Bram Moolenaar | 6199d43 | 2017-10-14 19:05:44 +0200 | [diff] [blame] | 344 | !ifdef HAVE_NLS |
| 345 | File ${GETTEXT}\gettext64\libintl-8.dll |
| 346 | File ${GETTEXT}\gettext64\libiconv-2.dll |
| 347 | !endif |
| 348 | |
| 349 | IfErrors 0 GvimExt64Done |
| 350 | |
| 351 | # Can't copy gvimext.dll, create it under another name and rename it |
| 352 | # on next reboot. |
| 353 | GetTempFileName $3 $0\GvimExt64 |
Bram Moolenaar | 81b07b5 | 2017-10-15 21:43:21 +0200 | [diff] [blame] | 354 | File /oname=$3 ${VIMSRC}\GvimExt\gvimext64.dll |
Bram Moolenaar | 6199d43 | 2017-10-14 19:05:44 +0200 | [diff] [blame] | 355 | Rename /REBOOTOK $3 $0\GvimExt64\gvimext.dll |
| 356 | !ifdef HAVE_NLS |
| 357 | GetTempFileName $3 $0\GvimExt64 |
| 358 | File /oname=$3 ${GETTEXT}\gettext64\libintl-8.dll |
| 359 | Rename /REBOOTOK $3 $0\GvimExt64\libintl-8.dll |
| 360 | GetTempFileName $3 $0\GvimExt64 |
| 361 | File /oname=$3 ${GETTEXT}\gettext64\libiconv-2.dll |
| 362 | Rename /REBOOTOK $3 $0\GvimExt64\libiconv-2.dll |
| 363 | !endif |
Bram Moolenaar | 442b422 | 2010-05-24 21:34:22 +0200 | [diff] [blame] | 364 | ${EndIf} |
Bram Moolenaar | 6199d43 | 2017-10-14 19:05:44 +0200 | [diff] [blame] | 365 | |
| 366 | GvimExt64Done: |
| 367 | |
| 368 | # Install 32-bit gvimext.dll into the GvimExt32 directory. |
| 369 | SetOutPath $0\GvimExt32 |
| 370 | ClearErrors |
| 371 | |
| 372 | File /oname=gvimext.dll ${VIMSRC}\GvimExt\gvimext.dll |
| 373 | !ifdef HAVE_NLS |
| 374 | File ${GETTEXT}\gettext32\libintl-8.dll |
| 375 | File ${GETTEXT}\gettext32\libiconv-2.dll |
| 376 | File ${GETTEXT}\gettext32\libgcc_s_sjlj-1.dll |
| 377 | !endif |
| 378 | |
| 379 | IfErrors 0 GvimExt32Done |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 380 | |
| 381 | # Can't copy gvimext.dll, create it under another name and rename it on |
| 382 | # next reboot. |
Bram Moolenaar | 6199d43 | 2017-10-14 19:05:44 +0200 | [diff] [blame] | 383 | GetTempFileName $3 $0\GvimExt32 |
| 384 | File /oname=$3 ${VIMSRC}\GvimExt\gvimext.dll |
| 385 | Rename /REBOOTOK $3 $0\GvimExt32\gvimext.dll |
| 386 | !ifdef HAVE_NLS |
| 387 | GetTempFileName $3 $0\GvimExt32 |
| 388 | File /oname=$3 ${GETTEXT}\gettext32\libintl-8.dll |
| 389 | Rename /REBOOTOK $3 $0\GvimExt32\libintl-8.dll |
| 390 | GetTempFileName $3 $0\GvimExt32 |
| 391 | File /oname=$3 ${GETTEXT}\gettext32\libiconv-2.dll |
| 392 | Rename /REBOOTOK $3 $0\GvimExt32\libiconv-2.dll |
| 393 | GetTempFileName $3 $0\GvimExt32 |
| 394 | File /oname=$3 ${GETTEXT}\gettext32\libgcc_s_sjlj-1.dll |
| 395 | Rename /REBOOTOK $3 $0\GvimExt32\libgcc_s_sjlj-1.dll |
| 396 | !endif |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 397 | |
Bram Moolenaar | 6199d43 | 2017-10-14 19:05:44 +0200 | [diff] [blame] | 398 | GvimExt32Done: |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 399 | SetOverwrite lastused |
| 400 | |
| 401 | # We don't have a separate entry for the "Open With..." menu, assume |
| 402 | # the user wants either both or none. |
| 403 | StrCpy $1 "$1 -install-popup -install-openwith" |
| 404 | SectionEnd |
| 405 | |
| 406 | ########################################################## |
| 407 | Section "Create a _vimrc if it doesn't exist" |
| 408 | SectionIn 1 3 |
| 409 | |
| 410 | StrCpy $1 "$1 -create-vimrc" |
| 411 | SectionEnd |
| 412 | |
| 413 | ########################################################## |
| 414 | Section "Create plugin directories in HOME or VIM" |
| 415 | SectionIn 1 3 |
| 416 | |
| 417 | StrCpy $1 "$1 -create-directories home" |
| 418 | SectionEnd |
| 419 | |
| 420 | ########################################################## |
| 421 | Section "Create plugin directories in VIM" |
| 422 | SectionIn 3 |
| 423 | |
| 424 | StrCpy $1 "$1 -create-directories vim" |
| 425 | SectionEnd |
| 426 | |
| 427 | ########################################################## |
| 428 | Section "VisVim Extension for MS Visual Studio" |
| 429 | SectionIn 3 |
| 430 | |
| 431 | SetOutPath $0 |
| 432 | !insertmacro UpgradeDLL "${VIMSRC}\VisVim\VisVim.dll" "$0\VisVim.dll" "$0" |
| 433 | File ${VIMSRC}\VisVim\README_VisVim.txt |
| 434 | SectionEnd |
| 435 | |
| 436 | ########################################################## |
| 437 | !ifdef HAVE_NLS |
| 438 | Section "Native Language Support" |
| 439 | SectionIn 1 3 |
| 440 | |
| 441 | SetOutPath $0\lang |
| 442 | File /r ${VIMRT}\lang\*.* |
| 443 | SetOutPath $0\keymap |
| 444 | File ${VIMRT}\keymap\README.txt |
| 445 | File ${VIMRT}\keymap\*.vim |
| 446 | SetOutPath $0 |
Bram Moolenaar | 6199d43 | 2017-10-14 19:05:44 +0200 | [diff] [blame] | 447 | File ${GETTEXT}\gettext32\libintl-8.dll |
| 448 | File ${GETTEXT}\gettext32\libiconv-2.dll |
| 449 | #File /nonfatal ${VIMRT}\libwinpthread-1.dll |
| 450 | File /nonfatal ${GETTEXT}\gettext32\libgcc_s_sjlj-1.dll |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 451 | SectionEnd |
| 452 | !endif |
| 453 | |
| 454 | ########################################################## |
| 455 | Section -call_install_exe |
| 456 | SetOutPath $0 |
| 457 | ExecWait "$0\install.exe $1" |
| 458 | SectionEnd |
| 459 | |
| 460 | ########################################################## |
| 461 | Section -post |
| 462 | BringToFront |
| 463 | SectionEnd |
| 464 | |
| 465 | ########################################################## |
| 466 | Section Uninstall |
| 467 | # Apparently $INSTDIR is set to the directory where the uninstaller is |
| 468 | # created. Thus the "vim61" directory is included in it. |
| 469 | StrCpy $0 "$INSTDIR" |
| 470 | |
| 471 | # If VisVim was installed, unregister the DLL. |
| 472 | IfFileExists "$0\VisVim.dll" Has_VisVim No_VisVim |
| 473 | Has_VisVim: |
| 474 | ExecWait "regsvr32.exe /u /s $0\VisVim.dll" |
| 475 | |
| 476 | No_VisVim: |
| 477 | |
| 478 | # delete the context menu entry and batch files |
| 479 | ExecWait "$0\uninstal.exe -nsis" |
| 480 | |
| 481 | # We may have been put to the background when uninstall did something. |
| 482 | BringToFront |
| 483 | |
| 484 | # ask the user if the Vim version dir must be removed |
| 485 | MessageBox MB_YESNO|MB_ICONQUESTION \ |
| 486 | "Would you like to delete $0?$\n \ |
| 487 | $\nIt contains the Vim executables and runtime files." IDNO NoRemoveExes |
| 488 | |
| 489 | Delete /REBOOTOK $0\*.dll |
Bram Moolenaar | 6199d43 | 2017-10-14 19:05:44 +0200 | [diff] [blame] | 490 | Delete /REBOOTOK $0\GvimExt32\*.dll |
| 491 | ${If} ${RunningX64} |
| 492 | Delete /REBOOTOK $0\GvimExt64\*.dll |
| 493 | ${EndIf} |
| 494 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 495 | ClearErrors |
| 496 | # Remove everything but *.dll files. Avoids that |
| 497 | # a lot remains when gvimext.dll cannot be deleted. |
Bram Moolenaar | 408b585 | 2006-05-13 10:44:07 +0000 | [diff] [blame] | 498 | RMDir /r $0\autoload |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 499 | RMDir /r $0\colors |
| 500 | RMDir /r $0\compiler |
| 501 | RMDir /r $0\doc |
| 502 | RMDir /r $0\ftplugin |
| 503 | RMDir /r $0\indent |
| 504 | RMDir /r $0\macros |
| 505 | RMDir /r $0\plugin |
Bram Moolenaar | 408b585 | 2006-05-13 10:44:07 +0000 | [diff] [blame] | 506 | RMDir /r $0\spell |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 507 | RMDir /r $0\syntax |
| 508 | RMDir /r $0\tools |
| 509 | RMDir /r $0\tutor |
| 510 | RMDir /r $0\VisVim |
| 511 | RMDir /r $0\lang |
| 512 | RMDir /r $0\keymap |
| 513 | Delete $0\*.exe |
| 514 | Delete $0\*.bat |
| 515 | Delete $0\*.vim |
| 516 | Delete $0\*.txt |
| 517 | |
| 518 | IfErrors ErrorMess NoErrorMess |
| 519 | ErrorMess: |
| 520 | MessageBox MB_OK|MB_ICONEXCLAMATION \ |
| 521 | "Some files in $0 have not been deleted!$\nYou must do it manually." |
| 522 | NoErrorMess: |
| 523 | |
| 524 | # No error message if the "vim62" directory can't be removed, the |
| 525 | # gvimext.dll may still be there. |
| 526 | RMDir $0 |
| 527 | |
| 528 | NoRemoveExes: |
| 529 | # get the parent dir of the installation |
| 530 | Push $INSTDIR |
| 531 | Call un.GetParent |
| 532 | Pop $0 |
| 533 | StrCpy $1 $0 |
| 534 | |
| 535 | # if a plugin dir was created at installation ask the user to remove it |
| 536 | # first look in the root of the installation then in HOME |
| 537 | IfFileExists $1\vimfiles AskRemove 0 |
| 538 | ReadEnvStr $1 "HOME" |
| 539 | StrCmp $1 "" NoRemove 0 |
| 540 | |
| 541 | IfFileExists $1\vimfiles 0 NoRemove |
| 542 | |
| 543 | AskRemove: |
| 544 | MessageBox MB_YESNO|MB_ICONQUESTION \ |
Bram Moolenaar | e04abda | 2010-08-01 22:35:43 +0200 | [diff] [blame] | 545 | "Remove all files in your $1\vimfiles directory?$\n \ |
Bram Moolenaar | 760d14a | 2010-07-31 22:03:44 +0200 | [diff] [blame] | 546 | $\nCAREFUL: If you have created something there that you want to keep, click No" IDNO Fin |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 547 | RMDir /r $1\vimfiles |
| 548 | NoRemove: |
| 549 | |
| 550 | # ask the user if the Vim root dir must be removed |
| 551 | MessageBox MB_YESNO|MB_ICONQUESTION \ |
| 552 | "Would you like to remove $0?$\n \ |
| 553 | $\nIt contains your Vim configuration files!" IDNO NoDelete |
| 554 | RMDir /r $0 ; skipped if no |
| 555 | NoDelete: |
| 556 | |
| 557 | Fin: |
| 558 | Call un.onUnInstSuccess |
| 559 | |
| 560 | SectionEnd |