r1842: *** 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 cd ${DISTDIR}
40 make distclean
41 cd ..
42 GZIP=-9 tar czf ${DISTDIR}.tar.gz ${DISTDIR}
43
44 find ${DISTDIR} -type f -and -name \*.c -or -name \*.h -or -name \*.list -or \
45     -name \*.system -or -name Makefile -or -name ChangeLog -or \
46     -name COPYRIGHT -or -name TODO -or -name README -or -name INSTALL \
47     -or -name NEWS -or -name \*.sgml -or -name COPYING\* -or -name catalog \
48     | xargs unix2dos
49 zip -rq ${DISTDIR}.zip ${DISTDIR}
50
51 rm -rf ${DISTDIR}
52
53 tar xzf ${DISTDIR}.tar.gz 
54 if [ "${DISTDIR}" != "${DEBDIR}" ]; then
55   mv ${DISTDIR} ${DEBDIR}
56 fi
57 cp -a ${TOPDIR}/debian ${DEBDIR}
58
59 cp ${DISTDIR}.tar.gz ${PKG}_${VERSION}.orig.tar.gz
60 cd ${DEBDIR}
61 dpkg-buildpackage -rfakeroot -kkevin@b9.com -a
62 cd ..
63 # rm -rf ${DEBDIR}
64
65 lintian ${DEBPKG}_${VERSION}-*.changes
66
67 mkdir -p /usr/local/share/Packages/${DEBPKG}
68 mv ${DEBPKG}_${VERSION}* /usr/local/share/Packages/${DEBPKG}
69 cd ${TOPDIR}
70 exit 0