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