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