#!/bin/sh
# Creates debian and system-independent archive files
-# Programmer: Kevin Rosenberg based on script used by onShore Development
+# Programmer: Kevin M. Rosenberg
set -e
DEBPKG=ctsim
PKG=ctsim
VERSION=`sed -n -e "s/${DEBPKG} (\(.*\)-[0-9]).*/\1/p" < debian/changelog |head -1`
-echo $VERSION
TOPDIR=`basename $PWD`
DISTDIR=${PKG}-${VERSION}
DEBDIR=${DEBPKG}-${VERSION}
+if [! (-f docs/${PKG}.htb -a -f docs/html/${PKG}_contents.html -a -f docs/${PKG}.pdf) ]; then
+ echo "Making documentation"
+ pushd doc
+ make all
+ popd
+fi
+
TAG=upstream_version_`echo $VERSION | tr . _`
#echo "(re)tagging with release tag '$TAG'"
#cvs -q rtag -d $TAG $PKG
#cvs -q tag -F $TAG
-# build the tarball
-echo "building tarballs"
+echo "Preparing for archives"
pushd ..
rm -f ${PKG}_${VERSION}.tar.gz ${DEBPKG}_${VERSION}.orig.tar.gz
rm -rf ${DISTDIR} ${DEBDIR} ${DISTDIR}.zip
+
+echo "Making archives"
cp -a ${TOPDIR} ${DISTDIR}
# Remove junk from distribution dir
pushd ${DISTDIR}
make distclean
+rm -f `find . -type f -name .cvsignore`
+rm -rf `find . -type d -name CVS`
+rm -f `find . -type f -name '*~' -or -name '.*~' -or \
+ -name '.#*' -or -name '#*#' -or -name '*.fig' -or -name '*.psd'`
+rm -rf images copy make-dist.sh make-doc.sh doc stamp-h.in build-stamp \
+ configure-stamp
popd
-rm -f `find ${DISTDIR} -type f -name .cvsignore`
-rm -rf `find ${DISTDIR} -type d -name CVS`
-rm -f `find ${DISTDIR} -type f -name '*~' -or -name '.*~' -or \
- -name '.#*' -or -name '#*#'`
# Create original distribution archives
rm -rf ${DISTDIR}/debian
-pushd ${DISTDIR}
-make distclean
-popd
GZIP=-9 tar czf ${DISTDIR}.tar.gz ${DISTDIR}
unix2dos `find ${DISTDIR} -type f -and -name '*.c' -or -name '*.h' -or \
- -name Makefile -or -name ChangeLog -or -name COPYRIGHT -or -name TODO -or \
+ -name '*.cpp' -or -name '*.sh' -or -name '*.in' -or \
+ -name 'Makefile*' -or -name ChangeLog -or -name COPYRIGHT -or -name TODO -or \
-name README -or -name INSTALL -or -name NEWS -or -name '*.tex' -or \
+ -name '*.hhc' -or -name '*.hhk' -or -name '*.hpj' -or -name '*.ini' -or \
-name COPYING* -or -name catalog`
zip -rq ${DISTDIR}.zip ${DISTDIR}
fi
cp -a ${TOPDIR}/debian ${DEBDIR}
-# dpkg-source ${DEBDIR} ${PKG}_${VERSION}.orig.tar.gz
+echo "Building Debian packages"
pushd ${DEBDIR}
dpkg-buildpackage -rfakeroot -kkevin@b9.com #-tc -b