Added MPlayer logo to resources.
[mplayer-setup-win32.git] / MPUI_Wrapper.nsi
blobe444e3a24677d9ede3e142f585bcdee0abb8ad5f
1 ; ///////////////////////////////////////////////////////////////////////////////
2 ; // MPlayer for Windows - Install Script
3 ; // Copyright (C) 2004-2013 LoRd_MuldeR <MuldeR2@GMX.de>
4 ; //
5 ; // This program is free software; you can redistribute it and/or modify
6 ; // it under the terms of the GNU General Public License as published by
7 ; // the Free Software Foundation; either version 2 of the License, or
8 ; // (at your option) any later version.
9 ; //
10 ; // This program is distributed in the hope that it will be useful,
11 ; // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 ; // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 ; // GNU General Public License for more details.
14 ; //
15 ; // You should have received a copy of the GNU General Public License along
16 ; // with this program; if not, write to the Free Software Foundation, Inc.,
17 ; // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 ; //
19 ; // http://www.gnu.org/licenses/gpl-2.0.txt
20 ; ///////////////////////////////////////////////////////////////////////////////
23 ;--------------------------------------------------------------------------------
24 ; BASIC DEFINES
25 ;--------------------------------------------------------------------------------
27 !ifndef MPLAYER_BUILDNO
28 !error "MPLAYER_BUILDNO is not defined !!!"
29 !endif
31 !ifndef MPLAYER_DATE
32 !error "MPLAYER_DATE is not defined !!!"
33 !endif
35 !ifndef MPLAYER_OUTFILE
36 !error "MPLAYER_OUTPUT_FILE is not defined !!!"
37 !endif
39 !ifndef MPLAYER_SRCFILE
40 !error "MPLAYER_SOURCE_FILE is not defined !!!"
41 !endif
43 !ifndef UPX_PATH
44 !error "UPX_PATH is not defined !!!"
45 !endif
47 ; Web-Site
48 !define MyWebSite "http://mulder.at.gg/"
50 ; Temp file name
51 !define TempFileName "$PLUGINSDIR\MPUI-Installer-r${MPLAYER_BUILDNO}.exe"
54 ;--------------------------------------------------------------------------------
55 ; INCLUDES
56 ;--------------------------------------------------------------------------------
58 !include `LogicLib.nsh`
59 !include `StdUtils.nsh`
62 ;--------------------------------------------------------------------------------
63 ; INSTALLER ATTRIBUTES
64 ;--------------------------------------------------------------------------------
66 XPStyle on
67 RequestExecutionLevel user
68 InstallColors /windows
70 Name "MPlayer for Windows ${MPLAYER_DATE} (Build #${MPLAYER_BUILDNO})"
71 Caption "MPlayer for Windows ${MPLAYER_DATE} (Build #${MPLAYER_BUILDNO})"
72 BrandingText "MPlayer-Win32 (Build #${MPLAYER_BUILDNO})"
73 Icon "${NSISDIR}\Contrib\Graphics\Icons\orange-install.ico"
74 ChangeUI all "${NSISDIR}\Contrib\UIs\sdbarker_tiny.exe"
75 OutFile "${MPLAYER_OUTFILE}"
77 ShowInstDetails show
78 AutoCloseWindow true
79 InstallDir ""
82 ;--------------------------------
83 ;Page Captions
84 ;--------------------------------
86 SubCaption 0 " "
87 SubCaption 1 " "
88 SubCaption 2 " "
89 SubCaption 3 " "
90 SubCaption 4 " "
93 ;--------------------------------------------------------------------------------
94 ; COMPRESSOR
95 ;--------------------------------------------------------------------------------
97 !packhdr "$%TEMP%\exehead.tmp" '"${UPX_PATH}\upx.exe" --brute "$%TEMP%\exehead.tmp"'
100 ;--------------------------------------------------------------------------------
101 ; RESERVE FILES
102 ;--------------------------------------------------------------------------------
104 ReserveFile "${NSISDIR}\Plugins\Banner.dll"
105 ReserveFile "${NSISDIR}\Plugins\LangDLL.dll"
106 ReserveFile "${NSISDIR}\Plugins\LockedList.dll"
107 ReserveFile "${NSISDIR}\Plugins\nsDialogs.dll"
108 ReserveFile "${NSISDIR}\Plugins\nsExec.dll"
109 ReserveFile "${NSISDIR}\Plugins\StdUtils.dll"
110 ReserveFile "${NSISDIR}\Plugins\System.dll"
111 ReserveFile "${NSISDIR}\Plugins\UserInfo.dll"
114 ;--------------------------------------------------------------------------------
115 ; VERSION INFO
116 ;--------------------------------------------------------------------------------
118 !searchreplace PRODUCT_VERSION_DATE "${MPLAYER_DATE}" "-" "."
119 VIProductVersion "${PRODUCT_VERSION_DATE}.${MPLAYER_BUILDNO}"
121 VIAddVersionKey "Author" "LoRd_MuldeR <mulder2@gmx.de>"
122 VIAddVersionKey "Comments" "This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version."
123 VIAddVersionKey "CompanyName" "Free Software Foundation"
124 VIAddVersionKey "FileDescription" "MPlayer for Windows (Build #${MPLAYER_BUILDNO})"
125 VIAddVersionKey "FileVersion" "${PRODUCT_VERSION_DATE}.${MPLAYER_BUILDNO}"
126 VIAddVersionKey "LegalCopyright" "Copyright 2000-2013 The MPlayer Project"
127 VIAddVersionKey "LegalTrademarks" "GNU"
128 VIAddVersionKey "OriginalFilename" "MPUI-Setup.exe"
129 VIAddVersionKey "ProductName" "MPlayer for Windows"
130 VIAddVersionKey "ProductVersion" "Build #${MPLAYER_BUILDNO} (${MPLAYER_DATE})"
131 VIAddVersionKey "Website" "${MPlayerWebSite}"
134 ;--------------------------------
135 ;Installer initialization
136 ;--------------------------------
138 Section "-LaunchTheInstaller"
139 SetDetailsPrint textonly
140 DetailPrint "Launching installer, please stay tuned..."
141 SetDetailsPrint listonly
143 InitPluginsDir
144 SetOutPath "$PLUGINSDIR"
146 SetOverwrite on
147 File "/oname=${TempFileName}" "${MPLAYER_SRCFILE}"
149 ; --------
151 ${StdUtils.GetAllParameters} $R9 0
152 ${IfThen} "$R9" == "too_long" ${|} StrCpy $R9 "" ${|}
154 ${IfNot} "$R9" == ""
155 DetailPrint "Parameters: $R9"
156 ${EndIf}
158 ; --------
160 ${Do}
161 SetOverwrite ifdiff
162 File "/oname=${TempFileName}" "${MPLAYER_SRCFILE}"
164 DetailPrint "ExecShellWait: ${TempFileName}"
165 ${StdUtils.ExecShellWaitEx} $R1 $R2 "${TempFileName}" "open" '$R9'
166 DetailPrint "Result: $R1 ($R2)"
168 ${IfThen} $R1 == "no_wait" ${|} Goto SetupCompleted ${|}
170 ${If} $R1 == "ok"
171 Sleep 333
172 HideWindow
173 ${StdUtils.WaitForProcEx} $R1 $R2
174 Goto SetupCompleted
175 ${EndIf}
177 MessageBox MB_RETRYCANCEL|MB_ICONSTOP|MB_TOPMOST "Failed to launch the installer. Please try again!" IDCANCEL FallbackMode
178 ${Loop}
180 ; --------
182 FallbackMode:
184 SetOverwrite ifdiff
185 File "/oname=${TempFileName}" "${MPLAYER_SRCFILE}"
187 ClearErrors
188 ExecShell "open" "${TempFileName}" '$R9' SW_SHOWNORMAL
189 IfErrors 0 SetupCompleted
191 ClearErrors
192 ExecShell "" "${TempFileName}" '$R9' SW_SHOWNORMAL
193 IfErrors 0 SetupCompleted
195 ; --------
197 SetDetailsPrint both
198 DetailPrint "Failed to launch installer :-("
199 SetDetailsPrint listonly
201 Abort "Aborted."
203 ; --------
205 SetupCompleted:
207 ${For} $R0 1 5
208 Delete "${TempFileName}"
209 Sleep 333
210 ${Next}
212 Delete /REBOOTOK "${TempFileName}"
213 SectionEnd