2006-03-07 11:50:07 -05:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
# Build a range of Unix demos for uploading to the wxWidgets web site.
|
|
|
|
# Example:
|
|
|
|
# builddemos.sh --wxmsw --verbose &> log
|
|
|
|
|
|
|
|
PROGNAME=$0
|
|
|
|
WXSRCDIR=$WXWIN
|
|
|
|
WXDESTDIR=$WXSRCDIR/deliver
|
2006-03-07 17:02:37 -05:00
|
|
|
PLATFORM=linux
|
2006-03-07 11:50:07 -05:00
|
|
|
|
2006-03-07 16:04:05 -05:00
|
|
|
# Default binary subdirectory to copy sample executable from
|
|
|
|
WINBINDIR=vc_msw
|
|
|
|
|
2006-03-07 11:50:07 -05:00
|
|
|
# Suffix to append to each demo tarball, e.g. SuSE92 for widgets-SuSE92
|
|
|
|
SUFFIX=linux
|
|
|
|
|
2006-03-07 17:02:37 -05:00
|
|
|
# Determine if the binary name is .app or not
|
|
|
|
determine_binary()
|
|
|
|
{
|
|
|
|
if [ "$PLATFORM" = "mac" ]; then
|
|
|
|
BINARYNAME=$1.app
|
|
|
|
else
|
|
|
|
BINARYNAME=$1
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2006-03-07 16:04:05 -05:00
|
|
|
dobuilddemos_unix()
|
2006-03-07 11:50:07 -05:00
|
|
|
{
|
|
|
|
if [ ! -d "$WXSRCDIR" ] ; then
|
|
|
|
echo Cannot find wxWidgets source directory. Use --wxdir option.
|
|
|
|
exit
|
|
|
|
fi
|
|
|
|
if [ ! -d "$WXDESTDIR" ] ; then
|
|
|
|
echo Cannot find wxWidgets destination directory. Use --deliver option.
|
|
|
|
exit
|
|
|
|
fi
|
|
|
|
if [ ! -d samples ] ; then
|
|
|
|
echo Cannot find samples directory. Invoke this script from the root of the build folder.
|
|
|
|
exit
|
|
|
|
fi
|
2006-03-07 17:02:37 -05:00
|
|
|
if [ -d include ] ; then
|
2006-03-07 11:50:07 -05:00
|
|
|
echo Do not invoke this from the source directory - invoke from the build directory.
|
|
|
|
exit
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo wxWidgets build directory is `pwd`
|
|
|
|
echo wxWidgets source directory is $WXSRCDIR
|
|
|
|
echo wxWidgets deliver directory is $WXDESTDIR
|
|
|
|
echo Suffix is $SUFFIX
|
|
|
|
|
|
|
|
rm -f $WXDESTDIR/*.tar.gz
|
|
|
|
|
|
|
|
# Dialogs
|
|
|
|
|
|
|
|
pushd samples/dialogs
|
|
|
|
make
|
|
|
|
if [ -f dialogs ] ; then
|
2006-03-07 17:02:37 -05:00
|
|
|
determine_binary dialogs
|
2006-03-07 11:50:07 -05:00
|
|
|
cp $WXSRCDIR/samples/dialogs/*.cpp $WXSRCDIR/samples/dialogs/*.h .
|
2006-03-07 17:02:37 -05:00
|
|
|
tar cfz $WXDESTDIR/wxWidgets-DialogsDemo-$SUFFIX.tar.gz $BINARYNAME *.cpp *.h
|
2006-03-07 11:50:07 -05:00
|
|
|
rm -f *.cpp *.h
|
|
|
|
else
|
|
|
|
echo "*** Warning: dialogs sample did not build"
|
|
|
|
fi
|
|
|
|
popd
|
|
|
|
|
|
|
|
# HTML
|
|
|
|
|
|
|
|
pushd samples/html/test
|
|
|
|
make
|
|
|
|
if [ -f test ] ; then
|
2006-03-07 17:02:37 -05:00
|
|
|
if [ "$PLATFORM" = "mac" ]; then
|
|
|
|
# Don't rename app on Mac in case it messes up the bundle
|
|
|
|
determine_binary test
|
|
|
|
else
|
|
|
|
mv test htmldemo
|
|
|
|
determine_binary htmldemo
|
|
|
|
fi
|
2006-03-07 11:50:07 -05:00
|
|
|
cp $WXSRCDIR/samples/html/test/*.cpp $WXSRCDIR/samples/html/test/*.htm* $WXSRCDIR/samples/html/test/*.png $WXSRCDIR/samples/html/test/*.gif .
|
2006-03-07 17:02:37 -05:00
|
|
|
tar cfz $WXDESTDIR/wxWidgets-HtmlDemo-$SUFFIX.tar.gz $BINARYNAME *.cpp *.png *.gif *.htm*
|
2006-03-07 14:36:11 -05:00
|
|
|
rm -f *.cpp *.gif *.png *.htm*
|
2006-03-07 11:50:07 -05:00
|
|
|
else
|
|
|
|
echo "*** Warning: HTML sample did not build"
|
|
|
|
fi
|
|
|
|
popd
|
|
|
|
|
|
|
|
# Widgets
|
|
|
|
|
|
|
|
pushd samples/widgets
|
|
|
|
make
|
|
|
|
if [ -f widgets ] ; then
|
2006-03-07 17:02:37 -05:00
|
|
|
determine_binary widgets
|
2006-03-07 11:50:07 -05:00
|
|
|
cp $WXSRCDIR/samples/widgets/*.cpp $WXSRCDIR/samples/widgets/*.h .
|
2006-03-07 17:02:37 -05:00
|
|
|
tar cfz $WXDESTDIR/wxWidgets-WidgetsDemo-$SUFFIX.tar.gz $BINARYNAME *.cpp *.h
|
2006-03-07 11:50:07 -05:00
|
|
|
rm -f *.cpp *.h
|
|
|
|
else
|
|
|
|
echo "*** Warning: widgets sample did not build"
|
|
|
|
fi
|
|
|
|
popd
|
|
|
|
|
|
|
|
# Life
|
|
|
|
|
|
|
|
pushd demos/life
|
|
|
|
make
|
|
|
|
if [ -f life ] ; then
|
2006-03-07 17:02:37 -05:00
|
|
|
determine_binary life
|
2006-03-07 11:50:07 -05:00
|
|
|
cp $WXSRCDIR/demos/life/*.cpp $WXSRCDIR/demos/life/*.h $WXSRCDIR/demos/life/*.xpm $WXSRCDIR/demos/life/*.inc $WXSRCDIR/demos/life/*.lif .
|
|
|
|
mkdir bitmaps
|
|
|
|
cp $WXSRCDIR/demos/life/bitmaps/*.* bitmaps
|
2006-03-07 17:02:37 -05:00
|
|
|
tar cfz $WXDESTDIR/wxWidgets-LifeDemo-$SUFFIX.tar.gz $BINARYNAME *.cpp *.h *.xpm *.inc *.lif bitmaps/*.*
|
2006-03-07 11:50:07 -05:00
|
|
|
rm -f *.cpp *.h *.xpm *.inc *.lif
|
|
|
|
rm -f -r bitmaps
|
|
|
|
else
|
|
|
|
echo "*** Warning: life demo did not build"
|
|
|
|
fi
|
|
|
|
popd
|
|
|
|
}
|
|
|
|
|
2006-03-07 16:04:05 -05:00
|
|
|
dobuilddemos_windows()
|
|
|
|
{
|
|
|
|
if [ ! -d "$WXSRCDIR" ] ; then
|
|
|
|
echo Cannot find wxWidgets source directory. Use --wxdir option.
|
|
|
|
exit
|
|
|
|
fi
|
|
|
|
if [ ! -d "$WXDESTDIR" ] ; then
|
|
|
|
echo Cannot find wxWidgets destination directory. Use --deliver option.
|
|
|
|
exit
|
|
|
|
fi
|
|
|
|
if [ ! -d samples ] ; then
|
|
|
|
echo Cannot find samples directory. Invoke this script from the root of the build folder.
|
|
|
|
exit
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo wxWidgets build directory is `pwd`
|
|
|
|
echo wxWidgets source directory is $WXSRCDIR
|
|
|
|
echo wxWidgets deliver directory is $WXDESTDIR
|
|
|
|
echo Suffix is $SUFFIX
|
|
|
|
|
|
|
|
rm -f $WXDESTDIR/*.zip
|
|
|
|
|
|
|
|
# Dialogs
|
|
|
|
|
|
|
|
pushd samples/dialogs
|
|
|
|
if [ -f $WINBINDIR/dialogs.exe ] ; then
|
|
|
|
cp $WINBINDIR/dialogs.exe .
|
|
|
|
zip $WXDESTDIR/wxWidgets-DialogsDemo-$SUFFIX.zip dialogs.exe *.cpp *.h
|
|
|
|
rm -f dialogs.exe
|
|
|
|
else
|
|
|
|
echo "*** Warning: dialogs sample did not build"
|
|
|
|
fi
|
|
|
|
popd
|
|
|
|
|
|
|
|
# HTML
|
|
|
|
|
|
|
|
pushd samples/html/test
|
|
|
|
if [ -f $WINBINDIR/test.exe ] ; then
|
|
|
|
cp $WINBINDIR/test.exe htmldemo.exe
|
|
|
|
zip $WXDESTDIR/wxWidgets-HtmlDemo-$SUFFIX.zip htmldemo.exe *.cpp *.png *.gif *.htm*
|
|
|
|
rm -f htmldemo.exe
|
|
|
|
else
|
|
|
|
echo "*** Warning: HTML sample did not build"
|
|
|
|
fi
|
|
|
|
popd
|
|
|
|
|
|
|
|
# Widgets
|
|
|
|
|
|
|
|
pushd samples/widgets
|
|
|
|
if [ -f $WINBINDIR/widgets.exe ] ; then
|
|
|
|
cp $WINBINDIR/widgets.exe .
|
|
|
|
zip $WXDESTDIR/wxWidgets-WidgetsDemo-$SUFFIX.zip widgets.exe *.cpp *.h
|
|
|
|
else
|
|
|
|
echo "*** Warning: widgets sample did not build"
|
|
|
|
fi
|
|
|
|
popd
|
|
|
|
|
|
|
|
# Life
|
|
|
|
|
|
|
|
pushd demos/life
|
|
|
|
if [ -f $WINBINDIR/life.exe ] ; then
|
|
|
|
cp $WINBINDIR/life.exe .
|
|
|
|
zip $WXDESTDIR/wxWidgets-LifeDemo-$SUFFIX.zip life.exe *.cpp *.h *.xpm *.inc *.lif bitmaps/*.*
|
|
|
|
else
|
|
|
|
echo "*** Warning: life demo did not build"
|
|
|
|
fi
|
|
|
|
popd
|
|
|
|
}
|
|
|
|
|
2006-03-07 11:50:07 -05:00
|
|
|
usage()
|
|
|
|
{
|
|
|
|
echo "Usage: $PROGNAME [ options ]" 1>&2
|
|
|
|
echo Options:
|
|
|
|
echo " --help Display this help message"
|
|
|
|
echo " --suffix Append suffix to each tarball"
|
|
|
|
echo " --wxdir wxWidgets source dir"
|
|
|
|
echo " --deliver Tarball destination dir"
|
2006-03-07 17:02:37 -05:00
|
|
|
echo " --mac Whether we're building on Mac"
|
2006-03-07 11:50:07 -05:00
|
|
|
echo.
|
|
|
|
echo Note that options only override settings in $SCRIPTDIR/setup.var.
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
|
|
|
# Process command line options.
|
|
|
|
|
|
|
|
while [ $# -gt 0 ]
|
|
|
|
do
|
|
|
|
case "$1" in
|
|
|
|
--suffix) SUFFIX=$2; shift;;
|
|
|
|
--wxdir) WXSRCDIR=$2; WXDESTDIR=$WXSRCDIR/deliver; shift;;
|
|
|
|
--deliver) WXDESTDIR=$2; shift;;
|
2006-03-07 17:02:37 -05:00
|
|
|
--mac) PLATFORM=mac;;
|
2006-03-07 11:50:07 -05:00
|
|
|
*)
|
|
|
|
usage
|
|
|
|
exit
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
shift
|
|
|
|
done
|
|
|
|
|
2006-03-07 17:02:37 -05:00
|
|
|
if [ "$OS" = "Windows_NT" ]; then
|
2006-03-07 16:04:05 -05:00
|
|
|
dobuilddemos_windows
|
|
|
|
else
|
2006-03-07 17:02:37 -05:00
|
|
|
dobuilddemos_unix
|
2006-03-07 16:04:05 -05:00
|
|
|
fi
|
|
|
|
|
2006-03-07 11:50:07 -05:00
|
|
|
|
2006-03-07 17:02:37 -05:00
|
|
|
|