* add code to install locales
[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 rss"
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
39 ifneq (,$(findstring rss,$(DEB_BUILD_OPTIONS)))
40         CFLAGS += -D DEBUG_RSS
41 endif
42
43 ifneq (,$(findstring iodbg,$(DEB_BUILD_OPTIONS)))
44         CFLAGS += -D BIGBAD_IODBG
45 endif
46
47 configure: configure-stamp
48 configure-stamp:
49         dh_testdir
50
51         LDFLAGS="$(LDFLAGS)"; CFLAGS="$(CFLAGS)" ./configure \
52                 --prefix=/var/lib/citadel/ \
53                 --with-datadir=/var/lib/citadel/ \
54                 --with-helpdir=/usr/share/citadel-server/ \
55                 --with-staticdatadir=/etc/citadel/ \
56                 --with-spooldir=/var/spool/citadel/ \
57                 --with-sysconfdir=/etc/citadel/ \
58                 --with-rundir=/var/run/citadel/ \
59                 --with-docdir=/usr/share/doc/citadel-doc/ \
60                 --with-ssldir=/etc/ssl/citadel/ \
61                 --with-utility-bindir=/usr/lib/citadel-server/ \
62                 --with-autosysconfdir=/var/lib/citadel/data/ \
63                 --with-localedir=/usr/share/ \
64                 --with-pam \
65                 --with-db \
66                 --enable-debug $(EXTRA_ARGS) $(PROFILE_ARGS) $(THREAD_ARGS)
67
68         touch configure-stamp
69
70 #Architecture 
71 build: build-arch build-indep
72
73 build-arch: build-arch-stamp
74 build-arch-stamp: configure-stamp
75
76         $(MAKE)
77         touch $@
78
79 build-indep: build-indep-stamp
80 build-indep-stamp: configure-stamp
81
82         touch $@
83
84 clean:
85         dh_testdir
86         dh_testroot
87         rm -f build-arch-stamp build-indep-stamp configure-stamp
88
89
90         dh_clean 
91         rm -f config.status config.log
92 #[ ! -f Makefile ] || $(MAKE) distclean
93
94 install: install-indep install-arch
95 install-indep: build-indep
96         dh_testdir
97         dh_testroot
98         dh_clean -k -i 
99         dh_installdirs -i
100
101         $(MAKE) DESTDIR=$(DEB_DESTDIR) install-doc-new
102
103         dh_install -i --sourcedir=debian/tmp
104
105 install-arch: build-arch
106         dh_testdir
107         dh_testroot
108         dh_clean -k -s 
109         dh_installdirs -s
110
111         $(MAKE) install-locale DESTDIR=$(DEB_DESTDIR)
112         $(MAKE) DESTDIR=$(DEB_DESTDIR) install-exec-new install-data-new
113
114         install -D -p -m0755 database_cleanup.sh \
115                 $(DEB_DESTDIR)/usr/share/doc/citadel-server/examples/database_cleanup.sh
116
117         install -D -p -m0644 docs/welcomemail.html \
118                 $(DEB_DESTDIR)/usr/share/doc/citadel-server/welcomemail.html
119
120         install -D -p -m0644 docs/welcomemail.txt \
121                 $(DEB_DESTDIR)/usr/share/doc/citadel-server/welcomemail.txt
122
123         dh_install -s --sourcedir=debian/tmp
124
125 binary-common:
126         dh_testdir
127         dh_testroot
128         dh_installchangelogs
129         dh_installdocs
130         dh_installdebconf       
131         dh_installinit --name=citadel
132         dh_installman
133         dh_strip --dbg-package=citadel-dbg
134         dh_link
135         dh_compress 
136         dh_fixperms
137         dh_makeshlibs
138         dh_installdeb
139         dh_shlibdeps
140         dh_gencontrol
141         dh_md5sums
142         dh_builddeb
143
144 # Build architecture independant packages using the common target.
145 binary-indep: build-indep install-indep
146         $(MAKE) -f debian/rules DH_OPTIONS=-i binary-common
147
148 # Build architecture dependant packages using the common target.
149 binary-arch: build-arch install-arch
150         $(MAKE) -f debian/rules DH_OPTIONS=-s binary-common
151
152 binary: binary-arch binary-indep
153 .PHONY: build clean binary-indep binary-arch binary install install-indep install-arch configure