Merge branch 'master' of ssh://git.privoxy.org:23/git/privoxy
[privoxy.git] / debian / rules
1 #!/usr/bin/make -f
2 #
3 # (c) 2002-2020 Roland Rosenfeld <roland@debian.org>
4 #
5 # Uncomment this to turn on verbose mode.
6 #export DH_VERBOSE=1
7 #export DH_OPTIONS=-v
8
9 export DEB_BUILD_MAINT_OPTIONS = hardening=+all
10
11 DEBDIR=`pwd`/debian/privoxy
12
13 %:
14         dh $@
15
16 override_dh_auto_configure:
17         autoheader
18         autoconf
19         dh_auto_configure -- \
20                 --prefix=/usr \
21                 --sysconfdir=/etc \
22                 --mandir=/usr/share/man \
23                 --enable-zlib \
24                 --enable-no-gifs \
25                 --enable-external-filters \
26                 --with-mbedtls \
27                 --with-docbook=/usr/share/sgml/docbook/stylesheet/dsssl/modular
28
29 override_dh_auto_build:
30         $(MAKE)
31 #       preserve auto build documentation from source package:
32         tar cf debian/doc.tar README INSTALL AUTHORS doc/source doc/webserver
33         env -u LANG LC_ALL=C.UTF-8 $(MAKE) dok
34         rm -f doc/webserver/user-manual/*.bak
35         env -u LANG LC_ALL=C.UTF-8 $(MAKE) man
36
37 override_dh_auto_clean:
38 #       restore auto build documentation from source package:
39         [ ! -f debian/doc.tar ] || tar xf debian/doc.tar
40         rm -f debian/doc.tar
41         find doc/source -name \*.html | xargs -r rm -f
42         [ ! -f GNUmakefile ] || $(MAKE) clean
43         [ ! -f GNUmakefile ] || $(MAKE) distclean
44         rm -f configure config.h GNUmakefile
45         rm -f privoxy.8
46         rm -rf obj
47         rm -f ActivityConsole.jar
48         rm -f src/java/org/privoxy/activityconsole/*.class
49         rm -f doc/source/ldp.dsl
50         rm -rf doc/source/temp
51         dh_clean -Xrc.privoxy.orig
52
53 override_dh_auto_install:
54         install -m 0755 privoxy $(DEBDIR)/usr/sbin/privoxy
55         sed -e 's/\(Sample Configuration File for Privoxy\).*/\1/;' < config \
56             > $(DEBDIR)/usr/share/privoxy/config
57         install -m 0644 default.action $(DEBDIR)/etc/privoxy/default.action
58         install -m 0644 match-all.action $(DEBDIR)/etc/privoxy/match-all.action
59         install -m 0644 user.action $(DEBDIR)/etc/privoxy/user.action
60         install -m 0644 regression-tests.action \
61                 $(DEBDIR)/etc/privoxy/regression-tests.action
62         install -m 0644 default.filter $(DEBDIR)/etc/privoxy/default.filter
63         install -m 0644 user.filter $(DEBDIR)/etc/privoxy/user.filter
64         install -m 0644 trust $(DEBDIR)/etc/privoxy/trust
65
66         install -m 0755 tools/privoxy-log-parser.pl \
67                 $(DEBDIR)/usr/bin/privoxy-log-parser
68         pod2man tools/privoxy-log-parser.pl \
69                 > $(DEBDIR)/usr/share/man/man1/privoxy-log-parser.1
70
71         install -m 0755 tools/privoxy-regression-test.pl \
72                 $(DEBDIR)/usr/bin/privoxy-regression-test
73         pod2man tools/privoxy-regression-test.pl \
74                 > $(DEBDIR)/usr/share/man/man1/privoxy-regression-test.1
75
76         cp -r templates $(DEBDIR)/etc/privoxy/
77         rm -f $(DEBDIR)/etc/privoxy/templates/*~
78
79 #      Remove trailing spaces from config files:
80         find $(DEBDIR)/etc/privoxy -type f \
81         | xargs grep -l ' $$' \
82         | while read f; do \
83             sed -e 's/  *$$//' < $$f > $$f.new; \
84             mv -f $$f.new $$f; \
85         done
86
87 override_dh_installdocs:
88         dh_installdocs
89         (cd $(DEBDIR)/usr/share/doc/privoxy/; \
90          mv privoxy-index.html index.html)
91         (cd $(DEBDIR)/usr/share/doc/privoxy/user-manual; ln -s '../p_doc.css')
92
93 override_dh_perl:
94 #       We only need perl-base:
95         dh_perl -d