* added a.n.o patches for solaris compatibility
[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 DEB_HOST_GNU_TYPE   ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
8 DEB_BUILD_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
9
10 export DH_OPTIONS
11
12 DEB_DESTDIR = $(CURDIR)/debian/tmp
13
14 CFLAGS = -Wall -g
15
16
17 EXTRA_ARGS=
18 PROFILE_ARGS=
19 #to enable debugging: export DEB_BUILD_OPTIONS="debug profiling threadoff"
20 ifneq (,$(findstring profiling,$(DEB_BUILD_OPTIONS)))
21         PROFILE_ARGS= --with-gprof
22 endif
23 ifneq (,$(findstring debug,$(DEB_BUILD_OPTIONS)))
24         CFLAGS += -O0 -ggdb -rdynamic -D_GNU_SOURCE -MD -MP -D TECH_PREVIEW
25         LDFLAGS+=-Wl,--no-undefined -Wl,--as-needed
26         EXTRA_ARGS = --with-backtrace
27 else
28         LDFLAGS+=-Wl,--no-undefined -Wl,--as-needed
29         CFLAGS += -O2
30 endif
31
32 ifneq (,$(findstring threadoff,$(DEB_BUILD_OPTIONS)))
33         THREAD_ARGS=--without-threaded-client
34 else
35         THREAD_ARGS=
36 endif
37
38 configure: configure-stamp
39 configure-stamp:
40         dh_testdir
41
42         LDFLAGS="$(LDFLAGS)"; CFLAGS="$(CFLAGS)" ./configure \
43                 --with-prefix=/var/lib/citadel \
44                 --with-datadir=/var/lib/citadel \
45                 --with-staticdatadir=/usr/share/citadel-server \
46                 --with-spooldir=/var/spool/citadel \
47                 --with-sysconfdir=/etc/citadel \
48                 --with-rundir=/var/run/citadel \
49                 --with-docdir=/usr/share/doc/citadel-doc/ \
50                 --with-ssldir=/etc/ssl/citadel/ \
51                 --with-utility-bindir=/usr/lib/citadel-server/ \
52                 --with-pam \
53                 --with-db \
54                 --with-zlib \
55                 --with-ldap \
56                 --with-libical \
57                 --with-libsieve \
58                 --enable-debug $(EXTRA_ARGS) $(PROFILE_ARGS) $(THREAD_ARGS)
59
60         touch configure-stamp
61
62 #Architecture 
63 build: build-arch build-indep
64
65 build-arch: build-arch-stamp
66 build-arch-stamp: configure-stamp
67
68         $(MAKE)
69         touch $@
70
71 build-indep: build-indep-stamp
72 build-indep-stamp: configure-stamp
73
74         touch $@
75
76 clean:
77         dh_testdir
78         dh_testroot
79         rm -f build-arch-stamp build-indep-stamp configure-stamp
80
81         [ ! -f Makefile ] || $(MAKE) distclean
82
83         dh_clean 
84         rm -f config.status config.log
85
86 install: install-indep install-arch
87 install-indep:
88         dh_testdir
89         dh_testroot
90         dh_clean -k -i 
91         dh_installdirs -i
92
93         $(MAKE) DESTDIR=$(DEB_DESTDIR) install-doc-new
94
95         dh_install -i --sourcedir=debian/tmp
96
97 install-arch:
98         dh_testdir
99         dh_testroot
100         dh_clean -k -s 
101         dh_installdirs -s
102
103         $(MAKE) DESTDIR=$(DEB_DESTDIR) install-exec-new install-data-new
104
105         install -D -p -m0755 database_cleanup.sh \
106                 $(DEB_DESTDIR)/usr/share/doc/citadel-server/examples/database_cleanup.sh
107
108         install -D -p -m0644 docs/welcomemail.html \
109                 $(DEB_DESTDIR)/usr/share/doc/citadel-server/welcomemail.html
110
111         install -D -p -m0644 docs/welcomemail.txt \
112                 $(DEB_DESTDIR)/usr/share/doc/citadel-server/welcomemail.txt
113
114         dh_install -s --sourcedir=debian/tmp
115
116 binary-common:
117         dh_testdir
118         dh_testroot
119         dh_installchangelogs
120         dh_installdocs
121         dh_installdebconf       
122         dh_installinit --name=citadel
123         dh_installman
124         dh_strip
125         dh_compress 
126         dh_fixperms
127         dh_makeshlibs
128         dh_installdeb
129         dh_shlibdeps
130         dh_gencontrol
131         dh_md5sums
132         dh_builddeb
133
134 # Build architecture independant packages using the common target.
135 binary-indep: build-indep install-indep
136         $(MAKE) -f debian/rules DH_OPTIONS=-i binary-common
137
138 # Build architecture dependant packages using the common target.
139 binary-arch: build-arch install-arch
140         $(MAKE) -f debian/rules DH_OPTIONS=-s binary-common
141
142 binary: binary-arch binary-indep
143 .PHONY: build clean binary-indep binary-arch binary install install-indep install-arch configure