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