2 # fontconfig/new-version.sh
4 # Copyright © 2000 Keith Packard
6 # Permission to use, copy, modify, distribute, and sell this software and its
7 # documentation for any purpose is hereby granted without fee, provided that
8 # the above copyright notice appear in all copies and that both that
9 # copyright notice and this permission notice appear in supporting
10 # documentation, and that the name of the author(s) not be used in
11 # advertising or publicity pertaining to distribution of the software without
12 # specific, written prior permission. The authors make no
13 # representations about the suitability of this software for any purpose. It
14 # is provided "as is" without express or implied warranty.
16 # THE AUTHOR(S) DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
17 # INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
18 # EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY SPECIAL, INDIRECT OR
19 # CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
20 # DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
21 # TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
22 # PERFORMANCE OF THIS SOFTWARE.
24 if [ "x`git status -s -uno`" != "x" ]; then
25 echo 'Uncommited changes in repository' 1>&2
34 echo 'Invalid version number:' "$version" 1>&2
40 awk -F. '{ printf ("major=%d\nminor=%d\nrevision=%d\n",
43 # Update the version numbers
45 sed -i configure.ac -e "/^AC_INIT(/s/2\.[0-9.]*/$version/"
47 sed -i fontconfig/fontconfig.h \
48 -e "/^#define FC_MAJOR/s/[0-9][0-9]*/$major/" \
49 -e "/^#define FC_MINOR/s/[0-9][0-9]*/$minor/" \
50 -e "/^#define FC_REVISION/s/[0-9][0-9]*/$revision/"
53 # Compute pretty form of new version number
55 version_note=`echo $version | awk -F. '{
57 printf ("%d.%d.%d (%d.%d RC%d)\n",
58 $1, $2, $3, $1, $2 + 1, $3 - 90);
60 printf ("%d.%d\n", $1, $2);
62 printf ("%d.%d.%d\n", $1, $2, $3); }'`
65 # Find previous version in README
67 last_note=`grep '^2\.[0-9.]*' README |
69 sed 's/ (2\.[0-9]* RC[0-9]*)//'`
78 echo 'cannot find previous changelog' 1>&2
83 # Format the current date for the README header
85 date=`date '+%Y-%m-%d'`
88 # Update the readme file
90 if [ $version != $last ]; then
94 (sed '/^2\.[0-9.]*/,$d' README |
95 sed -r -e "s/Version.*/Version $version_note/" \
96 -e "s/[0-9]{4}\-[0-9]{2}\-[0-9]{2}$/$date/" | awk '
100 space=(70 - length) / 2;
101 for (i = 0; i < space; i++)
116 git log --pretty=short $last.. | git shortlog | cat
119 # previous changelogs
122 sed -n '/^2\.[0-9.]*/,$p' README) > README.tmp ||
123 (echo "README update failed"; exit 1)
128 $test git commit -m"Bump version to $version" \
130 fontconfig/fontconfig.h \
134 $test git tag -s -m "Version $version" $version
136 # Make distributed change log
138 git log --stat $last.. > ChangeLog-$version