-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathvdrift.nsi
308 lines (239 loc) · 10.3 KB
/
vdrift.nsi
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
; basic script template for NSIS installers
;
; Written by Philip Chu
; Copyright (c) 2004-2005 Technicat, LLC
;
; This software is provided 'as-is', without any express or implied warranty.
; In no event will the authors be held liable for any damages arising from the use of this software.
; Permission is granted to anyone to use this software for any purpose,
; including commercial applications, and to alter it ; and redistribute
; it freely, subject to the following restrictions:
; 1. The origin of this software must not be misrepresented; you must not claim that
; you wrote the original software. If you use this software in a product, an
; acknowledgment in the product documentation would be appreciated but is not required.
; 2. Altered source versions must be plainly marked as such, and must not be
; misrepresented as being the original software.
; 3. This notice may not be removed or altered from any source distribution.
; this file is edited and optimized to work for Vdrift
SetCompressor /FINAL /SOLID lzma
SetCompressorDictSize 64
!define version "2012-07-22"
!define setup "vdrift-${version}.exe"
; change this to wherever the files to be packaged reside
!define srcdir ".."
;!define company "VDrift"
!define prodname "VDrift"
!define exec "vdrift.exe"
!define website "http://vdrift.net"
; optional stuff
; text file to open in notepad after installation
; !define notefile "docs\README"
; license text file
!define licensefile "LICENSE"
; icons must be Microsoft .ICO files
; !define icon "tools\win\VDrift.ico"
; installer background screen
; !define screenimage background.bmp
; file containing list of file-installation commands
; !define files "files.nsi"
; file containing list of file-uninstall commands
; !define unfiles "unfiles.nsi"
!define header "header.bmp"
!define welcome_installer "welcome-installer.bmp"
!define welcome_uninstaller "welcome-uninstaller.bmp"
; registry stuff
!define regkey "Software\${prodname}"
!define uninstkey "Software\Microsoft\Windows\CurrentVersion\Uninstall\${prodname}"
!define startmenu "$SMPROGRAMS\${prodname}"
!define uninstaller "uninstall.exe"
;--------------------------------
!include "MUI.nsh"
XPStyle on
ShowInstDetails hide
ShowUninstDetails hide
Name "${prodname}"
Caption "${prodname}"
!ifdef icon
Icon "${srcdir}\${icon}"
!endif
OutFile "${setup}"
SetDateSave on
SetDatablockOptimize on
CRCCheck on
SilentInstall normal
InstallDir "$PROGRAMFILES\${prodname}"
InstallDirRegKey HKLM "${regkey}" ""
;--------------------------------
;Interface Settings
!define MUI_ABORTWARNING
!define MUI_LICENSEPAGE_RADIOBUTTONS
!define MUI_HEADERIMAGE
!define MUI_HEADERIMAGE_BITMAP ${header}
!define MUI_HEADERIMAGE_RIGHT
!define MUI_HEADERIMAGE_BITMAP_NOSTRETCH
!define MUI_WELCOMEFINISHPAGE_BITMAP ${welcome_installer}
!define MUI_UNWELCOMEFINISHPAGE_BITMAP ${welcome_uninstaller}
;--------------------------------
;Pages
!insertmacro MUI_PAGE_WELCOME
!ifdef licensefile
!insertmacro MUI_PAGE_LICENSE "${srcdir}\${licensefile}"
!endif
!insertmacro MUI_PAGE_COMPONENTS
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
!define MUI_FINISHPAGE_RUN "$INSTDIR\${exec}"
!insertmacro MUI_PAGE_FINISH
!insertmacro MUI_UNPAGE_WELCOME
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
!insertmacro MUI_UNPAGE_FINISH
;Languages
!insertmacro MUI_LANGUAGE "English"
;--------------------------------
AutoCloseWindow false
ShowInstDetails show
; beginning (invisible) section
Section "Install VDrift" SEC_VDRIFT
SectionIn RO ; The user can't disable it
WriteRegStr HKLM "${regkey}" "Install_Dir" "$INSTDIR"
; write uninstall strings
WriteRegStr HKLM "${uninstkey}" "DisplayName" "${prodname} (remove only)"
WriteRegStr HKLM "${uninstkey}" "UninstallString" '"$INSTDIR\${uninstaller}"'
!ifdef filetype
WriteRegStr HKCR "${filetype}" "" "${prodname}"
!endif
WriteRegStr HKCR "${prodname}\Shell\open\command\" "" '"$INSTDIR\${exec} "%1"'
!ifdef icon
WriteRegStr HKCR "${prodname}\DefaultIcon" "" "$INSTDIR\${icon}"
!endif
SetOutPath $INSTDIR
; package all files, recursively, preserving attributes
; assume files are in the correct places
File /a "${srcdir}\${exec}"
File /a /oname=glew32.dll "${srcdir}\glew32.dll"
File /a /oname=libarchive-2.dll "${srcdir}\libarchive-2.dll"
File /a /oname=libbz2-2.dll "${srcdir}\libbz2-2.dll"
File /a /oname=libcurl.dll "${srcdir}\libcurl.dll"
File /a /oname=libexpat-1.dll "${srcdir}\libexpat-1.dll"
File /a /oname=libgcc_s_dw2-1.dll "${srcdir}\libgcc_s_dw2-1.dll"
File /a /oname=liblzma-1.dll "${srcdir}\liblzma-1.dll"
File /a /oname=libpng15-15.dll "${srcdir}\libpng15-15.dll"
File /a /oname=libz-1.dll "${srcdir}\libz-1.dll"
File /a /oname=ogg.dll "${srcdir}\ogg.dll"
File /a /oname=SDL2.dll "${srcdir}\SDL2.dll"
File /a /oname=SDL2_gfx.dll "${srcdir}\SDL2_gfx.dll"
File /a /oname=SDL2_image.dll "${srcdir}\SDL2_image.dll"
File /a /oname=vorbis.dll "${srcdir}\vorbis.dll"
File /a /oname=vorbisfile.dll "${srcdir}\vorbisfile.dll"
File /a /oname=zlib1.dll "${srcdir}\zlib1.dll"
File /a "VDrift.ico"
!ifdef licensefile
File /a /oname=license.txt "${srcdir}\${licensefile}"
!endif
!ifdef notefile
File /a /oname=readme.txt "${srcdir}\${notefile}"
!endif
!ifdef icon
File /a "${srcdir}\${icon}"
!endif
SetOutPath "$INSTDIR\data"
File /a /r /x .* /x SConscript /x vdrift-*x*.png /x cars /x tracks "${srcdir}\data\"
SetOutPath "$INSTDIR\data\cars"
File /a /r /x .* /x SConscript /x vdrift-*x*.png "${srcdir}\data\cars\350Z"
File /a /r /x .* /x SConscript /x vdrift-*x*.png "${srcdir}\data\cars\360"
File /a /r /x .* /x SConscript /x vdrift-*x*.png "${srcdir}\data\cars\ATT"
File /a /r /x .* /x SConscript /x vdrift-*x*.png "${srcdir}\data\cars\CO"
File /a /r /x .* /x SConscript /x vdrift-*x*.png "${srcdir}\data\cars\CS"
File /a /r /x .* /x SConscript /x vdrift-*x*.png "${srcdir}\data\cars\F1-02"
File /a /r /x .* /x SConscript /x vdrift-*x*.png "${srcdir}\data\cars\G4"
File /a /r /x .* /x SConscript /x vdrift-*x*.png "${srcdir}\data\cars\LE"
File /a /r /x .* /x SConscript /x vdrift-*x*.png "${srcdir}\data\cars\M7"
File /a /r /x .* /x SConscript /x vdrift-*x*.png "${srcdir}\data\cars\MC"
File /a /r /x .* /x SConscript /x vdrift-*x*.png "${srcdir}\data\cars\MI"
File /a /r /x .* /x SConscript /x vdrift-*x*.png "${srcdir}\data\cars\SV"
File /a /r /x .* /x SConscript /x vdrift-*x*.png "${srcdir}\data\cars\T73"
File /a /r /x .* /x SConscript /x vdrift-*x*.png "${srcdir}\data\cars\TC6"
File /a /r /x .* /x SConscript /x vdrift-*x*.png "${srcdir}\data\cars\TL2"
File /a /r /x .* /x SConscript /x vdrift-*x*.png "${srcdir}\data\cars\XS"
SetOutPath "$INSTDIR\data\tracks"
File /a /r /x .* /x SConscript /x vdrift-*x*.png "${srcdir}\data\tracks\bahrain"
File /a /r /x .* /x SConscript /x vdrift-*x*.png "${srcdir}\data\tracks\estoril88"
File /a /r /x .* /x SConscript /x vdrift-*x*.png "${srcdir}\data\tracks\garage"
;File /a /r /x .* /x SConscript /x vdrift-*x*.png "${srcdir}\data\tracks\hungaroring06"
File /a /r /x .* /x SConscript /x vdrift-*x*.png "${srcdir}\data\tracks\jerez88"
File /a /r /x .* /x SConscript /x vdrift-*x*.png "${srcdir}\data\tracks\lemans"
File /a /r /x .* /x SConscript /x vdrift-*x*.png "${srcdir}\data\tracks\monaco88"
File /a /r /x .* /x SConscript /x vdrift-*x*.png "${srcdir}\data\tracks\monza88"
File /a /r /x .* /x SConscript /x vdrift-*x*.png "${srcdir}\data\tracks\paulricard88"
;File /a /r /x .* /x SConscript /x vdrift-*x*.png "${srcdir}\data\tracks\weekend"
File /a /r /x .* /x SConscript /x vdrift-*x*.png "${srcdir}\data\tracks\rouen"
;File /a /r /x .* /x SConscript /x vdrift-*x*.png "${srcdir}\data\tracks\vir"
SetOutPath $INSTDIR
File /a /oname=data\textures\icons\vdrift-16x16.png "${srcdir}\data\textures\icons\vdrift-16x16-windows.png"
File /a /oname=data\textures\icons\vdrift-32x32.png "${srcdir}\data\textures\icons\vdrift-32x32-windows.png"
File /a /oname=data\textures\icons\vdrift-64x64.png "${srcdir}\data\textures\icons\vdrift-64x64-windows.png"
;File /a /oname=data\tracks\track_list.txt "${srcdir}\data\tracks\track_list.txt.full"
;File /a /oname=data\cars\car_list.txt "${srcdir}\data\cars\car_list.txt.full"
; any application-specific files
!ifdef files
!include "${files}"
!endif
WriteUninstaller "${uninstaller}"
SectionEnd
; create shortcuts
Section "Create shortcuts" SEC_SHORTCUTS
SectionSetText "shortcuts" "This adds shourtcuts on the desktop and in the Startmenu"
CreateDirectory "${startmenu}"
SetOutPath $INSTDIR ; for working directory
!ifdef icon
CreateShortCut "${startmenu}\${prodname}.lnk" "$INSTDIR\${exec}" "" "$INSTDIR\${icon}"
!else
CreateShortCut "${startmenu}\${prodname}.lnk" "$INSTDIR\${exec}"
!endif
CreateShortCut "${startmenu}\Uninstaller.lnk" "$INSTDIR\${uninstaller}"
!ifdef notefile
CreateShortCut "${startmenu}\Release Notes.lnk "$INSTDIR\${notefile}"
!endif
!ifdef helpfile
CreateShortCut "${startmenu}\Documentation.lnk "$INSTDIR\${helpfile}"
!endif
!ifdef website
WriteINIStr "${startmenu}\web site.url" "InternetShortcut" "URL" ${website}
; CreateShortCut "${startmenu}\Web Site.lnk "${website}" "URL"
!endif
!ifdef notefile
ExecShell "open" "$INSTDIR\${notefile}"
!endif
SectionEnd
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
!insertmacro MUI_DESCRIPTION_TEXT ${SEC_VDRIFT} "The base VDrift package"
!insertmacro MUI_DESCRIPTION_TEXT ${SEC_SHORTCUTS} "Adds shortcuts to the Desktop and startmenu"
!insertmacro MUI_FUNCTION_DESCRIPTION_END
; Uninstaller
; All section names prefixed by "Un" will be in the uninstaller
UninstallText "This will uninstall ${prodname}."
!ifdef icon
UninstallIcon "${srcdir}\${icon}"
!endif
Section "Uninstall"
DeleteRegKey HKLM "${uninstkey}"
DeleteRegKey HKLM "${regkey}"
Delete "${startmenu}\*.*"
RMDir /r "${startmenu}\"
!ifdef licensefile
Delete "$INSTDIR\${licensefile}"
!endif
!ifdef notefile
Delete "$INSTDIR\${notefile}"
!endif
!ifdef icon
Delete "$INSTDIR\${icon}"
!endif
Delete "$INSTDIR\${exec}"
Delete "$INSTDIR\*"
RMDir /r "$INSTDIR\"
!ifdef unfiles
!include "${unfiles}"
!endif
SectionEnd