comparison makeinst-script.sh @ 3431:a7c772aa106f

Move mk-dist script functionality into Makefile. * mk-dist: Delete. * binary-dist-rules.mk: New file. * Makefile.in: Include binary-dist-rules.mk. (STRIP_DIST_FILES, STABLE_BUILD, DATE): New variables. * configure.ac: New option --disable-strip-dist-files. * makeinst-script.sh: Require output file as second argument.
author John W. Eaton <jwe@octave.org>
date Thu, 16 Jan 2014 18:03:14 -0500
parents 2183ac663bcb
children 70b110956a4e
comparison
equal deleted inserted replaced
3430:2183ac663bcb 3431:a7c772aa106f
1 #! /bin/bash 1 #! /bin/bash
2 set -e 2 set -e
3 3
4 if [ $# != 1 ]; then 4 if [ $# != 2 ]; then
5 echo "Expected octave folder" 5 echo "usage: makeinst-script.sh dist-dir output-script-name" 1>&2
6 exit 6 exit 1
7 fi 7 fi
8 8
9 ARG1=$1 9 OUTFILE="$2"
10 10 TOPDIR=`dirname $1`
11 TOPDIR=`dirname $ARG1` 11 OCTAVE_SOURCE=`basename $1`
12 OCTAVE_SOURCE=`basename $ARG1`
13 12
14 echo "Generating installer script ... " 13 echo "Generating installer script ... "
15 14
16 cd $TOPDIR 15 cd $TOPDIR
17 MXEDIR=`cd ..; pwd` 16 MXEDIR=`cd ..; pwd`
22 # extract version number 21 # extract version number
23 OCTAVE_VERSION=`head -1 $MXEDIR/octave/octave-version` 22 OCTAVE_VERSION=`head -1 $MXEDIR/octave/octave-version`
24 VERSION=`echo $OCTAVE_VERSION | sed -n 's,\([0-9\.]*\).*,\1,p'` 23 VERSION=`echo $OCTAVE_VERSION | sed -n 's,\([0-9\.]*\).*,\1,p'`
25 24
26 # create installer script 25 # create installer script
27 echo "; octave setup script $OCTAVE_SOURCE" > octave.nsi 26 echo "; octave setup script $OCTAVE_SOURCE" > $OUTFILE
28 27
29 # installer settings 28 # installer settings
30 cat >> octave.nsi << EOF 29 cat >> $OUTFILE << EOF
31 !define APP_NAME "GNU Octave" 30 !define APP_NAME "GNU Octave"
32 !define COMP_NAME "GNU Project" 31 !define COMP_NAME "GNU Project"
33 !define WEB_SITE "http://www.octave.org" 32 !define WEB_SITE "http://www.octave.org"
34 !define VERSION "$VERSION.0" 33 !define VERSION "$VERSION.0"
35 !define OCTAVE_VERSION "$OCTAVE_VERSION" 34 !define OCTAVE_VERSION "$OCTAVE_VERSION"
132 131
133 # insert the files 132 # insert the files
134 IFS=$'\n' 133 IFS=$'\n'
135 for f in $(find $OCTAVE_SOURCE -type d -printf "%P\n"); do 134 for f in $(find $OCTAVE_SOURCE -type d -printf "%P\n"); do
136 winf=`echo $f | sed 's,/,\\\\,g'` 135 winf=`echo $f | sed 's,/,\\\\,g'`
137 echo " CreateDirectory \"\$INSTDIR\\$winf\"" >> octave.nsi 136 echo " CreateDirectory \"\$INSTDIR\\$winf\"" >> $OUTFILE
138 echo " SetOutPath \"\$INSTDIR\\$winf\"" >> octave.nsi 137 echo " SetOutPath \"\$INSTDIR\\$winf\"" >> $OUTFILE
139 find "$OCTAVE_SOURCE/$f" -maxdepth 1 -type f -printf " File \"%p\"\n" >> octave.nsi 138 find "$OCTAVE_SOURCE/$f" -maxdepth 1 -type f -printf " File \"%p\"\n" >> $OUTFILE
140 done 139 done
141 140
142 cat >> octave.nsi << EOF 141 cat >> $OUTFILE << EOF
143 142
144 ; add qt.conf 143 ; add qt.conf
145 Push \$0 144 Push \$0
146 \${StrRep} '\$0' '\$INSTDIR' '\\' '/' 145 \${StrRep} '\$0' '\$INSTDIR' '\\' '/'
147 WriteINIStr "\$INSTDIR\\bin\\qt.conf" "Paths" "Prefix" "\$0" 146 WriteINIStr "\$INSTDIR\\bin\\qt.conf" "Paths" "Prefix" "\$0"
170 CreateShortCut "\$SMPROGRAMS\\Octave-$VERSION\\Octave (Experimental GUI).lnk" "\$INSTDIR\\bin\\octave-gui.exe" "" "\$INSTDIR\\$ICON" 0 169 CreateShortCut "\$SMPROGRAMS\\Octave-$VERSION\\Octave (Experimental GUI).lnk" "\$INSTDIR\\bin\\octave-gui.exe" "" "\$INSTDIR\\$ICON" 0
171 SetOutPath "\$INSTDIR" 170 SetOutPath "\$INSTDIR"
172 EOF 171 EOF
173 # if we have documentation files, create shortcuts 172 # if we have documentation files, create shortcuts
174 if [ -d $OCTAVE_SOURCE/share/doc/octave ]; then 173 if [ -d $OCTAVE_SOURCE/share/doc/octave ]; then
175 cat >> octave.nsi << EOF 174 cat >> $OUTFILE << EOF
176 CreateDirectory "\$SMPROGRAMS\\Octave-$VERSION\\Documentation" 175 CreateDirectory "\$SMPROGRAMS\\Octave-$VERSION\\Documentation"
177 CreateShortCut "\$SMPROGRAMS\\Octave-$VERSION\\Documentation\\Octave C++ Classes (PDF).lnk" "\$INSTDIR\\share\\doc\\octave\\liboctave.pdf" "" "" 0 176 CreateShortCut "\$SMPROGRAMS\\Octave-$VERSION\\Documentation\\Octave C++ Classes (PDF).lnk" "\$INSTDIR\\share\\doc\\octave\\liboctave.pdf" "" "" 0
178 CreateShortCut "\$SMPROGRAMS\\Octave-$VERSION\\Documentation\\Octave C++ Classes (HTML).lnk" "\$INSTDIR\\share\\doc\\octave\\liboctave.html\\index.html" "" "" 0 177 CreateShortCut "\$SMPROGRAMS\\Octave-$VERSION\\Documentation\\Octave C++ Classes (HTML).lnk" "\$INSTDIR\\share\\doc\\octave\\liboctave.html\\index.html" "" "" 0
179 CreateShortCut "\$SMPROGRAMS\\Octave-$VERSION\\Documentation\\Octave (PDF).lnk" "\$INSTDIR\\share\\doc\\octave\\octave.pdf" "" "" 0 178 CreateShortCut "\$SMPROGRAMS\\Octave-$VERSION\\Documentation\\Octave (PDF).lnk" "\$INSTDIR\\share\\doc\\octave\\octave.pdf" "" "" 0
180 CreateShortCut "\$SMPROGRAMS\\Octave-$VERSION\\Documentation\\Octave (HTML).lnk" "\$INSTDIR\\share\\doc\\octave\\octave.html\\index.html" "" "" 0 179 CreateShortCut "\$SMPROGRAMS\\Octave-$VERSION\\Documentation\\Octave (HTML).lnk" "\$INSTDIR\\share\\doc\\octave\\octave.html\\index.html" "" "" 0
181 EOF 180 EOF
182 fi 181 fi
183 182
184 cat >> octave.nsi << EOF 183 cat >> $OUTFILE << EOF
185 SectionEnd 184 SectionEnd
186 185
187 Section "Uninstall" 186 Section "Uninstall"
188 187
189 DeleteRegKey HKLM "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Octave-$VERSION" 188 DeleteRegKey HKLM "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Octave-$VERSION"
204 EOF 203 EOF
205 204
206 # insert dir list (backwards order) for uninstall files 205 # insert dir list (backwards order) for uninstall files
207 for f in $(find $OCTAVE_SOURCE -depth -type d -printf "%P\n"); do 206 for f in $(find $OCTAVE_SOURCE -depth -type d -printf "%P\n"); do
208 winf=`echo $f | sed 's,/,\\\\,g'` 207 winf=`echo $f | sed 's,/,\\\\,g'`
209 echo " Delete \"\$INSTDIR\\$winf\\*.*\"" >> octave.nsi 208 echo " Delete \"\$INSTDIR\\$winf\\*.*\"" >> $OUTFILE
210 echo " RmDir \"\$INSTDIR\\$winf\"" >> octave.nsi 209 echo " RmDir \"\$INSTDIR\\$winf\"" >> $OUTFILE
211 done 210 done
212 211
213 # last bit of the uninstaller 212 # last bit of the uninstaller
214 cat >> octave.nsi << EOF 213 cat >> $OUTFILE << EOF
215 Delete "\$INSTDIR\\*.*" 214 Delete "\$INSTDIR\\*.*"
216 RmDir "\$INSTDIR" 215 RmDir "\$INSTDIR"
217 SectionEnd 216 SectionEnd
218 217
219 ; Function to detect Windows version and abort if Octave is unsupported in the current platform 218 ; Function to detect Windows version and abort if Octave is unsupported in the current platform