3 # Make a distribution of an application.
5 # If your zip accepts Cygwin-style paths, then
6 # use cygpath, else substitute echo
13 .
$SCRIPTDIR/setup.var
15 # Set this to the required version
23 if [ -f $thefile ]; then
24 sed -e "$theexpr" < $thefile > $thefile.tmp
25 mv $thefile.tmp
$thefile
27 echo "*** $thefile not found."
33 echo $1 | sed -e "s/\//\\\\\\\/g" > /tmp
/filename.tmp
34 RETVALUE
=`cat /tmp/filename.tmp`
35 rm -f /tmp
/filename.tmp
40 echo $1 | sed -e "s/\//\\\\/g" > /tmp
/filename.tmp
41 RETVALUE
=`cat /tmp/filename.tmp`
42 rm -f /tmp
/filename.tmp
47 echo "#include <stdio.h>" > /tmp
/appver.c
48 echo "#include \"$VERSIONSYMBOLFILE\"" >> /tmp
/appver.c
49 echo "int main() { printf(\"%.2f\", $VERSIONSYMBOL); }" >> /tmp
/appver.c
50 gcc
/tmp
/appver.c
-I$APPDIR -o /tmp
/appver
52 rm -f /tmp
/appver
/tmp
/appver.c
57 if [ -d $SETUPIMAGEDIR ]; then
58 echo Removing existing
$SETUPIMAGEDIR
59 rm -f -r $SETUPIMAGEDIR
62 echo Making the
$SETUPIMAGEDIR for preparing the setup
63 mkdir -p $SETUPIMAGEDIR
65 if [ -f $READMEFILE ]; then
66 echo Copying readme.txt
67 cp $READMEFILE $SETUPIMAGEDIR
69 echo "*** Warning - $READMEFILE not found"
72 if [ -f $LICENSEFILE ]; then
73 echo Copying licence.txt
74 cp $LICENSEFILE $SETUPIMAGEDIR
76 echo "*** Warning - $LICENSEFILE not found"
79 cp $APPDIR/docs
/gpl.txt
$SETUPIMAGEDIR
80 cp $APPDIR/docs
/lgpl.txt
$SETUPIMAGEDIR
81 cp $APPDIR/docs
/licendoc.txt
$SETUPIMAGEDIR
83 echo Copying sample configuration settings
file...
84 cp $APPDIR/configs
/wxwin250.wxs
$SETUPIMAGEDIR
86 if [ "$RESOURCESFILE" != "" ] && [ "$RESOURCESDIR" != "" ]; then
87 if [ -d $RESOURCESDIR ]; then
89 echo Compiling resource
file $RESOURCESFILE
90 zip $SETUPIMAGEDIR/$RESOURCESFILE *
92 echo "*** Warning - $RESOURCESDIR directory not found"
96 if [ "$MAKEMANUAL" != "0" ]; then
97 if [ -d $MANUALDIR ]; then
101 for EACHFILE
in $MANUALFILES ; do
102 if [ -f $EACHFILE ]; then
103 echo Copying
$EACHFILE
104 cp $EACHFILE $SETUPIMAGEDIR
106 echo "*** Warning - $EACHFILE not found"
110 echo "*** Warning - $MANUALDIR not found"
114 if [ -f $WXMANUALCHM ]; then
115 echo Copying wxWindows manual
$WXMANUALCHM
116 cp $WXMANUALCHM $SETUPIMAGEDIR
118 echo "*** Warning - $WXMANUALCHM not found"
121 if [ -f $APPBINARY ]; then
122 echo Copying binary
$APPBINARY
123 cp $APPBINARY $SETUPIMAGEDIR
125 echo "*** Error - $APPBINARY not found"
129 if [ "$UPX" != "0" ]; then
130 echo Compressing binary
131 upx
$SETUPIMAGEDIR/`basename $APPBINARY`
134 # Time to regenerate the Inno Install script
135 if [ "$INNO" != "0" ]; then
136 echo Generating
$SETUPSCRIPTNAME
137 rm -f $SETUPSCRIPTNAME
139 sh
$SCRIPTDIR/makeinno.sh
$SETUPIMAGEDIR $INNOTOP $INNOBOTTOM $SETUPSCRIPTNAME
141 if [ ! -f $SETUPSCRIPTNAME ]; then
142 echo "*** Error - something went wrong with the script file generation."
146 # Now replace %VERSION% with the real application version, and other
148 echo Replacing variables
in the setup
script
149 doreplace
$SETUPSCRIPTNAME "s/%VERSION%/$VERSION/g"
150 doreplace
$SETUPSCRIPTNAME "s/%COPYRIGHTHOLDER%/$AUTHOR/g"
151 doreplace
$SETUPSCRIPTNAME "s/%VENDOR%/$VENDOR/g"
153 unix2dosname
$READMEFILE
154 doreplace
$SETUPSCRIPTNAME "s;%READMEFILE%;$RETVALUE;g"
156 unix2dosname
$READMEAFTERFILE
157 doreplace
$SETUPSCRIPTNAME "s;%READMEAFTERFILE%;$RETVALUE;g"
159 unix2dosname
$LICENSEFILE
160 doreplace
$SETUPSCRIPTNAME "s;%LICENSEFILE%;$RETVALUE;g"
162 doreplace
$SETUPSCRIPTNAME "s/%APPNAME%/$APPNAME/g"
163 doreplace
$SETUPSCRIPTNAME "s/%APPTITLE%/$APPTITLE/g"
165 unix2dosname
$SETUPIMAGEDIR
166 doreplace
$SETUPSCRIPTNAME "s;%SOURCEDIR%;$RETVALUE;g"
168 unix2dosname
$DESTDIR
169 doreplace
$SETUPSCRIPTNAME "s;%OUTPUTDIR%;$RETVALUE;g"
171 doreplace
$SETUPSCRIPTNAME "s/%APPEXTENSION%/$APPEXTENSION/g"
173 # FIXME: how do we get the first name in the list?
174 if [ "$MANUALFILES" != "" ]; then
175 HELPFILE
=`basename $MANUALFILES`
176 unix2dosname
$HELPFILE
177 doreplace
$SETUPSCRIPTNAME "s;%HELPFILE%;$RETVALUE;g"
181 rm -f $DESTDIR/setup
*.
*
183 # Inno Setup complains if this step is not done
184 unix2dos
--unix2dos $SETUPSCRIPTNAME
186 # Now invoke INNO compiler on the new ISS file
187 # First, make a DOS filename or Inno Setup will get confused.
189 unix2dosname2
$SETUPSCRIPTNAME
190 DOSFILENAME
=$RETVALUE
192 # Note: the double slash is Mingw32/MSYS convention for
193 # denoting a switch, that must not be converted into
194 # a path (otherwise /c = c:/)
196 cd `dirname $SETUPSCRIPTNAME`
197 BASESCRIPTNAME
=`basename $SETUPSCRIPTNAME`
198 echo Invoking Inno Setup compiler on
$BASESCRIPTNAME
200 "$SETUPCOMPILER" //cc
$BASESCRIPTNAME
202 if [ ! -f $DESTDIR/setup.exe
]; then
203 echo "*** Error - the setup.exe was not generated."
208 mv setup.exe
$APPNAME-$VERSION-setup.exe
210 echo If you saw no warnings or errors
, $APPTITLE was successfully spun.
214 # We can't use e.g. this:
215 # ls `cat $SRC/distrib/msw/makefile.rsp` zip -@ -u $DEST/wxWindows-$VERSION-gen.zip
216 # because there's not enough space on the command line, plus we need to ignore the
218 # So if we need to (not in this script so far) we do something like this instead:
219 # expandlines $SRC/setup/files.rsp temp.txt
220 # zip -@ `$CYGPATHPROG -w $DEST/archive.zip` < temp.txt
229 for line
in `cat $toexpand` ; do
230 if [ $line != "" ]; then
231 ls $line >> $outputfile
238 echo "Usage: $PROGNAME [ options ]" 1>&2
240 echo " --help Display this help message"
241 echo " --upx Compress executable with UPX"
242 echo " --no-upx Do not compress executable with UPX"
243 echo " --inno Build the setup.exe"
244 echo " --no-inno Do not build the setup.exe"
246 echo Note that options only override settings
in $SCRIPTDIR/setup.var.
250 # Process command line options.