* add the IO-Debug statement to the comment howto build .debs with devel support
[citadel.git] / webcit / debian / rules
1 #!/usr/bin/make -f
2 # -*- makefile -*-
3 # Sample debian/rules that uses debhelper.
4 # This file was originally written by Joey Hess and Craig Small.
5 # As a special exception, when this file is copied by dh-make into a
6 # dh-make output file, you may use that output file without restriction.
7 # This special exception was added by Craig Small in version 0.37 of dh-make.
8
9 # Uncomment this to turn on verbose mode.
10 #export DH_VERBOSE=1
11
12 include /usr/share/quilt/quilt.make
13
14 upstreamversion := $(shell dpkg-parsechangelog | sed -n 's/^Version: *\([^-]\+\)-.\+/\1/p')
15
16 DESTDIR=$(CURDIR)/debian/citadel-webcit
17
18 EXTRA_ARGS=
19 PROFILE_ARGS=
20 #to enable debugging: export DEB_BUILD_OPTIONS="debug profiling compression urldebug iodbg"
21
22 ifneq (,$(findstring profiling,$(DEB_BUILD_OPTIONS)))
23         PROFILE_ARGS= --with-gprof
24         LDFLAGS += -pg 
25 endif
26 ifneq (,$(findstring debug,$(DEB_BUILD_OPTIONS)))
27         CFLAGS += -O0 -ggdb -rdynamic -MD -MP -D TECH_PREVIEW -pedantic -Wformat-nonliteral
28         EXTRA_ARGS =  --with-backtrace
29 else
30         CFLAGS += -O2
31 endif
32 ifneq (,$(findstring urldebug,$(DEB_BUILD_OPTIONS)))
33         CFLAGS += -D DEBUG_URLSTRINGS
34 endif
35
36 ifneq (,$(findstring iodbg,$(DEB_BUILD_OPTIONS)))
37         CFLAGS += -D SERV_TRACE
38 endif
39
40
41 configure: patch configure-stamp
42 configure-stamp:
43         dh_testdir
44 ifneq "$(wildcard /usr/share/misc/config.sub)" ""
45         cp -f /usr/share/misc/config.sub config.sub
46 endif
47 ifneq "$(wildcard /usr/share/misc/config.guess)" ""
48         cp -f /usr/share/misc/config.guess config.guess
49 endif
50         CFLAGS="$(CFLAGS)" ./configure \
51                 --host=$(DEB_HOST_GNU_TYPE) \
52                 --build=$(DEB_BUILD_GNU_TYPE) \
53                 --prefix=/usr/sbin/ \
54                 --with-wwwdir=/usr/share/citadel-webcit \
55                 --with-localedir=/usr/share/ \
56                 --with-editordir=/usr/share/tinymce/www/ \
57                 --with-rundir=/var/run/citadel \
58                 --with-ssldir=/etc/ssl/webcit/ \
59                 --with-ssl \
60                 --with-datadir=/var/run/citadel \
61                 --enable-debug $(EXTRA_ARGS) $(PROFILE_ARGS)
62
63         touch configure-stamp
64
65
66 build: build-stamp
67
68 build-stamp: configure-stamp
69         dh_testdir
70
71 # Add here commands to compile the package.
72         $(MAKE)
73
74         touch build-stamp
75
76 clean: configure-stamp
77         dh_testdir
78         dh_testroot
79         rm -f build-stamp configure-stamp
80
81 # Add here commands to clean up after the build process.
82         [ ! -f Makefile ] || $(MAKE) clean
83         debconf-updatepo
84
85         dh_clean 
86
87 install: build
88         dh_testdir
89         dh_testroot
90         dh_clean -k 
91         dh_installdirs
92         $(MAKE) install-bin install-locale install-wwwdata DESTDIR=$(DESTDIR)
93         chmod a-x -R $(DESTDIR)/usr/share/citadel-webcit/static/*
94         find $(DESTDIR)/usr/share/locale/ -name webcit.mo -exec chmod a-x {} \;
95         rm $(DESTDIR)/usr/share/citadel-webcit/static/prototype.js
96 #       mkdir -p $(DESTDIR)/etc/citadel; cp webcit.conf $(DESTDIR)/etc/citadel/
97
98
99
100 # Build architecture-independent files here.
101 binary-indep: build install
102 # We have nothing to do by default.
103
104 # Build architecture-dependent files here.
105 binary-arch: build install
106         dh_testdir
107         dh_testroot
108         dh_installchangelogs
109         dh_installdocs
110         dh_installexamples
111         dh_install
112         dh_installdebconf       
113         dh_installinit --name=webcit
114         dh_installman
115         dh_link
116         dh_strip
117         dh_compress
118         dh_fixperms
119         dh_installdeb
120         dh_shlibdeps
121         dh_gencontrol
122         dh_md5sums
123         dh_builddeb
124
125 binary: binary-indep binary-arch
126 .PHONY: build clean binary-indep binary-arch binary install configure