summaryrefslogtreecommitdiff
path: root/update-version
blob: c85a45e3339a58e1140db133b932bcaf4404ec97 (plain)
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
#!/bin/sh

set -e

if [ $# -lt 3 ] || [ $# -gt 5 ]; then
  echo >&2 "Usage: $0 <major> <minor> <patchlevel> [ <suffix> [ - ] ]"
  echo >&2 "(use 5 arguments to produce patches for releases)"
  exit 1
fi

vers="$1.$2.$3"
full="$vers${4:+-$4}"
echo $full > VERSION
perl -pi -e "s/(?<=#define MPFR_VERSION_MAJOR ).*/$1/; \
             s/(?<=#define MPFR_VERSION_MINOR ).*/$2/; \
             s/(?<=#define MPFR_VERSION_PATCHLEVEL ).*/$3/; \
             s/(?<=#define MPFR_VERSION_STRING ).*/\"$full\"/" mpfr.h
perl -pi -e "s/(?<=return \").*\"/$full\"/" version.c

if [ $# -lt 5 ]; then
  perl -pi -e "s/(?<=\@set VERSION ).*/$full/" mpfr.texi
  perl -pi -e "s/(?<=AC_INIT).*/([MPFR],[$full])/" configure.in
  perl -pi -e "s,(?<=http://www.mpfr.org/mpfr-).*?/,$vers/," INSTALL
fi

if [ $# -ge 4 ]; then
  tvers=0
else
  tvers=1
fi
perl -pi -e "s/(?<=#if ).*/$tvers/" tests/tversion.c

echo "MPFR version successfully updated."
echo "Don't forget to update MPFR libtool version in Makefile.am."