]> git.saurik.com Git - wxWidgets.git/blob - misc/scripts/inc_release
added a script to update release version field
[wxWidgets.git] / misc / scripts / inc_release
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 run_sed() {
21 filename=$1
22 shift
23 cmd=
24 while [ $# -gt 0 ]; do
25 cmd="$cmd-e \"$1\" "
26 shift
27 done
28
29 msg " updating $filename"
30 eval "sed -i $cmd $filename"
31 }
32
33 progname=`basename $0`
34
35 # we must be run from wx directory
36 if [ ! -f wxwin.m4 ]; then
37 error "must be ran from root wx directory"
38 exit 1
39 fi
40
41 # exit on any error
42 set -e
43
44 # the primary source of information is wx/version.h
45 ver_string=`grep '#define wxVERSION_STRING ' include/wx/version.h | sed 's/^.*"wxWidgets \(.*\)")/\1/'`
46 ver_major=`echo $ver_string | sed 's/\([0-9]\{1,\}\)\..*/\1/'`
47 ver_minor=`echo $ver_string | sed 's/.*\.\([0-9]\{1,\}\)\..*/\1/'`
48 ver_release=`echo $ver_string | sed 's/.*\.\([0-9]\{1,\}\)$/\1/'`
49
50 msg "Original version is $ver_major.$ver_minor.$ver_release"
51
52 ver_release_new=$(($ver_release + 1))
53 ver_string_new=$ver_major.$ver_minor.$ver_release_new
54
55 msg "Updating version to $ver_string_new"
56
57 ver_for_sed="$ver_major\.$ver_minor\.$ver_release"
58
59 run_sed include/wx/version.h \
60 "s/^\(#define wxRELEASE_NUMBER *\) $ver_release$/\1 $ver_release_new/" \
61 "s/^\(#define wxSUBRELEASE_NUMBER *\) [0-9]\{1,\}$/\1 0/"
62
63 run_sed configure.in \
64 "/^AC_INIT/s/$ver_for_sed/$ver_string_new/" \
65 "s/^wx_release_number=$ver_release/wx_release_number=$ver_release_new/" \
66 "s/^wx_subrelease_number=.*$/wx_subrelease_number=0/"
67
68 for f in *.spec; do
69 run_sed $f "/^%define *ver/s/$ver_for_sed/$ver_string_new/"
70 done
71
72 run_sed build/script/win_docs.bat "/SET WXW_VER=/s/$ver_for_sed/$ver_string_new/"