2003-12-19 Martin Baulig <martin@ximian.com>
[mono.git] / monowiz.win32.nsi
1 ; =====================================================
2 ; mono.nsi - Mono Setup wizard for windows
3 ; =====================================================
4 ;
5 ; (C) Copyright 2003 by Johannes Roith
6 ; (C) Copyright 2003 by Daniel Morgan
7 ;
8 ; Authors: 
9 ;       Johannes Roith <johannes@jroith.de>
10 ;       Daniel Morgan <danmorg@sc.rr.com>
11 ;
12 ; This .nsi includes code from the NSIS Archives:
13 ; function StrReplace and VersionCheck 
14 ; by Hendri Adriaens
15 ; HendriAdriaens@hotmail.com
16
17 ; =====================================================
18 ;
19 ; This script can build a binary setup wizard of mono.
20 ; It is released under the GNU GPL.
21 ;
22 ; =====================================================
23 ; SET MILESTONE & SOURCE DIR
24 ; =====================================================
25 ; set by makefile!!
26 ;
27 ; !define MILESTONE "0.26" ;
28 ; !define SOURCE_INSTALL_DIR "/usr/monodist\\*" ;
29
30 ; =====================================================
31 ; SET LOGO
32 ; =====================================================
33 ;
34 ;  Beautification:
35 ;
36 ;  This adds a Mono-specific Image on the left
37 ;  You can choose between the light or dark one.
38 ;  
39 ;  If you wish no mono-specifi logo, please outcomment
40 ;  the lines.
41 ;  
42 ;  "light" is enabled.
43 ;
44 ;  !define MUI_SPECIALBITMAP "mono-win32-setup-dark.bmp"
45    !define MUI_SPECIALBITMAP "mono-win32-setup-light.bmp"
46
47 ; =====================================================
48 ; BUILDING
49 ; =====================================================
50 ;
51 ; 1. Build mono to a clean directory prefix.
52 ;
53 ; 2. In your install directory, delete the *.a files.
54 ;     Most people won't need them and it saves ~ 4 MB.
55 ;
56 ; 3. Type "make win32setup"
57 ;
58 ; 4. The output file is mono-[MILESTONE]-win32-1.exe
59 ;
60 ;
61 ;
62 ;
63 ;
64 ; =====================================================
65 ; MONO & REGISTRY / DETECTING MONO
66 ; =====================================================
67 ;
68 ;
69 ; This setup creates several Registry Keys:
70 ;
71 ; HKEY_LOCAL_MACHINE SOFTWARE\Mono DefaultCLR
72 ; HKEY_LOCAL_MACHINE SOFTWARE\Mono\${MILESTONE} SdkInstallRoot
73 ; HKEY_LOCAL_MACHINE SOFTWARE\Mono\${MILESTONE} FrameworkAssemblyDirectory
74 ; HKEY_LOCAL_MACHINE SOFTWARE\Mono\${MILESTONE} MonoConfigDir
75 ;
76 ; =====================================================
77 ;
78 ; To get the current Mono Install Directory:
79 ;
80 ; 1. Get DefaultCLR
81 ; 2. Get HKEY_LOCAL_MACHINE SOFTWARE\Mono\$THE_DEFAULT_CLR_VALUE SdkInstallRoot
82 ;
83 ; =====================================================
84 ;
85 ; To get the current Mono assembly Directory:
86 ;
87 ; 1. Get DefaultCLR
88 ; 2. Get HKEY_LOCAL_MACHINE SOFTWARE\Mono\$THE_DEFAULT_CLR_VALUE FrameworkAssemblyDirectory
89
90 ; =====================================================
91 ; Do not edit below
92 ; =====================================================
93 ;
94 ;
95 ; =====================================================
96 ; GENERAL SETTING - NEED NOT TO BE CHANGED
97 ; =====================================================
98
99  !define NAME "Mono" ;
100  !define TARGET_INSTALL_DIR "$PROGRAMFILES\Mono-${MILESTONE}" ;
101  !define OUTFILE "mono-${MILESTONE}-win32-1.exe" ;
102
103 ; =====================================================
104 ; SCRIPT
105 ; =====================================================
106
107  !define MUI_PRODUCT "${NAME}"
108  !define MUI_VERSION "${MILESTONE}"
109  !define FULLNAME "${MUI_PRODUCT} ${MUI_VERSION}"
110  !define MUI_UI "${NSISDIR}\Contrib\UIs\modern2.exe"
111  !define MUI_ICON "${NSISDIR}\Contrib\Icons\setup.ico"
112  !define MUI_UNICON "${NSISDIR}\Contrib\Icons\normal-uninstall.ico"
113  !define MUI_WELCOMEPAGE
114  !define MUI_DIRECTORYPAGE
115  !define MUI_DIRECTORYSELECTIONPAGE
116  !include "${NSISDIR}\Contrib\Modern UI\System.nsh"
117  !insertmacro MUI_SYSTEM
118  !insertmacro MUI_LANGUAGE "ENGLISH"
119
120
121  OutFile "${OUTFILE}"
122  InstallDir "${TARGET_INSTALL_DIR}"
123
124
125 ;========================
126 ; Uninstaller
127 ;========================
128
129 Section "Uninstall"
130
131   MessageBox MB_YESNO "Are you sure you want to uninstall Mono from your system?" IDNO NoUnInstall
132
133   Delete $INSTDIR\Uninst.exe ; delete Uninstaller
134   DeleteRegKey HKLM SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Mono-${MILESTONE} ; Remove Entry in Software List
135
136   MessageBox MB_YESNO "Mono was installed into $INSTDIR. Should this directory be removed completly?" IDNO GoNext1
137   RMDir /r $INSTDIR
138   GoNext1:
139
140   DeleteRegKey HKLM SOFTWARE\Mono\${MILESTONE}
141
142   ; If the Default-Key is the current Milestone, we just remove the wrappers
143
144   ReadRegStr $0 HKEY_LOCAL_MACHINE SOFTWARE\Mono\ DefaultCLR
145   StrCmp $0 ${MILESTONE} DeleteWrappers
146
147   MessageBox MB_YESNO "Mono ${MILESTONE} has been removed, but the default installation of Mono differs form this version. Should the wrappers and the Mono registry key be still be removed? This could disable other Mono installations." IDNO GoNext2
148
149   DeleteWrappers:
150
151   ; Complete Uninstall
152
153   DeleteRegKey HKLM SOFTWARE\Mono
154   Delete $WINDIR\monobasepath.bat
155   Delete $WINDIR\mcs.bat
156   Delete $WINDIR\mbas.bat
157   Delete $WINDIR\mint.bat
158   Delete $WINDIR\mono.bat
159   Delete $WINDIR\monodis.bat
160   Delete $WINDIR\monoilasm.bat
161   Delete $WINDIR\sqlsharp.bat
162   Delete $WINDIR\secutil.bat
163   Delete $WINDIR\cert2spc.bat
164   Delete $WINDIR\monoresgen.bat
165   Delete $WINDIR\monosn.bat
166   Delete $WINDIR\cilc.bat
167
168   GoNext2:
169   NoUnInstall:
170
171 SectionEnd
172
173
174  Section
175
176  ; Warn people if a newer Mono is already installed
177
178  ReadRegStr $0 HKEY_LOCAL_MACHINE SOFTWARE\Mono\ DefaultCLR
179  Push $0
180  Push ${MILESTONE} 
181  Call VersionCheck
182  Pop $0
183  StrCmp $0 0 NoAskInstall
184  StrCmp $0 2 NoAskInstall
185  MessageBox MB_YESNO "A newer Mono version is already installed. Still continue?" IDNO NoInstall
186
187  NoAskInstall:
188
189  SetOutPath $INSTDIR
190  File /r "${SOURCE_INSTALL_DIR}"
191  WriteUninstaller Uninst.exe
192
193  WriteRegStr HKEY_LOCAL_MACHINE SOFTWARE\Mono\${MILESTONE} SdkInstallRoot $INSTDIR
194  WriteRegStr HKEY_LOCAL_MACHINE SOFTWARE\Mono\${MILESTONE} FrameworkAssemblyDirectory $INSTDIR\lib
195  WriteRegStr HKEY_LOCAL_MACHINE SOFTWARE\Mono\${MILESTONE} MonoConfigDir $INSTDIR\etc\mono
196  ;WriteRegStr HKEY_LOCAL_MACHINE SOFTWARE\Mono\${MILESTONE} GtkSharpLibPath $INSTDIR\lib
197  WriteRegStr HKEY_LOCAL_MACHINE SOFTWARE\Mono DefaultCLR ${MILESTONE}
198
199  ; Mono Uninstall Entry in Windows Software List in the Control panel
200  WriteRegStr HKEY_LOCAL_MACHINE SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Mono-${MILESTONE} DisplayName "Mono ${MILESTONE}"
201  WriteRegStr HKEY_LOCAL_MACHINE SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Mono-${MILESTONE} UninstallString $INSTDIR\uninst.exe
202
203  ;original string is like C:\mono-0.20\install
204  StrCpy $5 $INSTDIR 
205  Push $5
206  Push "\" ;search for this string
207  Push "/" ;replace with this string
208  Call StrReplace
209  ;resulting string which is like C:/mono-0.20/install
210  Pop $6
211
212 ;========================
213 ; Write the wrapper files
214 ;========================
215
216 ; create bin/mono wrapper to be used if the user has cygwin
217 FileOpen $0 "$INSTDIR\bin\mono.exe.sh" "w"
218 FileWrite $0 "#!/bin/sh$\r$\n"
219 FileWrite $0 "export MONO_PATH=$6/lib$\r$\n"
220 FileWrite $0 "export MONO_CFG_DIR=$6/etc/mono$\r$\n"
221 FileWrite $0 '$6/bin/mono.exe "$$@"'
222 FileClose $0
223
224 ; create bin/mint wrapper to be used if the user has cygwin
225 FileOpen $0 "$INSTDIR\bin\mint.exe.sh" "w"
226 FileWrite $0 "#!/bin/sh$\r$\n"
227 FileWrite $0 "export MONO_PATH=$6/lib$\r$\n"
228 FileWrite $0 "export MONO_CFG_DIR=$6/etc/mono$\r$\n"
229 FileWrite $0 '$6/bin/mint.exe "$$@"'
230 FileClose $0
231
232 ; create bin/mcs wrapper to be used if the user has cygwin
233 FileOpen $0 "$INSTDIR\bin\mcs.exe.sh" "w"
234 FileWrite $0 "#!/bin/sh$\r$\n"
235 FileWrite $0 "export MONO_PATH=$6/lib$\r$\n"
236 FileWrite $0 "export MONO_CFG_DIR=$6/etc/mono$\r$\n"
237 FileWrite $0 '$6/bin/mono.exe $6/bin/mcs.exe "$$@"'
238 FileClose $0
239
240 ; create bin/mbas wrapper to be used if the user has cygwin
241 FileOpen $0 "$INSTDIR\bin\mbas.exe.sh" "w"
242 FileWrite $0 "#!/bin/sh$\r$\n"
243 FileWrite $0 "export MONO_PATH=$6/lib$\r$\n"
244 FileWrite $0 "export MONO_CFG_DIR=$6/etc/mono$\r$\n"
245 FileWrite $0 '$6/bin/mono.exe $6/bin/mbas.exe "$$@"'
246 FileClose $0
247
248 ; create bin/sqlsharp wrapper to be used if the user has cygwin
249 FileOpen $0 "$INSTDIR\bin\sqlsharp.exe.sh" "w"
250 FileWrite $0 "#!/bin/sh$\r$\n"
251 FileWrite $0 "export MONO_PATH=$6/lib$\r$\n"
252 FileWrite $0 "export MONO_CFG_DIR=$6/etc/mono$\r$\n"
253 FileWrite $0 '$6/bin/mono.exe $6/bin/sqlsharp.exe "$$@"'
254 FileClose $0
255
256 ; create bin/monodis wrapper to be used if the user has cygwin
257 FileOpen $0 "$INSTDIR\bin\monodis.exe.sh" "w"
258 FileWrite $0 "#!/bin/sh$\r$\n"
259 FileWrite $0 "export MONO_PATH=$6/lib$\r$\n"
260 FileWrite $0 "export MONO_CFG_DIR=$6/etc/mono$\r$\n"
261 FileWrite $0 '$6/bin/mono.exe $6/bin/monodis.exe "$$@"'
262 FileClose $0
263
264 ; create bin/monoresgen wrapper to be used if the user has cygwin
265 FileOpen $0 "$INSTDIR\bin\monoresgen.exe.sh" "w"
266 FileWrite $0 "#!/bin/sh$\r$\n"
267 FileWrite $0 "export MONO_PATH=$6/lib$\r$\n"
268 FileWrite $0 "export MONO_CFG_DIR=$6/etc/mono$\r$\n"
269 FileWrite $0 '$6/bin/mono.exe $6/bin/monoresgen.exe "$$@"'
270 FileClose $0
271
272 ; create bin/monoilasm wrapper to be used if the user has cygwin
273 FileOpen $0 "$INSTDIR\bin\monoilasm.exe.sh" "w"
274 FileWrite $0 "#!/bin/sh$\r$\n"
275 FileWrite $0 "export MONO_PATH=$6/lib$\r$\n"
276 FileWrite $0 "export MONO_CFG_DIR=$6/etc/mono$\r$\n"
277 FileWrite $0 '$6/bin/mono.exe $6/bin/monoilasm.exe "$$@"'
278 FileClose $0
279
280 ; create bin/monosn wrapper to be used if the user has cygwin
281 FileOpen $0 "$INSTDIR\bin\monosn.exe.sh" "w"
282 FileWrite $0 "#!/bin/sh$\r$\n"
283 FileWrite $0 "export MONO_PATH=$6/lib$\r$\n"
284 FileWrite $0 "export MONO_CFG_DIR=$6/etc/mono$\r$\n"
285 FileWrite $0 '$6/bin/mono.exe $6/bin/monosn.exe "$$@"'
286 FileClose $0
287
288 ; create bin/secutil wrapper to be used if the user has cygwin
289 FileOpen $0 "$INSTDIR\bin\secutil.exe.sh" "w"
290 FileWrite $0 "#!/bin/sh$\r$\n"
291 FileWrite $0 "export MONO_PATH=$6/lib$\r$\n"
292 FileWrite $0 "export MONO_CFG_DIR=$6/etc/mono$\r$\n"
293 FileWrite $0 '$6/bin/mono.exe $6/bin/secutil.exe "$$@"'
294 FileClose $0
295
296 ; create bin/cert2spc wrapper to be used if the user has cygwin
297 FileOpen $0 "$INSTDIR\bin\cert2spc.exe.sh" "w"
298 FileWrite $0 "#!/bin/sh$\r$\n"
299 FileWrite $0 "export MONO_PATH=$6/lib$\r$\n"
300 FileWrite $0 "export MONO_CFG_DIR=$6/etc/mono$\r$\n"
301 FileWrite $0 '$6/bin/mono.exe $6/bin/cert2spc.exe "$$@"'
302 FileClose $0
303
304 ; create bin/cilc wrapper to be used if the user has cygwin
305 FileOpen $0 "$INSTDIR\bin\cilc.exe.sh" "w"
306 FileWrite $0 "#!/bin/sh$\r$\n"
307 FileWrite $0 "export MONO_PATH=$6/lib$\r$\n"
308 FileWrite $0 "export MONO_CFG_DIR=$6/etc/mono$\r$\n"
309 FileWrite $0 '$6/bin/mono.exe $6/bin/cilc.exe "$$@"'
310 FileClose $0
311
312 ;
313 ; These wrappers are copied to the windows directory.
314 ;
315
316 ;========================
317 ; Write the path file
318 ;========================
319
320 FileOpen $0 "$WINDIR\monobasepath.bat" "w"
321 FileWrite $0 'set MONO_BASEPATH="$INSTDIR"$\r$\n'
322 FileWrite $0 'set MONO_PATH=$INSTDIR\lib$\r$\n'
323 FileWrite $0 'set MONO_CFG_DIR="$INSTDIR\etc\mono"'
324 FileClose $0
325
326
327 ;========================
328 ; Write the mcs file
329 ;========================
330
331 FileOpen $0 "$WINDIR\mcs.bat" "w"
332
333 FileWrite $0 "@echo off$\r$\n"
334 FileWrite $0 "call monobasepath.bat$\r$\n"
335 FileWrite $0 "set MONOARGS=$\r$\n"
336 FileWrite $0 ":loop$\r$\n"
337 FileWrite $0 "if x%1 == x goto :done$\r$\n"
338 FileWrite $0 "set MONOARGS=%MONOARGS% %1$\r$\n"
339 FileWrite $0 "shift$\r$\n"
340 FileWrite $0 "goto loop$\r$\n"
341 FileWrite $0 ":done$\r$\n"
342 FileWrite $0 "setlocal$\r$\n"
343 FileWrite $0 'set path="$INSTDIR\bin\;$INSTDIR\lib\;%path%"$\r$\n'
344 FileWrite $0 '"$INSTDIR\bin\mono.exe" "$INSTDIR\bin\mcs.exe" %MONOARGS%$\r$\n'
345 FileWrite $0 "endlocal$\r$\n"
346
347 FileClose $0
348
349 ;========================
350 ; Write the mbas file
351 ;========================
352
353 FileOpen $0 "$WINDIR\mbas.bat" "w"
354
355 FileWrite $0 "@echo off$\r$\n"
356 FileWrite $0 "call monobasepath.bat$\r$\n"
357 FileWrite $0 "set MONOARGS=$\r$\n"
358 FileWrite $0 ":loop$\r$\n"
359 FileWrite $0 "if x%1 == x goto :done$\r$\n"
360 FileWrite $0 "set MONOARGS=%MONOARGS% %1$\r$\n"
361 FileWrite $0 "shift$\r$\n"
362 FileWrite $0 "goto loop$\r$\n"
363 FileWrite $0 ":done$\r$\n"
364 FileWrite $0 "setlocal$\r$\n"
365 FileWrite $0 'set path="$INSTDIR\bin\;$INSTDIR\lib\;%path%"$\r$\n'
366 FileWrite $0 '"$INSTDIR\bin\mono.exe" "$INSTDIR\bin\mbas.exe" %MONOARGS%$\r$\n'
367 FileWrite $0 "endlocal$\r$\n"
368
369 FileClose $0
370
371 ;========================
372 ; Write the mint file
373 ;========================
374
375 FileOpen $0 "$WINDIR\mint.bat" "w"
376
377 FileWrite $0 "@echo off$\r$\n"
378 FileWrite $0 "call monobasepath.bat$\r$\n"
379 FileWrite $0 "set MONOARGS=$\r$\n"
380 FileWrite $0 ":loop$\r$\n"
381 FileWrite $0 "if x%1 == x goto :done$\r$\n"
382 FileWrite $0 "set MONOARGS=%MONOARGS% %1$\r$\n"
383 FileWrite $0 "shift$\r$\n"
384 FileWrite $0 "goto loop$\r$\n"
385 FileWrite $0 ":done$\r$\n"
386 FileWrite $0 "setlocal$\r$\n"
387 FileWrite $0 'set path="$INSTDIR\bin\;$INSTDIR\lib\;%path%"$\r$\n'
388 FileWrite $0 '"$INSTDIR\bin\mint.exe" %MONOARGS%$\r$\n'
389 FileWrite $0 "endlocal$\r$\n"
390
391 FileClose $0
392
393 ;========================
394 ; Write the mono file
395 ;========================
396
397 FileOpen $0 "$WINDIR\mono.bat" "w"
398
399 FileWrite $0 "@echo off$\r$\n"
400 FileWrite $0 "call monobasepath.bat$\r$\n"
401 FileWrite $0 "set MONOARGS=$\r$\n"
402 FileWrite $0 ":loop$\r$\n"
403 FileWrite $0 "if x%1 == x goto :done$\r$\n"
404 FileWrite $0 "set MONOARGS=%MONOARGS% %1$\r$\n"
405 FileWrite $0 "shift$\r$\n"
406 FileWrite $0 "goto loop$\r$\n"
407 FileWrite $0 ":done$\r$\n"
408 FileWrite $0 "setlocal$\r$\n"
409 FileWrite $0 'set path="$INSTDIR\bin\;$INSTDIR\lib\;%path%"$\r$\n'
410 FileWrite $0 '"$INSTDIR\bin\mono.exe" %MONOARGS%$\r$\n'
411 FileWrite $0 "endlocal$\r$\n"
412 FileClose $0
413
414 ;========================
415 ; Write monodis
416 ;========================
417
418 FileOpen $0 "$WINDIR\monodis.bat" "w"
419
420 FileWrite $0 "@echo off$\r$\n"
421 FileWrite $0 "call monobasepath.bat$\r$\n"
422 FileWrite $0 "set MONOARGS=$\r$\n"
423 FileWrite $0 ":loop$\r$\n"
424 FileWrite $0 "if x%1 == x goto :done$\r$\n"
425 FileWrite $0 "set MONOARGS=%MONOARGS% %1$\r$\n"
426 FileWrite $0 "shift$\r$\n"
427 FileWrite $0 "goto loop$\r$\n"
428 FileWrite $0 ":done$\r$\n"
429 FileWrite $0 "setlocal$\r$\n"
430 FileWrite $0 'set path="$INSTDIR\bin\;$INSTDIR\lib\;%path%"$\r$\n'
431 FileWrite $0 '"$INSTDIR\bin\monodis.exe" %MONOARGS%$\r$\n'
432 FileWrite $0 "endlocal$\r$\n"
433
434 FileClose $0
435
436 ;========================
437 ; Write monoilasm
438 ;========================
439
440 FileOpen $0 "$WINDIR\monoilasm.bat" "w"
441
442 FileWrite $0 "@echo off$\r$\n"
443 FileWrite $0 "call monobasepath.bat$\r$\n"
444 FileWrite $0 "set MONOARGS=$\r$\n"
445 FileWrite $0 ":loop$\r$\n"
446 FileWrite $0 "if x%1 == x goto :done$\r$\n"
447 FileWrite $0 "set MONOARGS=%MONOARGS% %1$\r$\n"
448 FileWrite $0 "shift$\r$\n"
449 FileWrite $0 "goto loop$\r$\n"
450 FileWrite $0 ":done$\r$\n"
451 FileWrite $0 "setlocal$\r$\n"
452 FileWrite $0 'set path="$INSTDIR\bin\;$INSTDIR\lib\;%path%"$\r$\n'
453 FileWrite $0 '"$INSTDIR\bin\mono.exe" "$INSTDIR\bin\monoilasm.exe" %MONOARGS%$\r$\n'
454 FileWrite $0 "endlocal$\r$\n"
455
456 FileClose $0
457
458
459 ;========================
460 ; Write the sqlsharp file
461 ;========================
462
463 FileOpen $0 "$WINDIR\sqlsharp.bat" "w"
464
465 FileWrite $0 "@echo off$\r$\n"
466 FileWrite $0 "call monobasepath.bat$\r$\n"
467 FileWrite $0 "set MONOARGS=$\r$\n"
468 FileWrite $0 ":loop$\r$\n"
469 FileWrite $0 "if x%1 == x goto :done$\r$\n"
470 FileWrite $0 "set MONOARGS=%MONOARGS% %1$\r$\n"
471 FileWrite $0 "shift$\r$\n"
472 FileWrite $0 "goto loop$\r$\n"
473 FileWrite $0 ":done$\r$\n"
474 FileWrite $0 "setlocal$\r$\n"
475 FileWrite $0 'set path="$INSTDIR\bin\;$INSTDIR\lib\;%path%"$\r$\n'
476 FileWrite $0 '"$INSTDIR\bin\mono.exe" "$INSTDIR\bin\sqlsharp.exe" %MONOARGS%$\r$\n'
477 FileWrite $0 "endlocal$\r$\n"
478
479 FileClose $0
480
481 ;========================
482 ; Write the secutil file
483 ;========================
484
485 FileOpen $0 "$WINDIR\secutil.bat" "w"
486
487 FileWrite $0 "@echo off$\r$\n"
488 FileWrite $0 "call monobasepath.bat$\r$\n"
489 FileWrite $0 "set MONOARGS=$\r$\n"
490 FileWrite $0 ":loop$\r$\n"
491 FileWrite $0 "if x%1 == x goto :done$\r$\n"
492 FileWrite $0 "set MONOARGS=%MONOARGS% %1$\r$\n"
493 FileWrite $0 "shift$\r$\n"
494 FileWrite $0 "goto loop$\r$\n"
495 FileWrite $0 ":done$\r$\n"
496 FileWrite $0 "setlocal$\r$\n"
497 FileWrite $0 'set path="$INSTDIR\bin\;$INSTDIR\lib\;%path%"$\r$\n'
498 FileWrite $0 '"$INSTDIR\bin\mono.exe" "$INSTDIR\bin\secutil.exe" %MONOARGS%$\r$\n'
499 FileWrite $0 "endlocal$\r$\n"
500
501 FileClose $0
502
503 ;========================
504 ; Write the cert2spc file
505 ;========================
506
507 FileOpen $0 "$WINDIR\cert2spc.bat" "w"
508
509 FileWrite $0 "@echo off$\r$\n"
510 FileWrite $0 "call monobasepath.bat$\r$\n"
511 FileWrite $0 "set MONOARGS=$\r$\n"
512 FileWrite $0 ":loop$\r$\n"
513 FileWrite $0 "if x%1 == x goto :done$\r$\n"
514 FileWrite $0 "set MONOARGS=%MONOARGS% %1$\r$\n"
515 FileWrite $0 "shift$\r$\n"
516 FileWrite $0 "goto loop$\r$\n"
517 FileWrite $0 ":done$\r$\n"
518 FileWrite $0 "setlocal$\r$\n"
519 FileWrite $0 'set path="$INSTDIR\bin\;$INSTDIR\lib\;%path%"$\r$\n'
520 FileWrite $0 '"$INSTDIR\bin\mono.exe" "$INSTDIR\bin\cert2spec.exe" %MONOARGS%$\r$\n'
521 FileWrite $0 "endlocal$\r$\n"
522
523 FileClose $0
524
525
526 ;========================
527 ; Write the monoresgen file
528 ;========================
529
530 FileOpen $0 "$WINDIR\monoresgen.bat" "w"
531
532 FileWrite $0 "@echo off$\r$\n"
533 FileWrite $0 "call monobasepath.bat$\r$\n"
534 FileWrite $0 "set MONOARGS=$\r$\n"
535 FileWrite $0 ":loop$\r$\n"
536 FileWrite $0 "if x%1 == x goto :done$\r$\n"
537 FileWrite $0 "set MONOARGS=%MONOARGS% %1$\r$\n"
538 FileWrite $0 "shift$\r$\n"
539 FileWrite $0 "goto loop$\r$\n"
540 FileWrite $0 ":done$\r$\n"
541 FileWrite $0 "setlocal$\r$\n"
542 FileWrite $0 'set path="$INSTDIR\bin\;$INSTDIR\lib\;%path%"$\r$\n'
543 FileWrite $0 '"$INSTDIR\bin\mono.exe" "$INSTDIR\bin\monoresgen.exe" %MONOARGS%$\r$\n'
544 FileWrite $0 "endlocal$\r$\n"
545
546 FileClose $0
547
548 ;========================
549 ; Write the monosn file
550 ;========================
551
552 FileOpen $0 "$WINDIR\monosn.bat" "w"
553
554 FileWrite $0 "@echo off$\r$\n"
555 FileWrite $0 "call monobasepath.bat$\r$\n"
556 FileWrite $0 "set MONOARGS=$\r$\n"
557 FileWrite $0 ":loop$\r$\n"
558 FileWrite $0 "if x%1 == x goto :done$\r$\n"
559 FileWrite $0 "set MONOARGS=%MONOARGS% %1$\r$\n"
560 FileWrite $0 "shift$\r$\n"
561 FileWrite $0 "goto loop$\r$\n"
562 FileWrite $0 ":done$\r$\n"
563 FileWrite $0 "setlocal$\r$\n"
564 FileWrite $0 'set path="$INSTDIR\bin\;$INSTDIR\lib\;%path%"$\r$\n'
565 FileWrite $0 '"$INSTDIR\bin\monosn.exe" %MONOARGS%$\r$\n'
566 FileWrite $0 "endlocal$\r$\n"
567
568 FileClose $0
569
570 ;========================
571 ; Write the cilc file
572 ;========================
573
574 FileOpen $0 "$WINDIR\cilc.bat" "w"
575
576
577 FileWrite $0 "@echo off$\r$\n"
578 FileWrite $0 "call monobasepath.bat$\r$\n"
579 FileWrite $0 "set MONOARGS=$\r$\n"
580 FileWrite $0 ":loop$\r$\n"
581 FileWrite $0 "if x%1 == x goto :done$\r$\n"
582 FileWrite $0 "set MONOARGS=%MONOARGS% %1$\r$\n"
583 FileWrite $0 "shift$\r$\n"
584 FileWrite $0 "goto loop$\r$\n"
585 FileWrite $0 ":done$\r$\n"
586 FileWrite $0 "setlocal$\r$\n"
587 FileWrite $0 'set path="$INSTDIR\bin\;$INSTDIR\lib\;%path%"$\r$\n'
588 FileWrite $0 '"$INSTDIR\bin\mono.exe" "$INSTDIR\bin\cilc.exe" %MONOARGS%$\r$\n'
589 FileWrite $0 "endlocal$\r$\n"
590
591 FileClose $0
592
593 NoInstall:
594 SectionEnd
595
596 ; function StrReplace
597 ; by Hendri Adriaens
598 ; HendriAdriaens@hotmail.com
599 ; found in the NSIS Archives
600 function StrReplace
601   Exch $0 ;this will replace wrong characters
602   Exch
603   Exch $1 ;needs to be replaced
604   Exch
605   Exch 2
606   Exch $2 ;the orginal string
607   Push $3 ;counter
608   Push $4 ;temp character
609   Push $5 ;temp string
610   Push $6 ;length of string that need to be replaced
611   Push $7 ;length of string that will replace
612   Push $R0 ;tempstring
613   Push $R1 ;tempstring
614   Push $R2 ;tempstring
615   StrCpy $3 "-1"
616   StrCpy $5 ""
617   StrLen $6 $1
618   StrLen $7 $0
619   Loop:
620   IntOp $3 $3 + 1
621   StrCpy $4 $2 $6 $3
622   StrCmp $4 "" ExitLoop
623   StrCmp $4 $1 Replace
624   Goto Loop
625   Replace:
626   StrCpy $R0 $2 $3
627   IntOp $R2 $3 + $6
628   StrCpy $R1 $2 "" $R2
629   StrCpy $2 $R0$0$R1
630   IntOp $3 $3 + $7
631   Goto Loop
632   ExitLoop:
633   StrCpy $0 $2
634   Pop $R2
635   Pop $R1
636   Pop $R0
637   Pop $7
638   Pop $6
639   Pop $5
640   Pop $4
641   Pop $3
642   Pop $2
643   Pop $1
644   Exch $0
645 FunctionEnd
646
647 Function VersionCheck
648   Exch $0 ;second versionnumber
649   Exch
650   Exch $1 ;first versionnumber
651   Push $R0 ;counter for $0
652   Push $R1 ;counter for $1
653   Push $3 ;temp char
654   Push $4 ;temp string for $0
655   Push $5 ;temp string for $1
656   StrCpy $R0 "-1"
657   StrCpy $R1 "-1"
658   Start:
659   StrCpy $4 ""
660   DotLoop0:
661   IntOp $R0 $R0 + 1
662   StrCpy $3 $0 1 $R0
663   StrCmp $3 "" DotFound0
664   StrCmp $3 "." DotFound0
665   StrCpy $4 $4$3
666   Goto DotLoop0
667   DotFound0:
668   StrCpy $5 ""
669   DotLoop1:
670   IntOp $R1 $R1 + 1
671   StrCpy $3 $1 1 $R1
672   StrCmp $3 "" DotFound1
673   StrCmp $3 "." DotFound1
674   StrCpy $5 $5$3
675   Goto DotLoop1
676   DotFound1:
677   Strcmp $4 "" 0 Not4
678     StrCmp $5 "" Equal
679     Goto Ver2Less
680   Not4:
681   StrCmp $5 "" Ver2More
682   IntCmp $4 $5 Start Ver2Less Ver2More
683   Equal:
684   StrCpy $0 "0"
685   Goto Finish
686   Ver2Less:
687   StrCpy $0 "1"
688   Goto Finish
689   Ver2More:
690   StrCpy $0 "2"
691   Finish:
692   Pop $5
693   Pop $4
694   Pop $3
695   Pop $R1
696   Pop $R0
697   Pop $1
698   Exch $0
699 FunctionEnd