Add changes from 3.0.6-2, 3.0.6-3 and several unreleased changes
[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 # Include dpatch stuff.
18 include /usr/share/dpatch/dpatch.make
19
20 OPTIMIZE=
21 ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
22         OPTIMIZE=-O0
23 else
24         OPTIMIZE=-O2
25 endif
26
27 build: build-stamp
28 build-stamp: patch-stamp
29         dh_testdir
30
31         autoheader
32         autoconf
33         env CFLAGS="$(OPTIMIZE) -g" \
34                 ./configure --prefix=/usr --sysconfdir=/etc \
35                 --mandir=/usr/share/man $(WITHDEBUG) \
36                 --enable-zlib \
37                 --with-docbook=/usr/share/sgml/docbook/stylesheet/dsssl/modular
38         $(MAKE)
39 #       create missing doc/pdf directory if necessary:
40         [ -d doc/pdf ] || mkdir doc/pdf
41         $(MAKE) dok-pdf
42         $(MAKE) dok
43         env -u LANG $(MAKE) man
44         $(MAKE) man2html
45
46 #       remove trailing whitespaces:
47         for x in developer-manual user-manual faq; do \
48                 sed -e 's/[     ]*$$//' < doc/text/$$x.txt > doc/text/$$x.nws;\
49                 mv -f doc/text/$$x.nws doc/text/$$x.txt; \
50         done
51
52         touch build-stamp
53
54 clean: clean1 unpatch
55 clean1:
56         dh_testdir
57         dh_testroot
58         rm -f build-stamp configure-stamp
59
60         -$(MAKE) clean
61         -$(MAKE) distclean
62         rm -f configure config.h GNUmakefile
63         rm -f privoxy.8
64
65         rm -rf obj
66         rm -f ActivityConsole.jar
67         rm -f src/java/org/privoxy/activityconsole/*.class
68
69         rm -f doc/source/ldp.dsl
70         rm -rf doc/source/temp
71 #       rm -rf doc/pdf
72
73         dh_clean -Xrc.privoxy.orig
74
75 install: build-stamp
76         dh_testdir
77         dh_testroot
78         dh_clean -k -Xrc.privoxy.orig
79         dh_installdirs
80
81         install -m 0755 privoxy $(DEBDIR)/usr/sbin/privoxy
82
83         install -m 644 config $(DEBDIR)/etc/privoxy/config
84         install -m 0644 default.action $(DEBDIR)/etc/privoxy/default.action
85         install -m 0644 global.action $(DEBDIR)/etc/privoxy/global.action
86         install -m 0644 standard.action $(DEBDIR)/etc/privoxy/standard.action
87         install -m 0644 user.action $(DEBDIR)/etc/privoxy/user.action
88         install -m 0644 default.filter $(DEBDIR)/etc/privoxy/default.filter
89         install -m 0644 trust $(DEBDIR)/etc/privoxy/trust
90
91         cp -r templates $(DEBDIR)/etc/privoxy/
92         rm -f $(DEBDIR)/etc/privoxy/templates/*~
93         rm -rf $(DEBDIR)/etc/privoxy/templates/CVS
94
95 #       Remove CVS tags and trailing spaces from config files:
96         find $(DEBDIR)/etc/privoxy -type f \
97         | xargs grep -l '\$$[A-Z][^$$]*:[^$$]*\$$' \
98         | while read f; do \
99             sed -e 's/\$$\(Id: [^$$]*,v\)[^$$]*\$$/\1/' \
100                 -e 's/\$$\(Source: [^$$]*\)\$$/\1/' \
101                 -e 's/\$$\(Log: [^$$]*\)\$$/\1/' \
102                 -e 's/ *$$//' < $$f > $$f.new; \
103             mv -f $$f.new $$f; \
104         done
105
106 # Build architecture-independent files here.
107 binary-indep: build-stamp install
108 # We have nothing to do by default.
109
110 # Build architecture-dependent files here.
111 binary-arch: build-stamp install
112         dh_testdir
113         dh_testroot
114 #       dh_installdebconf       
115         dh_installdocs -XCVS
116         (cd $(DEBDIR)/usr/share/doc/privoxy/; \
117          mv privoxy-index.html index.html)
118         dh_installexamples
119         dh_installmenu
120         dh_installlogrotate
121 #       dh_installemacsen
122 #       dh_installpam
123 #       dh_installmime
124         dh_installinit
125         dh_installcron
126         dh_installman
127         dh_installinfo
128 #       dh_undocumented
129         dh_installchangelogs ChangeLog
130         dh_link
131         dh_strip
132         dh_compress -Xpdf
133         dh_fixperms
134 #       dh_makeshlibs
135         dh_installdeb
136 #       dh_perl
137         dh_shlibdeps
138         dh_gencontrol
139         dh_md5sums
140         dh_builddeb
141
142 binary: binary-indep binary-arch
143
144 .PHONY: build clean binary-indep binary-arch binary install patch unpatch \
145         clean1