r1839: *** empty log message ***
[ctsim.git] / make-dist.sh
1 #!/bin/sh
2
3 # Creates debian and system-independent archive files
4 # Programmer: Kevin Rosenberg based on script used by onShore Development
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 echo $VERSION
12 TOPDIR=`basename $PWD`
13
14 DISTDIR=${PKG}-${VERSION}
15 DEBDIR=${DEBPKG}-${VERSION}
16
17 TAG=upstream_version_`echo $VERSION | tr . _`
18 echo "(re)tagging with release tag '$TAG'"
19 cvs -q rtag -d $TAG $PKG
20 cvs -q tag -F $TAG
21
22
23 # build the tarball
24 echo "building tarballs"
25 cd ..
26 rm -f ${PKG}_${VERSION}.tar.gz ${DEBPKG}_${VERSION}.orig.tar.gz
27 rm -rf ${DISTDIR} ${DEBDIR} ${DISTDIR}.zip
28 cp -a ${TOPDIR} ${DISTDIR}
29
30 # Remove junk from distribution dir
31 find ${DISTDIR} -type f -name .cvsignore -exec rm {} \;
32 find ${DISTDIR} -type d -name CVS | xargs rm -r
33 find ${DISTDIR}/doc -type f -name \*.tex -or -name \*.aux -or \
34     -name \*.log -or -name \*.out -or -name \*.dvi -or \
35     -name \*~ -or -name .\#\*  -or -name \#*\# |xargs rm -f
36
37 # Create original distribution archives
38 rm -rf ${DISTDIR}/debian
39 GZIP=-9 tar czf ${DISTDIR}.tar.gz ${DISTDIR}
40
41 find ${DISTDIR} -type f -and -name \*.c -or -name \*.h -or -name \*.list -or \
42     -name \*.system -or -name Makefile -or -name ChangeLog -or \
43     -name COPYRIGHT -or -name TODO -or -name README -or -name INSTALL \
44     -or -name NEWS -or -name \*.sgml -or -name COPYING\* -or -name catalog \
45     | xargs unix2dos
46 zip -rq ${DISTDIR}.zip ${DISTDIR}
47
48 rm -rf ${DISTDIR}
49
50 tar xzf ${DISTDIR}.tar.gz 
51 if [ "${DISTDIR}" != "${DEBDIR}" ]; then
52   mv ${DISTDIR} ${DEBDIR}
53 fi
54 cp -a ${TOPDIR}/debian ${DEBDIR}
55
56 cd ${DEBDIR}
57 dpkg-buildpackage -rfakeroot -kkevin@b9.com -a
58
59 cd ..
60 rm -rf $DEBDIR}
61
62 lintian ${DEBPKG}_${VERSION}-*.changes
63
64 mkdir -p /usr/local/share/Packages/${DEBPKG}
65 mv ${DEBPKG}_${VERSION}* /usr/local/share/Packages/${DEBPKG}
66 cd ${TOPDIR}
67 exit 0