2 ; Regina Install Script, based on Modern Example Script Written by Joost Verburg
3 ; Requires: ${NSISDIR}\Contrib\Path\path.nsi
5 ; makensis /DVERSION=x.x /DNODOTVER=xx regina.nsi
7 ; regina.nsi MUST be in the current directory!
9 !define LONGNAME
"Regina Rexx" ;Long Name (for descriptions)
10 !define SHORTNAME
"Regina" ;Short name (no slash) of package
11 !define SFHOME
"http://regina-rexx.sourceforge.net"
12 !define SFGROUP
"28102"
13 !define UNINSTALLER
"uninstall.exe"
14 !define DISPLAYICON
"$INSTDIR\regina.exe,0"
15 !define KEYFILE
"regina.exe"
17 !define MUI_ICON
"${SRCDIR}\reginaw32.ico"
18 !define MUI_UNICON
"uninstall.ico"
20 Name "${LONGNAME} ${VERSION}"
24 !define MUI_CUSTOMPAGECOMMANDS
26 !define MUI_LICENSEPAGE
27 !define MUI_COMPONENTSPAGE
28 !define MUI_DIRECTORYPAGE
29 !define MUI_FINISHPAGE
30 !define MUI_FINISHPAGE_NOAUTOCLOSE
32 !define MUI_ABORTWARNING
34 !define MUI_UNINSTALLER
35 !define MUI_UNCONFIRMPAGE
37 !addplugindir ${SRCDIR}\nsis
39 ; VERSION ;Must be supplied on compile command line
40 ; NODOTVER ;Must be supplied on compile command line
42 ;--------------------------------
46 OutFile "${SHORTNAME}${NODOTVER}${ARCH}.exe"
52 LicenseData "${SRCDIR}\COPYING-LIB"
56 InstallDir "c:\${SHORTNAME}"
58 LangString TEXT_IO_PAGETITLE_ASSOC
${LANG_ENGLISH} "File Associations"
59 LangString TEXT_IO_SUBTITLE_ASSOC
${LANG_ENGLISH} "Associate file extensions with Regina"
60 LangString TEXT_IO_PAGETITLE_LANGUAGE
${LANG_ENGLISH} "Language for Error Messages"
61 LangString TEXT_IO_SUBTITLE_LANGUAGE
${LANG_ENGLISH} "Select the language for Regina error messages"
62 LangString TEXT_IO_PAGETITLE_STACK
${LANG_ENGLISH} "Regina Stack Service"
63 LangString TEXT_IO_SUBTITLE_STACK
${LANG_ENGLISH} "Install Regina Stack Service"
64 ;--------------------------------
67 !insertmacro MUI_PAGE_LICENSE
"${SRCDIR}\COPYING-LIB"
68 !insertmacro MUI_PAGE_COMPONENTS
69 !insertmacro MUI_PAGE_DIRECTORY
70 Page custom SetCustomAssoc
71 Page custom SetCustomLanguage
72 Page custom SetCustomStack
73 !insertmacro MUI_PAGE_INSTFILES
74 !insertmacro MUI_PAGE_FINISH
76 ;--------------------------------
78 !insertmacro MUI_LANGUAGE
"English"
84 ;--------------------------------
87 ReserveFile
"regina_fa.ini"
88 ReserveFile
"regina_ss.ini"
89 ReserveFile
"regina_mt.ini"
90 !insertmacro MUI_RESERVEFILE_INSTALLOPTIONS
92 ;========================================================================
95 ;------------------------------------------------------------------------
98 Section "${LONGNAME} Core (required)" SecMain
100 ; Set output path to the installation directory.
102 ; Distribution files...
117 File /oname=README
${NODOTVER}.txt
${SRCDIR}\README
.${NODOTVER}
118 File /oname=READMEW32
.txt
${SRCDIR}\README
.W32
119 File /oname=LICENSE
.txt
${SRCDIR}\COPYING
-LIB
121 Push $IsAdminUser ; "true" or "false" per admin user
124 CreateDirectory "$SMPROGRAMS\${LONGNAME}"
125 CreateShortCut "$SMPROGRAMS\${LONGNAME}\Uninstall ${SHORTNAME}.lnk" "$INSTDIR\uninstall.exe" "" "$INSTDIR\uninstall.exe" 0
126 CreateShortCut "$SMPROGRAMS\${LONGNAME}\Release Notes.lnk" "$INSTDIR\README${NODOTVER}.txt" "" "$INSTDIR\README${NODOTVER}.txt" 0
127 CreateShortCut "$SMPROGRAMS\${LONGNAME}\README.lnk" "$INSTDIR\READMEW32.txt" "" "$INSTDIR\READMEW32.txt" 0
128 CreateShortCut "$SMPROGRAMS\${LONGNAME}\LICENSE.lnk" "$INSTDIR\LICENSE.txt" "" "$INSTDIR\LICENSE.txt" 0
129 ; Can't use CreateShortcut for URLs
130 WriteINIStr "$SMPROGRAMS\${LONGNAME}\Regina Rexx Home Page.url" "InternetShortcut" "URL" "http://regina-rexx.sourceforge.net"
131 ; Write the installation path into the registry
132 ; Write the uninstall keys
133 !include "${SRCDIR}\common\uninstaller.nsh"
134 ; WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${SHORTNAME}" "DisplayName" "${LONGNAME}"
135 ; WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${SHORTNAME}" "DisplayIcon" "${DISPLAYICON}"
136 ; WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${SHORTNAME}" "HelpLink" "http://www.rexxla.org/support.html"
137 ; WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${SHORTNAME}" "URLUpdateInfo" "http://sourceforge.net/project/showfiles.php?group_id=28102"
138 ; WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${SHORTNAME}" "URLInfoAbout" "http://www.rexx.org/"
139 ; WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${SHORTNAME}" "DisplayVersion" "${VERSION}"
140 ; WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${SHORTNAME}" "Publisher" "Mark Hessling"
141 ; WriteRegExpandStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${SHORTNAME}" "UninstallString" '"$INSTDIR\${UNINSTALLER}"'
142 ; WriteRegExpandStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${SHORTNAME}" "InstallLocation" '"$INSTDIR"'
143 ; WriteRegExpandStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${SHORTNAME}" "UnInstallLocation" "$INSTDIR" ; dont quote it
144 ; WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${SHORTNAME}" "NoModify" 0x00000001
145 ; WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${SHORTNAME}" "NoRepair" 0x00000001
146 ; WriteUninstaller "$INSTDIR\${UNINSTALLER}"
148 ReadIniStr
$R0 "$PLUGINSDIR\regina_ss.ini" "Field 4" State
149 ReadIniStr
$R1 "$PLUGINSDIR\regina_ss.ini" "Field 5" State
154 ReadIniStr
$R0 "$PLUGINSDIR\regina_fa.ini" "Field 2" State
155 ReadIniStr
$R1 "$PLUGINSDIR\regina_fa.ini" "Field 2" Text
158 Call DoFileAssociation
159 ReadIniStr
$R0 "$PLUGINSDIR\regina_fa.ini" "Field 3" State
160 ReadIniStr
$R1 "$PLUGINSDIR\regina_fa.ini" "Field 3" Text
163 Call DoFileAssociation
164 ReadIniStr
$R0 "$PLUGINSDIR\regina_fa.ini" "Field 4" State
165 ReadIniStr
$R1 "$PLUGINSDIR\regina_fa.ini" "Field 4" Text
168 Call DoFileAssociation
169 ReadIniStr
$R0 "$PLUGINSDIR\regina_fa.ini" "Field 5" State
170 ReadIniStr
$R1 "$PLUGINSDIR\regina_fa.ini" "Field 5" Text
173 Call DoFileAssociation
174 ReadIniStr
$R0 "$PLUGINSDIR\regina_fa.ini" "Field 6" State
175 ReadIniStr
$R1 "$PLUGINSDIR\regina_fa.ini" "Field 6" Text
178 Call DoFileAssociation
179 ReadIniStr
$R0 "$PLUGINSDIR\regina_fa.ini" "Field 7" State
180 ReadIniStr
$R1 "$PLUGINSDIR\regina_fa.ini" "Field 7" Text
183 Call DoFileAssociation
184 ReadIniStr
$R0 "$PLUGINSDIR\regina_fa.ini" "Field 8" State
185 ReadIniStr
$R1 "$PLUGINSDIR\regina_fa.ini" "Field 8" Text
188 Call DoFileAssociation
189 Call DoFileAssociationDetails
190 Call DoLanguageDefault
193 ;------------------------------------------------------------------------
196 Section "${LONGNAME} Demos" SecDemo
197 CreateDirectory "$SMPROGRAMS\${LONGNAME}\${LONGNAME} Demos"
198 ; Set output path to the installation directory.
199 SetOutPath $INSTDIR\demo
202 ; Distribution files...
203 File /oname=rexxcps
.rexx
${SRCDIR}\demo\rexxcps
.rexx
204 CreateShortCut "$SMPROGRAMS\${LONGNAME}\${LONGNAME} Demos\Rexxcps.lnk" "$INSTDIR\regina.exe" '-p "$INSTDIR\demo\rexxcps.rexx"' "$INSTDIR\regina.exe"
205 File /oname=dynfunc
.rexx
${SRCDIR}\demo\dynfunc
.rexx
206 CreateShortCut "$SMPROGRAMS\${LONGNAME}\${LONGNAME} Demos\Dynfunc.lnk" "$INSTDIR\regina.exe" '-p "$INSTDIR\demo\dynfunc.rexx"' "$INSTDIR\regina.exe"
207 File ${SRCDIR}\demo\
*.rexx
210 ;------------------------------------------------------------------------
213 Section "${LONGNAME} Development Kit" SecDev
214 ; Set output path to the installation directory.
215 SetOutPath $INSTDIR\lib
216 ; Distribution files...
219 SetOutPath $INSTDIR\include
220 File /oname=rexxsaa
.h
${SRCDIR}\rexxsaa
.h
223 ;------------------------------------------------------------------------
226 Section "${LONGNAME} Documentation" SecDoc
227 ; Set output path to the installation directory.
228 SetOutPath $INSTDIR\doc
229 File ${DOCDIR}\regina
${NODOTVER}.pdf
230 CreateShortCut "$SMPROGRAMS\${LONGNAME}\${LONGNAME} Interpreter PDF Documentation.lnk" "$INSTDIR\doc\regina${NODOTVER}.pdf" "" "$INSTDIR\doc\regina${NODOTVER}.pdf" 0
231 File ${DOCDIR}\regutil
${NODOTVER}.pdf
232 CreateShortCut "$SMPROGRAMS\${LONGNAME}\${LONGNAME} RegUtil PDF Documentation.lnk" "$INSTDIR\doc\regutil${NODOTVER}.pdf" "" "$INSTDIR\doc\regutil${NODOTVER}.pdf" 0
237 ;Invisible section to display the Finish header
238 ; !insertmacro MUI_FINISHHEADER
242 ;========================================================================
246 !insertmacro MUI_INSTALLOPTIONS_EXTRACT
"regina_fa.ini"
247 !insertmacro MUI_INSTALLOPTIONS_EXTRACT
"regina_ss.ini"
248 !insertmacro MUI_INSTALLOPTIONS_EXTRACT
"regina_mt.ini"
250 ; Uninstall previous version if present
252 !include "${SRCDIR}\common\oninit.nsh"
255 Function SetCustomAssoc
256 !insertmacro MUI_HEADER_TEXT
"$(TEXT_IO_PAGETITLE_ASSOC)" "$(TEXT_IO_SUBTITLE_ASSOC)"
257 !insertmacro MUI_INSTALLOPTIONS_DISPLAY
"regina_fa.ini"
260 Function SetCustomLanguage
261 !insertmacro MUI_HEADER_TEXT
"$(TEXT_IO_PAGETITLE_LANGUAGE)" "$(TEXT_IO_SUBTITLE_LANGUAGE)"
262 !insertmacro MUI_INSTALLOPTIONS_DISPLAY
"regina_mt.ini"
265 Function SetCustomStack
266 !insertmacro MUI_HEADER_TEXT
"$(TEXT_IO_PAGETITLE_STACK)" "$(TEXT_IO_SUBTITLE_STACK)"
267 !insertmacro MUI_INSTALLOPTIONS_DISPLAY
"regina_ss.ini"
270 Function .onMouseOverSection
272 !insertmacro MUI_DESCRIPTION_BEGIN
274 !insertmacro MUI_DESCRIPTION_TEXT
${SecMain} "Installs the core components of ${LONGNAME} to the application folder."
275 !insertmacro MUI_DESCRIPTION_TEXT
${SecDev} "Installs the files required to embed ${LONGNAME} into you C/C++ application."
276 !insertmacro MUI_DESCRIPTION_TEXT
${SecDemo} "Install sample ${LONGNAME} programs."
277 !insertmacro MUI_DESCRIPTION_TEXT
${SecDoc} "Install ${LONGNAME} documentation."
279 !insertmacro MUI_DESCRIPTION_END
283 Function DoFileAssociation
289 DetailPrint "Registering $R1 extension to run with Regina"
291 WriteRegStr HKCR $R1 "" "Regina"
296 Function DoFileAssociationDetails
298 ; do the association details
299 WriteRegStr HKCR "Regina" "" "Regina Rexx Program"
300 WriteRegStr HKCR "Regina\shell" "" "open"
301 WriteRegStr HKCR "Regina\DefaultIcon" "" "$INSTDIR\regina.exe,0"
302 WriteRegStr HKCR "Regina\shell\open" "" "Run"
303 WriteRegStr HKCR "Regina\shell\open\command" "" '"$INSTDIR\regina.exe" -p "%1" %*'
304 WriteRegStr HKCR "Regina\shell\edit" "" "Edit"
305 WriteRegStr HKCR "Regina\shell\edit\command" "" 'notepad.exe "%1"'
310 Function DoLanguageDefault
314 ReadIniStr
$R0 "$PLUGINSDIR\regina_mt.ini" $2 State
315 StrCmp $R0 1 langFound
317 StrCmp $1 9 langExit
; the "9" here must be 1 more than the last field number in regina_mt.ini
320 ReadIniStr
$R0 "$PLUGINSDIR\regina_mt.ini" $2 Text
321 ; do the language default
322 Push "REGINA_LANG_DIR"
324 Push $IsAdminUser ; "true" or "false"
328 Push $IsAdminUser ; "true" or "false"
330 DetailPrint "$R0 set as default language for error messages"
335 Function InstallRxstack
339 ; do the install of rxstack
340 DetailPrint "Installing Regina Stack Service"
341 nsExec::ExecToLog
"$INSTDIR\rxstack -install"
343 DetailPrint "Starting Regina Stack Service"
344 Services::SendServiceCommand
'start' 'Regina Stack'
346 StrCmp $R0 'Ok' exitss
347 MessageBox MB_OK|
MB_ICONEXCLAMATION|
MB_TOPMOST "Failed to start the Regina Stack service:$\n$0" /SD
IDOK
351 ;========================================================================
356 ; get rid of file associations
358 Call un
.DeleteFileAssociation
360 Call un
.DeleteFileAssociation
362 Call un
.DeleteFileAssociation
364 Call un
.DeleteFileAssociation
366 Push $IsAdminUser ; pushes "true" or "false"
368 Call un
.RemoveFromPath
369 DeleteRegKey HKCR "Regina"
370 ; remove LANG environment variables
371 Push "REGINA_LANG_DIR"
372 Push $IsAdminUser ; pushes "true" or "false"
375 Push $IsAdminUser ; pushes "true" or "false"
377 ; stop and remove the rxstack service - ignore if we get errors
378 Services::SendServiceCommand
'stop' 'Regina Stack'
379 Exec "$INSTDIR\rxstack -remove"
383 ; Remove the installation stuff
384 DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${SHORTNAME}"
386 ; remove shortcuts directory and everything in it
387 RMDir /r
"$SMPROGRAMS\${LONGNAME}"
389 ; !insertmacro MUI_UNFINISHHEADER
393 ;========================================================================
394 ;Uninstaller Functions
398 ; UnInstall as All Users if an admin
400 !include "${SRCDIR}\common\unoninit.nsh"
403 Function un
.DeleteFileAssociation
405 ReadRegStr $R1 HKCR "$R0" ""
406 StrCmp $R1 "Regina" 0 NoOwn
; only delete key if we own it
407 DeleteRegKey HKCR "$R0"
408 DetailPrint "Deleting file association for $R0"
412 !include "${SRCDIR}\common\admin.nsh"
413 !include "${SRCDIR}\common\isnt.nsh"
414 !include "${SRCDIR}\common\path.nsh"
415 !include "${SRCDIR}\common\WriteEnv.nsh"