correct error message hint
[citadel] / 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 DATE=`date '+%a, %d %b %Y %H:%I:00 %z'`
12 ACTUAL_DIR=`pwd`
13
14
15 rm -rf debian/libcitadel debian/libcitadel-dev debian/libcitadel1 debian/libcitadel1-dbg debian/tmp
16 if echo "$ACTUAL_DIR" |grep -q "$LIBCITADEL_VERSION"; then
17         echo "directory ($ACTUAL_DIR) naming scheme seems right. nothing done."
18 else
19         done=false
20         if test -L "$ACTUAL_DIR"; then 
21                 SYMLINK_=`pwd`
22                 SYMLINK=`ls -l $SYMLINK_|sed "s;.*-> ;;"`
23                 if ls -l $SYMLINK|grep -q "$LIBCITADEL_VERSION"; then
24                         done=true
25                 fi
26         else
27                 SYMLINK=`pwd|sed "s;.*/;;"`
28         fi
29         if test "$done" = "false"; then 
30                 cd ..
31                 ln -sf libcitadel "libcitadel-$LIBCITADEL_VERSION" 
32                 cd "libcitadel-$LIBCITADEL_VERSION"
33         else
34                 cd "../libcitadel-$LIBCITADEL_VERSION"
35         fi
36         
37 fi
38
39
40 case $1 in
41     debian)
42         if grep -q "($LIBCITADEL_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 -rL libcitadel-$LIBCITADEL_VERSION tmp
53             cd tmp/libcitadel-$LIBCITADEL_VERSION
54             rm -rf `find -name .svn ` svn*tmp config.log config.status `find -name .libs`
55             find -type f -exec chmod a-x {} \;
56             chmod a+x configure
57             cd ..
58             tar -chzf libcitadel_${LIBCITADEL_VERSION}.orig.tar.gz libcitadel-${LIBCITADEL_VERSION}/ --exclude "debian/*"
59             pwd
60             cd  libcitadel-${LIBCITADEL_VERSION}; debuild -S -sa -kw.goesgens@outgesourced.org
61         else
62             fakeroot dpkg-buildpackage
63         fi
64         ;;
65     csw)
66         if !test -d ~/pkgs/; then
67             mkdir ~/pkgs
68         fi
69         echo "
70 PKG=CSWlibcitadel
71 NAME=libcitadel - The groupware server for Web 2.0
72 VERSION=${PACKAGE_VERSION}
73 CATEGORY=application
74 VENDOR=http://www.citadel.org/  packaged for CSW by Wilfried Goesgens
75 HOTLINE=https://uncensored.citadel.org/ Room citadel support
76 EMAIL=citadel@outgesourced.org
77 " >~/pkgs/citadel
78         export LDFLAGS='-L/opt/csw/lib -L /usr/local/lib'
79         export CFLAGS='-I/opt/csw/include -I/usr/local/include  -DDISABLE_CURSES'
80         ./configure \
81             --with-db=/opt/csw/bdb44 \
82             --with-ical=/usr/local/ \
83             --without-curses \
84             --with-prefix=/opt/csw/ \
85             --with-datadir=/opt/csw/var/lib/citadel \
86             --with-sysconfdir=/opt/csw/etc/citadel \
87             --with-ssldir=/opt/csw/etc/ssl/citadel/ \
88             --with-spooldir=/opt/csw/var/spool/citadel \
89             --with-rundir=/opt/csw/var/run/citadel \
90             --with-docdir=/opt/csw/share/doc/citadel-doc/ \
91             --with-pam \
92             --with-zlib \
93             --with-ldap \
94             --with-libsieve
95             
96         gmake citserver aidepost msgform citmail userlist sendcommand base64 whobbs citadel
97         gmake DESTDIR=$ACTUAL_DIR/cswstage install-new
98         
99
100
101         ;;
102     sourcedist)
103         cd ..; tar --exclude .svn \
104             --exclude "*svn*" \
105             --exclude .libs \
106             --exclude "*.lo" \
107             --exclude "*.o" \
108             --exclude "*.d" \
109             --exclude "debian/*" \
110             --exclude "sysdep.h" \
111             --exclude tests/testdata \
112             \
113             -chvzf libcitadel-$LIBCITADEL_VERSION.tar.gz libcitadel-$LIBCITADEL_VERSION/
114         ;;
115         *)
116                 echo "Not yet implemented. we have: debian, sourcedist "
117                 ;;
118 esac