* create format strings different for solaris
[citadel.git] / citadel / buildpackages
1 #!/bin/bash
2 # find out the package version from conf
3 if test -x Makefile; then
4     make clean
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 if echo "$ACTUAL_DIR" |grep -q "$CITADEL_VERSION"; then
16         echo "directory ($ACTUAL_DIR) naming scheme seems right. nothing done."
17 else
18         done=false
19         if test -L "$ACTUAL_DIR"; then 
20                 SYMLINK_=`pwd`
21                 SYMLINK=`ls -l $SYMLINK_|sed "s;.*-> ;;"`
22                 if ls -l $SYMLINK_|grep -q "$CITADEL_VERSION"; then
23                         done=true
24                 fi
25         else
26                 SYMLINK=`pwd|sed "s;.*/;;"`
27         fi
28         if test "$done" = "false"; then 
29                 cd ..
30                 mv -- $SYMLINK "citadel-$CITADEL_VERSION"
31                 ln -sf "citadel-$CITADEL_VERSION" citadel
32                 cd "citadel-$CITADEL_VERSION"
33         else
34                 cd "../citadel-$CITADEL_VERSION"
35         fi
36         
37 fi
38
39
40 case $1 in
41     debian)
42         if grep -q "($CITADEL_VERSION" debian/changelog; then
43             echo rebuilding package.
44         else
45             echo "citadel (${CITADEL_VERSION}-${PACKAGE_VERSION}) unstable; urgency=low
46
47   * update to actual Citadel SVN. many new features. see Packages changelog.
48
49  -- Wilfried Goesgens <citadel@outgesourced.org>  $DATE
50
51 " >/tmp/citadel_changelog
52             cat debian/changelog >>/tmp/citadel_changelog
53             mv /tmp/citadel_changelog debian/changelog
54             
55         fi
56         if test "$2" == "src"; then
57             cd ..; dpkg-source -b "citadel-$CITADEL_VERSION"
58         else
59             fakeroot dpkg-buildpackage
60         fi
61         ;;
62     csw)
63         if !test -d ~/pkgs/; then
64             mkdir ~/pkgs
65         fi
66         echo "
67 PKG=CSWcitadel
68 NAME=citadel - The groupware server for Web 2.0
69 VERSION=${PACKAGE_VERSION}
70 CATEGORY=application
71 VENDOR=http://www.citadel.org/  packaged for CSW by Wilfried Goesgens
72 HOTLINE=https://uncensored.citadel.org/ Room citadel support
73 EMAIL=citadel@outgesourced.org
74 " >~/pkgs/citadel
75         export LDFLAGS='-L/opt/csw/lib -L /usr/local/lib'
76         export CFLAGS='-I/opt/csw/include -I/usr/local/include  -DDISABLE_CURSES'
77         ./configure \
78             --with-db=/opt/csw/bdb44 \
79             --with-ical=/usr/local/ \
80             --without-curses \
81             --with-prefix=/opt/csw/ \
82             --with-datadir=/opt/csw/var/lib/citadel \
83             --with-sysconfdir=/opt/csw/etc/citadel \
84             --with-ssldir=/opt/csw/etc/ssl/citadel/ \
85             --with-spooldir=/opt/csw/var/spool/citadel \
86             --with-rundir=/opt/csw/var/run/citadel \
87             --with-docdir=/opt/csw/share/doc/citadel-doc/ \
88             --with-pam \
89             --with-zlib \
90             --with-ldap \
91             --with-libsieve
92             
93         gmake citserver aidepost msgform citmail userlist sendcommand base64 whobbs citadel
94         gmake DESTDIR=$ACTUAL_DIR/cswstage install-new
95         
96
97
98         ;;
99     sourcedist)
100         cd ..; tar --exclude .svn -cvzf citadel-$CITADEL_VERSION.tgz citadel-$CITADEL_VERSION/
101         ;;
102         *)
103                 echo "Not yet implemented. we have: debian "
104                 ;;
105 esac