exclude git specific files from the distribution tarballs
[citadel.git] / citadel / buildpackages
1 #!/bin/bash
2 # find out the package version from conf
3 if test -f Makefile; then
4     make distclean
5 fi
6
7 ./bootstrap
8
9 export `grep PACKAGE_VERSION= configure |sed -e "s;';;g" -e "s;PACKAGE;CITADEL;"`
10
11 PACKAGE_VERSION=`cat packageversion`
12 DATE=`date '+%a, %d %b %Y %H:%I:00 %z'`
13 ACTUAL_DIR=`pwd`
14
15
16 rm -rf debian/citadel-client debian/citadel-common debian/citadel-doc debian/citadel-mta debian/citadel-server debian/citadel-suite debian/tmp
17 if echo "$ACTUAL_DIR" |grep -q "$CITADEL_VERSION"; then
18         echo "directory ($ACTUAL_DIR) naming scheme seems right. nothing done."
19 else
20         done=false
21         if test -L "$ACTUAL_DIR"; then 
22                 SYMLINK_=`pwd`
23                 SYMLINK=`ls -l $SYMLINK_|sed "s;.*-> ;;"`
24                 if ls -l $SYMLINK_|grep -q "$CITADEL_VERSION"; then
25                         done=true
26                 fi
27         else
28                 SYMLINK=`pwd|sed "s;.*/;;"`
29         fi
30         if test "$done" = "false"; then 
31                 cd ..
32                 ln -sf citadel "citadel-$CITADEL_VERSION"
33                 cd "citadel-$CITADEL_VERSION"
34         else
35                 cd "../citadel-$CITADEL_VERSION"
36         fi
37         
38 fi
39
40
41 case $1 in
42     debian)
43         if grep -q "($CITADEL_VERSION" debian/changelog; then
44             echo rebuilding package.
45         else
46             echo "Upstream Version higher than local."
47             
48         fi
49         if test "$2" == "src"; then
50             cd ..
51             rm -rf tmp
52             mkdir tmp
53             cp -rL citadel-$CITADEL_VERSION tmp
54             cd tmp/citadel-$CITADEL_VERSION
55             rm -rf `find -name .svn ` svn*tmp config.log config.status
56             find -type f -exec chmod a-x {} \;
57             chmod a+x configure *.sh *.sh.in debian/rules debian/*inst* debian/rules mkinstalldirs
58             cd ..
59             tar -chzf citadel_${CITADEL_VERSION}.orig.tar.gz citadel-${CITADEL_VERSION}/ --exclude "debian/*"
60             pwd
61             cd  citadel-${CITADEL_VERSION}; debuild -S -sa -kw.goesgens@outgesourced.org
62         else
63             fakeroot dpkg-buildpackage
64         fi
65         ;;
66     csw)
67         if !test -d ~/pkgs/; then
68             mkdir ~/pkgs
69         fi
70         echo "
71 PKG=CSWcitadel
72 NAME=citadel - The groupware server for Web 2.0
73 VERSION=${PACKAGE_VERSION}
74 CATEGORY=application
75 VENDOR=http://www.citadel.org/  packaged for CSW by Wilfried Goesgens
76 HOTLINE=https://uncensored.citadel.org/ Room citadel support
77 EMAIL=citadel@outgesourced.org
78 " >~/pkgs/citadel
79         export LDFLAGS='-L/opt/csw/lib -L /usr/local/lib'
80         export CFLAGS='-I/opt/csw/include -I/usr/local/include  -DDISABLE_CURSES'
81         ./configure \
82             --with-db=/opt/csw/bdb44 \
83             --with-ical=/usr/local/ \
84             --with-prefix=/opt/csw/ \
85             --with-datadir=/opt/csw/var/lib/citadel \
86             --with-sysconfdir=/opt/csw/etc/citadel \
87             --with-ssldir=/opt/csw/etc/ssl/citadel/ \
88             --with-spooldir=/opt/csw/var/spool/citadel \
89             --with-rundir=/opt/csw/var/run/citadel \
90             --with-docdir=/opt/csw/share/doc/citadel-doc/ \
91             --with-pam \
92             --with-zlib \
93             --with-ldap \
94             --with-libsieve
95             
96         gmake citserver aidepost msgform citmail userlist sendcommand base64 whobbs citadel
97         gmake DESTDIR=$ACTUAL_DIR/cswstage install-new
98         
99
100
101         ;;
102     sourcedist)
103         cd ..; tar --exclude .gitignore --exclude "debian/*" -chvzf citadel-$CITADEL_VERSION.tar.gz citadel-$CITADEL_VERSION/
104         ;;
105         *)
106                 echo "Not yet implemented. we have: debian "
107                 ;;
108 esac