forked from HaxeFoundation/haxe
-
Notifications
You must be signed in to change notification settings - Fork 3
/
installer.nsi
190 lines (126 loc) · 4.79 KB
/
installer.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
; Haxe/Neko Install script
; Instructions:
; - put haxe files in resources/haxe
; - put neko files in resources/neko
; - run
;--------------------------------
!include "MUI.nsh"
!include "LogicLib.nsh"
!include "WordFunc.nsh"
!include "winmessages.nsh"
!include "EnvVarUpdate.nsh"
;--------------------------------
; Define version info
!define VERSION "%%VERSION%%"
!define VERSTRING "%%VERSTRING%%"
!define VERLONG "%%VERLONG%%"
; Define Neko info
!define NEKO_VERSION "2.0.0"
; Installer details
VIAddVersionKey "CompanyName" "Haxe Foundation"
VIAddVersionKey "ProductName" "Haxe Installer"
VIAddVersionKey "LegalCopyright" "Haxe Foundation 2005-2013"
VIAddVersionKey "FileDescription" "Haxe Installer"
VIAddVersionKey "ProductVersion" "${VERSION}.0"
VIAddVersionKey "FileVersion" "${VERSION}.0"
VIProductVersion "${VERSION}.0"
; The name of the installer
Name "Haxe ${VERSTRING}"
; The captions of the installer
Caption "Haxe ${VERLONG} Setup"
UninstallCaption "Haxe ${VERLONG} Uninstall"
; The file to write
OutFile "haxe-${VERSTRING}-win.exe"
; Default installation folder
InstallDir "C:\HaxeToolkit\"
; Define executable files
!define EXECUTABLE "$INSTDIR\haxe\haxe.exe"
!define HaxeLIB "$INSTDIR\Haxe\haxelib.exe"
!define NEKOEXE "$INSTDIR\neko\neko.exe"
; Vista redirects $SMPROGRAMS to all users without this
RequestExecutionLevel admin
; Use replace and version compare
!insertmacro WordReplace
!insertmacro VersionCompare
; Required props
SetFont /LANG=${LANG_ENGLISH} "Tahoma" 8
SetCompressor /SOLID lzma
CRCCheck on
XPStyle on
;--------------------------------
; Interface Configuration
!define MUI_HEADERIMAGE
!define MUI_ABORTWARNING
!define MUI_HEADERIMAGE_BITMAP "images\Banner.bmp"
!define MUI_WELCOMEFINISHPAGE_BITMAP "images\Wizard.bmp"
!define MUI_UNWELCOMEFINISHPAGE_BITMAP "images\Wizard.bmp"
!define MUI_PAGE_HEADER_SUBTEXT "Please view the license before installing Haxe ${VERLONG}."
!define MUI_WELCOMEPAGE_TEXT "This wizard will guide you through the installation of $(^NameDA).\r\n\r\nIt is recommended that you close all other applications before starting Setup. This will make it possible to update relevant system files without having to reboot your computer.\r\n\r\n$_CLICK"
;--------------------------------
; Pages
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_COMPONENTS
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_PAGE_FINISH
!insertmacro MUI_UNPAGE_WELCOME
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_COMPONENTS
!insertmacro MUI_UNPAGE_INSTFILES
!insertmacro MUI_UNPAGE_FINISH
!insertmacro MUI_LANGUAGE "English"
;--------------------------------
; InstallTypes
InstType "Default"
InstType "un.Default"
InstType "un.Full"
;--------------------------------
; Functions
Function .onInit
FunctionEnd
;--------------------------------
; Install Sections
!define env_hklm 'HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"'
!define env_hkcu 'HKCU "Environment"'
Section "Haxe ${VERSION}" Main
SectionIn 1 2 RO
SetOverwrite on
RMDir /r /REBOOTOK "$INSTDIR\haxe\std"
SetOutPath "$INSTDIR\haxe"
File /r /x .svn /x *.db /x Exceptions.log /x .local /x .multi /x *.pdb /x *.vshost.exe /x *.vshost.exe.config /x *.vshost.exe.manifest "resources\haxe\*.*"
ExecWait "$INSTDIR\haxe\haxesetup.exe -silent"
WriteUninstaller "$INSTDIR\Uninstall.exe"
SectionEnd
Section "Neko ${NEKO_VERSION}" Neko
SectionIn 1 2
SetOverwrite on
SetOutPath "$INSTDIR\neko"
File /r /x .svn /x *.db /x Exceptions.log /x .local /x .multi /x *.pdb /x *.vshost.exe /x *.vshost.exe.config /x *.vshost.exe.manifest "resources\neko\*.*"
SectionEnd
;--------------------------------
; Install section strings
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
!insertmacro MUI_DESCRIPTION_TEXT ${Main} "Installs Haxe and other core files."
!insertmacro MUI_DESCRIPTION_TEXT ${Neko} "Installs Neko, which is required by various Haxe tools."
!insertmacro MUI_FUNCTION_DESCRIPTION_END
;--------------------------------
; Uninstall Sections
Section "un.Haxe" UninstMain
RMDir /r "$INSTDIR\haxe"
${un.EnvVarUpdate} $0 "PATH" "R" "HKLM" "%HAXEPATH%"
DeleteRegValue ${env_hklm} HAXEPATH
SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000
SectionEnd
Section "un.Neko" UninstNeko
RMDir /r "$INSTDIR\neko"
${un.EnvVarUpdate} $0 "PATH" "R" "HKLM" "%NEKO_INSTPATH%"
DeleteRegValue ${env_hklm} NEKO_INSTPATH
SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000
SectionEnd
;--------------------------------
; Uninstall section strings
!insertmacro MUI_UNFUNCTION_DESCRIPTION_BEGIN
!insertmacro MUI_DESCRIPTION_TEXT ${UninstMain} "Uninstalls Haxe and other core files."
!insertmacro MUI_DESCRIPTION_TEXT ${UninstNeko} "Uninstalls Neko."
!insertmacro MUI_UNFUNCTION_DESCRIPTION_END
;--------------------------------