~ubuntu-branches/ubuntu/gutsy/blender/gutsy-security

« back to all changes in this revision

Viewing changes to release/windows/installer/00.sconsblender.nsi

  • Committer: Bazaar Package Importer
  • Author(s): Florian Ernst
  • Date: 2005-11-06 12:40:03 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20051106124003-3pgs7tcg5rox96xg
Tags: 2.37a-1.1
* Non-maintainer upload.
* Split out parts of 01_SConstruct_debian.dpatch again: root_build_dir
  really needs to get adjusted before the clean target runs - closes: #333958,
  see #288882 for reference

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
;
 
2
; $Id: 00.sconsblender.nsi,v 1.7 2005/06/10 08:43:59 jesterking Exp $
 
3
;
 
4
; Blender Self-Installer for Windows (NSIS - http://nsis.sourceforge.net)
 
5
;
 
6
 
 
7
!include "MUI.nsh"
 
8
 
 
9
Name "Blender VERSION" 
 
10
 
 
11
!define MUI_ABORTWARNING
 
12
 
 
13
!define MUI_WELCOMEPAGE_TEXT  "This wizard will guide you through the installation of Blender.\r\n\r\nIt is recommended that you close all other applications before starting Setup.\r\n\r\nNote to Win2k/XP users: You may require administrator privileges to install Blender successfully."
 
14
!define MUI_WELCOMEFINISHPAGE_BITMAP "01.installer.bmp"
 
15
!define MUI_HEADERIMAGE
 
16
!define MUI_HEADERIMAGE_BITMAP  "00.header.bmp"
 
17
!define MUI_COMPONENTSPAGE_SMALLDESC
 
18
!define MUI_FINISHPAGE_RUN "$INSTDIR\blender.exe"
 
19
!define MUI_CHECKBITMAP "00.checked.bmp"
 
20
 
 
21
!insertmacro MUI_PAGE_WELCOME
 
22
!insertmacro MUI_PAGE_LICENSE "DISTDIR\Copyright.txt"
 
23
!insertmacro MUI_PAGE_COMPONENTS
 
24
    
 
25
!insertmacro MUI_PAGE_DIRECTORY
 
26
Page custom DataLocation
 
27
!insertmacro MUI_PAGE_INSTFILES
 
28
!insertmacro MUI_PAGE_FINISH
 
29
  
 
30
!insertmacro MUI_UNPAGE_WELCOME
 
31
!insertmacro MUI_UNPAGE_CONFIRM
 
32
!insertmacro MUI_UNPAGE_INSTFILES
 
33
!insertmacro MUI_UNPAGE_FINISH
 
34
 
 
35
 
 
36
Icon "00.installer.ico"
 
37
UninstallIcon "00.installer.ico"
 
38
 
 
39
;--------------------------------
 
40
;Languages
 
41
 
 
42
  !insertmacro MUI_LANGUAGE "English"
 
43
    
 
44
;--------------------------------
 
45
;Language Strings
 
46
 
 
47
  ;Description
 
48
  LangString DESC_SecCopyUI ${LANG_ENGLISH} "Copy all required files to the application folder."
 
49
  LangString DESC_Section2 ${LANG_ENGLISH} "Add shortcut items to the Start Menu. (Recommended)"
 
50
  LangString DESC_Section3 ${LANG_ENGLISH} "Add a shortcut to Blender on your desktop."
 
51
  LangString DESC_Section4 ${LANG_ENGLISH} "Blender can register itself with .blend files to allow double-clicking from Windows Explorer, etc."
 
52
  LangString TEXT_IO_TITLE ${LANG_ENGLISH} "Specify User Data Location"
 
53
;--------------------------------
 
54
;Data
 
55
 
 
56
Caption "Blender VERSION Installer"
 
57
OutFile "DISTDIR\..\blender-VERSION-windows.exe"
 
58
 
 
59
InstallDir "$PROGRAMFILES\Blender Foundation\Blender"
 
60
 
 
61
BrandingText "http://www.blender.org/bf"
 
62
ComponentText "This will install Blender VERSION on your computer."
 
63
 
 
64
DirText "Use the field below to specify the folder where you want Blender to be copied to. To specify a different folder, type a new name or use the Browse button to select an existing folder."
 
65
 
 
66
; GetWindowsVersion
 
67
;
 
68
; Based on Yazno's function, http://yazno.tripod.com/powerpimpit/
 
69
; Updated by Joost Verburg
 
70
;
 
71
; Returns on top of stack
 
72
;
 
73
; Windows Version (95, 98, ME, NT x.x, 2000, XP, 2003)
 
74
; or
 
75
; '' (Unknown Windows Version)
 
76
;
 
77
; Usage:
 
78
;   Call GetWindowsVersion
 
79
;   Pop $R0
 
80
;   ; at this point $R0 is "NT 4.0" or whatnot
 
81
 
 
82
Function GetWindowsVersion
 
83
 
 
84
  Push $R0
 
85
  Push $R1
 
86
 
 
87
  ReadRegStr $R0 HKLM \
 
88
  "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion
 
89
 
 
90
  IfErrors 0 lbl_winnt
 
91
   
 
92
  ; we are not NT
 
93
  ReadRegStr $R0 HKLM \
 
94
  "SOFTWARE\Microsoft\Windows\CurrentVersion" VersionNumber
 
95
 
 
96
  StrCpy $R1 $R0 1
 
97
  StrCmp $R1 '4' 0 lbl_error
 
98
 
 
99
  StrCpy $R1 $R0 3
 
100
 
 
101
  StrCmp $R1 '4.0' lbl_win32_95
 
102
  StrCmp $R1 '4.9' lbl_win32_ME lbl_win32_98
 
103
 
 
104
  lbl_win32_95:
 
105
    StrCpy $R0 '95'
 
106
  Goto lbl_done
 
107
 
 
108
  lbl_win32_98:
 
109
    StrCpy $R0 '98'
 
110
  Goto lbl_done
 
111
 
 
112
  lbl_win32_ME:
 
113
    StrCpy $R0 'ME'
 
114
  Goto lbl_done
 
115
 
 
116
  lbl_winnt:
 
117
 
 
118
  StrCpy $R1 $R0 1
 
119
 
 
120
  StrCmp $R1 '3' lbl_winnt_x
 
121
  StrCmp $R1 '4' lbl_winnt_x
 
122
 
 
123
  StrCpy $R1 $R0 3
 
124
 
 
125
  StrCmp $R1 '5.0' lbl_winnt_2000
 
126
  StrCmp $R1 '5.1' lbl_winnt_XP
 
127
  StrCmp $R1 '5.2' lbl_winnt_2003 lbl_error
 
128
 
 
129
  lbl_winnt_x:
 
130
    StrCpy $R0 "NT $R0" 6
 
131
  Goto lbl_done
 
132
 
 
133
  lbl_winnt_2000:
 
134
    Strcpy $R0 '2000'
 
135
  Goto lbl_done
 
136
 
 
137
  lbl_winnt_XP:
 
138
    Strcpy $R0 'XP'
 
139
  Goto lbl_done
 
140
 
 
141
  lbl_winnt_2003:
 
142
    Strcpy $R0 '2003'
 
143
  Goto lbl_done
 
144
 
 
145
  lbl_error:
 
146
    Strcpy $R0 ''
 
147
  lbl_done:
 
148
 
 
149
  Pop $R1
 
150
  Exch $R0
 
151
 
 
152
FunctionEnd
 
153
 
 
154
Var BLENDERHOME
 
155
Var winversion
 
156
 
 
157
Function SetWinXPPath
 
158
  StrCpy $BLENDERHOME "$PROFILE\Application Data\Blender Foundation\Blender"
 
159
FunctionEnd
 
160
 
 
161
Function SetWin9xPath
 
162
  StrCpy $BLENDERHOME $INSTDIR
 
163
FunctionEnd
 
164
 
 
165
Function .onInit
 
166
  Call GetWindowsVersion
 
167
  Pop $R0
 
168
  Strcpy $winversion $R0
 
169
  !insertmacro MUI_INSTALLOPTIONS_EXTRACT "data.ini"
 
170
FunctionEnd
 
171
 
 
172
Var HWND
 
173
Var DLGITEM
 
174
Var is2KXP
 
175
 
 
176
Function DataLocation
 
177
  !insertmacro MUI_HEADER_TEXT "$(TEXT_IO_TITLE)" ""
 
178
 
 
179
  ; Set default choice
 
180
  !insertmacro MUI_INSTALLOPTIONS_WRITE "data.ini" "Field 3" "State" 1
 
181
  
 
182
  StrCpy $R1 $winversion 2
 
183
  StrCmp $R1 "NT" do_win2kxp
 
184
  StrCmp $winversion "2000" do_win2kxp
 
185
  StrCmp $winversion "XP" do_win2kxp
 
186
  StrCmp $winversion "2003" do_win2kxp
 
187
  
 
188
  ;else...
 
189
  Strcpy $is2KXP "false"
 
190
 
 
191
  Goto continue
 
192
 
 
193
  do_win2kXP:
 
194
    Strcpy $is2KXP "true"
 
195
    
 
196
  continue: 
 
197
  
 
198
  !insertmacro MUI_INSTALLOPTIONS_INITDIALOG "data.ini"
 
199
  Pop $HWND
 
200
  
 
201
  Strcmp $is2KXP "true" do_dlg
 
202
  
 
203
  ; Disable App Data option on Win9x
 
204
  
 
205
  GetDlgItem $DLGITEM $HWND 1201
 
206
  EnableWindow $DLGITEM 0  
 
207
  
 
208
  do_dlg:
 
209
  
 
210
    !insertmacro MUI_INSTALLOPTIONS_SHOW
 
211
    !insertmacro MUI_INSTALLOPTIONS_READ $R0 "data.ini" "Field 2" "State" ; App Dir
 
212
    Strcmp $R0 1 do_app_data
 
213
    !insertmacro MUI_INSTALLOPTIONS_READ $R0 "data.ini" "Field 3" "State" ; Inst Dir
 
214
    Strcmp $R0 1 do_inst_path
 
215
    !insertmacro MUI_INSTALLOPTIONS_READ $R0 "data.ini" "Field 4" "State" ; Home Dir
 
216
    Strcmp $R0 1 do_home_path
 
217
  
 
218
  Goto end
 
219
  
 
220
  do_app_data:
 
221
    Call SetWinXPPath
 
222
    Goto end
 
223
  do_home_path:
 
224
    ReadEnvStr $BLENDERHOME "HOME"
 
225
    Goto end
 
226
  do_inst_path:
 
227
    Call SetWin9xPath
 
228
  end:
 
229
  
 
230
FunctionEnd
 
231
 
 
232
Section "Blender-VERSION (required)" SecCopyUI
 
233
  SectionIn RO
 
234
    
 
235
; Sets $BLENDERHOME to suit Windows version...
 
236
 
 
237
  ; Set output path to the installation directory.
 
238
  SetOutPath $INSTDIR
 
239
  ; Put file there
 
240
 [ROOTDIRCONTS]
 
241
     
 
242
  SetOutPath $BLENDERHOME\.blender
 
243
  [DOTBLENDERCONTS]
 
244
  
 
245
  SetOutPath $BLENDERHOME\.blender\scripts
 
246
  [SCRIPTCONTS]
 
247
  SetOutPath $BLENDERHOME\.blender\scripts\bpymodules
 
248
  [SCRIPTMODCONTS]
 
249
  SetOutPath $BLENDERHOME\.blender\scripts\bpydata
 
250
  [SCRIPTDATACONTS]
 
251
  SetOutPath $BLENDERHOME\.blender\scripts\bpydata\config
 
252
  [SCRIPTDATACFGCONTS]
 
253
  
 
254
  SetOutPath $BLENDERHOME\plugins\include
 
255
  [PLUGINCONTS]
 
256
  
 
257
  ; Language files
 
258
  [LANGUAGECONTS]
 
259
  
 
260
  SetOutPath $INSTDIR
 
261
  ; Write the installation path into the registry
 
262
  WriteRegStr HKLM SOFTWARE\BlenderFoundation "Install_Dir" "$INSTDIR"
 
263
  ; Write the uninstall keys for Windows
 
264
  WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Blender" "DisplayName" "Blender (remove only)"
 
265
  WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Blender" "UninstallString" '"$INSTDIR\uninstall.exe"'
 
266
  WriteUninstaller "uninstall.exe"
 
267
SectionEnd
 
268
 
 
269
Section "Add Start Menu shortcuts" Section2
 
270
  SetOutPath $INSTDIR
 
271
  CreateDirectory "$SMPROGRAMS\Blender Foundation\Blender\"
 
272
  CreateShortCut "$SMPROGRAMS\Blender Foundation\Blender\Uninstall.lnk" "$INSTDIR\uninstall.exe" "" "$INSTDIR\uninstall.exe" 0
 
273
  CreateShortCut "$SMPROGRAMS\Blender Foundation\Blender\Blender.lnk" "$INSTDIR\Blender.exe" "" "$INSTDIR\blender.exe" 0
 
274
  CreateShortCut "$SMPROGRAMS\Blender Foundation\Blender\Readme.lnk" "$INSTDIR\Blender.html" "" "" 0
 
275
  CreateShortCut "$SMPROGRAMS\Blender Foundation\Blender\Copyright.lnk" "$INSTDIR\Copyright.txt" "" "$INSTDIR\copyright.txt" 0
 
276
  CreateShortCut "$SMPROGRAMS\Blender Foundation\Blender\GPL-license.lnk" "$INSTDIR\GPL-license.txt" "" "$INSTDIR\GPL-license.txt" 0
 
277
  CreateShortCut "$SMPROGRAMS\Blender Foundation\Blender\Help.lnk" "$INSTDIR\Help.url"
 
278
SectionEnd
 
279
 
 
280
Section "Add Desktop Blender-VERSION shortcut" Section3
 
281
  SetOutPath $INSTDIR
 
282
  CreateShortCut "$DESKTOP\Blender.lnk" "$INSTDIR\blender.exe" "" "$INSTDIR\blender.exe" 0
 
283
SectionEnd
 
284
 
 
285
Section "Open .blend files with Blender-VERSION" Section4
 
286
  SetOutPath $INSTDIR
 
287
  ;ExecShell "open" '"$INSTDIR\blender.exe"' "-R -b"
 
288
  ;do it the manual way! ;)
 
289
  
 
290
  WriteRegStr HKCR ".blend" "" "blendfile"
 
291
  WriteRegStr HKCR "blendfile" "" "Blender .blend File"
 
292
  WriteRegStr HKCR "blendfile\shell" "" "open"
 
293
  WriteRegStr HKCR "blendfile\DefaultIcon" "" $INSTDIR\blender.exe,1
 
294
  WriteRegStr HKCR "blendfile\shell\open\command" "" \
 
295
    '"$INSTDIR\blender.exe" "%1"'
 
296
  
 
297
SectionEnd
 
298
 
 
299
UninstallText "This will uninstall Blender VERSION. Hit next to continue."
 
300
 
 
301
Section "Uninstall"
 
302
  ; remove registry keys
 
303
  DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Blender"
 
304
  DeleteRegKey HKLM SOFTWARE\BlenderFoundation
 
305
  ; remove files
 
306
  [DELROOTDIRCONTS]
 
307
  
 
308
  Delete $INSTDIR\.blender\.bfont.ttf
 
309
  Delete $INSTDIR\.blender\.Blanguages
 
310
  ; remove shortcuts, if any.
 
311
  Delete "$SMPROGRAMS\Blender Foundation\Blender\*.*"
 
312
  Delete "$DESKTOP\Blender.lnk"
 
313
  ; remove directories used.
 
314
  RMDir /r $INSTDIR\.blender\locale 
 
315
  RMDir /r $INSTDIR\.blender\scripts
 
316
  RMDir /r $INSTDIR\.blender\scripts\bpymodules
 
317
  RMDir /r $INSTDIR\.blender\scripts\bpydata
 
318
  RMDir /r $INSTDIR\.blender\scripts\bpydata\config
 
319
  RMDir /r $INSTDIR\plugins\include
 
320
  RMDir /r $INSTDIR\plugins
 
321
  RMDir $INSTDIR\.blender
 
322
  RMDir "$SMPROGRAMS\Blender Foundation\Blender"
 
323
  RMDir "$SMPROGRAMS\Blender Foundation"
 
324
  RMDir "$INSTDIR"
 
325
  RMDir "$INSTDIR\.."
 
326
SectionEnd
 
327
 
 
328
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
 
329
  !insertmacro MUI_DESCRIPTION_TEXT ${SecCopyUI} $(DESC_SecCopyUI)
 
330
  !insertmacro MUI_DESCRIPTION_TEXT ${Section2} $(DESC_Section2)
 
331
  !insertmacro MUI_DESCRIPTION_TEXT ${Section3} $(DESC_Section3)
 
332
  !insertmacro MUI_DESCRIPTION_TEXT ${Section4} $(DESC_Section4)
 
333
!insertmacro MUI_FUNCTION_DESCRIPTION_END