File: update-setup-h

package info (click to toggle)
wxpython4.0 4.2.3%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 221,752 kB
  • sloc: cpp: 962,555; python: 230,573; ansic: 170,731; makefile: 51,756; sh: 9,342; perl: 1,564; javascript: 584; php: 326; xml: 200
file content (129 lines) | stat: -rwxr-xr-x 3,744 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
#!/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
# Copyright:  (c) 2005 Vadim Zeitlin <vadim@wxwidgets.org>
# Licence:    wxWindows licence
##############################################################################

rc=0

error()
{
    echo $* 1>&2
}

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
#
# usage: cat_common_options_for setup_inc.h setup.h
cat_common_options_for()
{
    # get rid of the copyright header on top of the file
    cmd="sed '1,/^\$/d' $1"

    # 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 [ $2 = "setup.h.in" ]; then
        cmd="$cmd | sed -e '/^\/\//d' \
                        -e 's@ *//.*\$@@' \
                        -e 's/# *define \(.\+\) \+1 *\$/#define \1 0/'"
    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@ *//.*\$@@' \
                        -e 's/# *define \([^ ]\+\) \+\(1\|0\) *\$/#cmakedefine01 \1/'"
    fi

    eval $cmd
}

# update the single setup.h file passed in as the parameter if it is out of
# date
#
# usage: update_single_setup_h {common|MSW} setup_inc.h setup.h
update_single_setup_h()
{
    section=$1
    shift
    setup_inc=$1
    shift

    echo -n "Updating $1 ..."

    tmp=$i.$$.tmp
    sed -e "/^\/\* --- start $section options --- \*\/\$/q" $1 > $tmp &&
    cat_common_options_for $setup_inc $1 >> $tmp &&
    sed -n -e "/^\/\* --- end $section options --- \*\/\$/,\$p" $1 >> $tmp

    if cmp -s $1 $tmp; then
        rm $tmp
        msg " unchanged"
    else
        mv $tmp $1

        if [ $? -ne 0 ]; then
            msg " FAILED"
            error "$0: failed to update file $1"
            rc=2
        else
            msg " ok"
        fi
    fi
}

# 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
}

# 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
}

# entry point
if [ ! -f wxwin.m4 ]; then
    error "$0: must be ran from root wx directory"
    exit 1
fi

update_common_setup_h include/wx/android/setup.h
update_common_setup_h include/wx/motif/setup.h
update_common_setup_h include/wx/msw/setup.h
update_common_setup_h include/wx/gtk/setup.h
update_common_setup_h include/wx/osx/setup.h
update_common_setup_h include/wx/univ/setup.h
update_common_setup_h setup.h.in
update_common_setup_h build/cmake/setup.h.in

update_msw_setup_h include/wx/msw/setup.h
update_msw_setup_h include/wx/gtk/setup.h
update_msw_setup_h setup.h.in
update_msw_setup_h build/cmake/setup.h.in

update_osx_setup_h include/wx/osx/setup.h

update_single_setup_h wxUniv include/wx/univ/setup_inc.h include/wx/univ/setup.h

exit $rc