]> git.saurik.com Git - wxWidgets.git/blame_incremental - distrib/msw/createsetup.sh
compilation fix
[wxWidgets.git] / distrib / msw / createsetup.sh
... / ...
CommitLineData
1#!/bin/sh
2
3# Create an Inno Setup installer on MSW. It requires MSYS.
4#
5# Example:
6#
7# distrib/msw/createsetup.sh
8#
9# Prerequisites:
10#
11# (1) Change VERSION to the desired wxWidgets version.
12# (2) Change APPDIR to the root of a wxWidgets distribution containing
13# this script.
14# (3) Change DESTDIR (if necessary) to a directory for creating the
15# the installer.
16# (4) Change SETUPCOMPILER to where Inno Setup is installed.
17# (6) Make sure 'unzip' is in your path.
18# (7) Make sure wxMSW-x.y.z.zip and wxWidgets-x.y.z-CHM.zip are in
19# the directory $DESTDIR.
20# (8) Run createsetup.sh.
21#
22# The necessary script files are:
23#
24# distrib/msw/createsetup.sh ; The main script
25# distrib/msw/wxwidgets_in.iss ; The input for making the .iss
26#
27
28#-------------------------------------------------------------------------
29# The version
30#-------------------------------------------------------------------------
31
32VERSION=2.7.2
33
34#-------------------------------------------------------------------------
35# The application title
36#-------------------------------------------------------------------------
37
38APPTITLE="wxWidgets"
39
40#-------------------------------------------------------------------------
41# The application author (copyright holder)
42#-------------------------------------------------------------------------
43
44AUTHOR="The wxWidgets Team"
45
46#-------------------------------------------------------------------------
47# The application vendor (organisation)
48#-------------------------------------------------------------------------
49
50VENDOR="wxWidgets"
51
52#-------------------------------------------------------------------------
53# The top-level directory of the application source tree
54#-------------------------------------------------------------------------
55
56APPDIR=c:/wx2dev/wxWindows
57
58#-------------------------------------------------------------------------
59# The destination directory of the setup
60#-------------------------------------------------------------------------
61
62DESTDIR=$APPDIR/deliver
63
64#-------------------------------------------------------------------------
65# The temporary image directory to use when preparing the setup
66#-------------------------------------------------------------------------
67
68SETUPIMAGEDIR=$DESTDIR/wxWidgets-$VERSION
69
70#-------------------------------------------------------------------------
71# The location of the setup script
72#-------------------------------------------------------------------------
73
74SETUPSCRIPTNAME=$APPDIR/distrib/msw/wxwidgets.iss
75SETUPSCRIPTNAME_IN=$APPDIR/distrib/msw/wxwidgets_in.iss
76
77#-------------------------------------------------------------------------
78# The location of the zip files to be used to create the setup
79#-------------------------------------------------------------------------
80
81WXMSWARCHIVE=$DESTDIR/wxMSW-$VERSION.zip
82WXCHMARCHIVE=$DESTDIR/wxWidgets-$VERSION-CHM.zip
83
84#-------------------------------------------------------------------------
85# The locations of the readme and license files
86#-------------------------------------------------------------------------
87
88READMEFILE=$SETUPIMAGEDIR/docs/readme.txt
89READMEAFTERFILE=$SETUPIMAGEDIR/docs/msw/install.txt
90LICENSEFILE=$SETUPIMAGEDIR/docs/licence.txt
91
92#-------------------------------------------------------------------------
93# The location of the setup compiler
94#-------------------------------------------------------------------------
95
96SETUPCOMPILER="c:/Program Files/Inno Setup 5/compil32.exe"
97
98#-------------------------------------------------------------------------
99# Misc
100#-------------------------------------------------------------------------
101
102# If your zip accepts Cygwin-style paths, then
103# use cygpath, else substitute echo
104CYGPATHPROG=cygpath
105#CYGPATHPROG=echo
106PROGNAME=$0
107SCRIPTDIR=$WXWIN/distrib/msw
108ZIPFLAGS=
109
110# Seds the file represented by the 1st arg, using the expression passed as the 2nd arg.
111doreplace()
112{
113 thefile=$1
114 theexpr=$2
115
116 if [ -f $thefile ]; then
117 sed -e "$theexpr" < $thefile > $thefile.tmp
118 mv $thefile.tmp $thefile
119 else
120 echo "*** $thefile not found."
121 fi
122}
123
124unix2dosname()
125{
126 echo $1 | sed -e "s/\//\\\\\\\/g" > /tmp/filename.tmp
127 RETVALUE=`cat /tmp/filename.tmp`
128 rm -f /tmp/filename.tmp
129}
130
131unix2dosname2()
132{
133 echo $1 | sed -e "s/\//\\\\/g" > /tmp/filename.tmp
134 RETVALUE=`cat /tmp/filename.tmp`
135 rm -f /tmp/filename.tmp
136}
137
138doinit()
139{
140 if [ "$VERBOSE" != "1" ]; then
141 ZIPFLAGS=-q
142 fi
143}
144
145# Do the actual spin.
146
147dospinsetup()
148{
149 mkdir -p $DESTDIR
150 cd $DESTDIR
151
152 echo Now in `pwd`
153
154 rm -f -r wxWidgets-$VERSION
155 rm -f -r wxMSW-$VERSION
156
157 echo Unzipping the wxMSW files...
158
159 unzip $ZIPFLAGS $WXMSWARCHIVE
160
161 # This 'pause' is only necessary because on my system, the following 'mv' seems to fail
162 # without it.
163 echo About to rename wxMSW-$VERSION to wxWidgets-$VERSION. Press Return to continue.
164 read ch
165
166 mv wxMSW-$VERSION wxWidgets-$VERSION
167
168 if [ ! -d wxWidgets-$VERSION ]; then
169 echo *** Could not find wxWidgets-$VERSION: exiting.
170 exit
171 fi
172
173 echo Unzipping the CHM files...
174
175 cd wxWidgets-$VERSION
176 unzip $ZIPFLAGS $WXCHMARCHIVE
177
178 echo Copying readme files...
179 cp docs/msw/readme.txt README-MSW.txt
180 cp docs/msw/install.txt INSTALL-MSW.txt
181 cp docs/licence.txt LICENCE.txt
182 cp docs/lgpl.txt COPYING.LIB
183 cp docs/changes.txt CHANGES.txt
184 cp docs/readme.txt README.txt
185
186 # Now cp some binary files to 'bin'
187 # TODO
188# if [ ! -d bin ]; then
189# mkdir bin
190# fi
191# cp $APPDIR/bin/tex2rtf.exe bin
192# cp $APPDIR/bin/tex2rtf.chm bin
193# cp $APPDIR/bin/widgets.exe bin
194# cp $APPDIR/bin/life.exe bin
195# cp $APPDIR/demos/life/breeder.lif bin
196# cp $APPDIR/docs/htmlhelp/tex2rtf.chm bin
197
198 # Now replace %VERSION% with the real application version, and other
199 # variables
200
201 cp $SETUPSCRIPTNAME_IN $SETUPSCRIPTNAME
202
203 echo Replacing variables in the setup script
204 doreplace $SETUPSCRIPTNAME "s/%VERSION%/$VERSION/g"
205 doreplace $SETUPSCRIPTNAME "s/%COPYRIGHTHOLDER%/$AUTHOR/g"
206 doreplace $SETUPSCRIPTNAME "s/%VENDOR%/$VENDOR/g"
207
208 unix2dosname $READMEFILE
209 doreplace $SETUPSCRIPTNAME "s;%READMEFILE%;$RETVALUE;g"
210
211 unix2dosname $READMEAFTERFILE
212 doreplace $SETUPSCRIPTNAME "s;%READMEAFTERFILE%;$RETVALUE;g"
213
214 unix2dosname $LICENSEFILE
215 doreplace $SETUPSCRIPTNAME "s;%LICENSEFILE%;$RETVALUE;g"
216
217 doreplace $SETUPSCRIPTNAME "s/%APPTITLE%/$APPTITLE/g"
218
219 unix2dosname $SETUPIMAGEDIR
220 doreplace $SETUPSCRIPTNAME "s;%SOURCEDIR%;$RETVALUE;g"
221
222 unix2dosname $DESTDIR
223 doreplace $SETUPSCRIPTNAME "s;%OUTPUTDIR%;$RETVALUE;g"
224
225 rm -f $DESTDIR/setup*.* $DESTDIR/wxMSW-$VERSION-Setup.exe
226
227 # Inno Setup complains if this step is not done
228 unix2dos --unix2dos $SETUPSCRIPTNAME
229
230 # Now invoke INNO compiler on the new ISS file
231 # First, make a DOS filename or Inno Setup will get confused.
232
233 unix2dosname2 $SETUPSCRIPTNAME
234 DOSFILENAME=$RETVALUE
235
236 # Note: the double slash is Mingw32/MSYS convention for
237 # denoting a switch, that must not be converted into
238 # a path (otherwise /c = c:/)
239
240 cd `dirname $SETUPSCRIPTNAME`
241 BASESCRIPTNAME=`basename $SETUPSCRIPTNAME`
242 echo Invoking Inno Setup compiler on $BASESCRIPTNAME
243
244 "$SETUPCOMPILER" //cc $BASESCRIPTNAME
245
246 if [ ! -f $DESTDIR/setup.exe ]; then
247 echo "*** Error - the setup.exe was not generated."
248 exit
249 fi
250
251 cd $DESTDIR
252 mv setup.exe wxMSW-$VERSION-Setup.exe
253
254 echo If you saw no warnings or errors, $APPTITLE was successfully spun.
255 echo
256}
257
258# Get the archives
259getarchives()
260{
261 echo Getting archives...
262 cd $DESDIR
263 curl http://biolpc22.york.ac.uk/pub/$VERSION/wxMSW-$VERSION.zip
264 curl http://biolpc22.york.ac.uk/pub/$VERSION/wxWidgets-$VERSION-CHM.zip
265
266 # TODO
267 #curl http://biolpc22.york.ac.uk/pub/$VERSION/wxWidgets-Windows-Binaries.zip
268
269 echo Done getting archives.
270}
271
272# We can't use e.g. this:
273# ls `cat $SRC/distrib/msw/makefile.rsp` zip -@ -u $DEST/wxWidgets-$VERSION-gen.zip
274# because there's not enough space on the command line, plus we need to ignore the
275# blank lines.
276# So if we need to (not in this script so far) we do something like this instead:
277# expandlines $SRC/setup/files.rsp temp.txt
278# zip -@ `$CYGPATHPROG -w $DEST/archive.zip` < temp.txt
279
280expandlines()
281{
282 toexpand=$1
283 outputfile=$2
284
285 rm -f $outputfile
286 touch $outputfile
287 for line in `cat $toexpand` ; do
288 if [ $line != "" ]; then
289 ls $line >> $outputfile
290 fi
291 done
292}
293
294usage()
295{
296 echo "Usage: $PROGNAME [ options ]" 1>&2
297 echo Options:
298 echo " --help Display this help message"
299 echo " --verbose Verbose zip operation"
300 echo.
301 echo Note that options only override settings in $SCRIPTDIR/setup.var.
302 exit 1
303}
304
305# Process command line options.
306
307for i in "$@"; do
308 case "$i" in
309 --getarchives) GETARCHIVES=1 ;;
310 --verbose) VERBOSE=1 ;;
311 *)
312 usage
313 exit
314 ;;
315 esac
316done
317
318
319doinit
320
321if [ "$GETARCHIVES" = "1" ]; then
322 getarchives
323fi
324
325dospinsetup
326