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