]> git.saurik.com Git - wxWidgets.git/blame - distrib/scripts/builddemos.sh
typo fix
[wxWidgets.git] / distrib / scripts / builddemos.sh
CommitLineData
51128f7d
JS
1#!/bin/sh
2
3# Build a range of Unix demos for uploading to the wxWidgets web site.
4# Example:
5# builddemos.sh --wxmsw --verbose &> log
6
7PROGNAME=$0
8WXSRCDIR=$WXWIN
9WXDESTDIR=$WXSRCDIR/deliver
97148373 10PLATFORM=linux
51128f7d 11
1d1a4b71
JS
12# Default binary subdirectory to copy sample executable from
13WINBINDIR=vc_msw
14
51128f7d
JS
15# Suffix to append to each demo tarball, e.g. SuSE92 for widgets-SuSE92
16SUFFIX=linux
17
97148373
JS
18# Determine if the binary name is .app or not
19determine_binary()
20{
21 if [ "$PLATFORM" = "mac" ]; then
22 BINARYNAME=$1.app
23 else
24 BINARYNAME=$1
25 fi
26}
27
1d1a4b71 28dobuilddemos_unix()
51128f7d
JS
29{
30 if [ ! -d "$WXSRCDIR" ] ; then
31 echo Cannot find wxWidgets source directory. Use --wxdir option.
32 exit
33 fi
34 if [ ! -d "$WXDESTDIR" ] ; then
35 echo Cannot find wxWidgets destination directory. Use --deliver option.
36 exit
37 fi
38 if [ ! -d samples ] ; then
39 echo Cannot find samples directory. Invoke this script from the root of the build folder.
40 exit
41 fi
97148373 42 if [ -d include ] ; then
51128f7d
JS
43 echo Do not invoke this from the source directory - invoke from the build directory.
44 exit
45 fi
46
47 echo wxWidgets build directory is `pwd`
48 echo wxWidgets source directory is $WXSRCDIR
49 echo wxWidgets deliver directory is $WXDESTDIR
50 echo Suffix is $SUFFIX
51
52 rm -f $WXDESTDIR/*.tar.gz
53
54 # Dialogs
55
56 pushd samples/dialogs
57 make
58 if [ -f dialogs ] ; then
97148373 59 determine_binary dialogs
51128f7d 60 cp $WXSRCDIR/samples/dialogs/*.cpp $WXSRCDIR/samples/dialogs/*.h .
97148373 61 tar cfz $WXDESTDIR/wxWidgets-DialogsDemo-$SUFFIX.tar.gz $BINARYNAME *.cpp *.h
51128f7d
JS
62 rm -f *.cpp *.h
63 else
64 echo "*** Warning: dialogs sample did not build"
65 fi
66 popd
67
68 # HTML
69
70 pushd samples/html/test
71 make
72 if [ -f test ] ; then
97148373
JS
73 if [ "$PLATFORM" = "mac" ]; then
74 # Don't rename app on Mac in case it messes up the bundle
75 determine_binary test
76 else
77 mv test htmldemo
78 determine_binary htmldemo
79 fi
51128f7d 80 cp $WXSRCDIR/samples/html/test/*.cpp $WXSRCDIR/samples/html/test/*.htm* $WXSRCDIR/samples/html/test/*.png $WXSRCDIR/samples/html/test/*.gif .
97148373 81 tar cfz $WXDESTDIR/wxWidgets-HtmlDemo-$SUFFIX.tar.gz $BINARYNAME *.cpp *.png *.gif *.htm*
16c5f4ae 82 rm -f *.cpp *.gif *.png *.htm*
51128f7d
JS
83 else
84 echo "*** Warning: HTML sample did not build"
85 fi
86 popd
87
88 # Widgets
89
90 pushd samples/widgets
91 make
92 if [ -f widgets ] ; then
97148373 93 determine_binary widgets
51128f7d 94 cp $WXSRCDIR/samples/widgets/*.cpp $WXSRCDIR/samples/widgets/*.h .
97148373 95 tar cfz $WXDESTDIR/wxWidgets-WidgetsDemo-$SUFFIX.tar.gz $BINARYNAME *.cpp *.h
51128f7d
JS
96 rm -f *.cpp *.h
97 else
98 echo "*** Warning: widgets sample did not build"
99 fi
100 popd
101
102 # Life
103
104 pushd demos/life
105 make
106 if [ -f life ] ; then
97148373 107 determine_binary life
51128f7d
JS
108 cp $WXSRCDIR/demos/life/*.cpp $WXSRCDIR/demos/life/*.h $WXSRCDIR/demos/life/*.xpm $WXSRCDIR/demos/life/*.inc $WXSRCDIR/demos/life/*.lif .
109 mkdir bitmaps
110 cp $WXSRCDIR/demos/life/bitmaps/*.* bitmaps
97148373 111 tar cfz $WXDESTDIR/wxWidgets-LifeDemo-$SUFFIX.tar.gz $BINARYNAME *.cpp *.h *.xpm *.inc *.lif bitmaps/*.*
51128f7d
JS
112 rm -f *.cpp *.h *.xpm *.inc *.lif
113 rm -f -r bitmaps
114 else
115 echo "*** Warning: life demo did not build"
116 fi
117 popd
118}
119
1d1a4b71
JS
120dobuilddemos_windows()
121{
122 if [ ! -d "$WXSRCDIR" ] ; then
123 echo Cannot find wxWidgets source directory. Use --wxdir option.
124 exit
125 fi
126 if [ ! -d "$WXDESTDIR" ] ; then
127 echo Cannot find wxWidgets destination directory. Use --deliver option.
128 exit
129 fi
130 if [ ! -d samples ] ; then
131 echo Cannot find samples directory. Invoke this script from the root of the build folder.
132 exit
133 fi
134
135 echo wxWidgets build directory is `pwd`
136 echo wxWidgets source directory is $WXSRCDIR
137 echo wxWidgets deliver directory is $WXDESTDIR
138 echo Suffix is $SUFFIX
139
140 rm -f $WXDESTDIR/*.zip
141
142 # Dialogs
143
144 pushd samples/dialogs
145 if [ -f $WINBINDIR/dialogs.exe ] ; then
146 cp $WINBINDIR/dialogs.exe .
147 zip $WXDESTDIR/wxWidgets-DialogsDemo-$SUFFIX.zip dialogs.exe *.cpp *.h
148 rm -f dialogs.exe
149 else
150 echo "*** Warning: dialogs sample did not build"
151 fi
152 popd
153
154 # HTML
155
156 pushd samples/html/test
157 if [ -f $WINBINDIR/test.exe ] ; then
158 cp $WINBINDIR/test.exe htmldemo.exe
159 zip $WXDESTDIR/wxWidgets-HtmlDemo-$SUFFIX.zip htmldemo.exe *.cpp *.png *.gif *.htm*
160 rm -f htmldemo.exe
161 else
162 echo "*** Warning: HTML sample did not build"
163 fi
164 popd
165
166 # Widgets
167
168 pushd samples/widgets
169 if [ -f $WINBINDIR/widgets.exe ] ; then
170 cp $WINBINDIR/widgets.exe .
171 zip $WXDESTDIR/wxWidgets-WidgetsDemo-$SUFFIX.zip widgets.exe *.cpp *.h
172 else
173 echo "*** Warning: widgets sample did not build"
174 fi
175 popd
176
177 # Life
178
179 pushd demos/life
180 if [ -f $WINBINDIR/life.exe ] ; then
181 cp $WINBINDIR/life.exe .
182 zip $WXDESTDIR/wxWidgets-LifeDemo-$SUFFIX.zip life.exe *.cpp *.h *.xpm *.inc *.lif bitmaps/*.*
183 else
184 echo "*** Warning: life demo did not build"
185 fi
186 popd
187}
188
51128f7d
JS
189usage()
190{
191 echo "Usage: $PROGNAME [ options ]" 1>&2
192 echo Options:
193 echo " --help Display this help message"
194 echo " --suffix Append suffix to each tarball"
195 echo " --wxdir wxWidgets source dir"
196 echo " --deliver Tarball destination dir"
97148373 197 echo " --mac Whether we're building on Mac"
51128f7d
JS
198 echo.
199 echo Note that options only override settings in $SCRIPTDIR/setup.var.
200 exit 1
201}
202
203# Process command line options.
204
205while [ $# -gt 0 ]
206do
207 case "$1" in
208 --suffix) SUFFIX=$2; shift;;
209 --wxdir) WXSRCDIR=$2; WXDESTDIR=$WXSRCDIR/deliver; shift;;
210 --deliver) WXDESTDIR=$2; shift;;
97148373 211 --mac) PLATFORM=mac;;
51128f7d
JS
212 *)
213 usage
214 exit
215 ;;
216 esac
217 shift
218done
219
97148373 220if [ "$OS" = "Windows_NT" ]; then
1d1a4b71
JS
221 dobuilddemos_windows
222else
97148373 223 dobuilddemos_unix
1d1a4b71
JS
224fi
225
51128f7d 226
97148373 227