* rewind debian changelog for initial packaging process
[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 "Upstream Version higher than local."
46             
47         fi
48         if test "$2" == "src"; then
49             cd ..
50             rm -rf tmp
51             mkdir tmp
52             cp -a citadel-$CITADEL_VERSION tmp
53             cd tmp/citadel-$CITADEL_VERSION
54             rm -rf `find -name .svn ` svn*tmp config.log config.status
55             cd ..
56             tar -czf citadel_${CITADEL_VERSION}.orig.tar.gz citadel-${CITADEL_VERSION}/ --exclude "debian/*"
57             pwd
58             cd  citadel-${CITADEL_VERSION}; debuild -S -sa -kw.goesgens@outgesourced.org
59         else
60             fakeroot dpkg-buildpackage
61         fi
62         ;;
63     csw)
64         if !test -d ~/pkgs/; then
65             mkdir ~/pkgs
66         fi
67         echo "
68 PKG=CSWcitadel
69 NAME=citadel - The groupware server for Web 2.0
70 VERSION=${PACKAGE_VERSION}
71 CATEGORY=application
72 VENDOR=http://www.citadel.org/  packaged for CSW by Wilfried Goesgens
73 HOTLINE=https://uncensored.citadel.org/ Room citadel support
74 EMAIL=citadel@outgesourced.org
75 " >~/pkgs/citadel
76         export LDFLAGS='-L/opt/csw/lib -L /usr/local/lib'
77         export CFLAGS='-I/opt/csw/include -I/usr/local/include  -DDISABLE_CURSES'
78         ./configure \
79             --with-db=/opt/csw/bdb44 \
80             --with-ical=/usr/local/ \
81             --without-curses \
82             --with-prefix=/opt/csw/ \
83             --with-datadir=/opt/csw/var/lib/citadel \
84             --with-sysconfdir=/opt/csw/etc/citadel \
85             --with-ssldir=/opt/csw/etc/ssl/citadel/ \
86             --with-spooldir=/opt/csw/var/spool/citadel \
87             --with-rundir=/opt/csw/var/run/citadel \
88             --with-docdir=/opt/csw/share/doc/citadel-doc/ \
89             --with-pam \
90             --with-zlib \
91             --with-ldap \
92             --with-libsieve
93             
94         gmake citserver aidepost msgform citmail userlist sendcommand base64 whobbs citadel
95         gmake DESTDIR=$ACTUAL_DIR/cswstage install-new
96         
97
98
99         ;;
100     sourcedist)
101         cd ..; tar --exclude .svn --exclude "debian/*" -cvzf citadel-$CITADEL_VERSION.tgz citadel-$CITADEL_VERSION/
102         ;;
103         *)
104                 echo "Not yet implemented. we have: debian "
105                 ;;
106 esac