added makerelease.sh

a shell script for making release packages



git-svn-id: svn://ttmath.org/publicrep/ttcalc/trunk@339 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
Tomasz Sowa 2011-01-30 21:07:50 +00:00
parent 844f79b793
commit 8e9a459c9c
1 changed files with 258 additions and 0 deletions

258
makerelease.sh Normal file
View File

@ -0,0 +1,258 @@
#!/bin/sh
a=""
b=""
c=""
p=""
d=""
# reading until not empty
while [ -z $a ]
do
echo -n "Major: " ; read a
done
while [ -z $b ]
do
echo -n "Minor: " ; read b;
done
while [ -z $c ]
do
echo -n "Revision: " ; read c;
done
while [ -z $p ]
do
echo -n "Prerelease? (y/n): " ; read p;
done
while [ -z $d ]
do
echo -n "Add date? (y/n): " ; read d;
done
dir=$a.$b.$c
datestr=""
if [ $p = "y" -o $p = "Y" ]
then
dir=$dir.prerelease
fi
if [ $d = "y" -o $d = "Y" ]
then
datestr="("`/bin/date "+%G.%m.%d"`")";
dir=$dir.$datestr
fi
if [ -d $dir ]
then
echo "Directory $dir exists! (exiting)";
exit 1;
fi
mkdir $dir
echo "------------------------------------------------------"
echo "compiling normal version"
echo "------------------------------------------------------"
cd src
make clean
make
echo "------------------------------------------------------"
echo "creating help"
echo "------------------------------------------------------"
make help
echo "------------------------------------------------------"
echo "creating install program (setup)"
echo "------------------------------------------------------"
make setup
cd ../$dir
echo "------------------------------------------------------"
echo "making binary package"
echo "------------------------------------------------------"
n="ttcalc-$a.$b.$c";
if [ $p = "y" -o $p = "Y" ]
then
n="$n.prerelease"
fi
if [ $d = "y" -o $d = "Y" ]
then
ntar="$n-bin.$datestr.tar.gz";
else
ntar="$n-bin.tar.gz";
fi
mkdir $n
cp ../help/ttcalc.chm $n
cp ../src/ttcalc.exe $n
cp ../COPYRIGHT $n
cp ../README $n
cp ../CHANGELOG $n
tar -zcf $ntar $n
rm -r $n
echo "------------------------------------------------------"
echo "copying the setup program"
echo "------------------------------------------------------"
n="ttcalc-$a.$b.$c"
if [ $p = "y" -o $p = "Y" ]
then
n="$n.prerelease"
fi
if [ $d = "y" -o $d = "Y" ]
then
cp ../setup/ttcalc-setup.exe ./$n-setup.exe
else
cp ../setup/ttcalc-setup.exe ./$n-setup.$datestr.exe
fi
echo "------------------------------------------------------"
echo "compiling portable version"
echo "------------------------------------------------------"
# preserve ttcalc.chm because would be erased by 'make clean'
cp ../help/ttcalc.chm ./
cd ../src/
make clean
make -f Makefileportable
cd ../$dir
echo "------------------------------------------------------"
echo "making portable binary package"
echo "------------------------------------------------------"
n="ttcalc-portable-$a.$b.$c";
if [ $p = "y" -o $p = "Y" ]
then
n="$n.prerelease"
fi
if [ $d = "y" -o $d = "Y" ]
then
ntar="$n-bin.$datestr.tar.gz";
else
ntar="$n-bin.tar.gz";
fi
mkdir $n
cp ../src/ttcalcp.exe $n
cp ../src/ttcalc.ini $n
mv ttcalc.chm $n
cp ../COPYRIGHT $n
cp ../README $n
cp ../CHANGELOG $n
tar -zcf $ntar $n
rm -r $n
echo "------------------------------------------------------"
echo "creating source package"
echo "------------------------------------------------------"
n="ttcalc-$a.$b.$c";
if [ $p = "y" -o $p = "Y" ]
then
n="$n.prerelease"
fi
if [ $d = "y" -o $d = "Y" ]
then
ntar="$n-src.$datestr.tar.gz";
else
ntar="$n-src.tar.gz";
fi
mkdir $n
mkdir $n/ttmath
mkdir $n/ttcalc
mkdir $n/ttmath/ttmath
mkdir $n/ttmath/samples
mkdir $n/ttcalc/help
mkdir $n/ttcalc/res
mkdir $n/ttcalc/setup
mkdir $n/ttcalc/src
cp ../../ttmath/ttmath/* $n/ttmath/ttmath
cp ../../ttmath/samples/* $n/ttmath/samples
cp ../../ttmath/COPYRIGHT $n/ttmath
cp ../../ttmath/README $n/ttmath
cp ../../ttmath/CHANGELOG $n/ttmath
cd ../src
make clean
cd ../$dir
cp ../help/* $n/ttcalc/help
cp ../res/* $n/ttcalc/res
cp ../setup/* $n/ttcalc/setup
cp ../src/* $n/ttcalc/src
rm $n/ttcalc/src/*.ini
cp ../COPYRIGHT $n/ttcalc
cp ../README $n/ttcalc
cp ../CHANGELOG $n/ttcalc
tar -zcf $ntar $n
rm -r $n
echo "------------------------------------------------------"
echo "calculating md5 hashes"
echo "------------------------------------------------------"
md5sum * > note.txt.md5
echo "MD5 SUMS" > note.txt
echo "--------" >> note.txt
cat note.txt.md5 >> note.txt
rm note.txt.md5
unix2dos -o note.txt
echo "done"
exit 0