#!/bin/bash

#
# This script is used for preparing the tarballs.
# Do not use it, please.
#

#
# DeMorgan rules applied :-) I like math...
#

if [ "x`whoami`" != xpavel -a "x`whoami`" != xhugh -a "x`whoami`" != xpkot -a "x`whoami`" != xbozo ]
then
   echo "No way to test this :-)"
fi

VERSION=`cat ../VERSION`

PWD=`pwd`
SRC_DIR=`dirname ${PWD}`

rm -rf /tmp/gnokii-${VERSION}
cp -r ${SRC_DIR} /tmp/gnokii-${VERSION}

(
   cd /tmp/gnokii-${VERSION}
   ./autogen.sh
   make -C common vcal.c
   # RedHat thing
   cp packaging/RedHat/gnokii.spec .
   # and Debian one
   cp -r packaging/Debian debian
   make distclean
   cd ..
   tar cfz /tmp/gnokii-${VERSION}.tar.gz gnokii-${VERSION} --exclude CVS
   echo "Distribution generated in /tmp/gnokii-${VERSION}.tar.gz"
   tar cfj /tmp/gnokii-${VERSION}.tar.bz2 gnokii-${VERSION} --exclude CVS
   echo "Distribution generated in /tmp/gnokii-${VERSION}.tar.bz2"
)

rm -rf /tmp/gnokii-${VERSION}

