2006-12-11 Miguel de Icaza <miguel@novell.com>
[mono-project.git] / monowiz.win32.nsi
blobfba80ef2e3a794c58dec259fc56bb4dba6c17ca3
1 ; =================================================================
2 ; mono.nsi - This NSIS script creates Mono Setup wizard for Windows
4 ; Requires NSIS 2.0 (Nullsoft Scriptable Install System)
5 ; From http://nsis.sourceforge.net/site/index.php
6 ; =================================================================
8 ; (C) Copyright 2003 by Johannes Roith
9 ; (C) Copyright 2003, 2004 by Daniel Morgan
11 ; Authors:
12 ; Johannes Roith <johannes@jroith.de>
13 ; Daniel Morgan <danielmorgan@verizon.net>
14 ; Urs C Muff <umuff@quark.com>
15 ; Gonzalo Paniagua Javier <gonzalo@ximian.com>
17 ; This .nsi includes code from the NSIS Archives:
18 ; function StrReplace and VersionCheck
19 ; by Hendri Adriaens
20 ; HendriAdriaens@hotmail.com
22 ; =====================================================
24 ; This script can build a binary setup wizard of mono.
25 ; It is released under the GNU GPL.
27 !include "MUI.nsh"
28 !include "Sections.nsh"
31 ; =====================================================
32 ; SET MILESTONE & SOURCE DIR
33 ; =====================================================
34 ; set by makefile!!
36 ;!define MILESTONE 0.91.99
37 ;!define BUILDNUM 2
38 ;!define SOURCE_INSTALL_DIR ..\install\*.*
40 ; Used to install mcs.exe
41 !define PROFILE_VERSION 1.0
43 ; =====================================================
44 ; SET LOGO
45 ; =====================================================
47 ; Beautification:
49 ; This adds a Mono-specific Image on the left
50 ; You can choose between the light or dark one.
52 ; If you wish no mono-specifi logo, please outcomment
53 ; the lines.
55 ; "light" is enabled.
57 ; !define MUI_SPECIALBITMAP "mono-win32-setup-dark.bmp"
58 !define MUI_SPECIALBITMAP "mono-win32-setup-light.bmp"
60 ; =====================================================
61 ; BUILDING
62 ; =====================================================
64 ; 1. Build mono to a clean directory prefix.
66 ; 2. In your install directory, delete the *.a files.
67 ; Most people won't need them and it saves ~ 4 MB.
69 ; 3. Type "make win32setup"
71 ; 4. The output file is mono-[MILESTONE]-win32-[BUILDNUM].exe
74 ; =====================================================
75 ; MONO & REGISTRY / DETECTING MONO
76 ; =====================================================
79 ; This setup creates several Registry Keys:
81 ; HKEY_LOCAL_MACHINE SOFTWARE\Mono DefaultCLR
82 ; HKEY_LOCAL_MACHINE SOFTWARE\Mono\${MILESTONE} SdkInstallRoot
83 ; HKEY_LOCAL_MACHINE SOFTWARE\Mono\${MILESTONE} FrameworkAssemblyDirectory
84 ; HKEY_LOCAL_MACHINE SOFTWARE\Mono\${MILESTONE} MonoConfigDir
86 ; =====================================================
88 ; To get the current Mono Install Directory:
90 ; 1. Get DefaultCLR
91 ; 2. Get HKEY_LOCAL_MACHINE SOFTWARE\Mono\$THE_DEFAULT_CLR_VALUE SdkInstallRoot
93 ; =====================================================
95 ; To get the current Mono assembly Directory:
97 ; 1. Get DefaultCLR
98 ; 2. Get HKEY_LOCAL_MACHINE SOFTWARE\Mono\$THE_DEFAULT_CLR_VALUE FrameworkAssemblyDirectory
100 ; =====================================================
101 ; Do not edit below
102 ; =====================================================
105 ; =====================================================
106 ; GENERAL SETTING - NEED NOT TO BE CHANGED
107 ; =====================================================
109 !define NAME "Mono"
110 !define TARGET_INSTALL_DIR "$PROGRAMFILES\Mono-${MILESTONE}"
111 !define OUTFILE mono-${MILESTONE}-win32-${BUILDNUM}.exe
113 Name ${NAME}
114 Caption "Mono ${MILESTONE} Build ${BUILDNUM} Setup"
116 SetCompressor bzip2
117 SilentInstall normal
118 ShowInstDetails show
119 SetDateSave on
120 SetDatablockOptimize on
121 CRCCheck on
122 BGGradient 000000 800000 FFFFFF
123 InstallColors FF8080 000030
124 XPStyle on
125 AutoCloseWindow false
127 ; =====================================================
128 ; SCRIPT
129 ; =====================================================
131 #!define MUI_WELCOMEPAGE
132 #!define MUI_DIRECTORYPAGE
133 #!define MUI_DIRECTORYSELECTIONPAGE
135 !define MUI_WELCOMEPAGE_TEXT "This wizard will guide you through the installation of Mono for Windows.\r\n\r\n\r\n$_CLICK"
137 !insertmacro MUI_PAGE_WELCOME
138 !insertmacro MUI_PAGE_DIRECTORY
139 !insertmacro MUI_PAGE_INSTFILES
141 !define MUI_FINISHPAGE_LINK "Visit Mono's website for the latest news"
142 !define MUI_FINISHPAGE_LINK_LOCATION "http://www.go-mono.com/"
144 !define MUI_FINISHPAGE_NOREBOOTSUPPORT
146 !insertmacro MUI_PAGE_FINISH
148 !insertmacro MUI_UNPAGE_CONFIRM
149 !insertmacro MUI_UNPAGE_INSTFILES
151 !insertmacro MUI_LANGUAGE "ENGLISH"
153 AutoCloseWindow false
154 ShowInstDetails show
156 OutFile ${OUTFILE}
157 InstallDir "${TARGET_INSTALL_DIR}"
159 ;========================
160 ; Uninstaller
161 ;========================
163 Section "Uninstall"
165 MessageBox MB_YESNO "Are you sure you want to uninstall Mono from your system?" IDNO NoUnInstall
167 Delete "$INSTDIR\Uninst.exe" ; delete Uninstaller
168 DeleteRegKey HKLM SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Mono-${MILESTONE} ; Remove Entry in Software List
170 MessageBox MB_YESNO "Mono was installed into $INSTDIR. Should this directory be removed completly?" IDNO GoNext1
171 RMDir /r $INSTDIR
172 GoNext1:
174 DeleteRegKey HKLM SOFTWARE\Mono\${MILESTONE}
176 ; If the Default-Key is the current Milestone, we just remove the wrappers
178 ReadRegStr $0 HKEY_LOCAL_MACHINE SOFTWARE\Mono DefaultCLR
179 StrCmp $0 ${MILESTONE} DeleteWrappers
181 MessageBox MB_YESNO "Mono ${MILESTONE} Build ${BUILDNUM} 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
183 DeleteWrappers:
185 ; Complete Uninstall
187 GoNext2:
188 NoUnInstall:
190 SectionEnd
193 Section
195 ; Warn people if a newer Mono is already installed
197 ReadRegStr $0 HKEY_LOCAL_MACHINE SOFTWARE\Mono DefaultCLR
198 Push $0
199 Push ${MILESTONE}
200 Call VersionCheck
201 Pop $0
202 StrCmp $0 0 NoAskInstall
203 StrCmp $0 2 NoAskInstall
204 MessageBox MB_YESNO "A newer Mono version is already installed. Still continue?" IDNO NoInstall
206 NoAskInstall:
208 DetailPrint "Installing Mono Files..."
209 SetOverwrite on
210 SetOutPath $INSTDIR
211 File /r ${SOURCE_INSTALL_DIR}
213 WriteUninstaller Uninst.exe
215 WriteRegStr HKEY_LOCAL_MACHINE SOFTWARE\Mono\${MILESTONE} SdkInstallRoot $INSTDIR
216 WriteRegStr HKEY_LOCAL_MACHINE SOFTWARE\Mono\${MILESTONE} FrameworkAssemblyDirectory $INSTDIR\lib
217 WriteRegStr HKEY_LOCAL_MACHINE SOFTWARE\Mono\${MILESTONE} MonoConfigDir $INSTDIR\etc
218 ;WriteRegStr HKEY_LOCAL_MACHINE SOFTWARE\Mono\${MILESTONE} GtkSharpLibPath $INSTDIR\lib
219 WriteRegStr HKEY_LOCAL_MACHINE SOFTWARE\Mono DefaultCLR ${MILESTONE}
221 ; Mono Uninstall Entry in Windows Software List in the Control panel
222 WriteRegStr HKEY_LOCAL_MACHINE SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Mono-${MILESTONE} DisplayName "Mono ${MILESTONE}"
223 WriteRegStr HKEY_LOCAL_MACHINE SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Mono-${MILESTONE} UninstallString $INSTDIR\uninst.exe
225 ;original string is like C:\mono-0.20\install
226 StrCpy $5 $INSTDIR
227 Push $5
228 Push "\" ;search for this string
229 Push "/" ;replace with this string
230 Call StrReplace
231 ;resulting string which is like C:/mono-0.20/install
232 Pop $6
235 ; These wrappers are copied to the windows directory.
238 ;========================
239 ; Write the path file
240 ;========================
242 Push "mint"
243 Call windowsBatCore
245 Push "mono"
246 Call windowsBatCore
248 Push "monodis"
249 Call windowsBatCore
251 Push "monograph"
252 Call windowsBatCore
254 Push "pedump"
255 Call windowsBatCore
257 Push "mcs"
258 Call windowsBatProfile
260 Push "mbas"
261 Call windowsBatProfile
263 Push $0
264 Call PushBatFiles
265 Call createWindowsBatFiles
266 Pop $0
268 ; ============= glib-2.0.pc ===============
269 FileOpen $0 "$INSTDIR\lib\pkgconfig\glib-2.0.pc" "w"
270 FileWrite $0 "prefix=$6$\r$\n"
271 FileWrite $0 "exec_prefix=$${prefix}$\r$\n"
272 FileWrite $0 "libdir=$${exec_prefix}/lib$\r$\n"
273 FileWrite $0 "includedir=$${prefix}/include$\r$\n"
274 FileWrite $0 "$\r$\n"
275 FileWrite $0 "glib_genmarshal=glib-genmarshal$\r$\n"
276 FileWrite $0 "gobject_query=gobject-query$\r$\n"
277 FileWrite $0 "glib_mkenums=glib-mkenums$\r$\n"
278 FileWrite $0 "$\r$\n"
279 FileWrite $0 "Name: GLib$\r$\n"
280 FileWrite $0 "Description: C Utility Library$\r$\n"
281 FileWrite $0 "Version: 2.0.4$\r$\n"
282 FileWrite $0 "Libs: -L$${libdir} -lglib-2.0 -lintl -liconv $\r$\n"
283 FileWrite $0 "Cflags: -I$${includedir}/glib-2.0 -I$${libdir}/glib-2.0/include $\r$\n"
284 FileClose $0
286 ; ============= gmodule-2.0.pc ===============
287 FileOpen $0 "$INSTDIR\lib\pkgconfig\gmodule-2.0.pc" "w"
288 FileWrite $0 "prefix=$6$\r$\n"
289 FileWrite $0 "exec_prefix=$${prefix}$\r$\n"
290 FileWrite $0 "libdir=$${exec_prefix}/lib$\r$\n"
291 FileWrite $0 "includedir=$${prefix}/include$\r$\n"
292 FileWrite $0 "$\r$\n"
293 FileWrite $0 "gmodule_supported=true$\r$\n"
294 FileWrite $0 "$\r$\n"
295 FileWrite $0 "Name: GModule$\r$\n"
296 FileWrite $0 "Description: Dynamic module loader for GLib$\r$\n"
297 FileWrite $0 "Requires: glib-2.0$\r$\n"
298 FileWrite $0 "Version: 2.0.4$\r$\n"
299 FileWrite $0 "Libs: -L$${libdir} -lgmodule-2.0 $\r$\n"
300 FileWrite $0 "Cflags:$\r$\n"
301 FileClose $0
303 ; ============= gobject-2.0.pc ===============
304 FileOpen $0 "$INSTDIR\lib\pkgconfig\gobject-2.0.pc" "w"
305 FileWrite $0 "prefix=$6$\r$\n"
306 FileWrite $0 "exec_prefix=$${prefix}$\r$\n"
307 FileWrite $0 "libdir=$${exec_prefix}/lib$\r$\n"
308 FileWrite $0 "includedir=$${prefix}/include$\r$\n"
309 FileWrite $0 "$\r$\n"
310 FileWrite $0 "Name: GObject$\r$\n"
311 FileWrite $0 "Description: GLib Type, Object, Parameter and Signal Library$\r$\n"
312 FileWrite $0 "Requires: glib-2.0$\r$\n"
313 FileWrite $0 "Version: 2.0.4$\r$\n"
314 FileWrite $0 "Libs: -L$${libdir} -lgobject-2.0$\r$\n"
315 FileWrite $0 "Cflags:$\r$\n"
316 FileClose $0
318 ; ============= gthread-2.0.pc ===============
319 FileOpen $0 "$INSTDIR\lib\pkgconfig\gthread-2.0.pc" "w"
320 FileWrite $0 "prefix=$6$\r$\n"
321 FileWrite $0 "exec_prefix=$${prefix}$\r$\n"
322 FileWrite $0 "libdir=$${exec_prefix}/lib$\r$\n"
323 FileWrite $0 "includedir=$${prefix}/include$\r$\n"
324 FileWrite $0 "$\r$\n"
325 FileWrite $0 "Name: GThread$\r$\n"
326 FileWrite $0 "Description: Thread support for GLib$\r$\n"
327 FileWrite $0 "Requires: glib-2.0$\r$\n"
328 FileWrite $0 "Version: 2.0.4$\r$\n"
329 FileWrite $0 "Libs: -L$${libdir} -lgthread-2.0 $\r$\n"
330 FileWrite $0 "Cflags: -D_REENTRANT$\r$\n"
331 FileClose $0
333 ; ============= libintl.pc ===============
334 FileOpen $0 "$INSTDIR\lib\pkgconfig\libintl.pc" "w"
335 FileWrite $0 "prefix=$6$\r$\n"
336 FileWrite $0 "exec_prefix=$${prefix}$\r$\n"
337 FileWrite $0 "libdir=$${exec_prefix}/lib$\r$\n"
338 FileWrite $0 "includedir=$${prefix}/include$\r$\n"
339 FileWrite $0 "$\r$\n"
340 FileWrite $0 "Name: libintl$\r$\n"
341 FileWrite $0 "Description: The intl library from GNU gettext$\r$\n"
342 FileWrite $0 "Version: 0.10.40-tml$\r$\n"
343 FileWrite $0 "Libs: -L$${libdir} -lintl$\r$\n"
344 FileWrite $0 "Cflags: -I$${includedir}$\r$\n"
345 FileClose $0
347 Call CreateSetMonoPath
348 Call RunGacutil
350 MessageBox MB_ICONINFORMATION "Don't forget to prepend $INSTDIR\bin to your PATH when using Mono ${MILESTONE} Build ${BUILDNUM}.$\r$\nYou can use $INSTDIR\bin\setmonopath.bat to do it."
351 NoInstall:
353 SectionEnd
355 Function PushBatFiles
356 Push ""
357 Push "al"
358 Push "cert2spc"
359 Push "certmgr"
360 Push "chktrust"
361 Push "cilc"
362 Push "disco"
363 Push "gacutil"
364 Push "genxs"
365 Push "ilasm"
366 Push "ilasm"
367 Push "monop"
368 Push "monoresgen"
369 Push "secutil"
370 Push "sqlsharp"
371 Push "makecert"
372 Push "setreg"
373 Push "signcode"
374 Push "sn"
375 Push "soapsuds"
376 Push "wsdl"
377 Push "xsd"
378 FunctionEnd
380 Function createWindowsBatFiles
381 createloop:
382 Pop $0
383 StrCmp "$0" "" endcreateloop
384 Push $0
385 Call windowsBat
386 Goto createloop
387 endcreateloop:
388 FunctionEnd
390 Function CreateCreategac
391 Push $1
392 FileOpen $1 "$INSTDIR\creategac.bat" "w"
393 FileWrite $1 "@echo off$\r$\n"
394 FileWrite $1 "echo Mono version ${MILESTONE} Build ${BUILDNUM}$\r$\n"
395 FileWrite $1 "echo Running gacutil to install system assemblies into the GAC$\r$\n"
396 FileWrite $1 "SETLOCAL$\r$\n"
397 FileWrite $1 "PATH=$INSTDIR\bin;%PATH%$\r$\n"
398 FileWrite $1 '"$INSTDIR\bin\gacutil.bat" -il "$INSTDIR\lib\mono\${PROFILE_VERSION}\full-path-assemblies.lst"$\r$\n'
399 FileWrite $1 "ENDLOCAL$\r$\n"
400 FileClose $1
401 Pop $1
402 FunctionEnd
404 Function CreateSetMonoPath
405 Push $1
406 FileOpen $1 "$INSTDIR\bin\setmonopath.bat" "w"
407 FileWrite $1 "@echo off$\r$\n"
408 FileWrite $1 "echo Mono version ${MILESTONE} Build ${BUILDNUM}$\r$\n"
409 FileWrite $1 "echo Prepending '$INSTDIR\bin' to PATH$\r$\n"
410 FileWrite $1 "PATH=$INSTDIR\bin;%PATH%$\r$\n"
411 FileClose $1
412 Pop $1
413 FunctionEnd
415 Function RunGacutil
416 Push $1
417 Push $2
418 Push $3
419 FileOpen $1 "$INSTDIR\lib\mono\${PROFILE_VERSION}\assemblies.lst" "r"
420 FileOpen $2 "$INSTDIR\lib\mono\${PROFILE_VERSION}\full-path-assemblies.lst" "w"
421 nextline:
422 FileRead $1 $3
423 StrCmp "$3" "" giveup
424 FileWrite $2 "$INSTDIR\lib\mono\${PROFILE_VERSION}\$3"
425 goto nextline
426 giveup:
427 FileClose $1
428 FileClose $2
429 ExecWait '"$INSTDIR\bin\gacutil.bat" -il "$INSTDIR\lib\mono\${PROFILE_VERSION}\full-path-assemblies.lst"'
430 IfErrors errrun noerr
431 errrun:
432 MessageBox MB_ICONEXCLAMATION 'Error running gacutil!$\r$\nRun "$INSTDIR\creategac.bat" after finishing setup program.'
433 Call CreateCreategac
434 ;Delete "$INSTDIR\lib\mono\${PROFILE_VERSION}\assemblies.lst"
435 ;Delete "$INSTDIR\lib\mono\${PROFILE_VERSION}\full-path-assemblies.lst"
436 noerr:
437 Pop $3
438 Pop $2
439 Pop $1
440 FunctionEnd
442 Function windowsBatCore
443 Exch $1 ;core exe name
445 FileOpen $0 "$INSTDIR\bin\$1.bat" "w"
446 FileWrite $0 "@ECHO OFF$\r$\n"
447 FileWrite $0 "SET MONOARGS=$\r$\n"
448 FileWrite $0 ":loop$\r$\n"
449 FileWrite $0 "IF x%1 == x goto :done$\r$\n"
450 FileWrite $0 'SET MONOARGS=%MONOARGS% %1$\r$\n'
451 FileWrite $0 "SHIFT$\r$\n"
452 FileWrite $0 "GOTO loop$\r$\n"
453 FileWrite $0 ":done$\r$\n"
454 FileWrite $0 "SETLOCAL$\r$\n"
455 FileWrite $0 'SET PATH=$INSTDIR\bin;%PATH%$\r$\n'
456 FileWrite $0 'SET MONO_PATH=$INSTDIR\lib$\r$\n'
457 FileWrite $0 'SET MONO_CFG_DIR=$INSTDIR\etc$\r$\n'
458 FileWrite $0 '"$INSTDIR\lib\$1.exe" %MONOARGS%$\r$\n'
459 FileWrite $0 "ENDLOCAL$\r$\n"
460 FileClose $0
462 FileOpen $0 "$INSTDIR\bin\$1" "w"
463 FileWrite $0 "#!/bin/sh$\n"
464 FileWrite $0 'IDIRUNIX="`cygpath -u '
465 FileWrite $0 "'$INSTDIR'`"
466 FileWrite $0 '"$\n'
467 FileWrite $0 'PATH="$${IDIRUNIX}/bin:$$PATH"$\n'
468 FileWrite $0 "MONO_PATH='$INSTDIR\lib'$\n"
469 FileWrite $0 "MONO_CFG_DIR='$INSTDIR\etc'$\n"
470 FileWrite $0 "export PATH MONO_PATH MONO_CFG_DIR$\n"
471 FileWrite $0 'exec "$6/lib/$1.exe" "$$@"$\n'
472 FileClose $0
474 Pop $1
475 FunctionEnd
477 Function windowsBat
478 Exch $1 ;tool name
480 FileOpen $0 "$INSTDIR\bin\$1.bat" "w"
481 FileWrite $0 "@ECHO OFF$\r$\n"
482 FileWrite $0 "SET MONOARGS=$\r$\n"
483 FileWrite $0 ":loop$\r$\n"
484 FileWrite $0 "IF x%1 == x GOTO :done$\r$\n"
485 FileWrite $0 'SET MONOARGS=%MONOARGS% %1$\r$\n'
486 FileWrite $0 "SHIFT$\r$\n"
487 FileWrite $0 "GOTO loop$\r$\n"
488 FileWrite $0 ":done$\r$\n"
489 FileWrite $0 "SETLOCAL$\r$\n"
490 FileWrite $0 'SET PATH=$INSTDIR\bin;%PATH%$\r$\n'
491 FileWrite $0 'SET MONO_PATH=$INSTDIR\lib$\r$\n'
492 FileWrite $0 'SET MONO_CFG_DIR=$INSTDIR\etc$\r$\n'
493 FileWrite $0 '"$INSTDIR\lib\mono.exe" "$INSTDIR\lib\$1.exe" %MONOARGS%$\r$\n'
494 FileWrite $0 "ENDLOCAL$\r$\n"
495 FileClose $0
497 FileOpen $0 "$INSTDIR\bin\$1" "w"
498 FileWrite $0 "#!/bin/sh$\n"
499 FileWrite $0 'IDIRUNIX="`cygpath -u '
500 FileWrite $0 "'$INSTDIR'`"
501 FileWrite $0 '"$\n'
502 FileWrite $0 'PATH="$${IDIRUNIX}/bin:$$PATH"$\n'
503 FileWrite $0 "MONO_PATH='$INSTDIR\lib'$\n"
504 FileWrite $0 "MONO_CFG_DIR='$INSTDIR\etc'$\n"
505 FileWrite $0 "export PATH MONO_PATH MONO_CFG_DIR$\n"
506 FileWrite $0 'exec "$6/lib/mono.exe" "$6/lib/$1.exe" "$$@"$\n'
507 FileClose $0
509 Pop $1
510 FunctionEnd
512 Function windowsBatProfile
513 Exch $1 ;tool name
515 FileOpen $0 "$INSTDIR\bin\$1.bat" "w"
516 FileWrite $0 "@ECHO OFF$\r$\n"
517 FileWrite $0 "SET MONOARGS=$\r$\n"
518 FileWrite $0 ":loop$\r$\n"
519 FileWrite $0 "IF x%1 == x GOTO :done$\r$\n"
520 FileWrite $0 'SET MONOARGS=%MONOARGS% %1$\r$\n'
521 FileWrite $0 "SHIFT$\r$\n"
522 FileWrite $0 "GOTO loop$\r$\n"
523 FileWrite $0 ":done$\r$\n"
524 FileWrite $0 "SETLOCAL$\r$\n"
525 FileWrite $0 'SET PATH=$INSTDIR\bin;%PATH%$\r$\n'
526 FileWrite $0 'SET MONO_PATH=$INSTDIR\lib$\r$\n'
527 FileWrite $0 'SET MONO_CFG_DIR=$INSTDIR\etc$\r$\n'
528 FileWrite $0 '"$INSTDIR\lib\mono.exe" "$INSTDIR\lib\mono\${PROFILE_VERSION}\$1.exe" %MONOARGS%$\r$\n'
529 FileWrite $0 "ENDLOCAL$\r$\n"
530 FileClose $0
532 FileOpen $0 "$INSTDIR\bin\$1" "w"
533 FileWrite $0 "#!/bin/sh$\n"
534 FileWrite $0 'IDIRUNIX="`cygpath -u '
535 FileWrite $0 "'$INSTDIR'`"
536 FileWrite $0 '"$\n'
537 FileWrite $0 'PATH="$$IDIRUNIX/bin:$$PATH"$\n'
538 FileWrite $0 "MONO_PATH='$INSTDIR\lib'$\n"
539 FileWrite $0 "MONO_CFG_DIR='$INSTDIR\etc'$\n"
540 FileWrite $0 "export PATH MONO_PATH MONO_CFG_DIR$\n"
541 FileWrite $0 'exec "$6/lib/mono.exe" "$6/lib/mono/${PROFILE_VERSION}/$1.exe" "$$@"$\n'
542 FileClose $0
544 Pop $1
545 FunctionEnd
547 ; function StrReplace
548 ; by Hendri Adriaens
549 ; HendriAdriaens@hotmail.com
550 ; found in the NSIS Archives
551 function StrReplace
552 Exch $0 ;this will replace wrong characters
553 Exch
554 Exch $1 ;needs to be replaced
555 Exch
556 Exch 2
557 Exch $2 ;the orginal string
558 Push $3 ;counter
559 Push $4 ;temp character
560 Push $5 ;temp string
561 Push $6 ;length of string that need to be replaced
562 Push $7 ;length of string that will replace
563 Push $R0 ;tempstring
564 Push $R1 ;tempstring
565 Push $R2 ;tempstring
566 StrCpy $3 "-1"
567 StrCpy $5 ""
568 StrLen $6 $1
569 StrLen $7 $0
570 Loop:
571 IntOp $3 $3 + 1
572 StrCpy $4 $2 $6 $3
573 StrCmp $4 "" ExitLoop
574 StrCmp $4 $1 Replace
575 Goto Loop
576 Replace:
577 StrCpy $R0 $2 $3
578 IntOp $R2 $3 + $6
579 StrCpy $R1 $2 "" $R2
580 StrCpy $2 $R0$0$R1
581 IntOp $3 $3 + $7
582 Goto Loop
583 ExitLoop:
584 StrCpy $0 $2
585 Pop $R2
586 Pop $R1
587 Pop $R0
588 Pop $7
589 Pop $6
590 Pop $5
591 Pop $4
592 Pop $3
593 Pop $2
594 Pop $1
595 Exch $0
596 FunctionEnd
598 Function VersionCheck
599 Exch $0 ;second versionnumber
600 Exch
601 Exch $1 ;first versionnumber
602 Push $R0 ;counter for $0
603 Push $R1 ;counter for $1
604 Push $3 ;temp char
605 Push $4 ;temp string for $0
606 Push $5 ;temp string for $1
607 StrCpy $R0 "-1"
608 StrCpy $R1 "-1"
609 Start:
610 StrCpy $4 ""
611 DotLoop0:
612 IntOp $R0 $R0 + 1
613 StrCpy $3 $0 1 $R0
614 StrCmp $3 "" DotFound0
615 StrCmp $3 "." DotFound0
616 StrCpy $4 $4$3
617 Goto DotLoop0
618 DotFound0:
619 StrCpy $5 ""
620 DotLoop1:
621 IntOp $R1 $R1 + 1
622 StrCpy $3 $1 1 $R1
623 StrCmp $3 "" DotFound1
624 StrCmp $3 "." DotFound1
625 StrCpy $5 $5$3
626 Goto DotLoop1
627 DotFound1:
628 Strcmp $4 "" 0 Not4
629 StrCmp $5 "" Equal
630 Goto Ver2Less
631 Not4:
632 StrCmp $5 "" Ver2More
633 IntCmp $4 $5 Start Ver2Less Ver2More
634 Equal:
635 StrCpy $0 "0"
636 Goto Finish
637 Ver2Less:
638 StrCpy $0 "1"
639 Goto Finish
640 Ver2More:
641 StrCpy $0 "2"
642 Finish:
643 Pop $5
644 Pop $4
645 Pop $3
646 Pop $R1
647 Pop $R0
648 Pop $1
649 Exch $0
650 FunctionEnd