#!/bin/sh

exclude1="grep -v src/msw/"

while [ ! -z "$1" ]; do
    case "$1" in
	-all)
		exclude1=cat
		shift
		;;
	*)
		echo "Usage: `basename $0`: [-all]"
		exit 1
		;;
    esac
done


version=`cat VERSION`
out=xpce-$version.tar.gz
compress=gzip

rm -f xpce-$version
if [ ! "o$1" = "o-q" ]; then
  cp /dev/null cvsfiles
  echo -n "Collecting distribution files "
  for d in `find . -name CVS -type d -print`; do
      echo -n "."
      dir=`dirname $d`
      grep '^/' $dir/CVS/Entries | \
          awk -F/ '{printf("%s/%s\n", "'$dir'", $2)}' >> cvsfiles
  done
  echo "done"
fi

# Include generated files for building on MS-Windows.

cat cvsfiles | \
  $exclude1 | \
  grep -v sicstus/ | \
  grep -v prolog/pwboot/ | \
  grep -v quintus/ | \
  grep -v /prowindows | \
  grep -v /licence/ | \
	  sed "s@^\./@xpce-$version/@" > tapefiles

cd ..
rm -f xpce-$version
ln -s xpce xpce-$version
tar cvfT - xpce/tapefiles | $compress > $out
rm -f xpce-$version


