r1942: *** empty log message ***
[ctsim.git] / make-dist.sh
1 #!/bin/sh
2
3 # Creates debian and system-independent archive files
4 # Programmer: Kevin M. Rosenberg 
5
6 set -e
7
8 DEBPKG=ctsim
9 PKG=ctsim
10 VERSION=`sed -n -e "s/${DEBPKG} (\(.*\)-[0-9]).*/\1/p" < debian/changelog  |head -1`
11 TOPDIR=`basename $PWD`
12
13 DISTDIR=${PKG}-${VERSION}
14 DEBDIR=${DEBPKG}-${VERSION}
15
16 if [! -f docs/${PKG}.htb -o ! -f docs/html/${PKG}_contents.html -o ! -f docs/${PKG}.pdf ]; then
17   echo "Making documentation"
18   pushd doc
19   make all
20   popd
21 fi
22
23 TAG=upstream_version_`echo $VERSION | tr . _`
24 #echo "(re)tagging with release tag '$TAG'"
25 #cvs -q rtag -d $TAG $PKG
26 #cvs -q tag -F $TAG
27
28
29 echo "Preparing for archives"
30 pushd ..
31 rm -f ${PKG}_${VERSION}.tar.gz ${DEBPKG}_${VERSION}.orig.tar.gz
32 rm -rf ${DISTDIR} ${DEBDIR} ${DISTDIR}.zip
33
34 echo "Making archives"
35 cp -a ${TOPDIR} ${DISTDIR}
36
37 # Remove junk from distribution dir
38 pushd ${DISTDIR}
39 make distclean
40 rm -f `find . -type f -name .cvsignore`
41 rm -rf `find . -type d -name CVS`
42 rm -f `find . -type f -name '*~' -or -name '.*~' -or \
43    -name '.#*' -or -name '#*#' -or -name '*.fig' -or -name '*.psd'`
44 rm -rf images copy make-dist.sh make-doc.sh doc stamp-h.in build-stamp \
45     configure-stamp 
46 popd
47
48 # Create original distribution archives
49 rm -rf ${DISTDIR}/debian
50 GZIP=-9 tar czf ${DISTDIR}.tar.gz ${DISTDIR}
51
52 unix2dos `find ${DISTDIR} -type f -and -name '*.c' -or -name '*.h' -or \
53   -name '*.cpp' -or -name '*.sh' -or -name '*.in' -or \
54   -name 'Makefile*' -or -name ChangeLog -or -name COPYRIGHT -or -name TODO -or \
55   -name README -or -name INSTALL -or -name NEWS -or -name '*.tex' -or \
56   -name '*.hhc' -or -name '*.hhk' -or -name '*.hpj' -or -name '*.ini' -or \
57   -name COPYING* -or -name catalog` 
58 zip -rq ${DISTDIR}.zip ${DISTDIR}
59
60 rm -rf ${DISTDIR}
61
62 tar xzf ${DISTDIR}.tar.gz 
63 cp ${DISTDIR}.tar.gz ${DEBPKG}_${VERSION}.orig.tar.gz
64
65 if [ "${DISTDIR}" != "${DEBDIR}" ]; then
66   mv ${DISTDIR} ${DEBDIR}
67 fi
68 cp -a ${TOPDIR}/debian ${DEBDIR}
69
70 echo "Building Debian packages"
71
72 pushd ${DEBDIR}
73 dpkg-buildpackage -rfakeroot -kkevin@b9.com  #-tc -b
74 popd
75 rm -r ${DEBDIR}
76
77 lintian ${DEBPKG}_${VERSION}-*.changes
78
79 mkdir -p /usr/local/src/Packages/${DEBPKG}
80 mv ${DEBPKG}_${VERSION}* /usr/local/src/Packages/${DEBPKG}
81
82 popd
83 exit 0