-
Notifications
You must be signed in to change notification settings - Fork 1
/
tclmpi.nsis.in
184 lines (153 loc) · 5.99 KB
/
tclmpi.nsis.in
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
#!Nsis Installer Command Script
#
!include "MUI2.nsh"
!include "FileFunc.nsh"
!include "LogicLib.nsh"
!addplugindir "envvar/Plugins/x86-unicode"
!include "x64.nsh"
!macro CreateInternetShortcut FILENAME URL ICONFILE ICONINDEX
WriteINIStr "${FILENAME}.url" "InternetShortcut" "URL" "${URL}"
WriteINIStr "${FILENAME}.url" "InternetShortcut" "IconFile" "${ICONFILE}"
WriteINIStr "${FILENAME}.url" "InternetShortcut" "IconIndex" "${ICONINDEX}"
!macroend
Unicode true
XPStyle on
RequestExecutionLevel user
ShowInstDetails show
ShowUninstDetails show
!define MUI_ICON "@CMAKE_SOURCE_DIR@\TclMPI.ico"
!define MUI_UNICON "@CMAKE_SOURCE_DIR@\TclMPI.ico"
!define MUI_HEADERIMAGE
!define MUI_HEADERIMAGE_BITMAP "@CMAKE_SOURCE_DIR@\TclMPI-logo.bmp"
!define MUI_HEADERIMAGE_RIGHT
!define MUI_ABORTWARNING
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_LICENSE "LICENSE.txt"
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_UNPAGE_WELCOME
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
!insertmacro MUI_LANGUAGE "English"
# name of installer file and software
OutFile "TclMPI-@PROJECT_VERSION@-@CMAKE_SYSTEM_NAME@-@[email protected]"
!define TCLMPI "TclMPI @PROJECT_VERSION@"
Name "${TCLMPI}"
InstallDir "$LOCALAPPDATA\${TCLMPI}"
# Check for prerequisite software installations
Section Prerequisites
ClearErrors
ReadRegStr $0 HKLM "Software\Microsoft\MPI" Version
${If} ${Errors}
MessageBox MB_OK "Please install MS-MPI (msmpisetup.exe) from https://www.microsoft.com/en-us/download/details.aspx?id=100593"
Quit
${Else}
DetailPrint "MS-MPI is installed installed as version $0"
${EndIf}
ClearErrors
ReadRegStr $0 HKLM "Software\WOW6432Node\ActiveState\ActiveTcl" CurrentVersion
${If} ${Errors}
MessageBox MB_OK "Please install ActiveState ActiveTcl from https://www.activestate.com/products/tcl/"
Quit
${Else}
DetailPrint "ActiveTcl is installed installed as version $0"
${EndIf}
ReadRegStr $1 HKLM "Software\WOW6432Node\ActiveState\ActiveTcl\$0" ""
DetailPrint "ActiveTcl in installed in folder $1"
!define TCLDIR $1
SectionEnd
function .onInit
# Determine if TclMPI was already installed and if yes, offer to uninstall or quit
SetRegView 64
ClearErrors
ReadRegStr $0 HKCU "Software\TclMPI" "Version"
!define OLDVERSION $0
ReadRegStr $R0 HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\TclMPI" "UninstallString"
${If} ${Errors}
DetailPrint "TclMPI not (yet) installed"
${Else}
MessageBox MB_YESNO "TclMPI ${OLDVERSION} is already installed. Uninstall existing version?" /SD IDYES IDNO Quit
Pop $R1
StrCmp $R1 2 Quit +1
Exec $R0
Quit:
Quit
${EndIf}
setShellVarContext all
functionEnd
# Installation of TclMPI
Section "TclMPI @CMAKE_PROJECT_VERSION@" SecTclMPI
SectionIn RO
# write marker to registry
SetRegView 64
WriteRegStr HKCU "Software\TclMPI" "Version" "@CMAKE_PROJECT_VERSION@"
SetShellVarContext current
CreateDirectory "$SMPROGRAMS\${TCLMPI}"
CreateShortCut "$SMPROGRAMS\${TCLMPI}\Uninstall.lnk" "$INSTDIR\Uninstall.exe" "" ""
CreateShortCut "$SMPROGRAMS\${TCLMPI}\Examples.lnk" "$INSTDIR\Examples" "" ""
!insertmacro CreateInternetShortCut "$SMPROGRAMS\${TCLMPI}\TclMPI Homepage" "https://akohlmey.github.io/tclmpi" "" "0"
SetOutPath "$INSTDIR"
CreateDirectory "$INSTDIR\bin"
CreateDirectory "$INSTDIR\Examples"
File LICENSE.txt
File @CMAKE_SOURCE_DIR@\TclMPI.ico
SetOutPath "$INSTDIR\bin"
File ${BUILD_CONFIG}\tclmpish.exe
SetOutPath "$INSTDIR\Examples"
File @CMAKE_SOURCE_DIR@\examples\*
CreateDirectory "${TCLDIR}\lib\tcl8.6\tclmpi@CMAKE_PROJECT_VERSION@"
SetOutPath "${TCLDIR}\lib\tcl8.6\tclmpi@CMAKE_PROJECT_VERSION@"
File ${BUILD_CONFIG}\_tclmpi.dll
File tclmpi.tcl
File pkgIndex.tcl
SetOutPath "$INSTDIR"
# Register Application and its uninstaller
WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\TclMPI" \
"DisplayName" "TclMPI -- Tcl Bindings for MPI"
WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\TclMPI" \
"Publisher" "Axel Kohlmeyer"
WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\TclMPI" \
"URLInfoAbout" "akohlmey.github.io/tclmpi"
WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\TclMPI" \
"DisplayIcon" "$INSTDIR\TclMPI.ico"
WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\TclMPI" \
"DisplayVersion" "@CMAKE_PROJECT_VERSION@"
WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\TclMPI" \
"InstallLocation" "$INSTDIR"
WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\TclMPI" \
"UninstallString" "$\"$INSTDIR\uninstall.exe$\""
WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\TclMPI" \
"QuietUninstallString" "$\"$INSTDIR\uninstall.exe$\" /S"
${GetSize} "$INSTDIR" "/S=0K" $0 $1 $2
IntFmt $0 "0x%08X" $0
WriteRegDWORD HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\TclMPI" \
"EstimatedSize" "$0"
# update path variables
EnVar::SetHKCU
# add tclmpish to executable path
EnVar::AddValue "PATH" "$INSTDIR\bin"
WriteUninstaller "$INSTDIR\Uninstall.exe"
SectionEnd
function un.onInit
SetShellVarContext current
functionEnd
Section "Uninstall"
# remove TclMPI
SetRegView 64
DeleteRegKey HKCU "Software\TclMPI"
SetShellVarContext current
# unregister installation
DeleteRegKey HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\TclMPI"
# update path variables
EnVar::SetHKCU
# remove tclmpish executable
EnVar::DeleteValue "PATH" "$INSTDIR\bin"
RMDir /r "$SMPROGRAMS\${TCLMPI}"
RMDir /r /REBOOTOK "${TCLDIR}\lib\tcl8.6\tclmpi@CMAKE_PROJECT_VERSION@"
Delete /REBOOTOK "$INSTDIR\*.txt"
Delete /REBOOTOK "$INSTDIR\*.ico"
Delete /REBOOTOK "$INSTDIR\Uninstall.exe"
RMDir /r /REBOOTOK "$INSTDIR\bin"
RMDir /r /REBOOTOK "$INSTDIR\Examples"
RMDir /REBOOTOK "$INSTDIR"
SectionEnd