]> git.saurik.com Git - wxWidgets.git/blame - build/update-setup-h
Support renderer::LeftClick() in generic code, removed unsupported RightClick(),...
[wxWidgets.git] / build / update-setup-h
CommitLineData
ff3a660b
VZ
1#!/bin/sh
2##############################################################################
3# Name: build/update-setup.h
4# Purpose: run from root wx directory to update wx/*/setup.h files: those
5# having special comment markers in them will be update using
6# include/wx/setup_inc.h contents
7# Created: 2005-01-15
8# RCS-ID: $Id$
9# Copyright: (c) 2005 Vadim Zeitlin <vadim@wxwindows.org>
10# Licence: wxWindows licence
11##############################################################################
12
13rc=0
14
15error()
16{
17 echo $* 1>&2
18}
19
8d51d7d2
VZ
20msg()
21{
22 # TODO: only output from here if "quiet" option is not given
23 echo "$*"
24}
25
26# write all the common options to stdout, massaging them specially if they are
508d12b2
VZ
27# meant to be included in a configure input file setup.h.in
28#
29# usage: cat_common_options_for setup_inc.h setup0.h
8d51d7d2
VZ
30cat_common_options_for()
31{
0818de2d 32 # get rid of the copyright header on top of the file
508d12b2 33 cmd="sed '1,/^\$/d' $1"
8d51d7d2
VZ
34
35 # the file used for configure is special: we need to get rid of C++
36 # comments in it because it is included by some C code and we also have to
37 # set all options to 0 by default as they're put to 1 only by configure
38 # (and hence any #ifdefs setting default values for them become unneeded)
508d12b2 39 if [ $2 = "setup.h.in" ]; then
8d51d7d2
VZ
40 cmd="$cmd | sed -e '/^\/\//d' \
41 -e 's@ *//.*\$@@' \
de1efd2d 42 -e 's/# *define \(.\+\) \+1 *\$/#define \1 0/'"
8d51d7d2
VZ
43 fi
44
45 eval $cmd
46}
47
48# update the single setup.h file passed in as the parameter if it is out of
49# date
508d12b2
VZ
50#
51# usage: update_single_setup_h {common|MSW} setup_inc.h setup0.h
ff3a660b
VZ
52update_single_setup_h()
53{
508d12b2
VZ
54 section=$1
55 shift
56 setup_inc=$1
57 shift
58
59 if [ $setup_inc -ot $1 ]; then
8d51d7d2
VZ
60 echo "Skipping $1 which is already up to date."
61 return 0
62 fi
63
60b881f7 64 echo -n "Updating $1 ..."
8d51d7d2 65
ff3a660b 66 tmp=$i.$$.tmp
508d12b2
VZ
67 sed -e "/^\/\* --- start $section options --- \*\/\$/q" $1 > $tmp &&
68 cat_common_options_for $setup_inc $1 >> $tmp &&
69 sed -n -e "/^\/\* --- end $section options --- \*\/\$/,\$p" $1 >> $tmp &&
ff3a660b
VZ
70 mv $tmp $1
71
72 if [ $? -ne 0 ]; then
8d51d7d2 73 msg " FAILED"
ff3a660b
VZ
74 error "$0: failed to update file $1"
75 rc=2
8d51d7d2
VZ
76 else
77 msg " ok"
ff3a660b
VZ
78 fi
79}
80
508d12b2
VZ
81# wrapper for update_single_setup_h which only updates the common options
82update_common_setup_h()
83{
84 update_single_setup_h common include/wx/setup_inc.h $1
85}
86
87# wrapper for update_single_setup_h which only updates the MSW options
88update_msw_setup_h()
89{
90 update_single_setup_h MSW include/wx/msw/setup_inc.h $1
91}
92
ff3a660b
VZ
93# entry point
94if [ ! -f wxwin.m4 ]; then
95 error "$0: must be ran from root wx directory"
96 exit 1
97fi
98
508d12b2
VZ
99update_common_setup_h include/wx/msw/setup0.h
100update_common_setup_h include/wx/msw/wince/setup.h
101update_common_setup_h include/wx/mac/setup0.h
102update_common_setup_h include/wx/palmos/setup0.h
103update_common_setup_h include/wx/os2/setup0.h
104update_common_setup_h include/wx/motif/setup0.h
3b7c589c 105update_common_setup_h include/wx/univ/setup0.h
508d12b2
VZ
106update_common_setup_h setup.h.in
107
108update_msw_setup_h include/wx/msw/setup0.h
109update_msw_setup_h setup.h.in
ff3a660b 110
3b7c589c
VZ
111update_single_setup_h wxUniv include/wx/univ/setup_inc.h include/wx/univ/setup0.h
112
ff3a660b 113exit $rc
8d8f077e 114