gif_deanimate(): Minor style fixes
[privoxy.git] / debian / rules
1 #!/usr/bin/make -f
2 #
3 # (c) 2002-2021 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                 --enable-extended-statistics \
27                 --enable-pcre-host-patterns \
28                 --with-mbedtls \
29                 --with-brotli \
30                 --with-docbook=/usr/share/sgml/docbook/stylesheet/dsssl/modular
31
32 override_dh_auto_build:
33         $(MAKE)
34
35 ifeq (,$(filter nodoc,$(DEB_BUILD_OPTIONS)))
36 #       preserve auto build documentation from source package:
37         tar cf debian/doc.tar README INSTALL AUTHORS doc/webserver privoxy.8
38         env -u LANG LC_ALL=C.UTF-8 $(MAKE) dok
39         rm -f doc/webserver/user-manual/*.bak
40         env -u LANG LC_ALL=C.UTF-8 $(MAKE) man
41         env -u LANG LC_ALL=C.UTF-8 $(MAKE) man2html
42 endif
43
44 override_dh_auto_clean:
45 ifeq (,$(filter nodoc,$(DEB_BUILD_OPTIONS)))
46 #       restore auto build documentation from source package:
47         [ ! -f debian/doc.tar ] || tar xf debian/doc.tar
48         rm -f debian/doc.tar
49 endif
50         find doc/source -name \*.html | xargs -r rm -f
51         [ ! -f GNUmakefile ] || $(MAKE) clean
52         [ ! -f GNUmakefile ] || $(MAKE) distclean
53         rm -f configure config.h GNUmakefile
54         rm -rf obj
55         rm -f ActivityConsole.jar
56         rm -f src/java/org/privoxy/activityconsole/*.class
57         rm -f doc/source/ldp.dsl
58         rm -rf doc/source/temp
59         dh_clean
60
61 override_dh_auto_install:
62         install -m 0755 privoxy $(DEBDIR)/usr/sbin/privoxy
63         sed -e 's/\(Sample Configuration File for Privoxy\).*/\1/;' < config \
64             > $(DEBDIR)/usr/share/privoxy/config
65 ifeq (,$(filter nodoc,$(DEB_BUILD_OPTIONS)))
66         echo "with doc"
67 else
68 #       use remote user-manual (default) on nodoc configuration:
69         sed -i 's/^user-manual/#user-manual/' \
70                 $(DEBDIR)/usr/share/privoxy/config
71 endif
72         install -m 0644 default.action $(DEBDIR)/etc/privoxy/default.action
73         install -m 0644 match-all.action $(DEBDIR)/etc/privoxy/match-all.action
74         install -m 0644 user.action $(DEBDIR)/etc/privoxy/user.action
75         install -m 0644 regression-tests.action \
76                 $(DEBDIR)/etc/privoxy/regression-tests.action
77         install -m 0644 default.filter $(DEBDIR)/etc/privoxy/default.filter
78         install -m 0644 user.filter $(DEBDIR)/etc/privoxy/user.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         install -m 0755 tools/privoxy-regression-test.pl \
87                 $(DEBDIR)/usr/bin/privoxy-regression-test
88         pod2man tools/privoxy-regression-test.pl \
89                 > $(DEBDIR)/usr/share/man/man1/privoxy-regression-test.1
90
91         cp -r templates $(DEBDIR)/etc/privoxy/
92         rm -f $(DEBDIR)/etc/privoxy/templates/*~
93
94 #      Remove trailing spaces from config files:
95         find $(DEBDIR)/etc/privoxy -type f \
96         | xargs grep -l ' $$' \
97         | while read f; do \
98             sed -e 's/  *$$//' < $$f > $$f.new; \
99             mv -f $$f.new $$f; \
100         done
101
102 override_dh_install:
103         dh_install
104         install -m0644 debian/apparmor/usr.sbin.privoxy \
105                 $(DEBDIR)/etc/apparmor.d/
106         dh_apparmor --profile-name=usr.sbin.privoxy
107
108 override_dh_installdocs:
109         dh_installdocs
110 ifeq (,$(filter nodoc,$(DEB_BUILD_OPTIONS)))
111         (cd $(DEBDIR)/usr/share/doc/privoxy/; \
112          mv privoxy-index.html index.html)
113         (cd $(DEBDIR)/usr/share/doc/privoxy/user-manual; ln -s '../p_doc.css')
114 endif
115
116 override_dh_perl:
117 #       We only need perl-base:
118         dh_perl -d