* send welcome mail on first debian package installation.
[citadel.git] / citadel / debian / rules
1 #!/usr/bin/make -f
2
3 # Uncomment this to turn on verbose mode.
4 #export DH_VERBOSE=1
5
6 # This has to be exported to make some magic below work.
7 export DH_OPTIONS
8
9 DEB_DESTDIR = $(CURDIR)/debian/tmp
10
11 CFLAGS = -Wall -g
12
13 ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
14         CFLAGS += -O0 -ggdb
15 else
16         CFLAGS += -O2
17 endif
18
19 configure: configure-stamp
20 configure-stamp:
21         dh_testdir
22
23         CFLAGS="$(CFLAGS)" ./configure \
24                 --with-datadir=/var/lib/citadel \
25                 --with-spooldir=/var/spool/citadel \
26                 --with-sysconfdir=/etc/citadel \
27                 --with-rundir=/var/run/citadel \
28                 --with-docdir=/usr/share/doc/citadel-doc/ \
29                 --with-pam \
30                 --with-db \
31                 --with-zlib \
32                 --with-ldap \
33                 --with-libical \
34                 --with-libsieve
35
36         touch configure-stamp
37
38 #Architecture 
39 build: build-arch build-indep
40
41 build-arch: build-arch-stamp
42 build-arch-stamp: configure-stamp
43
44         $(MAKE)
45         touch $@
46
47 build-indep: build-indep-stamp
48 build-indep-stamp: configure-stamp
49
50         touch $@
51
52 clean:
53         dh_testdir
54         dh_testroot
55         rm -f build-arch-stamp build-indep-stamp configure-stamp
56
57         -$(MAKE) distclean
58
59         dh_clean 
60
61 install: install-indep install-arch
62 install-indep:
63         dh_testdir
64         dh_testroot
65         dh_clean -k -i 
66         dh_installdirs -i
67
68         $(MAKE) DESTDIR=$(DEB_DESTDIR) install-doc-new
69
70         dh_install -i --sourcedir=debian/tmp
71
72 install-arch:
73         dh_testdir
74         dh_testroot
75         dh_clean -k -s 
76         dh_installdirs -s
77
78         $(MAKE) DESTDIR=$(DEB_DESTDIR) \
79                 install-exec-new \
80                 install-data-new \
81                 install-doc-new
82
83         mkdir -p $(DEB_DESTDIR)/usr/lib/citadel-server
84         mv $(DEB_DESTDIR)/usr/sbin/setup \
85                 $(DEB_DESTDIR)/usr/lib/citadel-server/
86
87         mkdir -p $(DEB_DESTDIR)/usr/share/doc/citadel-server/
88         mv $(DEB_DESTDIR)/usr/share/doc/citadel-doc/database_cleanup.sh \
89                 $(DEB_DESTDIR)/usr/share/doc/citadel-server/
90         mv $(DEB_DESTDIR)/usr/share/doc/citadel-doc/docs/welcomemail.txt \
91                 $(DEB_DESTDIR)/usr/share/doc/citadel-doc/docs/welcomemail.html \
92                 $(DEB_DESTDIR)/usr/share/doc/citadel-server/
93
94         dh_install -s --sourcedir=debian/tmp
95
96 binary-common:
97         dh_testdir
98         dh_testroot
99         dh_installchangelogs
100         dh_installdocs
101         dh_installdebconf       
102         dh_installinit --name=citadel
103         dh_installman
104         dh_strip
105         dh_compress 
106         dh_fixperms
107         dh_makeshlibs
108         dh_installdeb
109         dh_shlibdeps
110         dh_gencontrol
111         dh_md5sums
112         dh_builddeb
113
114 # Build architecture independant packages using the common target.
115 binary-indep: build-indep install-indep
116         $(MAKE) -f debian/rules DH_OPTIONS=-i binary-common
117
118 # Build architecture dependant packages using the common target.
119 binary-arch: build-arch install-arch
120         $(MAKE) -f debian/rules DH_OPTIONS=-s binary-common
121
122 binary: binary-arch binary-indep
123 .PHONY: build clean binary-indep binary-arch binary install install-indep install-arch configure