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