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