changeset 468:2079f6f576e1

Add vcredist.
author Simon Cross <hodgestar@gmail.com>
date Sat, 17 Sep 2011 21:43:37 +0200
parents 165fcc747951
children ca1fd4c8170d
files scripts/makensis scripts/mamba.nsi
diffstat 2 files changed, 53 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/makensis	Sat Sep 17 21:42:08 2011 +0200
+++ b/scripts/makensis	Sat Sep 17 21:43:37 2011 +0200
@@ -6,8 +6,28 @@
 MM_VERSION=`sed -ne 's/VERSION_STR = "\(.*\)"/\1/p' setup.py`
 TMP_NSI="$NSI_FILE.tmp"
 
+# We include the pre-SP1 version of the MS redistibutable package  - there are
+# contradictory reports of whether the SP1 release will work with python 2.6,
+# so I haven't tested it. Thiis version works for me
+# This is all for the 32 bit version - things will need to be redone for
+# 64 bit support.
+if [ ! -f "dist/vcredist_x86.exe" ]; then
+   echo "Please copy the required vcredist_x86.exe version into dist/"
+   echo "(version downloaded from http://www.microsoft.com/downloads/en/details.aspx?FamilyID=9b2da534-3e03-4391-8a4d-074b9f2bc1b)"
+   exit
+else
+   # md5sum from 2011-06-25 - MS haven't changed this package in some
+   # time, so hopefully this will stay valid
+   EXPECTED="b936f0f378b9a35489353e878154e899"
+   MD5=`md5sum dist/vcredist_x86.exe | cut -d " " -f 1`
+   if [ "$MD5" != "$EXPECTED" ]; then
+      echo "Unexpected md5sum for vcredist_x86.exe"
+      echo "expected $EXPECTED, got $MD5"
+      exit
+   fi
+fi
+
 cp "$NSI_FILE" "$TMP_NSI"
-#sed -i -e "s#\\(\\s*!define DEPENDENCIES_FOLDER\\).*#\\1 \"$DEPENDENCIES_FOLDER\"#" "$TMP_NSI"
 sed -i -e "s#\\(\\s*!define MM_VERSION\\).*#\\1 \"$MM_VERSION\"#" "$TMP_NSI"
 makensis "$TMP_NSI"
 rm "$TMP_NSI"
--- a/scripts/mamba.nsi	Sat Sep 17 21:42:08 2011 +0200
+++ b/scripts/mamba.nsi	Sat Sep 17 21:43:37 2011 +0200
@@ -30,6 +30,8 @@
   !define MM_ICON "../data/icons/program/icon.ico"
   !define MM_WINDOWS_ICON "data\icons\program\icon.ico"
   !define MM_PY2EXE_ZIP "mutable-mamba-${MM_VERSION}.zip"
+  !define VCREDIST "vcredist_x86.exe"
+  !define VCREDIST_KEY "{FF66E9F6-83E7-3A3E-AF14-8DE9A809A6A4}"
   !define UNINSTALLER "Uninstaller.exe"
 
 ; Pages
@@ -52,6 +54,32 @@
 
 ; Installer Sections
 
+Section "vcredist"
+
+  SetOutPath "$INSTDIR"
+  File "${DIST_FOLDER}\${VCREDIST}"
+   ; Check if it's already installed by checking for the uninstall key
+   ; Idea and key value to check taken post and comments at:
+   ; http://blogs.msdn.com/b/astebner/archive/2009/01/29/9384143.aspx
+
+   ReadRegStr $0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${VCREDIST_KEY}" UninstallString
+   ; NSIS docs say if the key doesn't exist, we get an error and an empty string
+   IfErrors install done
+
+install:
+   ; Runs install with progress bar and no cancel button
+   ; Details taken from
+   ; http://blogs.msdn.com/b/astebner/archive/2010/10/18/9513328.aspx
+
+   DetailPrint "Installing required MS runtime libraries"
+   ExecWait "$INSTDIR/${VCREDIST} /qb!"
+
+done:
+
+   DetailPrint "MS runtime libraries already installed, skipping"
+
+SectionEnd
+
 Section "Mutable Mamba"
   SetOutPath "$INSTDIR"
 
@@ -107,4 +135,8 @@
     Reboot
   noreboot:
 
+  ; TODO: We don't touch the vcredist stuff, since we can't tell a) if we were
+  ; the ones who installed it and b) if anything else needs it. This may cause
+  ; cruft on the users system, so should we tell the user?
+
 SectionEnd