#!/bin/bash

# Execute this to package up fracplanet as a .tar.gz.
# This is the script used to build the tarballs released on sourceforge

VERSION=`./VERSION`

DIR=${PWD##*/}

cd ..

PRUNE='-name moc -prune -o -name obj -prune -o -name pkg_* -prune'

FILES_MISC=`ls ${DIR}/{README,BUILD.sh,LICENSE,TODO,NEWS,BUGS,VERSION,THANKS,doxygen.cfg,mktgz,mkdeb,fracplanet.css,fracplanet.htm,fracplanet.menu,htm_to_qml.xsl}`
FILES_PRO=`find ${DIR} ${PRUNE} -o -name '*.pro' -print`
FILES_MAN=`find ${DIR}/man ${PRUNE} -o -name '*.1'   -print`
FILES_H=`find ${DIR} ${PRUNE} -o -name '*.h'   -print`
FILES_C=`find ${DIR} ${PRUNE} -o -name '*.c'   -print`
FILES_CPP=`find ${DIR} ${PRUNE} -o -name '*.cpp' -print`

FILES="$FILES_MISC $FILES_PRO $FILES_MAN $FILES_H $FILES_C $FILES_CPP"

tar --transform "s:^${DIR}/:fracplanet-${VERSION}/:" -cz -f ${DIR}/fracplanet.tar.gz $FILES

echo "***"
echo "*** Suggestion:"
echo "*** mv fracplanet.tar.gz fracplanet-$VERSION.tar.gz"
echo "***"
