aac8cdfd9eed1b6e63cd8af3427bd80930703378
[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-brotli \
28                 --with-docbook=/usr/share/sgml/docbook/stylesheet/dsssl/modular
29
30 override_dh_auto_build:
31         $(MAKE)
32 #       preserve auto build documentation from source package:
33         tar cf debian/doc.tar README INSTALL AUTHORS doc/source doc/webserver
34         env -u LANG LC_ALL=C.UTF-8 $(MAKE) dok
35         rm -f doc/webserver/user-manual/*.bak
36         env -u LANG LC_ALL=C.UTF-8 $(MAKE) man
37         env -u LANG LC_ALL=C.UTF-8 $(MAKE) man2html
38
39 override_dh_auto_clean:
40 #       restore auto build documentation from source package:
41         [ ! -f debian/doc.tar ] || tar xf debian/doc.tar
42         rm -f debian/doc.tar
43         find doc/source -name \*.html | xargs -r rm -f
44         [ ! -f GNUmakefile ] || $(MAKE) clean
45         [ ! -f GNUmakefile ] || $(MAKE) distclean
46         rm -f configure config.h GNUmakefile
47         rm -f privoxy.8
48         rm -rf obj
49         rm -f ActivityConsole.jar
50         rm -f src/java/org/privoxy/activityconsole/*.class
51         rm -f doc/source/ldp.dsl
52         rm -rf doc/source/temp
53         dh_clean -Xrc.privoxy.orig
54
55 override_dh_auto_install:
56         install -m 0755 privoxy $(DEBDIR)/usr/sbin/privoxy
57         sed -e 's/\(Sample Configuration File for Privoxy\).*/\1/;' < config \
58             > $(DEBDIR)/usr/share/privoxy/config
59         install -m 0644 default.action $(DEBDIR)/etc/privoxy/default.action
60         install -m 0644 match-all.action $(DEBDIR)/etc/privoxy/match-all.action
61         install -m 0644 user.action $(DEBDIR)/etc/privoxy/user.action
62         install -m 0644 regression-tests.action \
63                 $(DEBDIR)/etc/privoxy/regression-tests.action
64         install -m 0644 default.filter $(DEBDIR)/etc/privoxy/default.filter
65         install -m 0644 user.filter $(DEBDIR)/etc/privoxy/user.filter
66         install -m 0644 trust $(DEBDIR)/etc/privoxy/trust
67
68         install -m 0755 tools/privoxy-log-parser.pl \
69                 $(DEBDIR)/usr/bin/privoxy-log-parser
70         pod2man tools/privoxy-log-parser.pl \
71                 > $(DEBDIR)/usr/share/man/man1/privoxy-log-parser.1
72
73         install -m 0755 tools/privoxy-regression-test.pl \
74                 $(DEBDIR)/usr/bin/privoxy-regression-test
75         pod2man tools/privoxy-regression-test.pl \
76                 > $(DEBDIR)/usr/share/man/man1/privoxy-regression-test.1
77
78         cp -r templates $(DEBDIR)/etc/privoxy/
79         rm -f $(DEBDIR)/etc/privoxy/templates/*~
80
81 #      Remove trailing spaces from config files:
82         find $(DEBDIR)/etc/privoxy -type f \
83         | xargs grep -l ' $$' \
84         | while read f; do \
85             sed -e 's/  *$$//' < $$f > $$f.new; \
86             mv -f $$f.new $$f; \
87         done
88
89 override_dh_installdocs:
90         dh_installdocs
91         (cd $(DEBDIR)/usr/share/doc/privoxy/; \
92          mv privoxy-index.html index.html)
93         (cd $(DEBDIR)/usr/share/doc/privoxy/user-manual; ln -s '../p_doc.css')
94
95 override_dh_perl:
96 #       We only need perl-base:
97         dh_perl -d