#!/bin/bash

#Version
MAJOR_VERSION=4
#Release
MINOR_VERSION=4
#Patch
PATCH=2

VNAME="${MAJOR_VERSION}.${MINOR_VERSION}.${PATCH}"
TAG=v${MAJOR_VERSION}r${MINOR_VERSION}p${PATCH}

# Updates the version number kept in YAP
for nome in m4/Yap.h.m4 Makefile.in
do
   mv $nome ${nome}.old
   sed "s/Yap-[0-9].[0-9].[0-9]*/Yap-$VNAME/" ${nome}.old > $nome
   rm ${nome}.old
#   cvs commit -m "Updated version number" $nome
done

mv misc/Yap.spec misc/Yap.spec.old
sed "s/Version: [0-9].[0-9].[0-9]*/Version: $VNAME/" misc/Yap.spec.old > misc/Yap.spec
rm misc/Yap.spec.old
#   cvs commit -m "Updated version number" misc/Yap.spec

mv docs/yap.tex docs/yap.tex.old
sed "s/VERSION [0-9].[0-9].[0-9]*/VERSION: $VNAME/" docs/yap.tex.old > docs/yap.tex
rm docs/yap.tex.old
#    cvs commit -m "Updated version number" docs/yap.tex

# tag files
# cvs tag -b $TAG *

# create the tarball with the distribution
#./distribe ${MAJOR_VERSION} ${MINOR_VERSION} ${PATCH}

#Get new version from CVS
#cvs -d:ext:rslopes@cvs.yap.sourceforge.net:/cvsroot/yap checkout -r $TAG

