blob: 91c61e912e56899ac343cc3b6ee33da5b548bfef (
about) (
plain) (
blame)
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
|
;NSIS Install Script for KVIrc
;Created by Alexey, based on script contributed by Alvis
!include "MUI.nsh"
!include "WinMessages.nsh"
!include "LogicLib.nsh"
!include "WinVer.nsh"
!include "x64.nsh"
!include "StdUtils.nsh"
Name "@NICENAME@"
!define VERSION '@CMAKE_KVIRC_VERSION_RELEASE@'
!define RELEASE_NAME '@CMAKE_KVIRC_VERSION_CODENAME@'
!define /date GIT_VERSION '@CMAKE_KVIRC_BUILD_REVISION@'
!define KVIRC_BUILD_REVISION '@CMAKE_KVIRC_BUILD_REVISION@'
!define URL_ABOUT 'http://www.kvirc.net/'
!define URL_SUPPORT 'http://www.kvirc.net/'
!define URL_UPDATE 'http://www.kvirc.net/'
!define PUBLISHER 'Szymon Stefanek and The KVIrc Development Team'
; Git release, e.g. KVIrc-4.3.2-dev-git-5465-ge352609.exe
;OutFile KVIrc-${KVIRC_BUILD_REVISION}.exe
; Stable version, e.g. KVIrc-4.2.0-Equilibrium.exe
;OutFile KVIrc-${VERSION}-${RELEASE_NAME}.exe
; Github CI
OutFile KVIrc.exe
Unicode true
SetCompressor /SOLID lzma
XPStyle on
InstallDir $PROGRAMFILES\KVIrc
InstallDirRegKey HKLM "Software\KVIrc" "Install_Dir"
Icon ..\data\resources_win32\icon1.ico
;--------------------------------
!include "WordFunc.nsh"
!insertmacro un.WordReplace #we need this function for uninstall local data dir
Var LocalDir
;--------------------------------
!define MUI_ICON ..\data\resources_win32\icon1.ico
!define MUI_UNICON ..\data\resources_win32\icon1.ico
!define MUI_LANGDLL_REGISTRY_ROOT "HKCU"
!define MUI_LANGDLL_REGISTRY_KEY "Software\KVIrc"
!define MUI_LANGDLL_REGISTRY_VALUENAME "Installer Language"
!define MUI_LANGDLL_ALWAYSSHOW
!define MUI_FINISHPAGE_RUN
!define MUI_FINISHPAGE_RUN_TEXT "Start KVIrc"
!define MUI_FINISHPAGE_RUN_FUNCTION "LaunchKVIrc"
; Pages
!insertmacro MUI_PAGE_LICENSE "release\License\ABOUT-LICENSE"
!insertmacro MUI_PAGE_COMPONENTS
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_PAGE_FINISH
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_COMPONENTS
!insertmacro MUI_UNPAGE_INSTFILES
!insertmacro MUI_LANGUAGE "English"
LangString UnLocalDataDescr ${LANG_ENGLISH} "This will delete your settings, themes and logs. Keep it unchecked if you plan to reinstall KVIrc later."
LangString UnLocalData ${LANG_ENGLISH} "Settings and logs"
LangString UnGeneralFiles ${LANG_ENGLISH} "Program files"
LangString ProgramDescription ${LANG_ENGLISH} "Visual IRC client"
LangString TraySection ${LANG_ENGLISH} "Quick launch icon"
LangString TraySectionDescr ${LANG_ENGLISH} "Create quick launch icon"
LangString DesktopSection ${LANG_ENGLISH} "Desktop shortcut"
LangString DesktopSectionDescr ${LANG_ENGLISH} "Create desktop shortcut"
LangString KVIrc ${LANG_ENGLISH} "KVIrc (required)"
LangString KVIrcDescr ${LANG_ENGLISH} "KVIrc program files"
LangString StartMenuSection ${LANG_ENGLISH} "Start menu"
LangString StartMenuSectionDescr ${LANG_ENGLISH} "Create start menu icon"
LangString MsgUninstallOldInstaller ${LANG_ENGLISH} "Previous versions of KVIrc must be uninstalled."
LangString KVIrcIsRunning ${LANG_ENGLISH} "An instance of KVIrc is currently running. Exit KVIrc and then try again."
LangString WinVerUnsupported ${LANG_ENGLISH} "KVIrc does not support the currently running Windows version.$\r$\nWindows 7 or higher is required."
!include ".\translations\*.nsi"
Function TrimQuotes
Exch $R0
Push $R1
StrCpy $R1 $R0 1
StrCmp $R1 `"` 0 +2
StrCpy $R0 $R0 `` 1
StrCpy $R1 $R0 1 -1
StrCmp $R1 `"` 0 +2
StrCpy $R0 $R0 -1
Pop $R1
Exch $R0
FunctionEnd
Function GetParent
Exch $R0
Push $R1
Push $R2
Push $R3
StrCpy $R1 0
StrLen $R2 $R0
loop:
IntOp $R1 $R1 + 1
IntCmp $R1 $R2 get 0 get
StrCpy $R3 $R0 1 -$R1
StrCmp $R3 "\" get
Goto loop
get:
StrCpy $R0 $R0 -$R1
Pop $R3
Pop $R2
Pop $R1
Exch $R0
FunctionEnd
;--------------------------------
; Sections
Section !$(KVIrc) KVIrc_IDX
SectionIn RO
SetDetailsPrint textonly
DetailPrint $(KVIrcDescr)
SetDetailsPrint listonly
SetOutPath "$INSTDIR"
File /r release\*.*
; Write the installation path into the registry
WriteRegStr HKLM SOFTWARE\KVIrc "Install_Dir" "$INSTDIR"
; Write the uninstall keys for Windows
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\KVIrc" "DisplayName" "KVIrc"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\KVIrc" "DisplayIcon" "$INSTDIR\@KVIRC_BINARYNAME@.exe"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\KVIrc" "DisplayVersion" "${VERSION}"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\KVIrc" "UninstallString" "$\"$INSTDIR\uninstall.exe$\""
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\KVIrc" "URLInfoAbout" "${URL_ABOUT}"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\KVIrc" "HelpLink" "${URL_SUPPORT}"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\KVIrc" "URLUpdateInfo" "${URL_UPDATE}"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\KVIrc" "Publisher" "${PUBLISHER}"
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\KVIrc" "NoModify" 1
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\KVIrc" "NoRepair" 1
WriteUninstaller "$INSTDIR\uninstall.exe"
IfFileExists "$INSTDIR\vc_redist.x86.exe" VcRedist86Exists PastVcRedist86Check
VcRedist86Exists:
ExecWait '"$INSTDIR\vc_redist.x86.exe" /quiet /norestart'
PastVcRedist86Check:
IfFileExists "$INSTDIR\vc_redist.x64.exe" VcRedist64Exists PastVcRedist64Check
VcRedist64Exists:
ExecWait '"$INSTDIR\vc_redist.x64.exe" /quiet /norestart'
PastVcRedist64Check:
SectionEnd
; Optional section (can be disabled by the user)
Section $(StartMenuSection) StartMenuSection_IDX
SetShellVarContext all
CreateShortCut "$SMPROGRAMS\KVIrc.lnk" "$INSTDIR\@KVIRC_BINARYNAME@.exe" "" "$INSTDIR\@KVIRC_BINARYNAME@.exe" 0 "" "" $(ProgramDescription)
SectionEnd
Section $(DesktopSection) DesktopSection_IDX
SetShellVarContext all
CreateShortCut "$DESKTOP\KVIrc.lnk" "$INSTDIR\@KVIRC_BINARYNAME@.exe" "" "$INSTDIR\@KVIRC_BINARYNAME@.exe" 0 "" "" $(ProgramDescription)
SectionEnd
Section $(TraySection) TraySection_IDX
SetShellVarContext all
CreateShortCut "$QUICKLAUNCH\KVIrc.lnk" "$INSTDIR\@KVIRC_BINARYNAME@.exe" "" "$INSTDIR\@KVIRC_BINARYNAME@.exe" 0 "" "" $(ProgramDescription)
SectionEnd
;--------------------------------
; Descriptions
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
!insertmacro MUI_DESCRIPTION_TEXT ${KVIrc_IDX} \
$(KVIrcDescr)
!insertmacro MUI_DESCRIPTION_TEXT ${StartMenuSection_IDX} \
$(StartMenuSectionDescr)
!insertmacro MUI_DESCRIPTION_TEXT ${DesktopSection_IDX} \
$(DesktopSectionDescr)
!insertmacro MUI_DESCRIPTION_TEXT ${TraySection_IDX} \
$(TraySectionDescr)
!insertmacro MUI_FUNCTION_DESCRIPTION_END
Function .onInit
${IfNot} ${AtLeastWin7}
MessageBox MB_OK|MB_ICONSTOP "$(WinVerUnsupported)"
Quit
${EndIf}
!insertmacro MUI_LANGDLL_DISPLAY
Call CloseKVIrcInstances
${If} ${RunningX64}
; disable registry redirection (enable access to 64-bit portion of registry)
SetRegView 64
; change install dir
StrCpy $INSTDIR $PROGRAMFILES64\KVIrc
${EndIf}
SetShellVarContext all
; Remove old installer, check for 32-bit first, we don't want both installed
${If} ${RunningX64}
SetRegView 32
ReadRegStr $R0 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\KVIrc" "UninstallString"
StrCmp $R0 "" check64
${Else}
ReadRegStr $R0 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\KVIrc" "UninstallString"
StrCmp $R0 "" done
${EndIf}
MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION "$(MsgUninstallOldInstaller)" IDOK uninst
Abort
check64:
SetRegView 64
ReadRegStr $R0 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\KVIrc" "UninstallString"
StrCmp $R0 "" done
MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION "$(MsgUninstallOldInstaller)" IDOK uninst
;Run the uninstaller
uninst:
ClearErrors
; R0 contains the quoted full path to uninstall.exe
Push $R0
Call TrimQuotes
Call GetParent
Pop $R0
; at this point $R0 will equal to "C:\Program Files\KVirc"
InitPluginsDir
CreateDirectory "$pluginsdir\unold"
CopyFiles /SILENT /FILESONLY "$R0\uninstall.exe" "$pluginsdir\unold"
ExecWait '"$pluginsdir\unold\uninstall.exe" _?=$R0'
done:
FunctionEnd
;--------------------------------
; Uninstaller
Section !un.$(UnGeneralFiles)
Delete "$INSTDIR\uninstall.exe"
SetShellVarContext all
; Remove registry keys
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\KVIrc"
DeleteRegKey HKLM SOFTWARE\KVIrc
; Remove shortcuts, if any
Delete "$SMPROGRAMS\KVIrc.lnk"
Delete "$DESKTOP\KVIrc.lnk"
Delete "$QUICKLAUNCH\KVIrc.lnk"
; Delete installed trees of files
RMDir /r "$INSTDIR\config"
RMDir /r "$INSTDIR\audio"
RMDir /r "$INSTDIR\qt-plugins"
RMDir /r "$INSTDIR\defscript"
RMDir /r "$INSTDIR\doc"
RMDir /r "$INSTDIR\help"
RMDir /r "$INSTDIR\license"
RMDir /r "$INSTDIR\locale"
RMDir /r "$INSTDIR\modules"
RMDir /r "$INSTDIR\msgcolors"
RMDir /r "$INSTDIR\pics"
RMDir /r "$INSTDIR\themes"
Delete "$INSTDIR\*.dll"
Delete "$INSTDIR\*.exe"
Delete "$INSTDIR\*.ini"
RMDir "$INSTDIR"
SectionEnd
;Remove local data dir
Section /o un.$(UnLocalData)
DetailPrint $(UnLocalDataDescr)
IfFileExists "$INSTDIR\portable" portable notportable
portable:
RMDir /r "$INSTDIR\Settings"
Delete "$INSTDIR\portable"
Goto done
notportable:
; test kvirc4 file
ReadINIStr $LocalDir "$PROFILE\kvirc4.ini" Main LocalKvircDirectory
; not found => don't delete anything
StrCmp $LocalDir "" done
${un.WordReplace} $LocalDir "%20" " " "+" "$LocalDir"
${un.WordReplace} $LocalDir "/" "\" "+" "$LocalDir"
RMDir /r "$LocalDir"
Delete "$PROFILE\kvirc4.ini"
done:
SectionEnd
Function un.onInit
!insertmacro MUI_UNGETLANGUAGE
${If} ${RunningX64}
SetRegView 64
${EndIf}
Call un.CloseKVIrcInstances
FunctionEnd
;--------------------------------
; Functions
Function LaunchKVIrc
${StdUtils.ExecShellAsUser} $0 "$INSTDIR\@KVIRC_BINARYNAME@.exe" "open" ""
FunctionEnd
Function CloseKVIrcInstances
; Waits for all running instances of KVIrc to close
Push $0 ;saving stack
newcheck:
FindWindow $0 "QWidget" "Kvirc" 0
IntCmp $0 0 done
MessageBox MB_RETRYCANCEL|MB_ICONEXCLAMATION "$(KVIrcIsRunning)" IDRETRY newcheck
; cancel
Quit
done:
Pop $0 ; restoring stack
FunctionEnd
Function un.CloseKVIrcInstances
; Waits for all running instances of KVIrc to close
Push $0 ;saving stack
newcheck:
FindWindow $0 "QWidget" "Kvirc" 0
IntCmp $0 0 done
MessageBox MB_RETRYCANCEL|MB_ICONEXCLAMATION "$(KVIrcIsRunning)" IDRETRY newcheck
; cancel
Quit
done:
Pop $0 ; restoring stack
FunctionEnd
|