Windows service integration
[privoxy.git] / debian / rules
1 #!/usr/bin/make -f
2 #
3 # (C) 2002-2006 Roland Rosenfeld <roland@debian.org>, based on
4 # Sample debian/rules that uses debhelper.
5 # This file is public domain software, originally written by Joey Hess. 
6
7 # Uncomment this to turn on verbose mode.
8 #export DH_VERBOSE=1
9
10 # These are used for cross-compiling and for saving the configure script
11 # from having to guess our platform (since we know it already)
12 DEB_HOST_GNU_TYPE   ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
13 DEB_BUILD_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
14
15 DEBDIR=`pwd`/debian/privoxy
16
17 OPTIMIZE=
18 ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
19         OPTIMIZE=-O0
20 else
21         OPTIMIZE=-O2
22 endif
23
24 build: build-stamp
25 build-stamp: patch-stamp
26         dh_testdir
27
28         autoheader
29         autoconf
30         env CFLAGS="$(OPTIMIZE) -g" \
31                 ./configure --prefix=/usr --sysconfdir=/etc \
32                 --mandir=/usr/share/man $(WITHDEBUG) \
33                 --with-docbook=/usr/share/sgml/docbook/stylesheet/dsssl/modular
34         $(MAKE)
35 #       create missing doc/pdf directory if necessary:
36         [ -d doc/pdf ] || mkdir doc/pdf
37         $(MAKE) dok-pdf
38         $(MAKE) dok
39         env -u LANG $(MAKE) man
40         $(MAKE) man2html
41
42 #       remove trailing whitespaces:
43         for x in developer-manual user-manual faq; do \
44                 sed -e 's/[     ]*$$//' < doc/text/$$x.txt > doc/text/$$x.nws;\
45                 mv -f doc/text/$$x.nws doc/text/$$x.txt; \
46         done
47
48         touch build-stamp
49
50 clean: clean1 unpatch
51 clean1:
52         dh_testdir
53         dh_testroot
54         rm -f build-stamp configure-stamp
55
56         -$(MAKE) clean
57         -$(MAKE) distclean
58         rm -f configure config.h GNUmakefile
59         rm -f privoxy.8
60
61         rm -rf obj
62         rm -f ActivityConsole.jar
63         rm -f src/java/org/privoxy/activityconsole/*.class
64
65         rm -f doc/source/ldp.dsl
66         rm -rf doc/source/temp
67         rm -rf doc/pdf
68
69         dh_clean
70
71 install: build-stamp
72         dh_testdir
73         dh_testroot
74         dh_clean -k
75         dh_installdirs
76
77         install -m 0755 privoxy $(DEBDIR)/usr/sbin/privoxy
78
79         install -m 644 config $(DEBDIR)/etc/privoxy/config
80         install -m 0644 default.action $(DEBDIR)/etc/privoxy/default.action
81         install -m 0644 standard.action $(DEBDIR)/etc/privoxy/standard.action
82         install -m 0644 user.action $(DEBDIR)/etc/privoxy/user.action
83         install -m 0644 default.filter $(DEBDIR)/etc/privoxy/default.filter
84         install -m 0644 trust $(DEBDIR)/etc/privoxy/trust
85
86         cp -r templates $(DEBDIR)/etc/privoxy/
87         rm -f $(DEBDIR)/etc/privoxy/templates/*~
88         rm -rf $(DEBDIR)/etc/privoxy/templates/CVS
89
90 #       Remove CVS tags and trailing spaces from config files:
91         find $(DEBDIR)/etc/privoxy -type f \
92         | xargs grep -l '\$$[A-Z][^$$]*:[^$$]*\$$' \
93         | while read f; do \
94             sed -e 's/\$$\(Id: [^$$]*,v\)[^$$]*\$$/\1/' \
95                 -e 's/\$$\(Source: [^$$]*\)\$$/\1/' \
96                 -e 's/\$$\(Log: [^$$]*\)\$$/\1/' \
97                 -e 's/ *$$//' < $$f > $$f.new; \
98             mv -f $$f.new $$f; \
99         done
100
101 # Build architecture-independent files here.
102 binary-indep: build-stamp install
103 # We have nothing to do by default.
104
105 # Build architecture-dependent files here.
106 binary-arch: build-stamp install
107         dh_testdir
108         dh_testroot
109 #       dh_installdebconf       
110         dh_installdocs -XCVS
111         (cd $(DEBDIR)/usr/share/doc/privoxy/; \
112          mv privoxy-index.html index.html)
113         dh_installexamples
114         dh_installmenu
115         dh_installlogrotate
116 #       dh_installemacsen
117 #       dh_installpam
118 #       dh_installmime
119         dh_installinit
120         dh_installcron
121         dh_installman
122         dh_installinfo
123 #       dh_undocumented
124         dh_installchangelogs ChangeLog
125         dh_link
126         dh_strip
127         dh_compress -Xpdf
128         dh_fixperms
129 #       dh_makeshlibs
130         dh_installdeb
131 #       dh_perl
132         dh_shlibdeps
133         dh_gencontrol
134         dh_md5sums
135         dh_builddeb
136
137 patch: patch-stamp
138 patch-stamp:
139         dpatch apply-all
140         touch patch-stamp
141         #dpatch call-all -a=pkg-info >patch-stamp
142
143 unpatch:
144         dpatch deapply-all
145         rm -rf patch-stamp debian/patched
146
147 binary: binary-indep binary-arch
148
149 .PHONY: build clean binary-indep binary-arch binary install patch unpatch \
150         clean1