reenabled swaptest. quake should now load data and start on big endian architectures...
[AROS-Contrib.git] / regina / regina.nsi
blobcb6730b1b018f09e98eff4c455d6b0d73c6bb064
2 ; Regina Install Script, based on Modern Example Script Written by Joost Verburg
3 ; Requires: ${NSISDIR}\Contrib\Path\path.nsi
4 ; Run as:
5 ; makensis /DVERSION=x.x /DNODOTVER=xx regina.nsi
6 ; Note:
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}"
22 !include "MUI.nsh"
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 ;--------------------------------
43 ;Configuration
45 ;General
46 OutFile "${SHORTNAME}${NODOTVER}${ARCH}.exe"
47 ShowInstdetails show
48 SetOverwrite on
51 ;License dialog
52 LicenseData "${SRCDIR}\COPYING-LIB"
55 ;Folder-select dialog
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 ;--------------------------------
65 ;Pages
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 ;--------------------------------
77 ;Language
78 !insertmacro MUI_LANGUAGE "English"
80 ;================
81 ;Variables
82 Var IsAdminUser
84 ;--------------------------------
85 ;Reserved files
87 ReserveFile "regina_fa.ini"
88 ReserveFile "regina_ss.ini"
89 ReserveFile "regina_mt.ini"
90 !insertmacro MUI_RESERVEFILE_INSTALLOPTIONS
92 ;========================================================================
93 ;Installer Sections
95 ;------------------------------------------------------------------------
96 ; Core
98 Section "${LONGNAME} Core (required)" SecMain
99 SectionIn 1 RO
100 ; Set output path to the installation directory.
101 SetOutPath $INSTDIR
102 ; Distribution files...
103 File rexx.exe
104 File regina.exe
105 File regina.dll
106 File regutil.dll
107 File rxstack.exe
108 File rxqueue.exe
109 File de.mtb
110 File en.mtb
111 File es.mtb
112 File no.mtb
113 File pt.mtb
114 File pl.mtb
115 File tr.mtb
116 File sv.mtb
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
120 Push $INSTDIR
121 Push $IsAdminUser ; "true" or "false" per admin user
122 Push "PATH"
123 Call AddToPath
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}"
147 ; Stack Service
148 ReadIniStr $R0 "$PLUGINSDIR\regina_ss.ini" "Field 4" State
149 ReadIniStr $R1 "$PLUGINSDIR\regina_ss.ini" "Field 5" State
150 Push $R0
151 Push $R1
152 Call InstallRxstack
153 StrCpy $5 0
154 ReadIniStr $R0 "$PLUGINSDIR\regina_fa.ini" "Field 2" State
155 ReadIniStr $R1 "$PLUGINSDIR\regina_fa.ini" "Field 2" Text
156 Push $R0
157 Push $R1
158 Call DoFileAssociation
159 ReadIniStr $R0 "$PLUGINSDIR\regina_fa.ini" "Field 3" State
160 ReadIniStr $R1 "$PLUGINSDIR\regina_fa.ini" "Field 3" Text
161 Push $R0
162 Push $R1
163 Call DoFileAssociation
164 ReadIniStr $R0 "$PLUGINSDIR\regina_fa.ini" "Field 4" State
165 ReadIniStr $R1 "$PLUGINSDIR\regina_fa.ini" "Field 4" Text
166 Push $R0
167 Push $R1
168 Call DoFileAssociation
169 ReadIniStr $R0 "$PLUGINSDIR\regina_fa.ini" "Field 5" State
170 ReadIniStr $R1 "$PLUGINSDIR\regina_fa.ini" "Field 5" Text
171 Push $R0
172 Push $R1
173 Call DoFileAssociation
174 ReadIniStr $R0 "$PLUGINSDIR\regina_fa.ini" "Field 6" State
175 ReadIniStr $R1 "$PLUGINSDIR\regina_fa.ini" "Field 6" Text
176 Push $R0
177 Push $R1
178 Call DoFileAssociation
179 ReadIniStr $R0 "$PLUGINSDIR\regina_fa.ini" "Field 7" State
180 ReadIniStr $R1 "$PLUGINSDIR\regina_fa.ini" "Field 7" Text
181 Push $R0
182 Push $R1
183 Call DoFileAssociation
184 ReadIniStr $R0 "$PLUGINSDIR\regina_fa.ini" "Field 8" State
185 ReadIniStr $R1 "$PLUGINSDIR\regina_fa.ini" "Field 8" Text
186 Push $R0
187 Push $R1
188 Call DoFileAssociation
189 Call DoFileAssociationDetails
190 Call DoLanguageDefault
191 SectionEnd
193 ;------------------------------------------------------------------------
194 ; Demos
196 Section "${LONGNAME} Demos" SecDemo
197 CreateDirectory "$SMPROGRAMS\${LONGNAME}\${LONGNAME} Demos"
198 ; Set output path to the installation directory.
199 SetOutPath $INSTDIR\demo
200 File rxtest1.dll
201 File rxtest2.dll
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
208 SectionEnd
210 ;------------------------------------------------------------------------
211 ; Development tools
213 Section "${LONGNAME} Development Kit" SecDev
214 ; Set output path to the installation directory.
215 SetOutPath $INSTDIR\lib
216 ; Distribution files...
217 File regina.lib
218 File rexx.lib
219 SetOutPath $INSTDIR\include
220 File /oname=rexxsaa.h ${SRCDIR}\rexxsaa.h
221 SectionEnd
223 ;------------------------------------------------------------------------
224 ; Doco
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
233 SectionEnd
235 Section ""
237 ;Invisible section to display the Finish header
238 ; !insertmacro MUI_FINISHHEADER
240 SectionEnd
242 ;========================================================================
243 ;Installer Functions
245 Function .onInit
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"
253 FunctionEnd
255 Function SetCustomAssoc
256 !insertmacro MUI_HEADER_TEXT "$(TEXT_IO_PAGETITLE_ASSOC)" "$(TEXT_IO_SUBTITLE_ASSOC)"
257 !insertmacro MUI_INSTALLOPTIONS_DISPLAY "regina_fa.ini"
258 FunctionEnd
260 Function SetCustomLanguage
261 !insertmacro MUI_HEADER_TEXT "$(TEXT_IO_PAGETITLE_LANGUAGE)" "$(TEXT_IO_SUBTITLE_LANGUAGE)"
262 !insertmacro MUI_INSTALLOPTIONS_DISPLAY "regina_mt.ini"
263 FunctionEnd
265 Function SetCustomStack
266 !insertmacro MUI_HEADER_TEXT "$(TEXT_IO_PAGETITLE_STACK)" "$(TEXT_IO_SUBTITLE_STACK)"
267 !insertmacro MUI_INSTALLOPTIONS_DISPLAY "regina_ss.ini"
268 FunctionEnd
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
281 FunctionEnd
283 Function DoFileAssociation
284 Pop $R1
285 Pop $R0
286 Strcmp $R0 0 exitfa
287 Strcmp $R1 "" exitfa
288 ; do the association
289 DetailPrint "Registering $R1 extension to run with Regina"
290 IntOp $5 $5 + 1
291 WriteRegStr HKCR $R1 "" "Regina"
292 exitfa:
293 Return
294 FunctionEnd
296 Function DoFileAssociationDetails
297 StrCmp $5 0 exitfad
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"'
306 exitfad:
307 Return
308 FunctionEnd
310 Function DoLanguageDefault
311 StrCpy $1 2
312 langStartLoop:
313 StrCpy $2 "Field $1"
314 ReadIniStr $R0 "$PLUGINSDIR\regina_mt.ini" $2 State
315 StrCmp $R0 1 langFound
316 IntOp $1 $1 + 1
317 StrCmp $1 9 langExit ; the "9" here must be 1 more than the last field number in regina_mt.ini
318 Goto langStartLoop
319 langFound:
320 ReadIniStr $R0 "$PLUGINSDIR\regina_mt.ini" $2 Text
321 ; do the language default
322 Push "REGINA_LANG_DIR"
323 Push "$INSTDIR"
324 Push $IsAdminUser ; "true" or "false"
325 Call WriteEnvStr
326 Push "REGINA_LANG"
327 Push "$R0"
328 Push $IsAdminUser ; "true" or "false"
329 Call WriteEnvStr
330 DetailPrint "$R0 set as default language for error messages"
331 langExit:
332 Return
333 FunctionEnd
335 Function InstallRxstack
336 Pop $R1
337 Pop $R0
338 Strcmp $R0 0 exitss
339 ; do the install of rxstack
340 DetailPrint "Installing Regina Stack Service"
341 nsExec::ExecToLog "$INSTDIR\rxstack -install"
342 Strcmp $R1 0 exitss
343 DetailPrint "Starting Regina Stack Service"
344 Services::SendServiceCommand 'start' 'Regina Stack'
345 Pop $R0
346 StrCmp $R0 'Ok' exitss
347 MessageBox MB_OK|MB_ICONEXCLAMATION|MB_TOPMOST "Failed to start the Regina Stack service:$\n$0" /SD IDOK
348 exitss:
349 FunctionEnd
351 ;========================================================================
352 ;Uninstaller Section
354 Section "Uninstall"
356 ; get rid of file associations
357 Push ".rexx"
358 Call un.DeleteFileAssociation
359 Push ".rex"
360 Call un.DeleteFileAssociation
361 Push ".rx"
362 Call un.DeleteFileAssociation
363 Push ".cmd"
364 Call un.DeleteFileAssociation
365 Push $INSTDIR
366 Push $IsAdminUser ; pushes "true" or "false"
367 Push "PATH"
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"
373 Call un.DeleteEnvStr
374 Push "REGINA_LANG"
375 Push $IsAdminUser ; pushes "true" or "false"
376 Call un.DeleteEnvStr
377 ; stop and remove the rxstack service - ignore if we get errors
378 Services::SendServiceCommand 'stop' 'Regina Stack'
379 Exec "$INSTDIR\rxstack -remove"
381 RMDir /r "$INSTDIR"
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
391 SectionEnd
393 ;========================================================================
394 ;Uninstaller Functions
396 Function un.onInit
398 ; UnInstall as All Users if an admin
400 !include "${SRCDIR}\common\unoninit.nsh"
401 FunctionEnd
403 Function un.DeleteFileAssociation
404 Pop $R0
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"
409 NoOwn:
410 FunctionEnd
412 !include "${SRCDIR}\common\admin.nsh"
413 !include "${SRCDIR}\common\isnt.nsh"
414 !include "${SRCDIR}\common\path.nsh"
415 !include "${SRCDIR}\common\WriteEnv.nsh"
417 ;eof