CASA/tools/linux/mk-casa-tar
2006-04-26 20:35:43 +00:00

95 lines
2.9 KiB
Bash
Executable File

#!/bin/bash
#set -x
if [ $# -gt 2 ] > /dev/null 2>&1
then
echo Working...
#create build temp directory
mkdir -p ~/bld_tst
rm -rf ~/bld_tst/*
mkdir -p ~/bld_tst/CASA-$1.$2.$3
#copy the source to build temp directory
cd ../..
cp -R ./* ~/bld_tst/CASA-$1.$2.$3
#go to build temp directory
cd ~/bld_tst/CASA-$1.$2.$3
#do dos2unx and remove unncessary directory
dos2unix c_micasad/startup/micasad > /dev/null 2>&1
chmod +x c_micasad/startup/micasad
rm -rf products bin bin64 lib lib64 obj obj64
find . -name "*.lux" | xargs dos2unix > /dev/null 2>&1
find . -name "mk*" | xargs dos2unix > /dev/null 2>&1
find . -name "mk*" | xargs chmod +x > /dev/null 2>&1
find . -name "Make*" | xargs dos2unix > /dev/null 2>&1
find . -name "*.c" | xargs dos2unix > /dev/null 2>&1
find . -name "*.cs" | xargs dos2unix > /dev/null 2>&1
find . -name "*.cpp" | xargs dos2unix > /dev/null 2>&1
find . -name "*.java" | xargs dos2unix > /dev/null 2>&1
find . -name "*.h" | xargs dos2unix > /dev/null 2>&1
find . -name "link*" | xargs dos2unix > /dev/null 2>&1
find . -name ".svn" | xargs rm -rf > /dev/null 2>&1
find . -name "*.sh" | xargs dos2unix > /dev/null 2>&1
find . -name "*.sh" | xargs chmod +x > /dev/null 2>&1
find . -name "*ver.txt" | xargs dos2unix > /dev/null 2>&1
find . -name "*build.txt" | xargs dos2unix > /dev/null 2>&1
find . -name "*.mak" | xargs dos2unix > /dev/null 2>&1
find . -name "*.cl" | xargs dos2unix > /dev/null 2>&1
find . -name "*.spec" | xargs dos2unix > /dev/null 2>&1
find . -name "*.patch" | xargs dos2unix > /dev/null 2>&1
find . -name "*.changes" | xargs dos2unix > /dev/null 2>&1
rm -rf ./casa-yast
rm -rf ./c_kwallet
#create spec file from spec template
cp -f ./package/linux/CASA.spec.in ./package/linux/CASA.spec
cp -f ./CASA.changes ./package/linux/CASA.changes
#do create spec file
cd ./package/linux
dos2unix CASA.spec CASA.changes > /dev/null 2>&1
sed -i "s/@VERSION@/$1\.$2\.$3/" CASA.spec
sed -i "s/@PACKAGE@/CASA/" CASA.spec
cd ~/bld_tst/CASA-$1.$2.$3
sed -i "s/\(AM_INIT_AUTOMAKE.*\))/\AM_INIT_AUTOMAKE\(CASA, 1\.6\.$SVN_REVISION\)/" ./configure.in
#create source tar file
cd ~/bld_tst
tar cjf CASA-$1.$2.$3.tar.bz2 ./CASA-$1.$2.$3/ > /dev/null 2>&1
#copy the tar,spec,changes file to package directory.
cd CASA-$1.$2.$3
mkdir -p SOURCE
cp -f ../CASA-$1.$2.$3.tar.bz2 ./SOURCE
cp -f ./package/linux/CASA.spec ./SOURCE
cp -f ./CASA.changes ./SOURCE
#copy abldimg
cd ~/bld_tst/CASA-$1.$2.$3/tools/linux
chmod +x abldimg32 abldimg64
ARCH=`uname -a | grep -c 64`
if [ $ARCH -gt 0 ] > /dev/null 2>&1
then cp -f ./abldimg32 ~/bld_tst/CASA-$1.$2.$3/SOURCE
else
cp -f ./abldimg64 ~/bld_tst/CASA-$1.$2.$3/SOURCE
fi
echo Done!
else
echo
echo Usage: mk-casa-tar maj min bld [d]
echo maj = major version number
echo min = minor version number
echo bld = svn bld revision number
echo "d = debug rpm (optional)"
echo example = mk-patch-tar 1 5 187
echo example = mk-patch-tar 2 5 236 d
echo
fi