.debs: export the cflags
[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 COMPILER=
21 CFLAGS= 
22 #to enable debugging: export DEB_BUILD_OPTIONS="debug profiling compression urldebug iodbg clang"
23
24 ifneq (,$(findstring clang,$(DEB_BUILD_OPTIONS)))
25         COMPILER="clang" 
26 endif
27 ifneq (,$(findstring profiling,$(DEB_BUILD_OPTIONS)))
28         PROFILE_ARGS= --with-gprof
29         LDFLAGS += -pg 
30 endif
31 ifneq (,$(findstring debug,$(DEB_BUILD_OPTIONS)))
32         CFLAGS += -O0 -ggdb -rdynamic -MD -MP -D TECH_PREVIEW -pedantic -Wformat-nonliteral
33         EXTRA_ARGS =  --with-backtrace
34 else
35         CFLAGS += -O2
36 endif
37 ifneq (,$(findstring urldebug,$(DEB_BUILD_OPTIONS)))
38         CFLAGS += -D DEBUG_URLSTRINGS
39 endif
40
41 ifneq (,$(findstring iodbg,$(DEB_BUILD_OPTIONS)))
42         CFLAGS += -D SERV_TRACE
43 endif
44
45
46 configure: patch configure-stamp
47 configure-stamp:
48         dh_testdir
49 ifneq "$(wildcard /usr/share/misc/config.sub)" ""
50         cp -f /usr/share/misc/config.sub config.sub
51 endif
52 ifneq "$(wildcard /usr/share/misc/config.guess)" ""
53         cp -f /usr/share/misc/config.guess config.guess
54 endif
55         export CC=$(COMPILER); export CFLAGS=" -Wformat -Werror=format-security $(CFLAGS)"; ./configure \
56                 --host=$(DEB_HOST_GNU_TYPE) \
57                 --build=$(DEB_BUILD_GNU_TYPE) \
58                 --prefix=/usr/sbin/ \
59                 --with-wwwdir=/usr/share/citadel-webcit \
60                 --with-localedir=/usr/share/ \
61                 --with-editordir=/usr/share/tinymce/www/ \
62                 --with-rundir=/var/run/citadel \
63                 --with-ssldir=/etc/ssl/webcit/ \
64                 --with-ssl \
65                 --with-datadir=/var/run/citadel \
66                 --enable-debug $(EXTRA_ARGS) $(PROFILE_ARGS)
67
68         touch configure-stamp
69
70
71 build: build-stamp
72
73 build-stamp: configure-stamp
74         dh_testdir
75
76 # Add here commands to compile the package.
77         $(MAKE)
78
79         touch build-stamp
80
81 clean: configure-stamp
82         dh_testdir
83         dh_testroot
84         rm -f build-stamp configure-stamp
85
86 # Add here commands to clean up after the build process.
87         [ ! -f Makefile ] || $(MAKE) clean
88         debconf-updatepo
89
90         dh_clean 
91
92 install: build
93         dh_testdir
94         dh_testroot
95         dh_clean -k 
96         dh_installdirs
97         $(MAKE) install-bin install-locale install-wwwdata DESTDIR=$(DESTDIR)
98         chmod a-x -R $(DESTDIR)/usr/share/citadel-webcit/static/*
99         find $(DESTDIR)/usr/share/locale/ -name webcit.mo -exec chmod a-x {} \;
100         rm $(DESTDIR)/usr/share/citadel-webcit/static/prototype.js
101 #       mkdir -p $(DESTDIR)/etc/citadel; cp webcit.conf $(DESTDIR)/etc/citadel/
102
103
104
105 # Build architecture-independent files here.
106 binary-indep: build install
107 # We have nothing to do by default.
108
109 # Build architecture-dependent files here.
110 binary-arch: build install
111         dh_testdir
112         dh_testroot
113         dh_installchangelogs
114         dh_installdocs
115         dh_installexamples
116         dh_install
117         dh_installdebconf       
118         dh_installinit --name=webcit
119         dh_installman
120         dh_link
121         dh_strip
122         dh_compress
123         dh_fixperms
124         dh_installdeb
125         dh_shlibdeps
126         dh_gencontrol
127         dh_md5sums
128         dh_builddeb
129
130 binary: binary-indep binary-arch
131 .PHONY: build clean binary-indep binary-arch binary install configure