Exclude testdata from the distribution tgzs; they don't need it and they're huge.
[citadel.git] / libcitadel / 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;LIBCITADEL;"`
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/libcitadel debian/libcitadel-dev debian/libcitadel1 debian/libcitadel1-dbg debian/tmp
17 if echo "$ACTUAL_DIR" |grep -q "$LIBCITADEL_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 "$LIBCITADEL_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 libcitadel "libcitadel-$LIBCITADEL_VERSION" 
33                 cd "libcitadel-$LIBCITADEL_VERSION"
34         else
35                 cd "../libcitadel-$LIBCITADEL_VERSION"
36         fi
37         
38 fi
39
40
41 case $1 in
42     debian)
43         if grep -q "($LIBCITADEL_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 libcitadel-$LIBCITADEL_VERSION tmp
54             cd tmp/libcitadel-$LIBCITADEL_VERSION
55             rm -rf `find -name .svn ` svn*tmp config.log config.status `find -name .libs`
56             find -type f -exec chmod a-x {} \;
57             chmod a+x configure
58             cd ..
59             tar -chzf libcitadel_${LIBCITADEL_VERSION}.orig.tar.gz libcitadel-${LIBCITADEL_VERSION}/ --exclude "debian/*"
60             pwd
61             cd  libcitadel-${LIBCITADEL_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=CSWlibcitadel
72 NAME=libcitadel - 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             --without-curses \
85             --with-prefix=/opt/csw/ \
86             --with-datadir=/opt/csw/var/lib/citadel \
87             --with-sysconfdir=/opt/csw/etc/citadel \
88             --with-ssldir=/opt/csw/etc/ssl/citadel/ \
89             --with-spooldir=/opt/csw/var/spool/citadel \
90             --with-rundir=/opt/csw/var/run/citadel \
91             --with-docdir=/opt/csw/share/doc/citadel-doc/ \
92             --with-pam \
93             --with-zlib \
94             --with-ldap \
95             --with-libsieve
96             
97         gmake citserver aidepost msgform citmail userlist sendcommand base64 whobbs citadel
98         gmake DESTDIR=$ACTUAL_DIR/cswstage install-new
99         
100
101
102         ;;
103     sourcedist)
104         cd ..; tar --exclude .svn \
105             --exclude "*svn*" \
106             --exclude .libs \
107             --exclude "*.lo" \
108             --exclude "*.o" \
109             --exclude "*.d" \
110             --exclude "debian/*" \
111             --exclude "sysdep.h" \
112             --exclude tests/testdata \
113             \
114             -chvzf libcitadel-$LIBCITADEL_VERSION.tar.gz libcitadel-$LIBCITADEL_VERSION/
115         ;;
116         *)
117                 echo "Not yet implemented. we have: debian "
118                 ;;
119 esac