File buildtarball.sh of Package cyrus-imapd-3

#!/bin/bash

set -e

VERSION=3.6.6
export VERSION
GIT_REF=dev/kolab-3.6
NAME=cyrus-imapd-$VERSION

ROOT_DIR=$(pwd)

rm -Rf /tmp/$NAME
mkdir /tmp/$NAME
cd /tmp/$NAME

rm -f $NAME.tar.gz
[ -d "$NAME" ] && rm -rf "$NAME"
git clone --branch $GIT_REF https://git.kolab.org/source/cyrus-imapd.git $NAME
pushd $NAME
git reset --hard $GIT_REF

git clean -d -f -x

#Disable tools/git-version.sh and just set our version for the tarball
echo "$VERSION" > VERSION

autoreconf -vi || (libtoolize && autoreconf -vi)

./configure --enable-maintainer-mode || exit 124

make lex-fix

make -j4 || exit 125
make dist || exit 126

mv "$NAME.tar.gz" "$ROOT_DIR/$NAME.tar.gz"

cd "$PWD"