]>
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 | # Copyright: (c) 2007 Vadim Zeitlin <vadim@wxwindows.org> | |
8 | # Licence: wxWindows licence | |
9 | ############################################################################## | |
10 | ||
11 | error() { | |
12 | echo "$progname: $*" >&2 | |
13 | } | |
14 | ||
15 | msg() { | |
16 | echo "$progname: $*" | |
17 | } | |
18 | ||
19 | msgn() { | |
20 | echo -n "$progname: $*" | |
21 | } | |
22 | ||
23 | msgc() { | |
24 | echo "$*" | |
25 | } | |
26 | ||
27 | run_sed() { | |
28 | filename=$1 | |
29 | shift | |
30 | cmd= | |
31 | while [ $# -gt 0 ]; do | |
32 | cmd="$cmd-e \"$1\" " | |
33 | shift | |
34 | done | |
35 | ||
36 | msgn " processing $filename ... " | |
37 | eval "sed $cmd $filename" > $filename.$$ | |
38 | if cmp -s $filename $filename.$$; then | |
39 | rm $filename.$$ | |
40 | msgc "unchanged" | |
41 | else | |
42 | mv $filename.$$ $filename | |
43 | msgc "done" | |
44 | fi | |
45 | } | |
46 | ||
47 | progname=`basename $0` | |
48 | ||
49 | # we must be run from wx directory | |
50 | if [ ! -f wxwin.m4 ]; then | |
51 | error "must be ran from root wx directory" | |
52 | exit 1 | |
53 | fi | |
54 | ||
55 | # exit on any error | |
56 | set -e | |
57 | ||
58 | # the primary source of information is wx/version.h | |
59 | ver_string=`grep '#define wxVERSION_STRING ' include/wx/version.h | sed 's/^.*"wxWidgets \(.*\)")/\1/'` | |
60 | ver_major=`echo $ver_string | sed 's/\([0-9]\{1,\}\)\..*/\1/'` | |
61 | ver_minor=`echo $ver_string | sed 's/.*\.\([0-9]\{1,\}\)\..*/\1/'` | |
62 | ver_release=`echo $ver_string | sed 's/.*\.\([0-9]\{1,\}\)$/\1/'` | |
63 | ||
64 | msg "Original version is $ver_major.$ver_minor.$ver_release" | |
65 | ||
66 | ver_release_new=$(($ver_release + 1)) | |
67 | ver_string_new=$ver_major.$ver_minor.$ver_release_new | |
68 | ||
69 | msg "Updating version to $ver_string_new" | |
70 | ||
71 | ver_for_sed="$ver_major\.$ver_minor\.$ver_release" | |
72 | ||
73 | run_sed configure.in \ | |
74 | "/^AC_INIT/s/$ver_for_sed/$ver_string_new/" \ | |
75 | "s/^wx_release_number=$ver_release/wx_release_number=$ver_release_new/" \ | |
76 | "s/^wx_subrelease_number=.*$/wx_subrelease_number=0/" | |
77 | ||
78 | for f in *.spec; do | |
79 | run_sed $f "/^%define *ver/s/$ver_for_sed/$ver_string_new/" | |
80 | done | |
81 | ||
82 | run_sed build/osx/wxvers.xcconfig \ | |
83 | "/DYLIB_.* = /s/$ver_for_sed/$ver_string_new/" | |
84 | ||
85 | run_sed build/tools/bld_chm_exe.bat \ | |
86 | "/^SET WXW_VER=/s/$ver_for_sed/$ver_string_new/" | |
87 | ||
88 | run_sed docs/readme.txt \ | |
89 | "/wxWidgets /s/$ver_for_sed/$ver_string_new/" \ | |
90 | "/\//s/$ver_for_sed/$ver_string_new/" \ | |
91 | "/naming: while/s/$ver_for_sed/$ver_string_new/" | |
92 | ||
93 | run_sed docs/doxygen/Doxyfile_inc \ | |
94 | "/^PROJECT_NUMBER/s/$ver_for_sed/$ver_string_new/" | |
95 | ||
96 | run_sed docs/doxygen/latexdocstart.inc \ | |
97 | "/\\large Version/s/$ver_for_sed/$ver_string_new/" | |
98 | ||
99 | run_sed include/wx/version.h \ | |
100 | "s/^\(#define wxRELEASE_NUMBER *\) $ver_release$/\1 $ver_release_new/" \ | |
101 | "s/^\(#define wxSUBRELEASE_NUMBER *\) [0-9]\{1,\}$/\1 0/" \ | |
102 | "/^#define wxVERSION_STRING/s/$ver_for_sed/$ver_string_new/" | |
103 | ||
104 | run_sed include/wx/osx/config_xcode.h \ | |
105 | "/^#define PACKAGE/s/$ver_for_sed/$ver_string_new/" | |
106 | ||
107 | run_sed samples/Info.plist \ | |
108 | "/version/s/$ver_for_sed/$ver_string_new/" \ | |
109 | "/<string>/s/$ver_for_sed/$ver_string_new/" | |
110 | ||
111 | run_sed samples/minimal/Info_carbon.plist \ | |
112 | "/<string>/s/$ver_for_sed/$ver_string_new/" | |
113 | run_sed samples/minimal/Info_cocoa.plist \ | |
114 | "/<string>/s/$ver_for_sed/$ver_string_new/" | |
115 | ||
116 | run_sed samples/docview/Info.plist \ | |
117 | "/versionon/s/$ver_for_sed/$ver_string_new/" \ | |
118 | "/<string>/s/$ver_for_sed/$ver_string_new/" | |
119 | ||
120 | msg "Don't forget to change the C:R:A triplet in build/bakefiles/version.bkl now!" |