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
|
2019-04-22 08:12:05 -04:00
|
|
|
# Copyright: (c) 2005 Vadim Zeitlin <vadim@wxwidgets.org>
|
2005-01-15 10:54:00 -05:00
|
|
|
# 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
|
2007-07-21 08:56:22 -04:00
|
|
|
# meant to be included in a configure input file setup.h.in
|
|
|
|
#
|
|
|
|
# usage: cat_common_options_for setup_inc.h setup0.h
|
2005-01-16 10:44:44 -05:00
|
|
|
cat_common_options_for()
|
|
|
|
{
|
2005-07-29 20:29:41 -04:00
|
|
|
# get rid of the copyright header on top of the file
|
2007-07-21 08:56:22 -04:00
|
|
|
cmd="sed '1,/^\$/d' $1"
|
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)
|
2007-07-21 08:56:22 -04:00
|
|
|
if [ $2 = "setup.h.in" ]; then
|
2005-01-16 10:44:44 -05:00
|
|
|
cmd="$cmd | sed -e '/^\/\//d' \
|
|
|
|
-e 's@ *//.*\$@@' \
|
2005-01-16 10:54:17 -05:00
|
|
|
-e 's/# *define \(.\+\) \+1 *\$/#define \1 0/'"
|
2016-09-25 16:19:39 -04:00
|
|
|
elif [ $2 = "build/cmake/setup.h.in" ]; then
|
|
|
|
# The setup.h.in template for cmake needs special processing
|
|
|
|
cmd="$cmd | sed -e '/^\/\//d' \
|
|
|
|
-e 's@ *//.*\$@@' \
|
2017-12-09 08:46:32 -05:00
|
|
|
-e 's/# *define \([^ ]\+\) \+\(1\|0\) *\$/#cmakedefine01 \1/'"
|
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
|
2007-07-21 08:56:22 -04:00
|
|
|
#
|
|
|
|
# usage: update_single_setup_h {common|MSW} setup_inc.h setup0.h
|
2005-01-15 10:54:00 -05:00
|
|
|
update_single_setup_h()
|
|
|
|
{
|
2007-07-21 08:56:22 -04:00
|
|
|
section=$1
|
|
|
|
shift
|
|
|
|
setup_inc=$1
|
|
|
|
shift
|
|
|
|
|
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
|
2007-07-21 08:56:22 -04:00
|
|
|
sed -e "/^\/\* --- start $section options --- \*\/\$/q" $1 > $tmp &&
|
|
|
|
cat_common_options_for $setup_inc $1 >> $tmp &&
|
2020-07-14 14:24:52 -04:00
|
|
|
sed -n -e "/^\/\* --- end $section options --- \*\/\$/,\$p" $1 >> $tmp
|
2005-01-15 10:54:00 -05:00
|
|
|
|
2020-07-14 14:24:52 -04:00
|
|
|
if cmp -s $1 $tmp; then
|
|
|
|
rm $tmp
|
|
|
|
msg " unchanged"
|
2005-01-16 10:44:44 -05:00
|
|
|
else
|
2020-07-14 14:24:52 -04:00
|
|
|
mv $tmp $1
|
|
|
|
|
|
|
|
if [ $? -ne 0 ]; then
|
|
|
|
msg " FAILED"
|
|
|
|
error "$0: failed to update file $1"
|
|
|
|
rc=2
|
|
|
|
else
|
|
|
|
msg " ok"
|
|
|
|
fi
|
2005-01-15 10:54:00 -05:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2007-07-21 08:56:22 -04:00
|
|
|
# wrapper for update_single_setup_h which only updates the common options
|
|
|
|
update_common_setup_h()
|
|
|
|
{
|
|
|
|
update_single_setup_h common include/wx/setup_inc.h $1
|
|
|
|
}
|
|
|
|
|
|
|
|
# wrapper for update_single_setup_h which only updates the MSW options
|
|
|
|
update_msw_setup_h()
|
|
|
|
{
|
|
|
|
update_single_setup_h MSW include/wx/msw/setup_inc.h $1
|
|
|
|
}
|
|
|
|
|
2017-11-09 05:35:36 -05:00
|
|
|
# wrapper for update_single_setup_h which only updates the OSX options
|
|
|
|
update_osx_setup_h()
|
|
|
|
{
|
|
|
|
update_single_setup_h OSX include/wx/osx/setup_inc.h $1
|
|
|
|
}
|
|
|
|
|
2005-01-15 10:54:00 -05:00
|
|
|
# entry point
|
|
|
|
if [ ! -f wxwin.m4 ]; then
|
|
|
|
error "$0: must be ran from root wx directory"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2014-05-16 09:00:29 -04:00
|
|
|
update_common_setup_h include/wx/android/setup.h
|
2008-08-31 13:14:17 -04:00
|
|
|
update_common_setup_h include/wx/motif/setup0.h
|
2007-07-21 08:56:22 -04:00
|
|
|
update_common_setup_h include/wx/msw/setup0.h
|
2012-06-12 17:41:59 -04:00
|
|
|
update_common_setup_h include/wx/gtk/setup0.h
|
2008-08-31 13:14:17 -04:00
|
|
|
update_common_setup_h include/wx/osx/setup0.h
|
2008-02-03 07:20:06 -05:00
|
|
|
update_common_setup_h include/wx/univ/setup0.h
|
2007-07-21 08:56:22 -04:00
|
|
|
update_common_setup_h setup.h.in
|
2016-09-25 16:19:39 -04:00
|
|
|
update_common_setup_h build/cmake/setup.h.in
|
2007-07-21 08:56:22 -04:00
|
|
|
|
|
|
|
update_msw_setup_h include/wx/msw/setup0.h
|
2012-06-12 17:41:59 -04:00
|
|
|
update_msw_setup_h include/wx/gtk/setup0.h
|
2007-07-21 08:56:22 -04:00
|
|
|
update_msw_setup_h setup.h.in
|
2016-09-25 16:19:39 -04:00
|
|
|
update_msw_setup_h build/cmake/setup.h.in
|
2005-01-15 10:54:00 -05:00
|
|
|
|
2017-11-09 05:35:36 -05:00
|
|
|
update_osx_setup_h include/wx/osx/setup0.h
|
|
|
|
|
2008-02-03 07:20:06 -05:00
|
|
|
update_single_setup_h wxUniv include/wx/univ/setup_inc.h include/wx/univ/setup0.h
|
|
|
|
|
2005-01-15 10:54:00 -05:00
|
|
|
exit $rc
|
2005-01-15 11:14:14 -05:00
|
|
|
|