[smuxi/stable] Win32-Installer: create shortcut for Smuxi running on Mono



commit b2ed50c1dea55c06719de98b95b7f71e42cb429e
Author: Mirco Bauer <meebey meebey net>
Date:   Tue May 10 15:00:39 2016 +0200

    Win32-Installer: create shortcut for Smuxi running on Mono
    
    Smuxi requires Mono for connecting to a smuxi-server running on Mono. Since it
    is not trivial on Windows to run a binary on Mono, we create a shortcut for the
    user if Mono is installed.

 src/smuxi-win32.nsis.in |   30 ++++++++++++++++++++++++++++++
 1 files changed, 30 insertions(+), 0 deletions(-)
---
diff --git a/src/smuxi-win32.nsis.in b/src/smuxi-win32.nsis.in
index 2d675fd..4c891ec 100644
--- a/src/smuxi-win32.nsis.in
+++ b/src/smuxi-win32.nsis.in
@@ -36,6 +36,7 @@ SetCompressor lzma
 !define DOTNET_VERSION "4.0"
 !define GTKSHARP_PRODUCT_GUID "{3CB70B01-4BC8-4C0F-B28F-7C6E33F913CC}"
 !define GTKSHARP_VERSION "2.12.22"
+!define MONO_VERSION "4.2"
 
 ############################
 # MUI 1.67 compatible mode #
@@ -215,6 +216,27 @@ FunctionEnd
     End:
 !macroend
 
+!macro CheckMono
+    DetailPrint "Checking your Mono version..."
+
+    Var /GLOBAL MONO_FOUND_VERSION
+    ReadRegStr $MONO_FOUND_VERSION HKLM \
+              "SOFTWARE\Mono" "Version"
+
+    Var /GLOBAL MONO_FOUND_INSTALLDIR
+    ReadRegStr $MONO_FOUND_INSTALLDIR HKLM \
+              "SOFTWARE\Mono" "SdkInstallRoot"
+
+    ${If} $MONO_FOUND_VERSION != ""
+        DetailPrint "Found Mono $MONO_FOUND_VERSION in $MONO_FOUND_INSTALLDIR"
+    ${EndIf}
+
+    Var /GLOBAL MONO_EXE
+    # WTF: StrCpy can't append and there is no other way to append a string to a
+    # variable in NSIS
+    StrCpy $MONO_EXE "$MONO_FOUND_INSTALLDIRbin\mono.exe"
+!macroend
+
 # DotNET and MSI version checking macro.
 # Written by AnarkiNet(AnarkiNet gmail com) originally, modified by eyal0 (for use in 
http://www.sourceforge.net/projects/itwister)
 # MSI check code based on http://www.codeproject.com/useritems/NSIS.asp
@@ -499,6 +521,7 @@ Section "Main" SEC01
   !insertmacro CheckXPServicePack
   !insertmacro CheckDotNET "${DOTNET_VERSION}"
   !insertmacro CheckGtkSharp ${GTKSHARP_VERSION}
+  !insertmacro CheckMono
 
   SetShellVarContext all
   SetOutPath "$INSTDIR"
@@ -507,6 +530,11 @@ Section "Main" SEC01
   CreateShortCut "$SMPROGRAMS\Smuxi\Smuxi.lnk" "$INSTDIR\smuxi-frontend-gnome.exe"
   CreateShortCut "$DESKTOP\Smuxi.lnk" "$INSTDIR\smuxi-frontend-gnome.exe"
 
+  ${If} $MONO_FOUND_VERSION != ""
+    CreateShortCut "$SMPROGRAMS\Smuxi\Smuxi (Mono).lnk" "$MONO_EXE" 
"$\"$INSTDIR\smuxi-frontend-gnome.exe$\"" "$INSTDIR\smuxi-frontend-gnome.exe"
+    CreateShortCut "$DESKTOP\Smuxi (Mono).lnk" "$MONO_EXE" "$\"$INSTDIR\smuxi-frontend-gnome.exe$\"" 
"$INSTDIR\smuxi-frontend-gnome.exe"
+  ${EndIf}
+
   # remove obsolete libraries for upgrades from Smuxi < 0.8.10.2
   Delete "$INSTDIR\zlib1.dll"
   Delete "$INSTDIR\MonoPosixHelper.dll"
@@ -638,9 +666,11 @@ Section Uninstall
   RMDir /r "$INSTDIR\icons"
 
   Delete "$DESKTOP\Smuxi.lnk"
+  Delete "$DESKTOP\Smuxi (Mono).lnk"
   Delete "$SMPROGRAMS\Smuxi\Uninstall.lnk"
   Delete "$SMPROGRAMS\Smuxi\Website.lnk"
   Delete "$SMPROGRAMS\Smuxi\Smuxi.lnk"
+  Delete "$SMPROGRAMS\Smuxi\Smuxi (Mono).lnk"
 
   RMDir "$SMPROGRAMS\Smuxi"
   RMDir "$INSTDIR"


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]