| 1 | ; Installer script for win32 SMPlayer
|
|---|
| 2 | ; Written by redxii ([email protected])
|
|---|
| 3 | ; Tested/Developed with Unicode NSIS 2.46
|
|---|
| 4 |
|
|---|
| 5 | !ifndef VER_MAJOR | VER_MINOR | VER_BUILD
|
|---|
| 6 | !error "Version information not defined (or incomplete). You must define: VER_MAJOR, VER_MINOR, VER_BUILD."
|
|---|
| 7 | !endif
|
|---|
| 8 |
|
|---|
| 9 | ;--------------------------------
|
|---|
| 10 | ;Compressor
|
|---|
| 11 |
|
|---|
| 12 | SetCompressor /SOLID lzma
|
|---|
| 13 | SetCompressorDictSize 32
|
|---|
| 14 |
|
|---|
| 15 | ;--------------------------------
|
|---|
| 16 | ;Additional plugin folders
|
|---|
| 17 |
|
|---|
| 18 | !addplugindir .
|
|---|
| 19 | !addincludedir .
|
|---|
| 20 |
|
|---|
| 21 | ;--------------------------------
|
|---|
| 22 | ;Defines
|
|---|
| 23 |
|
|---|
| 24 | !ifdef VER_REVISION
|
|---|
| 25 | !define SMPLAYER_VERSION "${VER_MAJOR}.${VER_MINOR}.${VER_BUILD}.${VER_REVISION}"
|
|---|
| 26 | !define SMPLAYER_PRODUCT_VERSION "${VER_MAJOR}.${VER_MINOR}.${VER_BUILD}.${VER_REVISION}"
|
|---|
| 27 | !else ifndef VER_REVISION
|
|---|
| 28 | !define SMPLAYER_VERSION "${VER_MAJOR}.${VER_MINOR}.${VER_BUILD}"
|
|---|
| 29 | !define SMPLAYER_PRODUCT_VERSION "${VER_MAJOR}.${VER_MINOR}.${VER_BUILD}.0"
|
|---|
| 30 | !endif
|
|---|
| 31 |
|
|---|
| 32 | !define SMPLAYER_APP_PATHS_KEY "Software\Microsoft\Windows\CurrentVersion\App Paths\smplayer.exe"
|
|---|
| 33 | !define SMPLAYER_REG_KEY "Software\SMPlayer"
|
|---|
| 34 |
|
|---|
| 35 | !define SMPLAYER_UNINST_EXE "uninst.exe"
|
|---|
| 36 | !define SMPLAYER_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\SMPlayer"
|
|---|
| 37 |
|
|---|
| 38 | ;Fallback versions
|
|---|
| 39 | ;These can be changed in the compiler, otherwise
|
|---|
| 40 | ;if not defined the values shown here will be used.
|
|---|
| 41 | !ifndef DEFAULT_CODECS_VERSION
|
|---|
| 42 | !define DEFAULT_CODECS_VERSION "windows-essential-20071007"
|
|---|
| 43 | !endif
|
|---|
| 44 |
|
|---|
| 45 | !ifndef WITH_MPLAYER
|
|---|
| 46 |
|
|---|
| 47 | !ifndef DEFAULT_MPLAYER_VERSION
|
|---|
| 48 | !define DEFAULT_MPLAYER_VERSION "mplayer-svn-33216"
|
|---|
| 49 | !endif
|
|---|
| 50 |
|
|---|
| 51 | !endif
|
|---|
| 52 |
|
|---|
| 53 | ;Version control
|
|---|
| 54 | !ifndef VERSION_FILE_URL
|
|---|
| 55 | !define VERSION_FILE_URL "http://smplayer.sourceforge.net/mplayer-version-info"
|
|---|
| 56 | !endif
|
|---|
| 57 |
|
|---|
| 58 | ;--------------------------------
|
|---|
| 59 | ;General
|
|---|
| 60 |
|
|---|
| 61 | ;Name and file
|
|---|
| 62 | Name "SMPlayer ${SMPLAYER_VERSION}"
|
|---|
| 63 | BrandingText "SMPlayer for Windows v${SMPLAYER_VERSION}"
|
|---|
| 64 | !ifdef WITH_MPLAYER
|
|---|
| 65 | OutFile "smplayer-${SMPLAYER_VERSION}-win32.exe"
|
|---|
| 66 | !else ifndef WITH_MPLAYER
|
|---|
| 67 | OutFile "smplayer-${SMPLAYER_VERSION}-webdl.exe"
|
|---|
| 68 | !endif
|
|---|
| 69 |
|
|---|
| 70 | ;Version tab properties
|
|---|
| 71 | VIProductVersion "${SMPLAYER_PRODUCT_VERSION}"
|
|---|
| 72 | VIAddVersionKey "ProductName" "SMPlayer"
|
|---|
| 73 | VIAddVersionKey "ProductVersion" "${SMPLAYER_VERSION}"
|
|---|
| 74 | VIAddVersionKey "FileVersion" "${SMPLAYER_VERSION}"
|
|---|
| 75 | VIAddVersionKey "LegalCopyright" ""
|
|---|
| 76 | !ifdef WITH_MPLAYER
|
|---|
| 77 | VIAddVersionKey "FileDescription" "SMPlayer Installer (Offline)"
|
|---|
| 78 | !else ifndef WITH_MPLAYER
|
|---|
| 79 | VIAddVersionKey "FileDescription" "SMPlayer Installer (Web Downloader)"
|
|---|
| 80 | !endif
|
|---|
| 81 |
|
|---|
| 82 | ;Default installation folder
|
|---|
| 83 | InstallDir "$PROGRAMFILES\SMPlayer"
|
|---|
| 84 |
|
|---|
| 85 | ;Get installation folder from registry if available
|
|---|
| 86 | InstallDirRegKey HKLM "${SMPLAYER_REG_KEY}" "Path"
|
|---|
| 87 |
|
|---|
| 88 | ;Vista+ XML manifest, does not affect older OSes
|
|---|
| 89 | RequestExecutionLevel admin
|
|---|
| 90 |
|
|---|
| 91 | ShowInstDetails show
|
|---|
| 92 | ShowUnInstDetails show
|
|---|
| 93 |
|
|---|
| 94 | ;--------------------------------
|
|---|
| 95 | ;Variables
|
|---|
| 96 |
|
|---|
| 97 | Var Codec_Version
|
|---|
| 98 | Var Dialog_Reinstall
|
|---|
| 99 | Var Inst_Type
|
|---|
| 100 | Var Is_Admin
|
|---|
| 101 | !ifndef WITH_MPLAYER
|
|---|
| 102 | Var MPlayer_Version
|
|---|
| 103 | !endif
|
|---|
| 104 | Var Previous_Version
|
|---|
| 105 | Var Previous_Version_State
|
|---|
| 106 | Var Reinstall_ChgSettings
|
|---|
| 107 | Var Reinstall_ChgSettings_State
|
|---|
| 108 | Var Reinstall_Message
|
|---|
| 109 | Var Reinstall_OverwriteButton
|
|---|
| 110 | Var Reinstall_OverwriteButton_State
|
|---|
| 111 | Var Reinstall_Uninstall
|
|---|
| 112 | Var Reinstall_UninstallButton
|
|---|
| 113 | Var Reinstall_UninstallButton_State
|
|---|
| 114 | Var SMPlayer_Path
|
|---|
| 115 | Var SMPlayer_StartMenuFolder
|
|---|
| 116 | Var UserName
|
|---|
| 117 |
|
|---|
| 118 | ;--------------------------------
|
|---|
| 119 | ;Interface Settings
|
|---|
| 120 |
|
|---|
| 121 | ;Installer/Uninstaller icons
|
|---|
| 122 | !define MUI_ICON "smplayer-orange-installer.ico"
|
|---|
| 123 | !define MUI_UNICON "smplayer-orange-uninstaller.ico"
|
|---|
| 124 |
|
|---|
| 125 | ; Misc
|
|---|
| 126 | !define MUI_WELCOMEFINISHPAGE_BITMAP "smplayer-orange-wizard.bmp"
|
|---|
| 127 | !define MUI_UNWELCOMEFINISHPAGE_BITMAP "smplayer-orange-wizard-un.bmp"
|
|---|
| 128 | !define MUI_ABORTWARNING
|
|---|
| 129 |
|
|---|
| 130 | ; License page
|
|---|
| 131 | !define MUI_LICENSEPAGE_RADIOBUTTONS
|
|---|
| 132 |
|
|---|
| 133 | ; Components page
|
|---|
| 134 | !define MUI_COMPONENTSPAGE_SMALLDESC
|
|---|
| 135 |
|
|---|
| 136 | ; Finish page
|
|---|
| 137 | !define MUI_FINISHPAGE_LINK "http://smplayer.sourceforge.net"
|
|---|
| 138 | !define MUI_FINISHPAGE_LINK_LOCATION "http://smplayer.sourceforge.net"
|
|---|
| 139 | !define MUI_FINISHPAGE_NOREBOOTSUPPORT
|
|---|
| 140 | !define MUI_FINISHPAGE_RUN $INSTDIR\smplayer.exe
|
|---|
| 141 | !define MUI_FINISHPAGE_RUN_NOTCHECKED
|
|---|
| 142 | !define MUI_FINISHPAGE_SHOWREADME $INSTDIR\Release_notes.txt
|
|---|
| 143 | !define MUI_FINISHPAGE_SHOWREADME_NOTCHECKED
|
|---|
| 144 |
|
|---|
| 145 | ;Language Selection Dialog Settings
|
|---|
| 146 | !define MUI_LANGDLL_REGISTRY_ROOT HKLM
|
|---|
| 147 | !define MUI_LANGDLL_REGISTRY_KEY "${SMPLAYER_UNINST_KEY}"
|
|---|
| 148 | !define MUI_LANGDLL_REGISTRY_VALUENAME "NSIS:Language"
|
|---|
| 149 |
|
|---|
| 150 | ;Memento Settings
|
|---|
| 151 | !define MEMENTO_REGISTRY_ROOT HKLM
|
|---|
| 152 | !define MEMENTO_REGISTRY_KEY "${SMPLAYER_REG_KEY}"
|
|---|
| 153 |
|
|---|
| 154 | ;Start Menu Settings
|
|---|
| 155 | !define MUI_STARTMENUPAGE_DEFAULTFOLDER "SMPlayer"
|
|---|
| 156 | !define MUI_STARTMENUPAGE_NODISABLE
|
|---|
| 157 | !define MUI_STARTMENUPAGE_REGISTRY_ROOT HKLM
|
|---|
| 158 | !define MUI_STARTMENUPAGE_REGISTRY_KEY "${SMPLAYER_UNINST_KEY}"
|
|---|
| 159 | !define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "NSIS:StartMenu"
|
|---|
| 160 |
|
|---|
| 161 | ;--------------------------------
|
|---|
| 162 | ;Include Modern UI and functions
|
|---|
| 163 |
|
|---|
| 164 | !include MUI2.nsh
|
|---|
| 165 | !include FileFunc.nsh
|
|---|
| 166 | !include Memento.nsh
|
|---|
| 167 | !include nsDialogs.nsh
|
|---|
| 168 | !include Sections.nsh
|
|---|
| 169 | !include WinVer.nsh
|
|---|
| 170 | !include WordFunc.nsh
|
|---|
| 171 |
|
|---|
| 172 | ;--------------------------------
|
|---|
| 173 | ;Pages
|
|---|
| 174 |
|
|---|
| 175 | ;Install pages
|
|---|
| 176 | !insertmacro MUI_PAGE_WELCOME
|
|---|
| 177 | !insertmacro MUI_PAGE_LICENSE "smplayer-build\Copying.txt"
|
|---|
| 178 |
|
|---|
| 179 | #Upgrade/Reinstall
|
|---|
| 180 | Page custom PageReinstall PageReinstallLeave
|
|---|
| 181 |
|
|---|
| 182 | #Components
|
|---|
| 183 | !define MUI_PAGE_CUSTOMFUNCTION_PRE PageComponentsPre
|
|---|
| 184 | !insertmacro MUI_PAGE_COMPONENTS
|
|---|
| 185 |
|
|---|
| 186 | #Install Directory
|
|---|
| 187 | !define MUI_PAGE_CUSTOMFUNCTION_PRE PageDirectoryPre
|
|---|
| 188 | !insertmacro MUI_PAGE_DIRECTORY
|
|---|
| 189 |
|
|---|
| 190 | #Start Menu
|
|---|
| 191 | !define MUI_PAGE_CUSTOMFUNCTION_PRE PageStartMenuPre
|
|---|
| 192 | !insertmacro MUI_PAGE_STARTMENU "SMP_SMenu" $SMPlayer_StartMenuFolder
|
|---|
| 193 |
|
|---|
| 194 | !insertmacro MUI_PAGE_INSTFILES
|
|---|
| 195 | !insertmacro MUI_PAGE_FINISH
|
|---|
| 196 |
|
|---|
| 197 | ;Uninstall pages
|
|---|
| 198 | !define MUI_PAGE_CUSTOMFUNCTION_PRE un.ConfirmPagePre
|
|---|
| 199 | !insertmacro MUI_UNPAGE_CONFIRM
|
|---|
| 200 | !insertmacro MUI_UNPAGE_INSTFILES
|
|---|
| 201 | !define MUI_PAGE_CUSTOMFUNCTION_PRE un.FinishPagePre
|
|---|
| 202 | !insertmacro MUI_UNPAGE_FINISH
|
|---|
| 203 |
|
|---|
| 204 | ;--------------------------------
|
|---|
| 205 | ;Languages
|
|---|
| 206 |
|
|---|
| 207 | !insertmacro MUI_LANGUAGE "English"
|
|---|
| 208 | !insertmacro MUI_LANGUAGE "Basque"
|
|---|
| 209 | !insertmacro MUI_LANGUAGE "Catalan"
|
|---|
| 210 | !insertmacro MUI_LANGUAGE "Croatian"
|
|---|
| 211 | !insertmacro MUI_LANGUAGE "Czech"
|
|---|
| 212 | !insertmacro MUI_LANGUAGE "Danish"
|
|---|
| 213 | !insertmacro MUI_LANGUAGE "Dutch"
|
|---|
| 214 | !insertmacro MUI_LANGUAGE "Finnish"
|
|---|
| 215 | !insertmacro MUI_LANGUAGE "French"
|
|---|
| 216 | !insertmacro MUI_LANGUAGE "German"
|
|---|
| 217 | !insertmacro MUI_LANGUAGE "Hebrew"
|
|---|
| 218 | !insertmacro MUI_LANGUAGE "Hungarian"
|
|---|
| 219 | !insertmacro MUI_LANGUAGE "Italian"
|
|---|
| 220 | !insertmacro MUI_LANGUAGE "Japanese"
|
|---|
| 221 | !insertmacro MUI_LANGUAGE "Korean"
|
|---|
| 222 | !insertmacro MUI_LANGUAGE "Norwegian"
|
|---|
| 223 | !insertmacro MUI_LANGUAGE "Polish"
|
|---|
| 224 | !insertmacro MUI_LANGUAGE "Portuguese"
|
|---|
| 225 | !insertmacro MUI_LANGUAGE "Russian"
|
|---|
| 226 | !insertmacro MUI_LANGUAGE "SimpChinese"
|
|---|
| 227 | !insertmacro MUI_LANGUAGE "Slovak"
|
|---|
| 228 | !insertmacro MUI_LANGUAGE "Slovenian"
|
|---|
| 229 | !insertmacro MUI_LANGUAGE "Spanish"
|
|---|
| 230 | !insertmacro MUI_LANGUAGE "TradChinese"
|
|---|
| 231 |
|
|---|
| 232 | ; Custom translations for setup
|
|---|
| 233 |
|
|---|
| 234 | !insertmacro LANGFILE_INCLUDE "translations\english.nsh"
|
|---|
| 235 | !insertmacro LANGFILE_INCLUDE "translations\basque.nsh"
|
|---|
| 236 | !insertmacro LANGFILE_INCLUDE "translations\catalan.nsh"
|
|---|
| 237 | !insertmacro LANGFILE_INCLUDE "translations\croatian.nsh"
|
|---|
| 238 | !insertmacro LANGFILE_INCLUDE "translations\czech.nsh"
|
|---|
| 239 | !insertmacro LANGFILE_INCLUDE "translations\danish.nsh"
|
|---|
| 240 | !insertmacro LANGFILE_INCLUDE "translations\dutch.nsh"
|
|---|
| 241 | !insertmacro LANGFILE_INCLUDE "translations\finnish.nsh"
|
|---|
| 242 | !insertmacro LANGFILE_INCLUDE "translations\french.nsh"
|
|---|
| 243 | !insertmacro LANGFILE_INCLUDE "translations\german.nsh"
|
|---|
| 244 | !insertmacro LANGFILE_INCLUDE "translations\hebrew.nsh"
|
|---|
| 245 | !insertmacro LANGFILE_INCLUDE "translations\hungarian.nsh"
|
|---|
| 246 | !insertmacro LANGFILE_INCLUDE "translations\italian.nsh"
|
|---|
| 247 | !insertmacro LANGFILE_INCLUDE "translations\japanese.nsh"
|
|---|
| 248 | !insertmacro LANGFILE_INCLUDE "translations\korean.nsh"
|
|---|
| 249 | !insertmacro LANGFILE_INCLUDE "translations\norwegian.nsh"
|
|---|
| 250 | !insertmacro LANGFILE_INCLUDE "translations\polish.nsh"
|
|---|
| 251 | !insertmacro LANGFILE_INCLUDE "translations\portuguese.nsh"
|
|---|
| 252 | !insertmacro LANGFILE_INCLUDE "translations\russian.nsh"
|
|---|
| 253 | !insertmacro LANGFILE_INCLUDE "translations\simpchinese.nsh"
|
|---|
| 254 | !insertmacro LANGFILE_INCLUDE "translations\slovak.nsh"
|
|---|
| 255 | !insertmacro LANGFILE_INCLUDE "translations\slovenian.nsh"
|
|---|
| 256 | !insertmacro LANGFILE_INCLUDE "translations\spanish.nsh"
|
|---|
| 257 | !insertmacro LANGFILE_INCLUDE "translations\tradchinese.nsh"
|
|---|
| 258 |
|
|---|
| 259 | ;--------------------------------
|
|---|
| 260 | ;Reserve Files
|
|---|
| 261 |
|
|---|
| 262 | ;These files should be inserted before other files in the data block
|
|---|
| 263 | ;Keep these lines before any File command
|
|---|
| 264 | ;Only for solid compression (by default, solid compression is enabled for BZIP2 and LZMA)
|
|---|
| 265 |
|
|---|
| 266 | !insertmacro MUI_RESERVEFILE_LANGDLL
|
|---|
| 267 | ReserveFile "${NSISDIR}\Plugins\UserInfo.dll"
|
|---|
| 268 | ReserveFile "FindProcDLL.dll"
|
|---|
| 269 |
|
|---|
| 270 | ;--------------------------------
|
|---|
| 271 | ;Installer Sections
|
|---|
| 272 |
|
|---|
| 273 | ;--------------------------------
|
|---|
| 274 | ;Main SMPlayer files
|
|---|
| 275 | Section $(Section_SMPlayer) SecSMPlayer
|
|---|
| 276 |
|
|---|
| 277 | SectionIn RO
|
|---|
| 278 |
|
|---|
| 279 | ${If} $Reinstall_Uninstall == 1
|
|---|
| 280 |
|
|---|
| 281 | ${If} $Reinstall_UninstallButton_State == 1
|
|---|
| 282 | Exec '"$SMPlayer_Path\uninst.exe" /X'
|
|---|
| 283 | Quit
|
|---|
| 284 | ${ElseIf} $Reinstall_OverwriteButton_State == 1
|
|---|
| 285 | ${If} "$INSTDIR" == "$SMPlayer_Path"
|
|---|
| 286 | ExecWait '"$SMPlayer_Path\uninst.exe" /S /R _?=$SMPlayer_Path'
|
|---|
| 287 | ${Else}
|
|---|
| 288 | ExecWait '"$SMPlayer_Path\uninst.exe" /S /R'
|
|---|
| 289 | ${EndIf}
|
|---|
| 290 | ${EndIf}
|
|---|
| 291 |
|
|---|
| 292 | ${EndIf}
|
|---|
| 293 |
|
|---|
| 294 | SetOutPath "$INSTDIR"
|
|---|
| 295 | File "smplayer-build\*"
|
|---|
| 296 |
|
|---|
| 297 | ;SMPlayer docs
|
|---|
| 298 | SetOutPath "$INSTDIR\docs"
|
|---|
| 299 | File /r "smplayer-build\docs\*.*"
|
|---|
| 300 |
|
|---|
| 301 | ;Qt imageformats
|
|---|
| 302 | SetOutPath "$INSTDIR\imageformats"
|
|---|
| 303 | File /r "smplayer-build\imageformats\*.*"
|
|---|
| 304 |
|
|---|
| 305 | ;SMPlayer key shortcuts
|
|---|
| 306 | SetOutPath "$INSTDIR\shortcuts"
|
|---|
| 307 | File /r "smplayer-build\shortcuts\*.*"
|
|---|
| 308 |
|
|---|
| 309 | SetOutPath "$PLUGINSDIR"
|
|---|
| 310 | File 7za.exe
|
|---|
| 311 |
|
|---|
| 312 | ;Initialize to 0 if don't exist (based on error flag)
|
|---|
| 313 | ReadRegDWORD $R0 HKLM "${SMPLAYER_REG_KEY}" Installed_MPlayer
|
|---|
| 314 | ${If} ${Errors}
|
|---|
| 315 | WriteRegDWORD HKLM "${SMPLAYER_REG_KEY}" Installed_MPlayer 0x0
|
|---|
| 316 | ${EndIf}
|
|---|
| 317 |
|
|---|
| 318 | ReadRegDWORD $R0 HKLM "${SMPLAYER_REG_KEY}" Installed_Codecs
|
|---|
| 319 | ${If} ${Errors}
|
|---|
| 320 | WriteRegDWORD HKLM "${SMPLAYER_REG_KEY}" Installed_Codecs 0x0
|
|---|
| 321 | ${EndIf}
|
|---|
| 322 |
|
|---|
| 323 | SectionEnd
|
|---|
| 324 |
|
|---|
| 325 | ;--------------------------------
|
|---|
| 326 | ;Shortcuts
|
|---|
| 327 | SectionGroup $(ShortcutGroupTitle)
|
|---|
| 328 |
|
|---|
| 329 | ${MementoSection} $(Section_DesktopShortcut) SecDesktopShortcut
|
|---|
| 330 |
|
|---|
| 331 | SetOutPath "$INSTDIR"
|
|---|
| 332 | CreateShortCut "$DESKTOP\SMPlayer.lnk" "$INSTDIR\smplayer.exe"
|
|---|
| 333 |
|
|---|
| 334 | ${MementoSectionEnd}
|
|---|
| 335 |
|
|---|
| 336 | ${MementoSection} $(Section_StartMenu) SecStartMenuShortcut
|
|---|
| 337 |
|
|---|
| 338 | SetOutPath "$INSTDIR"
|
|---|
| 339 | !insertmacro MUI_STARTMENU_WRITE_BEGIN SMP_SMenu
|
|---|
| 340 | CreateDirectory "$SMPROGRAMS\$SMPlayer_StartMenuFolder"
|
|---|
| 341 | CreateShortCut "$SMPROGRAMS\$SMPlayer_StartMenuFolder\SMPlayer.lnk" "$INSTDIR\smplayer.exe"
|
|---|
| 342 | CreateShortCut "$SMPROGRAMS\$SMPlayer_StartMenuFolder\SMTube.lnk" "$INSTDIR\smtube.exe"
|
|---|
| 343 | WriteINIStr "$SMPROGRAMS\$SMPlayer_StartMenuFolder\SMPlayer on the Web.url" "InternetShortcut" "URL" "http://smplayer.sf.net"
|
|---|
| 344 | CreateShortCut "$SMPROGRAMS\$SMPlayer_StartMenuFolder\Uninstall SMPlayer.lnk" "$INSTDIR\${SMPLAYER_UNINST_EXE}"
|
|---|
| 345 | !insertmacro MUI_STARTMENU_WRITE_END
|
|---|
| 346 |
|
|---|
| 347 | ${MementoSectionEnd}
|
|---|
| 348 |
|
|---|
| 349 | SectionGroupEnd
|
|---|
| 350 |
|
|---|
| 351 | ;--------------------------------
|
|---|
| 352 | ;MPlayer & MPlayer Codecs
|
|---|
| 353 | SectionGroup $(MPlayerGroupTitle)
|
|---|
| 354 |
|
|---|
| 355 | Section $(Section_MPlayer) SecMPlayer
|
|---|
| 356 |
|
|---|
| 357 | SectionIn RO
|
|---|
| 358 |
|
|---|
| 359 | !ifdef WITH_MPLAYER
|
|---|
| 360 | SetOutPath "$INSTDIR\mplayer"
|
|---|
| 361 | File /r "smplayer-build\mplayer\*.*"
|
|---|
| 362 |
|
|---|
| 363 | WriteRegDWORD HKLM "${SMPLAYER_REG_KEY}" Installed_MPlayer 0x1
|
|---|
| 364 | !else ifndef WITH_MPLAYER
|
|---|
| 365 | AddSize 16800
|
|---|
| 366 |
|
|---|
| 367 | Call GetVerInfo
|
|---|
| 368 |
|
|---|
| 369 | /* Read from version-info
|
|---|
| 370 | If it was unable to download, set version to that defined in the
|
|---|
| 371 | beginning of the script. */
|
|---|
| 372 | ${If} ${FileExists} "$PLUGINSDIR\version-info"
|
|---|
| 373 | ReadINIStr $MPlayer_Version "$PLUGINSDIR\version-info" smplayer mplayer
|
|---|
| 374 | ${Else}
|
|---|
| 375 | StrCpy $MPlayer_Version ${DEFAULT_MPLAYER_VERSION}
|
|---|
| 376 | ${EndIf}
|
|---|
| 377 |
|
|---|
| 378 | retry_mplayer:
|
|---|
| 379 |
|
|---|
| 380 | DetailPrint $(MPlayer_DL_Msg)
|
|---|
| 381 | inetc::get /CONNECTTIMEOUT 15000 /RESUME "" /BANNER $(MPlayer_DL_Msg) /CAPTION $(MPlayer_DL_Msg) \"http://downloads.sourceforge.net/smplayer/$MPlayer_Version.7z?big_mirror=0" \
|
|---|
| 382 | "$PLUGINSDIR\$MPlayer_Version.7z" /END
|
|---|
| 383 | Pop $R0
|
|---|
| 384 | StrCmp $R0 OK 0 check_mplayer
|
|---|
| 385 |
|
|---|
| 386 | DetailPrint $(Info_Files_Extract)
|
|---|
| 387 | nsExec::Exec '"$PLUGINSDIR\7za.exe" x "$PLUGINSDIR\$MPlayer_Version.7z" -y -o"$PLUGINSDIR"'
|
|---|
| 388 |
|
|---|
| 389 | CreateDirectory "$INSTDIR\mplayer"
|
|---|
| 390 | CopyFiles /SILENT "$PLUGINSDIR\$MPlayer_Version\*" "$INSTDIR\mplayer"
|
|---|
| 391 |
|
|---|
| 392 | check_mplayer:
|
|---|
| 393 |
|
|---|
| 394 | ${If} $R0 != "OK"
|
|---|
| 395 | DetailPrint $(MPlayer_DL_Failed)
|
|---|
| 396 | ${EndIf}
|
|---|
| 397 |
|
|---|
| 398 | IfFileExists "$INSTDIR\mplayer\mplayer.exe" mplayerInstSuccess mplayerInstFailed
|
|---|
| 399 | mplayerInstSuccess:
|
|---|
| 400 | WriteRegDWORD HKLM "${SMPLAYER_REG_KEY}" Installed_MPlayer 0x1
|
|---|
| 401 | Goto done
|
|---|
| 402 | mplayerInstFailed:
|
|---|
| 403 | MessageBox MB_RETRYCANCEL|MB_ICONEXCLAMATION $(MPlayer_DL_Retry) /SD IDCANCEL IDRETRY retry_mplayer
|
|---|
| 404 | Abort $(MPlayer_Inst_Failed)
|
|---|
| 405 |
|
|---|
| 406 | done:
|
|---|
| 407 | !endif
|
|---|
| 408 | SectionEnd
|
|---|
| 409 |
|
|---|
| 410 | Section /o $(Section_MPlayerCodecs) SecCodecs
|
|---|
| 411 |
|
|---|
| 412 | AddSize 22300
|
|---|
| 413 |
|
|---|
| 414 | Call GetVerInfo
|
|---|
| 415 |
|
|---|
| 416 | /* Read from version-info
|
|---|
| 417 | If it was unable to download, set version to that defined in the
|
|---|
| 418 | beginning of the script. */
|
|---|
| 419 | ${If} ${FileExists} "$PLUGINSDIR\version-info"
|
|---|
| 420 | ReadINIStr $Codec_Version "$PLUGINSDIR\version-info" smplayer mplayercodecs
|
|---|
| 421 | ${Else}
|
|---|
| 422 | StrCpy $Codec_Version ${DEFAULT_CODECS_VERSION}
|
|---|
| 423 | ${EndIf}
|
|---|
| 424 |
|
|---|
| 425 | retry_codecs:
|
|---|
| 426 |
|
|---|
| 427 | DetailPrint $(Codecs_DL_Msg)
|
|---|
| 428 | inetc::get /CONNECTTIMEOUT 15000 /RESUME "" /BANNER $(Codecs_DL_Msg) /CAPTION $(Codecs_DL_Msg) \
|
|---|
| 429 | "http://www.mplayerhq.hu/MPlayer/releases/codecs/$Codec_Version.zip" \
|
|---|
| 430 | "$PLUGINSDIR\$Codec_Version.zip" /END
|
|---|
| 431 | Pop $R0
|
|---|
| 432 | StrCmp $R0 OK 0 check_codecs
|
|---|
| 433 |
|
|---|
| 434 | DetailPrint $(Info_Files_Extract)
|
|---|
| 435 | nsExec::Exec '"$PLUGINSDIR\7za.exe" x "$PLUGINSDIR\$Codec_Version.zip" -y -o"$PLUGINSDIR"'
|
|---|
| 436 |
|
|---|
| 437 | CreateDirectory "$INSTDIR\mplayer\codecs"
|
|---|
| 438 | CopyFiles /SILENT "$PLUGINSDIR\$Codec_Version\*" "$INSTDIR\mplayer\codecs"
|
|---|
| 439 |
|
|---|
| 440 | check_codecs:
|
|---|
| 441 |
|
|---|
| 442 | ${If} $R0 != "OK"
|
|---|
| 443 | DetailPrint $(Codecs_DL_Failed)
|
|---|
| 444 | ${EndIf}
|
|---|
| 445 |
|
|---|
| 446 | IfFileExists "$INSTDIR\mplayer\codecs\*.dll" codecsInstSuccess codecsInstFailed
|
|---|
| 447 | codecsInstSuccess:
|
|---|
| 448 | WriteRegDWORD HKLM "${SMPLAYER_REG_KEY}" Installed_Codecs 0x1
|
|---|
| 449 | Goto done
|
|---|
| 450 | codecsInstFailed:
|
|---|
| 451 | MessageBox MB_RETRYCANCEL|MB_ICONEXCLAMATION $(Codecs_DL_Retry) /SD IDCANCEL IDRETRY retry_codecs
|
|---|
| 452 | DetailPrint $(Codecs_Inst_Failed)
|
|---|
| 453 | WriteRegDWORD HKLM "${SMPLAYER_REG_KEY}" Installed_Codecs 0x0
|
|---|
| 454 | Sleep 5000
|
|---|
| 455 |
|
|---|
| 456 | done:
|
|---|
| 457 |
|
|---|
| 458 | SectionEnd
|
|---|
| 459 |
|
|---|
| 460 | SectionGroupEnd
|
|---|
| 461 |
|
|---|
| 462 | ;--------------------------------
|
|---|
| 463 | ;Icon themes
|
|---|
| 464 | ${MementoSection} $(Section_IconThemes) SecThemes
|
|---|
| 465 |
|
|---|
| 466 | SetOutPath "$INSTDIR\themes"
|
|---|
| 467 | File /r "smplayer-build\themes\*.*"
|
|---|
| 468 |
|
|---|
| 469 | ${MementoSectionEnd}
|
|---|
| 470 |
|
|---|
| 471 | ;--------------------------------
|
|---|
| 472 | ;Translations
|
|---|
| 473 | ${MementoSection} $(Section_Translations) SecTranslations
|
|---|
| 474 |
|
|---|
| 475 | SetOutPath "$INSTDIR\translations"
|
|---|
| 476 | File /r "smplayer-build\translations\*.*"
|
|---|
| 477 |
|
|---|
| 478 | ${MementoSectionEnd}
|
|---|
| 479 |
|
|---|
| 480 | ;--------------------------------
|
|---|
| 481 | ;Install/Uninstall information
|
|---|
| 482 | Section -Post
|
|---|
| 483 |
|
|---|
| 484 | ;Uninstall file
|
|---|
| 485 | WriteUninstaller "$INSTDIR\${SMPLAYER_UNINST_EXE}"
|
|---|
| 486 |
|
|---|
| 487 | ;Store installed path & version
|
|---|
| 488 | WriteRegStr HKLM "${SMPLAYER_REG_KEY}" "Path" "$INSTDIR"
|
|---|
| 489 | WriteRegStr HKLM "${SMPLAYER_REG_KEY}" "Version" "${SMPLAYER_VERSION}"
|
|---|
| 490 |
|
|---|
| 491 | ;Allows user to use 'start smplayer.exe'
|
|---|
| 492 | WriteRegStr HKLM "${SMPLAYER_APP_PATHS_KEY}" "" "$INSTDIR\smplayer.exe"
|
|---|
| 493 |
|
|---|
| 494 | ;Default Programs Registration (Vista & later)
|
|---|
| 495 | ${If} ${AtLeastWinVista}
|
|---|
| 496 | Call RegisterDefaultPrograms
|
|---|
| 497 | ${EndIf}
|
|---|
| 498 |
|
|---|
| 499 | ;Registry Uninstall information
|
|---|
| 500 | WriteRegStr HKLM "${SMPLAYER_UNINST_KEY}" "DisplayName" "$(^Name)"
|
|---|
| 501 | WriteRegStr HKLM "${SMPLAYER_UNINST_KEY}" "DisplayIcon" "$INSTDIR\smplayer.exe"
|
|---|
| 502 | WriteRegStr HKLM "${SMPLAYER_UNINST_KEY}" "DisplayVersion" "${SMPLAYER_VERSION}"
|
|---|
| 503 | WriteRegStr HKLM "${SMPLAYER_UNINST_KEY}" "HelpLink" "http://smplayer.berlios.de/forum"
|
|---|
| 504 | WriteRegStr HKLM "${SMPLAYER_UNINST_KEY}" "Publisher" "Ricardo Villalba"
|
|---|
| 505 | WriteRegStr HKLM "${SMPLAYER_UNINST_KEY}" "UninstallString" "$INSTDIR\${SMPLAYER_UNINST_EXE}"
|
|---|
| 506 | WriteRegStr HKLM "${SMPLAYER_UNINST_KEY}" "URLInfoAbout" "http://smplayer.sf.net"
|
|---|
| 507 | WriteRegStr HKLM "${SMPLAYER_UNINST_KEY}" "URLUpdateInfo" "http://smplayer.sf.net"
|
|---|
| 508 | WriteRegDWORD HKLM "${SMPLAYER_UNINST_KEY}" "NoModify" "1"
|
|---|
| 509 | WriteRegDWORD HKLM "${SMPLAYER_UNINST_KEY}" "NoRepair" "1"
|
|---|
| 510 |
|
|---|
| 511 | SectionEnd
|
|---|
| 512 |
|
|---|
| 513 | ${MementoSectionDone}
|
|---|
| 514 |
|
|---|
| 515 | ;--------------------------------
|
|---|
| 516 | ;Section descriptions
|
|---|
| 517 | !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
|
|---|
| 518 | !insertmacro MUI_DESCRIPTION_TEXT ${SecSMPlayer} $(Section_SMPlayer_Desc)
|
|---|
| 519 | !insertmacro MUI_DESCRIPTION_TEXT ${SecDesktopShortcut} $(Section_DesktopShortcut_Desc)
|
|---|
| 520 | !insertmacro MUI_DESCRIPTION_TEXT ${SecStartMenuShortcut} $(Section_StartMenu_Desc)
|
|---|
| 521 | !insertmacro MUI_DESCRIPTION_TEXT ${SecMPlayer} $(Section_MPlayer_Desc)
|
|---|
| 522 | !insertmacro MUI_DESCRIPTION_TEXT ${SecCodecs} $(Section_MPlayerCodecs_Desc)
|
|---|
| 523 | !insertmacro MUI_DESCRIPTION_TEXT ${SecThemes} $(Section_IconThemes_Desc)
|
|---|
| 524 | !insertmacro MUI_DESCRIPTION_TEXT ${SecTranslations} $(Section_Translations_Desc)
|
|---|
| 525 | !insertmacro MUI_FUNCTION_DESCRIPTION_END
|
|---|
| 526 |
|
|---|
| 527 | ;--------------------------------
|
|---|
| 528 | ;Macros
|
|---|
| 529 |
|
|---|
| 530 | !macro MacroAllExtensions _action
|
|---|
| 531 | !insertmacro ${_action} ".3gp"
|
|---|
| 532 | !insertmacro ${_action} ".ac3"
|
|---|
| 533 | !insertmacro ${_action} ".ape"
|
|---|
| 534 | !insertmacro ${_action} ".asf"
|
|---|
| 535 | !insertmacro ${_action} ".avi"
|
|---|
| 536 | !insertmacro ${_action} ".bin"
|
|---|
| 537 | !insertmacro ${_action} ".dat"
|
|---|
| 538 | !insertmacro ${_action} ".divx"
|
|---|
| 539 | !insertmacro ${_action} ".dv"
|
|---|
| 540 | !insertmacro ${_action} ".dvr-ms"
|
|---|
| 541 | !insertmacro ${_action} ".f4v"
|
|---|
| 542 | !insertmacro ${_action} ".flac"
|
|---|
| 543 | !insertmacro ${_action} ".flv"
|
|---|
| 544 | !insertmacro ${_action} ".hdmov"
|
|---|
| 545 | !insertmacro ${_action} ".iso"
|
|---|
| 546 | !insertmacro ${_action} ".m1v"
|
|---|
| 547 | !insertmacro ${_action} ".m2t"
|
|---|
| 548 | !insertmacro ${_action} ".m2ts"
|
|---|
| 549 | !insertmacro ${_action} ".m2v"
|
|---|
| 550 | !insertmacro ${_action} ".m3u"
|
|---|
| 551 | !insertmacro ${_action} ".m3u8"
|
|---|
| 552 | !insertmacro ${_action} ".m4v"
|
|---|
| 553 | !insertmacro ${_action} ".mkv"
|
|---|
| 554 | !insertmacro ${_action} ".mov"
|
|---|
| 555 | !insertmacro ${_action} ".mp3"
|
|---|
| 556 | !insertmacro ${_action} ".mp4"
|
|---|
| 557 | !insertmacro ${_action} ".mpeg"
|
|---|
| 558 | !insertmacro ${_action} ".mpg"
|
|---|
| 559 | !insertmacro ${_action} ".mpv"
|
|---|
| 560 | !insertmacro ${_action} ".mqv"
|
|---|
| 561 | !insertmacro ${_action} ".nsv"
|
|---|
| 562 | !insertmacro ${_action} ".ogg"
|
|---|
| 563 | !insertmacro ${_action} ".ogm"
|
|---|
| 564 | !insertmacro ${_action} ".ogv"
|
|---|
| 565 | !insertmacro ${_action} ".pls"
|
|---|
| 566 | !insertmacro ${_action} ".ra"
|
|---|
| 567 | !insertmacro ${_action} ".ram"
|
|---|
| 568 | !insertmacro ${_action} ".rec"
|
|---|
| 569 | !insertmacro ${_action} ".rm"
|
|---|
| 570 | !insertmacro ${_action} ".rmvb"
|
|---|
| 571 | !insertmacro ${_action} ".swf"
|
|---|
| 572 | !insertmacro ${_action} ".thd"
|
|---|
| 573 | !insertmacro ${_action} ".ts"
|
|---|
| 574 | !insertmacro ${_action} ".vcd"
|
|---|
| 575 | !insertmacro ${_action} ".vfw"
|
|---|
| 576 | !insertmacro ${_action} ".vob"
|
|---|
| 577 | !insertmacro ${_action} ".vp8"
|
|---|
| 578 | !insertmacro ${_action} ".wav"
|
|---|
| 579 | !insertmacro ${_action} ".webm"
|
|---|
| 580 | !insertmacro ${_action} ".wma"
|
|---|
| 581 | !insertmacro ${_action} ".wmv"
|
|---|
| 582 | !macroend
|
|---|
| 583 |
|
|---|
| 584 | !macro WriteRegStrSupportedTypes EXT
|
|---|
| 585 | WriteRegStr HKLM "${SMPLAYER_REG_KEY}\Capabilities\FileAssociations" ${EXT} "MPlayerFileVideo"
|
|---|
| 586 | !macroend
|
|---|
| 587 |
|
|---|
| 588 | !macro MacroRemoveSMPlayer
|
|---|
| 589 | ;Delete desktop and start menu shortcuts
|
|---|
| 590 | SetDetailsPrint textonly
|
|---|
| 591 | DetailPrint $(Info_Del_Shortcuts)
|
|---|
| 592 | SetDetailsPrint listonly
|
|---|
| 593 |
|
|---|
| 594 | SetShellVarContext all
|
|---|
| 595 | Delete "$DESKTOP\SMPlayer.lnk"
|
|---|
| 596 | Delete "$SMPROGRAMS\$SMPlayer_StartMenuFolder\SMPlayer.lnk"
|
|---|
| 597 | Delete "$SMPROGRAMS\$SMPlayer_StartMenuFolder\SMTube.lnk"
|
|---|
| 598 | Delete "$SMPROGRAMS\$SMPlayer_StartMenuFolder\SMPlayer on the Web.url"
|
|---|
| 599 | Delete "$SMPROGRAMS\$SMPlayer_StartMenuFolder\Uninstall SMPlayer.lnk"
|
|---|
| 600 | RMDir "$SMPROGRAMS\$SMPlayer_StartMenuFolder"
|
|---|
| 601 |
|
|---|
| 602 | ;Delete directories recursively except for main directory
|
|---|
| 603 | ;Do not recursively delete $INSTDIR
|
|---|
| 604 | SetDetailsPrint textonly
|
|---|
| 605 | DetailPrint $(Info_Del_Files)
|
|---|
| 606 | SetDetailsPrint listonly
|
|---|
| 607 |
|
|---|
| 608 | RMDir /r "$INSTDIR\docs"
|
|---|
| 609 | RMDir /r "$INSTDIR\imageformats"
|
|---|
| 610 | RMDir /r "$INSTDIR\mplayer"
|
|---|
| 611 | RMDir /r "$INSTDIR\shortcuts"
|
|---|
| 612 | RMDir /r "$INSTDIR\themes"
|
|---|
| 613 | RMDir /r "$INSTDIR\translations"
|
|---|
| 614 | Delete "$INSTDIR\*.txt"
|
|---|
| 615 | Delete "$INSTDIR\libgcc_s_dw2-1.dll"
|
|---|
| 616 | Delete "$INSTDIR\mingwm10.dll"
|
|---|
| 617 | Delete "$INSTDIR\zlib1.dll"
|
|---|
| 618 | Delete "$INSTDIR\Q*.dll"
|
|---|
| 619 | Delete "$INSTDIR\smplayer.exe"
|
|---|
| 620 | Delete "$INSTDIR\smtube.exe"
|
|---|
| 621 | Delete "$INSTDIR\dxlist.exe"
|
|---|
| 622 |
|
|---|
| 623 | ;Delete registry keys
|
|---|
| 624 | SetDetailsPrint textonly
|
|---|
| 625 | DetailPrint $(Info_Del_Registry)
|
|---|
| 626 | SetDetailsPrint listonly
|
|---|
| 627 |
|
|---|
| 628 | DeleteRegKey HKLM "${SMPLAYER_REG_KEY}"
|
|---|
| 629 | DeleteRegKey HKLM "${SMPLAYER_APP_PATHS_KEY}"
|
|---|
| 630 | DeleteRegKey HKLM "${SMPLAYER_UNINST_KEY}"
|
|---|
| 631 | DeleteRegKey HKCR "MPlayerFileVideo"
|
|---|
| 632 | DeleteRegValue HKLM "Software\RegisteredApplications" "SMPlayer"
|
|---|
| 633 |
|
|---|
| 634 | SetDetailsPrint both
|
|---|
| 635 | !macroend
|
|---|
| 636 |
|
|---|
| 637 | ;--------------------------------
|
|---|
| 638 | ;Shared functions
|
|---|
| 639 |
|
|---|
| 640 | !macro CheckUserRightsMacro UN
|
|---|
| 641 | Function ${UN}CheckUserRights
|
|---|
| 642 |
|
|---|
| 643 | ClearErrors
|
|---|
| 644 | UserInfo::GetName
|
|---|
| 645 | ${If} ${Errors}
|
|---|
| 646 | StrCpy $Is_Admin 1
|
|---|
| 647 | Return
|
|---|
| 648 | ${EndIf}
|
|---|
| 649 |
|
|---|
| 650 | Pop $UserName
|
|---|
| 651 | UserInfo::GetAccountType
|
|---|
| 652 | Pop $R0
|
|---|
| 653 | ${Switch} $R0
|
|---|
| 654 | ${Case} "Admin"
|
|---|
| 655 | ${Case} "Power"
|
|---|
| 656 | StrCpy $Is_Admin 1
|
|---|
| 657 | ${Break}
|
|---|
| 658 | ${Default}
|
|---|
| 659 | StrCpy $Is_Admin 0
|
|---|
| 660 | ${Break}
|
|---|
| 661 | ${EndSwitch}
|
|---|
| 662 |
|
|---|
| 663 | FunctionEnd
|
|---|
| 664 | !macroend
|
|---|
| 665 | !insertmacro CheckUserRightsMacro ""
|
|---|
| 666 | !insertmacro CheckUserRightsMacro "un."
|
|---|
| 667 |
|
|---|
| 668 | !macro RunCheckMacro UN
|
|---|
| 669 | Function ${UN}RunCheck
|
|---|
| 670 |
|
|---|
| 671 | retry_runcheck:
|
|---|
| 672 | FindProcDLL::FindProc "smplayer.exe"
|
|---|
| 673 | IntCmp $R0 1 0 +3
|
|---|
| 674 | MessageBox MB_RETRYCANCEL|MB_ICONEXCLAMATION $(SMPlayer_Is_Running) /SD IDCANCEL IDRETRY retry_runcheck
|
|---|
| 675 | Abort
|
|---|
| 676 |
|
|---|
| 677 | FunctionEnd
|
|---|
| 678 | !macroend
|
|---|
| 679 | !insertmacro RunCheckMacro ""
|
|---|
| 680 | !insertmacro RunCheckMacro "un."
|
|---|
| 681 |
|
|---|
| 682 | ;--------------------------------
|
|---|
| 683 | ;Installer functions
|
|---|
| 684 |
|
|---|
| 685 | Function .onInit
|
|---|
| 686 |
|
|---|
| 687 | !ifdef PRE_RELEASE
|
|---|
| 688 | MessageBox MB_OK|MB_ICONINFORMATION "This is a pre-release version of SMPlayer. Please report all issues."
|
|---|
| 689 | !endif
|
|---|
| 690 |
|
|---|
| 691 | ;Check if setup is already running
|
|---|
| 692 | System::Call 'kernel32::CreateMutexW(i 0, i 0, t "SMPlayerSetup") i .r1 ?e'
|
|---|
| 693 | Pop $R0
|
|---|
| 694 |
|
|---|
|
|---|