r1855: *** 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 -and -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 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 cp ${DISTDIR}.tar.gz ${DEBPKG}_${VERSION}.orig.tar.gz
55
56 if [ "${DISTDIR}" != "${DEBDIR}" ]; then
57   mv ${DISTDIR} ${DEBDIR}
58 fi
59 cp -a ${TOPDIR}/debian ${DEBDIR}
60
61 # dpkg-source ${DEBDIR} ${PKG}_${VERSION}.orig.tar.gz
62
63 cd ${DEBDIR}
64 dpkg-buildpackage -rfakeroot -kkevin@b9.com  #-tc -b
65 cd ..
66 rm -r ${DEBDIR}
67
68 lintian ${DEBPKG}_${VERSION}-*.changes
69
70 mkdir -p /usr/local/share/Packages/${DEBPKG}
71 mv ${DEBPKG}_${VERSION}* /usr/local/share/Packages/${DEBPKG}
72 cd ${TOPDIR}
73 exit 0