exclude git specific files from the distribution tarballs
[citadel.git] / webcit / buildpackages
1 #!/bin/bash
2 if test -x Makefile; then
3     make clean
4 fi
5 ./bootstrap
6 export `grep PACKAGE_VERSION= configure |sed -e "s;';;g" -e "s;PACKAGE;WEBCIT;"`
7
8 PACKAGE_VERSION=`cat packageversion`
9 DATE=`date '+%a, %d %b %Y %H:%I:00 %z'`
10 ACTUAL_DIR=`pwd`
11
12
13 rm -rf debian/citadel-webcit debian/tmp/
14 if echo "$ACTUAL_DIR" |grep -q "$WEBCIT_VERSION"; then
15         echo "directory ($ACTUAL_DIR) naming scheme seems right. nothing done."
16 else
17         done=false
18         if test -L "$ACTUAL_DIR"; then 
19                 SYMLINK_=`pwd`
20                 SYMLINK=`ls -l $SYMLINK_|sed "s;.*-> ;;"`
21                 if ls -l $SYMLINK_|grep -q "$WEBCIT_VERSION"; then
22                         done=true
23                 fi
24         else
25                 SYMLINK=`pwd|sed "s;.*/;;"`
26         fi
27         if test "$done" = "false"; then 
28                 cd ..
29                 ln -sf webcit "webcit-$WEBCIT_VERSION"
30                 cd "webcit-$WEBCIT_VERSION"
31         else
32                 cd "../webcit-$WEBCIT_VERSION"
33         fi
34         
35 fi
36
37 case $1 in
38     debian)
39         if grep -q "($WEBCIT_VERSION" debian/changelog; then
40             echo rebuilding package.
41         else
42             echo "Upstream Version higher than local."      
43         fi
44         if test "$2" == "src"; then
45             cd ..
46             rm -rf tmp
47             mkdir tmp
48             cp -rL webcit-$WEBCIT_VERSION tmp
49             cd tmp/webcit-$WEBCIT_VERSION
50             rm -rf `find -name .svn ` svn*tmp* build-stamp configure-stamp *~ config.guess  config.log config.status autom4te.cache Makefile 
51             find -type f -exec chmod a-x {} \;
52             chmod a+x configure debian/rules po/create-pot.sh mk_module_init.sh
53             cd ..
54             tar -chzf webcit_${WEBCIT_VERSION}.orig.tar.gz webcit-${WEBCIT_VERSION}/ --exclude "debian/*"
55             pwd
56             cd  webcit-${WEBCIT_VERSION}; debuild -S -sa -kw.goesgens@outgesourced.org
57         else
58             fakeroot dpkg-buildpackage
59         fi
60         ;;
61     sourcedist)
62         if test "$2" == "dfsg"; then
63             NONDFSG=-"-exclude static/webcit_icons/openid-small.gif"
64         fi
65         cd ..; tar --exclude .gitignore --exclude "debian/*" $NONDFSG -cvhzf webcit-${WEBCIT_VERSION}.tar.gz webcit-${WEBCIT_VERSION}/
66         ;;
67     i18n)
68         ./webcit -G `pwd`/i18n_templatelist.c
69         cd po;  ./create-pot.sh
70         ;;
71     *)
72         echo "Not yet implemented. we have: debian, sourcedist, i18n (needs ready compiled & installed webcit in your system)"
73         ;;
74 esac