2005-01-15 10:54:00 -05:00
|
|
|
#!/bin/sh
|
|
|
|
##############################################################################
|
|
|
|
# Name: build/update-setup.h
|
|
|
|
# Purpose: run from root wx directory to update wx/*/setup.h files: those
|
|
|
|
# having special comment markers in them will be update using
|
|
|
|
# include/wx/setup_inc.h contents
|
|
|
|
# Created: 2005-01-15
|
|
|
|
# RCS-ID: $Id$
|
|
|
|
# Copyright: (c) 2005 Vadim Zeitlin <vadim@wxwindows.org>
|
|
|
|
# Licence: wxWindows licence
|
|
|
|
##############################################################################
|
|
|
|
|
|
|
|
rc=0
|
|
|
|
|
|
|
|
error()
|
|
|
|
{
|
|
|
|
echo $* 1>&2
|
|
|
|
}
|
|
|
|
|
2005-01-16 10:44:44 -05:00
|
|
|
msg()
|
|
|
|
{
|
|
|
|
# TODO: only output from here if "quiet" option is not given
|
|
|
|
echo "$*"
|
|
|
|
}
|
|
|
|
|
|
|
|
# write all the common options to stdout, massaging them specially if they are
|
|
|
|
# meant to be included in a configure input file setup.h.in (the name of the
|
|
|
|
# file the common options are meant to be included in is the parameter)
|
|
|
|
cat_common_options_for()
|
|
|
|
{
|
2005-07-29 20:29:41 -04:00
|
|
|
# get rid of the copyright header on top of the file
|
|
|
|
cmd="sed '1,/^$/d' include/wx/setup_inc.h"
|
2005-01-16 10:44:44 -05:00
|
|
|
|
|
|
|
# the file used for configure is special: we need to get rid of C++
|
|
|
|
# comments in it because it is included by some C code and we also have to
|
|
|
|
# set all options to 0 by default as they're put to 1 only by configure
|
|
|
|
# (and hence any #ifdefs setting default values for them become unneeded)
|
|
|
|
if [ $1 = "setup.h.in" ]; then
|
|
|
|
cmd="$cmd | sed -e '/^\/\//d' \
|
|
|
|
-e 's@ *//.*\$@@' \
|
2005-01-16 10:54:17 -05:00
|
|
|
-e 's/# *define \(.\+\) \+1 *\$/#define \1 0/'"
|
2005-01-16 10:44:44 -05:00
|
|
|
fi
|
|
|
|
|
|
|
|
eval $cmd
|
|
|
|
}
|
|
|
|
|
|
|
|
# update the single setup.h file passed in as the parameter if it is out of
|
|
|
|
# date
|
2005-01-15 10:54:00 -05:00
|
|
|
update_single_setup_h()
|
|
|
|
{
|
2005-01-16 10:44:44 -05:00
|
|
|
if [ include/wx/setup_inc.h -ot $1 ]; then
|
|
|
|
echo "Skipping $1 which is already up to date."
|
|
|
|
return 0
|
|
|
|
fi
|
|
|
|
|
2005-03-10 19:19:09 -05:00
|
|
|
echo -n "Updating $1 ..."
|
2005-01-16 10:44:44 -05:00
|
|
|
|
2005-01-15 10:54:00 -05:00
|
|
|
tmp=$i.$$.tmp
|
|
|
|
sed -e '/^\/\* --- start common options --- \*\/$/q' $1 > $tmp &&
|
2005-01-16 10:44:44 -05:00
|
|
|
cat_common_options_for $1 >> $tmp &&
|
2005-01-15 10:54:00 -05:00
|
|
|
sed -n -e '/^\/\* --- end common options --- \*\/$/,$p' $1 >> $tmp &&
|
|
|
|
mv $tmp $1
|
|
|
|
|
|
|
|
if [ $? -ne 0 ]; then
|
2005-01-16 10:44:44 -05:00
|
|
|
msg " FAILED"
|
2005-01-15 10:54:00 -05:00
|
|
|
error "$0: failed to update file $1"
|
|
|
|
rc=2
|
2005-01-16 10:44:44 -05:00
|
|
|
else
|
|
|
|
msg " ok"
|
2005-01-15 10:54:00 -05:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
# entry point
|
|
|
|
if [ ! -f wxwin.m4 ]; then
|
|
|
|
error "$0: must be ran from root wx directory"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
update_single_setup_h include/wx/msw/setup0.h
|
2005-03-10 13:26:29 -05:00
|
|
|
update_single_setup_h include/wx/msw/wince/setup.h
|
2005-01-15 11:14:14 -05:00
|
|
|
update_single_setup_h include/wx/mac/setup0.h
|
2005-10-17 13:40:36 -04:00
|
|
|
update_single_setup_h include/wx/palmos/setup0.h
|
|
|
|
update_single_setup_h include/wx/os2/setup0.h
|
|
|
|
update_single_setup_h include/wx/motif/setup0.h
|
2005-01-15 11:37:38 -05:00
|
|
|
update_single_setup_h setup.h.in
|
2005-01-15 10:54:00 -05:00
|
|
|
|
|
|
|
exit $rc
|
2005-01-15 11:14:14 -05:00
|
|
|
|