c784a48c4c13bc8dc2f2e25b2b4bd6b2565db0aa
[citadel.git] / textclient / 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/textclient 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                 if test ! -L "textclient-$CITADEL_VERSION"; then
33                         ln -sf textclient "textclient-$CITADEL_VERSION"
34                 fi
35                 cd "textclient-$CITADEL_VERSION"
36         else
37                 cd "../textclient-$CITADEL_VERSION"
38         fi
39         
40 fi
41
42
43 case $1 in
44     debian)
45         if grep -q "($CITADEL_VERSION" debian/changelog; then
46             echo rebuilding package.
47         else
48             echo "Upstream Version higher than local."
49             
50         fi
51         if test "$2" == "src"; then
52             cd ..
53             rm -rf tmp
54             mkdir tmp
55             cp -rL textclient-$CITADEL_VERSION tmp
56             cd tmp/textclient-$CITADEL_VERSION
57             rm -rf `find -name .svn ` svn*tmp config.log config.status
58             find -type f -exec chmod a-x {} \;
59             chmod a+x configure *.sh *.sh.in debian/rules debian/*inst* debian/rules mkinstalldirs
60             cd ..
61             tar -chzf textclient_${CITADEL_VERSION}.orig.tar.gz textclient-${CITADEL_VERSION}/ --exclude "debian/*"
62             pwd
63             cd  textclient-${CITADEL_VERSION}; debuild -S -sa -kw.goesgens@outgesourced.org
64         else
65             fakeroot dpkg-buildpackage
66         fi
67         ;;
68     csw)
69         if !test -d ~/pkgs/; then
70             mkdir ~/pkgs
71         fi
72         echo "
73 PKG=CSWcitadel-textclient
74 NAME=citadel - The groupware server for Web 2.0
75 VERSION=${PACKAGE_VERSION}
76 CATEGORY=application
77 VENDOR=http://www.citadel.org/  packaged for CSW by Wilfried Goesgens
78 HOTLINE=https://uncensored.citadel.org/ Room citadel support
79 EMAIL=citadel@outgesourced.org
80 " >~/pkgs/citadel
81         export LDFLAGS='-L/opt/csw/lib -L /usr/local/lib'
82         export CFLAGS='-I/opt/csw/include -I/usr/local/include  -DDISABLE_CURSES'
83         ./configure \
84             --with-db=/opt/csw/bdb44 \
85             --with-ical=/usr/local/ \
86             --with-prefix=/opt/csw/ \
87             --with-datadir=/opt/csw/var/lib/citadel \
88             --with-sysconfdir=/opt/csw/etc/citadel \
89             --with-ssldir=/opt/csw/etc/ssl/citadel/ \
90             --with-spooldir=/opt/csw/var/spool/citadel \
91             --with-rundir=/opt/csw/var/run/citadel \
92             --with-docdir=/opt/csw/share/doc/citadel-doc/ \
93             --with-pam \
94             --with-zlib \
95             --with-ldap \
96             --with-libsieve
97             
98         gmake citserver aidepost msgform citmail userlist sendcommand base64 whobbs citadel
99         gmake DESTDIR=$ACTUAL_DIR/cswstage install-new
100         
101
102
103         ;;
104     sourcedist)
105         cd ..; tar \
106             --exclude ".gitignore" \
107             --exclude "*.lo" \
108             --exclude "*.o" \
109             --exclude "*.d" \
110             --exclude "autom4te.cache/*" \
111             --exclude "debian/*" \
112             --exclude "sysdep.h" \
113             \
114             -chvzf textclient-$CITADEL_VERSION.tar.gz textclient-$CITADEL_VERSION/
115         ;;
116         version)
117                 echo This would build textclient-$CITADEL_VERSION
118                 ;;
119         *)
120                 echo "Not yet implemented. we have: debian "
121                 ;;
122 esac