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