* preserve symlinks
[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                 mv -- $SYMLINK "libcitadel-$LIBCITADEL_VERSION"
33                 ln -sf "libcitadel-$LIBCITADEL_VERSION" libcitadel
34                 cd "libcitadel-$LIBCITADEL_VERSION"
35         else
36                 cd "../libcitadel-$LIBCITADEL_VERSION"
37         fi
38         
39 fi
40
41
42 case $1 in
43     debian)
44         if grep -q "($LIBCITADEL_VERSION" debian/changelog; then
45             echo rebuilding package.
46         else
47             echo "Upstream Version higher than local."
48             
49         fi
50         if test "$2" == "src"; then
51             cd ..
52             rm -rf tmp
53             mkdir tmp
54             cp -rL libcitadel-$LIBCITADEL_VERSION tmp
55             cd tmp/libcitadel-$LIBCITADEL_VERSION
56             rm -rf `find -name .svn ` svn*tmp config.log config.status
57             find -type f -exec chmod a-x {} \;
58             chmod a+x configure
59             cd ..
60             tar -chzf libcitadel_${LIBCITADEL_VERSION}.orig.tar.gz libcitadel-${LIBCITADEL_VERSION}/ --exclude "debian/*"
61             pwd
62             cd  libcitadel-${LIBCITADEL_VERSION}; debuild -S -sa -kw.goesgens@outgesourced.org
63         else
64             fakeroot dpkg-buildpackage
65         fi
66         ;;
67     csw)
68         if !test -d ~/pkgs/; then
69             mkdir ~/pkgs
70         fi
71         echo "
72 PKG=CSWlibcitadel
73 NAME=libcitadel - The groupware server for Web 2.0
74 VERSION=${PACKAGE_VERSION}
75 CATEGORY=application
76 VENDOR=http://www.citadel.org/  packaged for CSW by Wilfried Goesgens
77 HOTLINE=https://uncensored.citadel.org/ Room citadel support
78 EMAIL=citadel@outgesourced.org
79 " >~/pkgs/citadel
80         export LDFLAGS='-L/opt/csw/lib -L /usr/local/lib'
81         export CFLAGS='-I/opt/csw/include -I/usr/local/include  -DDISABLE_CURSES'
82         ./configure \
83             --with-db=/opt/csw/bdb44 \
84             --with-ical=/usr/local/ \
85             --without-curses \
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 --exclude .svn --exclude "debian/*" -chvzf libcitadel-$LIBCITADEL_VERSION.tar.gz libcitadel-$LIBCITADEL_VERSION/
106         ;;
107         *)
108                 echo "Not yet implemented. we have: debian "
109                 ;;
110 esac