Add update_version.sh script (which updates resources_win32.rc version now).

This commit is contained in:
David Capello 2012-08-22 21:28:31 -03:00
parent e89d087a04
commit b190e9e791
2 changed files with 36 additions and 10 deletions

View File

@ -32,21 +32,14 @@ fi
# Update version
# --------------
cd $destdir
cat config.h \
| sed -e "s/define VERSION.*/define VERSION \"$version\"/" \
> tmp
mv tmp config.h
cat data/gui.xml \
| sed -e "s/gui version=\".*/gui version=\"$version\">/" \
> tmp
mv tmp data/gui.xml
cd $destdir/scripts
sh update_version.sh $version
# ----------------------------------------------
# Make a build/ directory and compile with cmake
# ----------------------------------------------
cd $destdir
if [ ! -d build ] ; then
mkdir build
cd build

33
scripts/update_version.sh Normal file
View File

@ -0,0 +1,33 @@
#! /bin/sh
if [ ! -f update_version.sh ]; then
echo You must run update_version.sh from scripts/ directory
exit 1
fi
version=$1
if [ "$version" == "" ]; then
echo Usage: update_version.sh VERSION
exit 1
fi
version_win32=$(echo $1 | sed -e 's/\./,/g' | sed -e 's/-.*$//')
commas=$(grep -o "," <<< "$version_win32" | wc -l)
while [ $commas -lt 3 ] ; do
version_win32+=",0"
commas=$(grep -o "," <<< "$version_win32" | wc -l)
done
sed -e "s/define VERSION.*/define VERSION \"$version\"/" < ../config.h > tmp
mv tmp ../config.h
sed -e "s/gui version=\".*/gui version=\"$version\">/" < ../data/gui.xml > tmp
mv tmp ../data/gui.xml
sed -e "s/FILEVERSION .*/FILEVERSION $version_win32/" < ../src/resources_win32.rc \
| sed -e "s/PRODUCTVERSION .*/PRODUCTVERSION $version_win32/" \
| sed -e "s/FileVersion\",.*/FileVersion\", \"$version_win32\"/" \
| sed -e "s/ProductVersion\",.*/ProductVersion\", \"$version_win32\"/" \
> tmp
mv tmp ../src/resources_win32.rc