/
refineryinstall.nsi
382 lines (310 loc) · 11 KB
/
refineryinstall.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
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
; refineryinstall.nsi
;
; Copyright 2006 Sony Computer Entertainment Inc.
;
; Licensed under the MIT Open Source License, for details please see license.txt or the website
; http://www.opensource.org/licenses/mit-license.php
;
; This script attempts to install an uninstall refinery package.
!include "MUI.nsh"
!include AddToPath.nsh
!include WriteEnvStr.nsh
!include Sections.nsh
;--------------------------------
Name "Refinery Install"
Caption "Refinery Install"
;Icon "${EXEDIR}\icons\collada.ico"
OutFile "..\COLLADA_Refinery_2.1.0.exe"
Var PROGRAM_NAME
SetCompressor /SOLID lzma
InstallDir "$PROGRAMFILES\COLLADA\COLLADA_Refinery"
InstallDirRegKey HKLM "Software\COLLADA_Refinery" "Install_Dir"
;CheckBitmap "${EXEDIR}\icons\classic-cross.bmp"
LicenseText "Pease read the following important information before continuing"
LicenseData "scea-shared-source-lic1.0.txt"
;--------------------------------
; Pages
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_LICENSE "scea-shared-source-lic1.0.txt"
!insertmacro MUI_PAGE_COMPONENTS
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
# These indented statements modify settings for MUI_PAGE_FINISH
!define MUI_FINISHPAGE_NOAUTOCLOSE
!define MUI_FINISHPAGE_RUN
!define MUI_FINISHPAGE_RUN_CHECKED
!define MUI_FINISHPAGE_RUN_TEXT "Start COLLADA Refinery"
!define MUI_FINISHPAGE_RUN_FUNCTION "LaunchRefinery"
!define MUI_FINISHPAGE_SHOWREADME_CHECKED
!define MUI_FINISHPAGE_SHOWREADME_FUNCTION "LaunchReadme"
!define MUI_FINISHPAGE_SHOWREADME $INSTDIR\readme_e.txt
!insertmacro MUI_PAGE_FINISH
;Languages
!insertmacro MUI_LANGUAGE "English"
UninstPage uninstConfirm
UninstPage instfiles
AutoCloseWindow false
;--------------------------------
; Sections
Section "" ; empty string makes it hidden, so would starting with -
StrCpy '$PROGRAM_NAME' "Refinery"
SetOutPath $INSTDIR
WriteRegStr HKLM Software\Refinery "Install_Dir" "$INSTDIR"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Refinery" "DisplayName" "COLLADA Refinery"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Refinery" "UninstallString" '"$INSTDIR\refinery-uninst.exe"'
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Refinery" "NoModify" 1
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Refinery" "NoRepair" 1
WriteUninstaller "refinery-uninst.exe"
SectionEnd
Section "Binaries" Sec1
SetOutPath $INSTDIR\bin\vc8\release
File /r bin\vc8\release\*.dll
File /r bin\vc8\release\*.bat
File /r bin\vc8\release\*.jar
SetOutPath $INSTDIR\icons
File icons\*.*
SetOutPath $INSTDIR\macros
File macros\*.pip
SetOutPath $INSTDIR
File savefiles.xsd
File version.ini
File readme_e.txt
File scea-shared-source-lic1.0.txt
File scea-shared-source-license1.0.pdf
File update.dat
File update.exe
SectionEnd
Section /o "Source" Sec2
Call DetectMSVS
Call DetectJDK
SetOutPath $INSTDIR\bin\vc8\release
File /r bin\vc8\release\*.dll
File /r bin\vc8\release\*.bat
File /r bin\vc8\release\*.jar
SetOutPath $INSTDIR\bin\vc8\debug
File bin\vc8\debug\DevIL.dll
File bin\vc8\debug\iconv.dll
File bin\vc8\debug\libcollada141dom12.dll
File bin\vc8\debug\zip32.dll
File bin\vc8\debug\refinery.bat
SetOutPath $INSTDIR\bin\vc7\release
File bin\vc7\release\DevIL.dll
File bin\vc7\release\iconv.dll
File bin\vc7\release\libcollada141dom12.dll
File bin\vc7\release\zip32.dll
File bin\vc7\release\refinery.bat
SetOutPath $INSTDIR\bin\vc7\debug
File bin\vc7\debug\DevIL.dll
File bin\vc7\debug\iconv.dll
File bin\vc7\debug\libcollada141dom12.dll
File bin\vc7\debug\zip32.dll
File bin\vc7\debug\refinery.bat
SetOutPath $INSTDIR\icons
File icons\*.*
SetOutPath $INSTDIR\macros
File macros\*.*
SetOutPath $INSTDIR\include
File include\*.*
SetOutPath $INSTDIR\projects
File /r projects\*.sln
File /r projects\*.vcproj
SetOutPath $INSTDIR\src
File /r src\*.cpp
File /r src\*.java
File /r src\*.txt
SetOutPath $INSTDIR\external-libs\COLLADA_DOM
File /r /x .svn external-libs\COLLADA_DOM\*.*
SetOutPath $INSTDIR\..\external-libs\devil
File /r /x .svn ..\external-libs\devil\*.*
SetOutPath $INSTDIR\..\external-libs\zip32
File /r /x .svn ..\external-libs\zip32\*.*
SetOutPath $INSTDIR\..\external-libs\libxml2
File /r /x .svn ..\external-libs\libxml2\*.*
SetOutPath $INSTDIR
File savefiles.xsd
File version.ini
File readme_e.txt
File scea-shared-source-lic1.0.txt
File scea-shared-source-license1.0.pdf
File update.dat
File update.exe
SectionEnd
Section "Create short cut" Sec3
SetOutPath "$INSTDIR\bin\vc8\release"
CreateDirectory "$SMPROGRAMS\COLLADA\"
CreateDirectory "$SMPROGRAMS\COLLADA\COLLADA Refinery"
CreateShortCut "$SMPROGRAMS\COLLADA\COLLADA Refinery\Readme.lnk" "$PROGRAMFILES\Windows NT\Accessories\wordpad.exe" "$\"$INSTDIR\readme_e.txt$\"" "$PROGRAMFILES\Windows NT\Accessories\wordpad.exe" 0
CreateShortCut "$SMPROGRAMS\COLLADA\COLLADA Refinery\Refinery.lnk" "$INSTDIR\bin\vc8\release\refinery.bat" "" "$INSTDIR\icons\collada.ico" 0 SW_SHOWMINIMIZED
CreateShortCut "$SMPROGRAMS\COLLADA\COLLADA Refinery\Uninstall.lnk" "$INSTDIR\refinery-uninst.exe" "" "$INSTDIR\refinery-uninst.exe" 0
CreateShortCut "$SMPROGRAMS\COLLADA\COLLADA Refinery\Update.lnk" "$INSTDIR\update.exe" "" "$INSTDIR\update.exe" 0
SectionEnd
Section "Environment Variables" Sec4
ReadEnvStr $3 "COLLADA_EXTERNAL_LIBS_LOCATION"
StrCmp $3 "" 0 ExternalLibsLocDone
Push "COLLADA_EXTERNAL_LIBS_LOCATION"
Push "$INSTDIR\..\external-libs"
Call WriteEnvStr
ExternalLibsLocDone:
Push "PATH"
Push "$INSTDIR\bin\vc8\release"
Call AddToEnvVar
ReadEnvStr $3 "JDK_HOME"
StrCmp $3 "" 0 JdkHomeDone
ReadRegStr $1 HKLM "SOFTWARE\JavaSoft\Java Development Kit" "CurrentVersion"
ReadRegStr $2 HKLM "SOFTWARE\JavaSoft\Java Development Kit\$1" "JavaHome"
Push "JDK_HOME"
Push $2
Call WriteEnvStr
JdkHomeDone:
ReadRegStr $1 HKLM "SOFTWARE\JavaSoft\Java Runtime Environment" "CurrentVersion"
ReadRegStr $2 HKLM "SOFTWARE\JavaSoft\Java Runtime Environment\$1" "JavaHome"
Push "PATH"
Push "$2\bin"
Call AddToEnvVar
SectionEnd
LangString DESC_Section1 ${LANG_ENGLISH} "Everything you need to run COLLADA Refinery"
LangString DESC_Section2 ${LANG_ENGLISH} "All binaries and everything you need to build conditioners and refinery"
LangString DESC_Section3 ${LANG_ENGLISH} "Add short cuts"
LangString DESC_Section4 ${LANG_ENGLISH} "Set environment variables"
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
!insertmacro MUI_DESCRIPTION_TEXT ${Sec1} $(DESC_Section1)
!insertmacro MUI_DESCRIPTION_TEXT ${Sec2} $(DESC_Section2)
!insertmacro MUI_DESCRIPTION_TEXT ${Sec3} $(DESC_Section3)
!insertmacro MUI_DESCRIPTION_TEXT ${Sec4} $(DESC_Section4)
!insertmacro MUI_FUNCTION_DESCRIPTION_END
;--------------------------------
; Uninstaller
UninstallText "This will uninstall Refinery. Click next to continue."
;UninstallIcon "${EXEDIR}\icons\uninstall.ico"
Section "Uninstall"
; Remove registry keys
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Refinery"
DeleteRegKey HKLM Software\Refinery
Push "$INSTDIR"
Push ""
Call un.RmDirsButOne
Delete "$INSTDIR\*.*"
RMDir "$INSTDIR"
; Remove shortcuts, if any
Delete "$SMPROGRAMS\COLLADA\COLLADA Refinery\*.*"
; Remove directories used
RMDir "$SMPROGRAMS\COLLADA\COLLADA Refinery"
RMDir "$SMPROGRAMS\COLLADA"
RMDir "$INSTDIR"
Push "COLLADA_EXTERNAL_LIBS_LOCATION"
Push "$INSTDIR\..\external-libs"
Call un.RemoveFromEnvVar
Push "PATH"
Push "$INSTDIR\bin"
Call un.RemoveFromEnvVar
SectionEnd
;--------------------------------
; Function
Function .onInit
Call DetectJRE
StrCpy '$PROGRAM_NAME' "Refinery"
ReadRegStr $R0 HKLM \
"Software\Microsoft\Windows\CurrentVersion\Uninstall\Refinery" \
"UninstallString"
StrCmp $R0 "" done
MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION \
"Refinery is already installed. $\n$\nClick `OK` to remove the \
previous version or `Cancel` to cancel this upgrade." \
IDOK uninst
Abort
;Run the uninstaller
uninst:
ClearErrors
ExecWait '$R0 _?=$INSTDIR' ;Do not copy the uninstaller to a temp file
IfErrors no_remove_uninstaller
;You can either use Delete /REBOOTOK in the uninstaller or add some code
;here to remove the uninstaller. Use a registry key to check
;whether the user has chosen to uninstall. If you are using an uninstaller
;components page, make sure all sections are uninstalled.
no_remove_uninstaller:
done:
StrCpy $1 ${Sec1} ; Group 1 - Option 1 is selected by default
FunctionEnd
Function .onSelChange
!insertmacro StartRadioButtons $1
!insertmacro RadioButton ${Sec1}
!insertmacro RadioButton ${Sec2}
!insertmacro EndRadioButtons
FunctionEnd
Function un.RmDirsButOne
Exch $R0 ; exclude dir
Exch
Exch $R1 ; route dir
Push $R2
Push $R3
FindFirst $R3 $R2 "$R1\*.*"
IfErrors Exit
Top:
StrCmp $R2 "." Next
StrCmp $R2 ".." Next
StrCmp $R2 $R0 Next
IfFileExists "$R1\$R2\*.*" 0 Next
RmDir /r "$R1\$R2"
#Goto Exit ;uncomment this to stop it being recursive
Next:
ClearErrors
FindNext $R3 $R2
IfErrors Exit
Goto Top
Exit:
FindClose $R3
Pop $R3
Pop $R2
Pop $R1
Pop $R0
FunctionEnd
Function DetectJDK
Push $1
Push $2
ReadRegStr $1 HKLM "SOFTWARE\JavaSoft\Java Development Kit" "CurrentVersion"
StrCmp $1 "" NoFound
ReadRegStr $2 HKLM "SOFTWARE\JavaSoft\Java Development Kit\$1" "JavaHome"
StrCmp $2 "" NoFound
Goto DetectJDKEnd
NoFound:
MessageBox MB_OK "JDK not found, Please install JDK if you want to compile Refinery"
Goto DetectJDKEnd
DetectJDKEnd:
Pop $2
Pop $1
FunctionEnd
Function DetectJRE
Push $1
Push $2
ReadRegStr $1 HKLM "SOFTWARE\JavaSoft\Java Runtime Environment" "CurrentVersion"
StrCmp $1 "" NoFound
ReadRegStr $2 HKLM "SOFTWARE\JavaSoft\Java Runtime Environment\$1" "JavaHome"
StrCmp $2 "" NoFound
Goto DetectJREEnd
NoFound:
MessageBox MB_OK "JRE not found, Please install JRE\nYou can't run Refinery without JRE"
Abort
Goto DetectJREEnd
DetectJREEnd:
Pop $2
Pop $1
FunctionEnd
Function DetectMSVS
Push $1
ReadRegStr $1 HKLM "SOFTWARE\Microsoft\VisualStudio\7.1" "InstallDir"
StrCmp $1 "" NoVS71 DetectMSVSEnd
NoVS71:
ReadRegStr $1 HKLM "SOFTWARE\Microsoft\VisualStudio\8.0" "InstallDir"
StrCmp $1 "" NoVS80 DetectMSVSEnd
NoVS80:
MessageBox MB_OK "Microsoft Visual Studio not found, Please install Microsoft Visual Studio 7.1 or 8.0 if you want to compile"
Goto DetectMSVSEnd
DetectMSVSEnd:
Pop $1
FunctionEnd
Function LaunchRefinery
ExecShell "" "$SMPROGRAMS\COLLADA\COLLADA Refinery\Refinery.lnk"
FunctionEnd
Function LaunchReadme
ExecShell "" "$SMPROGRAMS\COLLADA\COLLADA Refinery\Readme.lnk"
FunctionEnd