#!/bin/sh set -e if [ $# -lt 3 ] || [ $# -gt 5 ]; then echo >&2 "Usage: $0 [ [ - ] ]" echo >&2 "(use 5 arguments to produce patches for releases)" exit 1 fi # Examples: # ./update-version 2 3 0 dev # ./update-version 2 3 0 rc1 # ./update-version 2 3 0 # ./update-version 2 3 0 p1 - 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 # Up to 4 arguments... u="http://www.mpfr.org/mpfr-" perl -pi -e "s/(?<=\@set VERSION ).*/$full/" mpfr.texi perl -pi -e \ "s,MPFR [\d.]+( web page \@url{$u)[\d.]+/,MPFR $vers\${1}$vers/," mpfr.texi perl -pi -e "s/(?<=AC_INIT).*/([MPFR],[$full])/" configure.in perl -pi -e "s,(?<=$u).*?/,$vers/," INSTALL fi # If there is a suffix, disable one of the tests in tests/tversion.c 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."