]>
Commit | Line | Data |
---|---|---|
1 | #!/bin/sh | |
2 | ############################################################################## | |
3 | # Name: misc/scripts/inc_release | |
4 | # Purpose: increments the release version number in all files mentioned in | |
5 | # docs/tech/tn0011.txt | |
6 | # Created: 2007-01-07 | |
7 | # RCS-ID: $Id$ | |
8 | # Copyright: (c) 2007 Vadim Zeitlin <vadim@wxwindows.org> | |
9 | # Licence: wxWindows licence | |
10 | ############################################################################## | |
11 | ||
12 | error() { | |
13 | echo "$progname: $*" >&2 | |
14 | } | |
15 | ||
16 | msg() { | |
17 | echo "$progname: $*" | |
18 | } | |
19 | ||
20 | msgn() { | |
21 | echo -n "$progname: $*" | |
22 | } | |
23 | ||
24 | msgc() { | |
25 | echo "$*" | |
26 | } | |
27 | ||
28 | run_sed() { | |
29 | filename=$1 | |
30 | shift | |
31 | cmd= | |
32 | while [ $# -gt 0 ]; do | |
33 | cmd="$cmd-e \"$1\" " | |
34 | shift | |
35 | done | |
36 | ||
37 | msgn " processing $filename ... " | |
38 | eval "sed $cmd $filename" > $filename.$$ | |
39 | if cmp -s $filename $filename.$$; then | |
40 | rm $filename.$$ | |
41 | msgc "unchanged" | |
42 | else | |
43 | mv $filename.$$ $filename | |
44 | msgc "done" | |
45 | fi | |
46 | } | |
47 | ||
48 | progname=`basename $0` | |
49 | ||
50 | # we must be run from wx directory | |
51 | if [ ! -f wxwin.m4 ]; then | |
52 | error "must be ran from root wx directory" | |
53 | exit 1 | |
54 | fi | |
55 | ||
56 | # exit on any error | |
57 | set -e | |
58 | ||
59 | # the primary source of information is wx/version.h | |
60 | ver_string=`grep '#define wxVERSION_STRING ' include/wx/version.h | sed 's/^.*"wxWidgets \(.*\)")/\1/'` | |
61 | ver_major=`echo $ver_string | sed 's/\([0-9]\{1,\}\)\..*/\1/'` | |
62 | ver_minor=`echo $ver_string | sed 's/.*\.\([0-9]\{1,\}\)\..*/\1/'` | |
63 | ver_release=`echo $ver_string | sed 's/.*\.\([0-9]\{1,\}\)$/\1/'` | |
64 | ||
65 | msg "Original version is $ver_major.$ver_minor.$ver_release" | |
66 | ||
67 | ver_release_new=$(($ver_release + 1)) | |
68 | ver_string_new=$ver_major.$ver_minor.$ver_release_new | |
69 | ||
70 | msg "Updating version to $ver_string_new" | |
71 | ||
72 | ver_for_sed="$ver_major\.$ver_minor\.$ver_release" | |
73 | ||
74 | run_sed include/wx/version.h \ | |
75 | "s/^\(#define wxRELEASE_NUMBER *\) $ver_release$/\1 $ver_release_new/" \ | |
76 | "s/^\(#define wxSUBRELEASE_NUMBER *\) [0-9]\{1,\}$/\1 0/" \ | |
77 | "/^#define wxVERSION_STRING/s/$ver_for_sed/$ver_string_new/" | |
78 | ||
79 | run_sed configure.in \ | |
80 | "/^AC_INIT/s/$ver_for_sed/$ver_string_new/" \ | |
81 | "s/^wx_release_number=$ver_release/wx_release_number=$ver_release_new/" \ | |
82 | "s/^wx_subrelease_number=.*$/wx_subrelease_number=0/" | |
83 | ||
84 | for f in *.spec; do | |
85 | run_sed $f "/^%define *ver/s/$ver_for_sed/$ver_string_new/" | |
86 | done | |
87 | ||
88 | run_sed docs/latex/wx/manual.tex \ | |
89 | "/^\\\\\\\\title/s/$ver_for_sed/$ver_string_new/" | |
90 | run_sed build/script/win_docs.bat "/SET WXW_VER=/s/$ver_for_sed/$ver_string_new/" |