merge Debian changes from 3.0.7 to 3.0.10
[privoxy.git] / debian / rules
1 #!/usr/bin/make -f
2 #
3 # (C) 2002-2008 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         $(MAKE) dok
40         env -u LANG $(MAKE) man
41         $(MAKE) man2html
42
43         touch build-stamp
44
45 clean: clean1 unpatch
46 clean1:
47         dh_testdir
48         dh_testroot
49         rm -f build-stamp configure-stamp
50
51         [ ! -f GNUmakefile ] || $(MAKE) clean
52         [ ! -f GNUmakefile ] || $(MAKE) distclean
53         rm -f configure config.h GNUmakefile
54         rm -f privoxy.8
55
56         rm -rf obj
57         rm -f ActivityConsole.jar
58         rm -f src/java/org/privoxy/activityconsole/*.class
59
60         rm -f doc/source/ldp.dsl
61         rm -rf doc/source/temp
62
63         dh_clean -Xrc.privoxy.orig
64
65 install: build-stamp
66         dh_testdir
67         dh_testroot
68         dh_clean -k -Xrc.privoxy.orig
69         dh_installdirs
70
71         install -m 0755 privoxy $(DEBDIR)/usr/sbin/privoxy
72
73         install -m 644 config $(DEBDIR)/etc/privoxy/config
74         install -m 0644 default.action $(DEBDIR)/etc/privoxy/default.action
75         install -m 0644 global.action $(DEBDIR)/etc/privoxy/global.action
76         install -m 0644 standard.action $(DEBDIR)/etc/privoxy/standard.action
77         install -m 0644 user.action $(DEBDIR)/etc/privoxy/user.action
78         install -m 0644 default.filter $(DEBDIR)/etc/privoxy/default.filter
79         install -m 0644 trust $(DEBDIR)/etc/privoxy/trust
80
81         install -m 0755 tools/privoxy-log-parser.pl \
82                 $(DEBDIR)/usr/bin/privoxy-log-parser
83         pod2man tools/privoxy-log-parser.pl \
84                 > $(DEBDIR)/usr/share/man/man1/privoxy-log-parser.1
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
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 binary: binary-indep binary-arch
138
139 .PHONY: build clean binary-indep binary-arch binary install patch unpatch \
140         clean1