#! /bin/sh
#  pack.sh
#  Time-stamp: <2002-10-10 18:02:08 takeuchi>
#  This script make a tar.gz file which you can expand it
#  as an offline package in some release directory.
#  header file, module.cc and its test file will be included into the
#  archive

if [ "$1" = "" ]; then
  cat <<EOT
Usage: ${0} [Packagename]
EOT
exit
fi

if [ ! -d $1 ]; then
  echo "No such package directory!"
  exit
fi

package=$1
ext=`date +%y%m%d`

arcfile=${package}.${ext}.tar.gz
echo "*** archive file: ${arcfile} ***"

files="GNUmakefile README"
files="${files} doc src ${package}"
#files="${files} test/{GNUmakefile,*.cc,*.tcl,*.C}"
files="${files} test/GNUmakefile test/*.cc test/*.tcl test/*.C"
files="${files} test/.binclean test/.refresh"

pfiles=""

for i in ${files}; do
  if [ -e ${package}/${i} ]; then
    pfiles="${pfiles} ${package}/${i}"
  fi
done

pfiles=" ${pfiles} include/${package}"

echo ${pfiles}

echo "*** generating tar.gz archive ***"
tar zcvf ${arcfile} ${pfiles}

## EOF ##
