Mercurial > mxe-octave
changeset 2992:4b450c162e39
Add ability to create simple NSIS installer
* makeinst-script.sh: New script
* mk-dist: added --installer option, which will add nsis to the applications to build, and create an installer instead of a zip file.
author | John Donoghue <john.donoghue@ieee.org> |
---|---|
date | Sat, 18 May 2013 18:15:43 -0400 |
parents | 07a5901747ae |
children | 1f944d8d6fe5 |
files | makeinst-script.sh mk-dist |
diffstat | 2 files changed, 133 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/makeinst-script.sh Sat May 18 18:15:43 2013 -0400 @@ -0,0 +1,104 @@ +#! /bin/bash +set -e + +if [ $# != 1 ]; then + echo "Expected octave folder" + exit +fi + +ARG1=$1 + +TOPDIR=`dirname $ARG1` +OCTAVE_SOURCE=`basename $ARG1` + +echo "Generating installer script ... " + +cd $TOPDIR + +# find icon +ICON=`find $OCTAVE_SOURCE -name octave-logo.ico -printf "%P" | sed 's,/,\\\\,g'` + +# create installer script +echo "; octave setup script $OCTAVE_SOURCE" > octave.nsi + +# initial installer settings + cat >> octave.nsi << EOF + +; installer settings +Name "Octave" +OutFile "Octave-Installer.exe" +InstallDir "c:\\$OCTAVE_SOURCE" +ShowInstDetails show +ShowUnInstDetails show + +Page directory +Page instfiles + +UninstPage uninstConfirm +Uninstpage instfiles + +; file section +Section "MainFiles" + +EOF + +# insert the files + IFS=$'\n' + for f in $(find $OCTAVE_SOURCE -type d -printf "%P\n"); do + winf=`echo $f | sed 's,/,\\\\,g'` + echo " CreateDirectory \"\$INSTDIR\\$winf\"" >> octave.nsi + echo " SetOutPath \"\$INSTDIR\\$winf\"" >> octave.nsi + find "$OCTAVE_SOURCE/$f" -maxdepth 1 -type f -printf " File \"%p\"\n" >> octave.nsi + done + + cat >> octave.nsi << EOF + +SectionEnd + +Section make_uninstaller + ; Write the uninstall keys for Windows + SetOutPath "\$INSTDIR" + WriteRegStr HKLM "Software\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Octave" "DisplayName" "Octave" + WriteRegStr HKLM "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Octave" "UninstallString" "\$INSTDIR\uninstall.exe" + WriteRegDWORD HKLM "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Octave" "NoModify" 1 + WriteRegDWORD HKLM "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Octave" "NoRepair" 1 + WriteUninstaller "uninstall.exe" +SectionEnd + +; start menu (currently hardcoded) +Section "Shortcuts" + + CreateDirectory "\$SMPROGRAMS\\Octave" + CreateShortCut "\$SMPROGRAMS\\Octave\\Uninstall.lnk" "\$INSTDIR\\uninstall.exe" "" "\$INSTDIR\\uninstall.exe" 0 + CreateShortCut "\$SMPROGRAMS\Octave\\Octave.lnk" "\$INSTDIR\\bin\\octave.exe" "" "\$INSTDIR\\$ICON" 0 + CreateShortCut "\$SMPROGRAMS\Octave\\Octave (No GUI).lnk" "\$INSTDIR\\bin\\octave-cli.exe" "" "\$INSTDIR\\$ICON" 0 + +SectionEnd + +Section "Uninstall" + + DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Octave" + DeleteRegKey HKLM "Software\Octave" + + ; Remove shortcuts + Delete "\$SMPROGRAMS\Octave\*.*" + RMDir "\$SMPROGRAMS\Octave" + +EOF + +# insert dir list (backwards order) for uninstall files + for f in $(find $OCTAVE_SOURCE -depth -type d -printf "%P\n"); do + winf=`echo $f | sed 's,/,\\\\,g'` + echo " Delete \"\$INSTDIR\\$winf\\*.*\"" >> octave.nsi + echo " RmDir \"\$INSTDIR\\$winf\"" >> octave.nsi + done + +# last bit of the uninstaller + cat >> octave.nsi << EOF + Delete "\$INSTDIR\*.*" + RmDir "\$INSTDIR" +SectionEnd +EOF + +echo "Generation Completed" +
--- a/mk-dist Thu May 23 14:35:03 2013 -0400 +++ b/mk-dist Sat May 18 18:15:43 2013 -0400 @@ -7,6 +7,7 @@ OCTAVE_TARGET=octave strip=yes +installer=no while [ $# -gt 0 ]; do case "$1" in --jobs) @@ -27,6 +28,11 @@ strip=no shift ;; + --installer) + installer=yes + echo "making installer" + shift + ;; *) echo "mk-dist: unrecognized option: $1" 1>&2 exit 1 @@ -42,13 +48,19 @@ STRIP=$TARGET-strip DATE=$(date +%Y-%m-%d-%H-%M) OCTAVE_DIST_DIR=$TOPDIR/dist/$OCTAVE_TARGET-$DATE +INSTALLER_PKG= + +if [ $installer = "yes" ]; then + echo "Adding installer to build dependancies" + INSTALLER_PKG="nsis" +fi echo "deleting previous dist directory..." rm -rf $TOPDIR/dist mkdir -p $OCTAVE_DIST_DIR echo "building octave and dependencies..." -make $OCTAVE_TARGET msys-base native-gcc native-binutils octave-forge-packages npp JOBS=$jobs +make $OCTAVE_TARGET $INSTALLER_PKG msys-base native-gcc native-binutils octave-forge-packages npp JOBS=$jobs echo "generating lists of files to exclude..." @@ -105,6 +117,20 @@ #cd $TOPDIR/dist #tar -c -j -f $OCTAVE_TARGET-$DATE.tar.bz2 $OCTAVE_TARGET-$DATE -echo "creating zip file..." cd $TOPDIR/dist -zip -q -9 -r $OCTAVE_TARGET-$DATE.zip $OCTAVE_TARGET-$DATE + +if [ $installer = "yes" ]; then + sh ../makeinst-script.sh $OCTAVE_TARGET-$DATE + + echo "Generating installer ..." + $TOPDIR/usr/bin/$TARGET-makensis octave.nsi > /dev/null + + if [ -e Octave-Installer.exe ]; then + rm octave.nsi + fi + +else + echo "creating zip file..." + zip -q -9 -r $OCTAVE_TARGET-$DATE.zip $OCTAVE_TARGET-$DATE +fi +