r1942: *** empty log message ***
[ctsim.git] / make-dist.sh
index 00592fd1f6f6c58acf91a5c15d9cf00525921bd4..5ab5bf3a56e90ea0139808556379422ba0936c7d 100755 (executable)
@@ -1,69 +1,83 @@
 #!/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 -o ! -f docs/html/${PKG}_contents.html -o ! -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
+#echo "(re)tagging with release tag '$TAG'"
+#cvs -q rtag -d $TAG $PKG
+#cvs -q tag -F $TAG
 
 
-# build the tarball
-echo "building tarballs"
-cd ..
+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
-find ${DISTDIR} -type f -name .cvsignore -exec rm {} \;
-find ${DISTDIR} -type d -name CVS | xargs rm -r
-find ${DISTDIR}/doc -type f -name \*.tex -or -name \*.aux -or \
-    -name \*.log -or -name \*.out -or -name \*.dvi -or \
-    -name \*~ -or -name .\#\*  -or -name \#*\# |xargs rm -f
+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
 
 # Create original distribution archives
 rm -rf ${DISTDIR}/debian
 GZIP=-9 tar czf ${DISTDIR}.tar.gz ${DISTDIR}
 
-find ${DISTDIR} -type f -and -name \*.cl -or -name \*.list -or \
-    -name \*.system -or -name Makefile -or -name ChangeLog -or \
-    -name COPYRIGHT -or -name TODO -or -name README -or -name INSTALL \
-    -or -name NEWS -or -name \*.sgml -or -name COPYING\* -or -name catalog \
-    | xargs unix2dos
+unix2dos `find ${DISTDIR} -type f -and -name '*.c' -or -name '*.h' -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}
 
 rm -rf ${DISTDIR}
 
-cp -a ${TOPDIR} ${DEBDIR}
-# Remove junk from distribution dir
-find ${DISTDIR} -type f -name .cvsignore -exec rm {} \;
-find ${DISTDIR} -type d -name CVS | xargs rm -r
-find ${DISTDIR}/doc -type f -name \*.tex -or -name \*.aux -or \
-    -name \*.log -or -name \*.out -or -name \*.dvi -or \
-    -name \*~ -or -name .\#\*  -or -name \#*\# |xargs rm -f
+tar xzf ${DISTDIR}.tar.gz 
+cp ${DISTDIR}.tar.gz ${DEBPKG}_${VERSION}.orig.tar.gz
 
-cd ${DEBDIR}
-dpkg-buildpackage -rfakeroot -kkevin@b9.com -a
+if [ "${DISTDIR}" != "${DEBDIR}" ]; then
+  mv ${DISTDIR} ${DEBDIR}
+fi
+cp -a ${TOPDIR}/debian ${DEBDIR}
 
-cd ..
-rm -rf ${DEBDIR}
+echo "Building Debian packages"
+
+pushd ${DEBDIR}
+dpkg-buildpackage -rfakeroot -kkevin@b9.com  #-tc -b
+popd
+rm -r ${DEBDIR}
 
 lintian ${DEBPKG}_${VERSION}-*.changes
 
-mkdir -p /usr/local/share/Packages/${DEBPKG}
-mv ${DEBPKG}_${VERSION}* /usr/local/share/Packages/${DEBPKG}
-cd ${TOPDIR}
+mkdir -p /usr/local/src/Packages/${DEBPKG}
+mv ${DEBPKG}_${VERSION}* /usr/local/src/Packages/${DEBPKG}
+
+popd
 exit 0