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
12 ; Johannes Roith <johannes@jroith.de>
13 ; Daniel Morgan <danielmorgan@verizon.net>
14 ; Urs C Muff <umuff@quark.com>
16 ; This .nsi includes code from the NSIS Archives:
17 ; function StrReplace and VersionCheck
19 ; HendriAdriaens@hotmail.com
21 ; =====================================================
23 ; This script can build a binary setup wizard of mono.
24 ; It is released under the GNU GPL.
26 ; =====================================================
27 ; SET MILESTONE & SOURCE DIR
28 ; =====================================================
31 !define MILESTONE
0.31.99
32 !define SOURCE_INSTALL_DIR
..\install\
*.*
34 ; =====================================================
36 ; =====================================================
40 ; This adds a Mono-specific Image on the left
41 ; You can choose between the light or dark one.
43 ; If you wish no mono-specifi logo, please outcomment
48 ; !define MUI_SPECIALBITMAP "mono-win32-setup-dark.bmp"
49 !define MUI_SPECIALBITMAP
"mono-win32-setup-light.bmp"
51 ; =====================================================
53 ; =====================================================
55 ; 1. Build mono to a clean directory prefix.
57 ; 2. In your install directory, delete the *.a files.
58 ; Most people won't need them and it saves ~ 4 MB.
60 ; 3. Type "make win32setup"
62 ; 4. The output file is mono-[MILESTONE]-win32-1.exe
65 ; =====================================================
66 ; MONO & REGISTRY / DETECTING MONO
67 ; =====================================================
70 ; This setup creates several Registry Keys:
72 ; HKEY_LOCAL_MACHINE SOFTWARE\Mono DefaultCLR
73 ; HKEY_LOCAL_MACHINE SOFTWARE\Mono\${MILESTONE} SdkInstallRoot
74 ; HKEY_LOCAL_MACHINE SOFTWARE\Mono\${MILESTONE} FrameworkAssemblyDirectory
75 ; HKEY_LOCAL_MACHINE SOFTWARE\Mono\${MILESTONE} MonoConfigDir
77 ; =====================================================
79 ; To get the current Mono Install Directory:
82 ; 2. Get HKEY_LOCAL_MACHINE SOFTWARE\Mono\$THE_DEFAULT_CLR_VALUE SdkInstallRoot
84 ; =====================================================
86 ; To get the current Mono assembly Directory:
89 ; 2. Get HKEY_LOCAL_MACHINE SOFTWARE\Mono\$THE_DEFAULT_CLR_VALUE FrameworkAssemblyDirectory
91 ; =====================================================
93 ; =====================================================
96 ; =====================================================
97 ; GENERAL SETTING - NEED NOT TO BE CHANGED
98 ; =====================================================
101 !define TARGET_INSTALL_DIR
"$PROGRAMFILES\Mono-${MILESTONE}"
102 !define OUTFILE mono
-${MILESTONE}-win32
-1.exe
105 Caption "Mono ${MILESTONE} Setup"
108 !include "Sections.nsh"
114 SetDatablockOptimize on
116 BGGradient 000000 800000 FFFFFF
117 InstallColors FF8080
000030
119 AutoCloseWindow false
121 ; =====================================================
123 ; =====================================================
125 #!define MUI_WELCOMEPAGE
126 #!define MUI_DIRECTORYPAGE
127 #!define MUI_DIRECTORYSELECTIONPAGE
129 !define MUI_WELCOMEPAGE_TEXT
"This wizard will guide you through the installation of Mono for Windows.\r\n\r\n\r\n$_CLICK"
131 !insertmacro MUI_PAGE_WELCOME
132 !insertmacro MUI_PAGE_DIRECTORY
133 !insertmacro MUI_PAGE_INSTFILES
135 !define MUI_FINISHPAGE_LINK
"Visit Mono's website for the latest news"
136 !define MUI_FINISHPAGE_LINK_LOCATION
"http://www.go-mono.com/"
138 !define MUI_FINISHPAGE_NOREBOOTSUPPORT
140 !insertmacro MUI_PAGE_FINISH
142 !insertmacro MUI_UNPAGE_CONFIRM
143 !insertmacro MUI_UNPAGE_INSTFILES
145 !insertmacro MUI_LANGUAGE
"ENGLISH"
147 AutoCloseWindow false
151 InstallDir "${TARGET_INSTALL_DIR}"
153 ;========================
155 ;========================
159 MessageBox MB_YESNO "Are you sure you want to uninstall Mono from your system?" IDNO NoUnInstall
161 Delete $INSTDIR\Uninst
.exe
; delete Uninstaller
162 DeleteRegKey HKLM SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Mono
-${MILESTONE} ; Remove Entry in Software List
164 MessageBox MB_YESNO "Mono was installed into $INSTDIR. Should this directory be removed completly?" IDNO GoNext1
168 DeleteRegKey HKLM SOFTWARE\Mono\
${MILESTONE}
170 ; If the Default-Key is the current Milestone, we just remove the wrappers
172 ReadRegStr $0 HKEY_LOCAL_MACHINE SOFTWARE\Mono\ DefaultCLR
173 StrCmp $0 ${MILESTONE} DeleteWrappers
175 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
181 DeleteRegKey HKLM SOFTWARE\Mono
182 Delete $WINDIR\monobasepath
.bat
183 Delete $WINDIR\mcs
.bat
184 Delete $WINDIR\mbas
.bat
185 Delete $WINDIR\mint
.bat
186 Delete $WINDIR\mono
.bat
187 Delete $WINDIR\monodis
.bat
188 Delete $WINDIR\monoilasm
.bat
189 Delete $WINDIR\sqlsharp
.bat
190 Delete $WINDIR\secutil
.bat
191 Delete $WINDIR\cert2spc
.bat
192 Delete $WINDIR\monoresgen
.bat
193 Delete $WINDIR\monosn
.bat
194 Delete $WINDIR\cilc
.bat
195 Delete $WINDIR\monop
.bat
196 Delete $WINDIR\xsp
.bat
206 ; Warn people if a newer Mono is already installed
208 ReadRegStr $0 HKEY_LOCAL_MACHINE SOFTWARE\Mono\ DefaultCLR
213 StrCmp $0 0 NoAskInstall
214 StrCmp $0 2 NoAskInstall
215 MessageBox MB_YESNO "A newer Mono version is already installed. Still continue?" IDNO NoInstall
219 DetailPrint "Installing Mono Files..."
222 File /r
${SOURCE_INSTALL_DIR}
224 WriteUninstaller Uninst
.exe
226 WriteRegStr HKEY_LOCAL_MACHINE SOFTWARE\Mono\
${MILESTONE} SdkInstallRoot
$INSTDIR
227 WriteRegStr HKEY_LOCAL_MACHINE SOFTWARE\Mono\
${MILESTONE} FrameworkAssemblyDirectory
$INSTDIR\lib
228 WriteRegStr HKEY_LOCAL_MACHINE SOFTWARE\Mono\
${MILESTONE} MonoConfigDir
$INSTDIR\etc\mono
229 ;WriteRegStr HKEY_LOCAL_MACHINE SOFTWARE\Mono\${MILESTONE} GtkSharpLibPath $INSTDIR\lib
230 WriteRegStr HKEY_LOCAL_MACHINE SOFTWARE\Mono DefaultCLR
${MILESTONE}
232 ; Mono Uninstall Entry in Windows Software List in the Control panel
233 WriteRegStr HKEY_LOCAL_MACHINE SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Mono
-${MILESTONE} DisplayName
"Mono ${MILESTONE}"
234 WriteRegStr HKEY_LOCAL_MACHINE SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Mono
-${MILESTONE} UninstallString
$INSTDIR\uninst
.exe
236 ;original string is like C:\mono-0.20\install
239 Push "\" ;search for this string
240 Push "/" ;replace with this string
242 ;resulting string which is like C:/mono-0.20/install
246 ; These wrappers are copied to the windows directory.
249 ;========================
250 ; Write the path file
251 ;========================
253 FileOpen $0 "$WINDIR\MonoBasePath.bat" "w"
254 FileWrite $0 'SET MONO_BASEPATH="$INSTDIR"$\r$\n'
255 FileWrite $0 'SET MONO_PATH=$INSTDIR\lib$\r$\n'
256 FileWrite $0 'SET MONO_CFG_DIR=$INSTDIR\etc'
301 ; ============= glib-2.0.pc ===============
302 FileOpen $0 "$INSTDIR\lib\pkgconfig\glib-2.0.pc" "w"
303 FileWrite $0 "prefix=$6$\r$\n"
304 FileWrite $0 "exec_prefix=$${prefix}$\r$\n"
305 FileWrite $0 "libdir=$${exec_prefix}/lib$\r$\n"
306 FileWrite $0 "includedir=$${prefix}/include$\r$\n"
307 FileWrite $0 "$\r$\n"
308 FileWrite $0 "glib_genmarshal=glib-genmarshal$\r$\n"
309 FileWrite $0 "gobject_query=gobject-query$\r$\n"
310 FileWrite $0 "glib_mkenums=glib-mkenums$\r$\n"
311 FileWrite $0 "$\r$\n"
312 FileWrite $0 "Name: GLib$\r$\n"
313 FileWrite $0 "Description: C Utility Library$\r$\n"
314 FileWrite $0 "Version: 2.0.4$\r$\n"
315 FileWrite $0 "Libs: -L$${libdir} -lglib-2.0 -lintl -liconv $\r$\n"
316 FileWrite $0 "Cflags: -I$${includedir}/glib-2.0 -I$${libdir}/glib-2.0/include $\r$\n"
319 ; ============= gmodule-2.0.pc ===============
320 FileOpen $0 "$INSTDIR\lib\pkgconfig\gmodule-2.0.pc" "w"
321 FileWrite $0 "prefix=$6$\r$\n"
322 FileWrite $0 "exec_prefix=$${prefix}$\r$\n"
323 FileWrite $0 "libdir=$${exec_prefix}/lib$\r$\n"
324 FileWrite $0 "includedir=$${prefix}/include$\r$\n"
325 FileWrite $0 "$\r$\n"
326 FileWrite $0 "gmodule_supported=true$\r$\n"
327 FileWrite $0 "$\r$\n"
328 FileWrite $0 "Name: GModule$\r$\n"
329 FileWrite $0 "Description: Dynamic module loader for GLib$\r$\n"
330 FileWrite $0 "Requires: glib-2.0$\r$\n"
331 FileWrite $0 "Version: 2.0.4$\r$\n"
332 FileWrite $0 "Libs: -L$${libdir} -lgmodule-2.0 $\r$\n"
333 FileWrite $0 "Cflags:$\r$\n"
336 ; ============= gobject-2.0.pc ===============
337 FileOpen $0 "$INSTDIR\lib\pkgconfig\gobject-2.0.pc" "w"
338 FileWrite $0 "prefix=$6$\r$\n"
339 FileWrite $0 "exec_prefix=$${prefix}$\r$\n"
340 FileWrite $0 "libdir=$${exec_prefix}/lib$\r$\n"
341 FileWrite $0 "includedir=$${prefix}/include$\r$\n"
342 FileWrite $0 "$\r$\n"
343 FileWrite $0 "Name: GObject$\r$\n"
344 FileWrite $0 "Description: GLib Type, Object, Parameter and Signal Library$\r$\n"
345 FileWrite $0 "Requires: glib-2.0$\r$\n"
346 FileWrite $0 "Version: 2.0.4$\r$\n"
347 FileWrite $0 "Libs: -L$${libdir} -lgobject-2.0$\r$\n"
348 FileWrite $0 "Cflags:$\r$\n"
351 ; ============= gthread-2.0.pc ===============
352 FileOpen $0 "$INSTDIR\lib\pkgconfig\gthread-2.0.pc" "w"
353 FileWrite $0 "prefix=$6$\r$\n"
354 FileWrite $0 "exec_prefix=$${prefix}$\r$\n"
355 FileWrite $0 "libdir=$${exec_prefix}/lib$\r$\n"
356 FileWrite $0 "includedir=$${prefix}/include$\r$\n"
357 FileWrite $0 "$\r$\n"
358 FileWrite $0 "Name: GThread$\r$\n"
359 FileWrite $0 "Description: Thread support for GLib$\r$\n"
360 FileWrite $0 "Requires: glib-2.0$\r$\n"
361 FileWrite $0 "Version: 2.0.4$\r$\n"
362 FileWrite $0 "Libs: -L$${libdir} -lgthread-2.0 $\r$\n"
363 FileWrite $0 "Cflags: -D_REENTRANT$\r$\n"
366 ; ============= libintl.pc ===============
367 FileOpen $0 "$INSTDIR\lib\pkgconfig\libintl.pc" "w"
368 FileWrite $0 "prefix=$6$\r$\n"
369 FileWrite $0 "exec_prefix=$${prefix}$\r$\n"
370 FileWrite $0 "libdir=$${exec_prefix}/lib$\r$\n"
371 FileWrite $0 "includedir=$${prefix}/include$\r$\n"
372 FileWrite $0 "$\r$\n"
373 FileWrite $0 "Name: libintl$\r$\n"
374 FileWrite $0 "Description: The intl library from GNU gettext$\r$\n"
375 FileWrite $0 "Version: 0.10.40-tml$\r$\n"
376 FileWrite $0 "Libs: -L$${libdir} -lintl$\r$\n"
377 FileWrite $0 "Cflags: -I$${includedir}$\r$\n"
383 Function windowsBatCore
384 Exch $1 ;core exe name
386 FileOpen $0 "$WINDIR\$1.bat" "w"
387 FileWrite $0 "@ECHO OFF$\r$\n"
388 FileWrite $0 "CALL MonoBasePath.bat$\r$\n"
389 FileWrite $0 "SET MONOARGS=$\r$\n"
390 FileWrite $0 ":loop$\r$\n"
391 FileWrite $0 "IF x%1 == x goto :done$\r$\n"
392 FileWrite $0 "SET MONOARGS=%MONOARGS% %1$\r$\n"
393 FileWrite $0 "SHIFT$\r$\n"
394 FileWrite $0 "GOTO loop$\r$\n"
395 FileWrite $0 ":done$\r$\n"
396 FileWrite $0 "SETLOCAL$\r$\n"
397 FileWrite $0 'SET PATH="$INSTDIR\bin\;$INSTDIR\lib\;$INSTDIR\icu\bin;%PATH%"$\r$\n'
398 FileWrite $0 '"$INSTDIR\bin\$1.exe" %MONOARGS%$\r$\n'
399 FileWrite $0 "ENDLOCAL$\r$\n"
402 FileOpen $0 "$INSTDIR\bin\$1" "w"
403 FileWrite $0 "#!/bin/sh$\r$\n"
404 FileWrite $0 "export MONO_PATH=$6/lib$\r$\n"
405 FileWrite $0 "export MONO_CFG_DIR=$6/etc/mono$\r$\n"
406 FileWrite $0 '$6/bin/$1.exe "$$@"'
415 FileOpen $0 "$WINDIR\$1.bat" "w"
416 FileWrite $0 "@ECHO OFF$\r$\n"
417 FileWrite $0 "CALL monobasepath.bat$\r$\n"
418 FileWrite $0 "SET MONOARGS=$\r$\n"
419 FileWrite $0 ":loop$\r$\n"
420 FileWrite $0 "IF x%1 == x GOTO :done$\r$\n"
421 FileWrite $0 "SET MONOARGS=%MONOARGS% %1$\r$\n"
422 FileWrite $0 "SHIFT$\r$\n"
423 FileWrite $0 "GOTO loop$\r$\n"
424 FileWrite $0 ":done$\r$\n"
425 FileWrite $0 "SETLOCAL$\r$\n"
426 FileWrite $0 'SET PATH="$INSTDIR\bin\;$INSTDIR\lib\;$INSTDIR\icu\bin;%PATH%"$\r$\n'
427 FileWrite $0 '"$INSTDIR\bin\mono.exe" "$INSTDIR\lib\$1.exe" %MONOARGS%$\r$\n'
428 FileWrite $0 "ENDLOCAL$\r$\n"
431 FileOpen $0 "$INSTDIR\bin\$1" "w"
432 FileWrite $0 "#!/bin/sh$\r$\n"
433 FileWrite $0 "export MONO_PATH=$6/lib$\r$\n"
434 FileWrite $0 "export MONO_CFG_DIR=$6/etc/mono$\r$\n"
435 FileWrite $0 '$6/bin/mono.exe $6/lib/$1.exe "$$@"'
441 ; function StrReplace
443 ; HendriAdriaens@hotmail.com
444 ; found in the NSIS Archives
446 Exch $0 ;this will replace wrong characters
448 Exch $1 ;needs to be replaced
451 Exch $2 ;the orginal string
453 Push $4 ;temp character
455 Push $6 ;length of string that need to be replaced
456 Push $7 ;length of string that will replace
467 StrCmp $4 "" ExitLoop
492 Function VersionCheck
493 Exch $0 ;second versionnumber
495 Exch $1 ;first versionnumber
496 Push $R0 ;counter for $0
497 Push $R1 ;counter for $1
499 Push $4 ;temp string for $0
500 Push $5 ;temp string for $1
508 StrCmp $3 "" DotFound0
509 StrCmp $3 "." DotFound0
517 StrCmp $3 "" DotFound1
518 StrCmp $3 "." DotFound1
526 StrCmp $5 "" Ver2More
527 IntCmp $4 $5 Start Ver2Less Ver2More