ttcalc/makerelease.sh

269 lines
4.5 KiB
Bash
Raw Permalink Normal View History

#!/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.zip";
else
ntar="$n-bin.zip";
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
zip -r -9 $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.$datestr.exe
else
cp ../setup/ttcalc-setup.exe ./$n-setup.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.zip";
else
ntar="$n-bin.zip";
fi
mkdir $n
cp ../src/ttcalcp.exe $n
$n/ttcalcp.exe createconfig
mv ttcalc.ini $n
mv ttcalc.chm $n
cp ../COPYRIGHT $n
cp ../README $n
cp ../CHANGELOG $n
#tar -zcf $ntar $n
zip -r -9 $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.zip";
else
ntar="$n-src.zip";
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
cp ../COPYRIGHT $n/ttcalc
cp ../README $n/ttcalc
cp ../CHANGELOG $n/ttcalc
#tar -zcf $ntar $n
zip -r -9 $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
echo "" >> note.txt
echo "" >> note.txt
echo "CHANGELOG" >> note.txt
echo "---------" >> note.txt
cat ../CHANGELOG >> note.txt
rm note.txt.md5
unix2dos note.txt
echo "done"
exit 0