2
; $Id: 00.sconsblender.nsi,v 1.7 2005/06/10 08:43:59 jesterking Exp $
4
; Blender Self-Installer for Windows (NSIS - http://nsis.sourceforge.net)
11
!define MUI_ABORTWARNING
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"
21
!insertmacro MUI_PAGE_WELCOME
22
!insertmacro MUI_PAGE_LICENSE "DISTDIR\Copyright.txt"
23
!insertmacro MUI_PAGE_COMPONENTS
25
!insertmacro MUI_PAGE_DIRECTORY
26
Page custom DataLocation
27
!insertmacro MUI_PAGE_INSTFILES
28
!insertmacro MUI_PAGE_FINISH
30
!insertmacro MUI_UNPAGE_WELCOME
31
!insertmacro MUI_UNPAGE_CONFIRM
32
!insertmacro MUI_UNPAGE_INSTFILES
33
!insertmacro MUI_UNPAGE_FINISH
36
Icon "00.installer.ico"
37
UninstallIcon "00.installer.ico"
39
;--------------------------------
42
!insertmacro MUI_LANGUAGE "English"
44
;--------------------------------
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
;--------------------------------
56
Caption "Blender VERSION Installer"
57
OutFile "DISTDIR\..\blender-VERSION-windows.exe"
59
InstallDir "$PROGRAMFILES\Blender Foundation\Blender"
61
BrandingText "http://www.blender.org/bf"
62
ComponentText "This will install Blender VERSION on your computer."
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."
68
; Based on Yazno's function, http://yazno.tripod.com/powerpimpit/
69
; Updated by Joost Verburg
71
; Returns on top of stack
73
; Windows Version (95, 98, ME, NT x.x, 2000, XP, 2003)
75
; '' (Unknown Windows Version)
78
; Call GetWindowsVersion
80
; ; at this point $R0 is "NT 4.0" or whatnot
82
Function GetWindowsVersion
88
"SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion
94
"SOFTWARE\Microsoft\Windows\CurrentVersion" VersionNumber
97
StrCmp $R1 '4' 0 lbl_error
101
StrCmp $R1 '4.0' lbl_win32_95
102
StrCmp $R1 '4.9' lbl_win32_ME lbl_win32_98
120
StrCmp $R1 '3' lbl_winnt_x
121
StrCmp $R1 '4' lbl_winnt_x
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
130
StrCpy $R0 "NT $R0" 6
157
Function SetWinXPPath
158
StrCpy $BLENDERHOME "$PROFILE\Application Data\Blender Foundation\Blender"
161
Function SetWin9xPath
162
StrCpy $BLENDERHOME $INSTDIR
166
Call GetWindowsVersion
168
Strcpy $winversion $R0
169
!insertmacro MUI_INSTALLOPTIONS_EXTRACT "data.ini"
176
Function DataLocation
177
!insertmacro MUI_HEADER_TEXT "$(TEXT_IO_TITLE)" ""
180
!insertmacro MUI_INSTALLOPTIONS_WRITE "data.ini" "Field 3" "State" 1
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
189
Strcpy $is2KXP "false"
194
Strcpy $is2KXP "true"
198
!insertmacro MUI_INSTALLOPTIONS_INITDIALOG "data.ini"
201
Strcmp $is2KXP "true" do_dlg
203
; Disable App Data option on Win9x
205
GetDlgItem $DLGITEM $HWND 1201
206
EnableWindow $DLGITEM 0
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
224
ReadEnvStr $BLENDERHOME "HOME"
232
Section "Blender-VERSION (required)" SecCopyUI
235
; Sets $BLENDERHOME to suit Windows version...
237
; Set output path to the installation directory.
242
SetOutPath $BLENDERHOME\.blender
245
SetOutPath $BLENDERHOME\.blender\scripts
247
SetOutPath $BLENDERHOME\.blender\scripts\bpymodules
249
SetOutPath $BLENDERHOME\.blender\scripts\bpydata
251
SetOutPath $BLENDERHOME\.blender\scripts\bpydata\config
254
SetOutPath $BLENDERHOME\plugins\include
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"
269
Section "Add Start Menu shortcuts" Section2
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"
280
Section "Add Desktop Blender-VERSION shortcut" Section3
282
CreateShortCut "$DESKTOP\Blender.lnk" "$INSTDIR\blender.exe" "" "$INSTDIR\blender.exe" 0
285
Section "Open .blend files with Blender-VERSION" Section4
287
;ExecShell "open" '"$INSTDIR\blender.exe"' "-R -b"
288
;do it the manual way! ;)
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"'
299
UninstallText "This will uninstall Blender VERSION. Hit next to continue."
302
; remove registry keys
303
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Blender"
304
DeleteRegKey HKLM SOFTWARE\BlenderFoundation
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"
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