fd7a2fc9ce50e10178e10477823ce6db6d249b1d
[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 -Wmaybe-uninitialized -Wunused-variable
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-markdowneditordir=/usr/share/epic/www/ \
63                 --with-rundir=/var/run/citadel \
64                 --with-ssldir=/etc/ssl/webcit/ \
65                 --with-etcdir=/etc/citadel \
66                 --with-ssl \
67                 --with-datadir=/var/run/citadel \
68                 --enable-debug $(EXTRA_ARGS) $(PROFILE_ARGS)
69
70         touch configure-stamp
71
72
73 build: build-stamp
74
75 build-stamp: configure-stamp
76         dh_testdir
77
78 # Add here commands to compile the package.
79         $(MAKE)
80
81         touch build-stamp
82
83 clean: configure-stamp
84         dh_testdir
85         dh_testroot
86         rm -f build-stamp configure-stamp
87
88 # Add here commands to clean up after the build process.
89         [ ! -f Makefile ] || $(MAKE) clean
90         debconf-updatepo
91
92         dh_clean 
93
94 install: build
95         dh_testdir
96         dh_testroot
97         dh_clean -k 
98         dh_installdirs
99         $(MAKE) install-bin install-locale install-wwwdata install-cfg DESTDIR=$(DESTDIR)
100         chmod a-x -R $(DESTDIR)/usr/share/citadel-webcit/static/*
101         find $(DESTDIR)/usr/share/locale/ -name webcit.mo -exec chmod a-x {} \;
102         rm $(DESTDIR)/usr/share/citadel-webcit/static/prototype.js
103 #       mkdir -p $(DESTDIR)/etc/citadel; cp webcit.conf $(DESTDIR)/etc/citadel/
104
105
106
107 # Build architecture-independent files here.
108 binary-indep: build install
109 # We have nothing to do by default.
110
111 # Build architecture-dependent files here.
112 binary-arch: build install
113         dh_testdir
114         dh_testroot
115         dh_installchangelogs
116         dh_installdocs
117         dh_installexamples
118         dh_install
119         dh_installdebconf       
120         dh_installinit --name=webcit
121         dh_installman
122         dh_link
123         dh_strip
124         dh_compress
125         dh_fixperms
126         dh_installdeb
127         dh_shlibdeps
128         dh_gencontrol
129         dh_md5sums
130         dh_builddeb
131
132 binary: binary-indep binary-arch
133 .PHONY: build clean binary-indep binary-arch binary install configure