Updates for no longer filtering text/plain, and demoronizer default settings,
[privoxy.git] / debian / rules
1 #!/usr/bin/make -f
2 #
3 # (C) 2002-2003 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 OPTIMIZE=
18 ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
19         OPTIMIZE=-O0
20 else
21         OPTIMIZE=-O2
22 endif
23
24 configure: configure-stamp
25 configure-stamp:
26         dh_testdir
27
28         autoheader
29         autoconf
30         env CFLAGS="$(OPTIMIZE) -g" \
31                 ./configure --prefix=/usr --sysconfdir=/etc \
32                 --mandir=/usr/share/man $(WITHDEBUG) \
33                 --with-docbook=/usr/share/sgml/docbook/stylesheet/dsssl/modular
34
35         touch configure-stamp
36
37 build: build-stamp
38 build-stamp: configure-stamp 
39         dh_testdir
40
41 #       backup formatted upstream documentation:
42         for x in source text webserver pdf; do \
43                 if [ ! -d doc/$$x.dist ]; then \
44                         cp -a doc/$$x doc/$$x.dist; \
45                 fi; \
46         done
47         for x in INSTALL README AUTHORS privoxy.1; do \
48                 if [ ! -f $$x.dist ]; then \
49                         cp -a $$x $$x.dist; \
50                 fi; \
51         done
52
53         $(MAKE)
54         $(MAKE) dok-pdf
55         $(MAKE) dok
56
57 #       remove trailing whitespaces:
58         for x in developer-manual user-manual faq; do \
59                 sed -e 's/[     ]*$$//' < doc/text/$$x.txt > doc/text/$$x.nws;\
60                 mv -f doc/text/$$x.nws doc/text/$$x.txt; \
61         done
62
63         touch build-stamp
64
65 clean:
66         dh_testdir
67         dh_testroot
68         rm -f build-stamp configure-stamp
69
70         -$(MAKE) clean
71         -$(MAKE) distclean
72         rm -f privoxy privoxy.8
73         rm -f configure config.h GNUmakefile 
74
75         rm -rf obj
76         rm -f ActivityConsole.jar
77         rm -f src/java/org/privoxy/activityconsole/*.class
78
79 #       restore formatted upstream documentation:
80         for x in source text webserver pdf; do \
81                 if [ -d doc/$$x.dist ]; then \
82                         rm -rf doc/$$x; \
83                         mv doc/$$x.dist doc/$$x; \
84                 fi; \
85         done
86         for x in INSTALL README AUTHORS privoxy.1; do \
87                 if [ -f $$x.dist ]; then \
88                         rm -f $$x; \
89                         mv $$x.dist $$x; \
90                 fi; \
91         done
92
93         rm -f doc/source/ldp.dsl
94
95         dh_clean
96
97 install: build
98         dh_testdir
99         dh_testroot
100         dh_clean -k
101         dh_installdirs
102
103         install -m 0755 privoxy $(DEBDIR)/usr/sbin/privoxy
104
105         sed -e 's/^\(\(trust\|proxy\)-info-url\|admin-address\)/#\1/'  \
106             -e 's/^\(enable-\(edit-actions\|remote-toggle\)\)[  ]*1/\1 0/' \
107             -e 's#^confdir .*#confdir /etc/privoxy#' \
108             -e 's#^logdir .*#logdir /var/log/privoxy#' \
109             -e 's%^#\(user-manual\).*%\1 /usr/share/doc/privoxy/user-manual%' \
110             -e 's/\(Sample Configuration File for Privoxy\).*/\1/' \
111             -e 's/Id: config,v.*/Id: config,v $$/' \
112             -e 's/ *$$//' \
113                 < config > $(DEBDIR)/etc/privoxy/config
114         install -m 0644 default.action $(DEBDIR)/etc/privoxy/default.action
115         install -m 0644 standard.action $(DEBDIR)/etc/privoxy/standard.action
116         install -m 0644 user.action $(DEBDIR)/etc/privoxy/user.action
117         install -m 0644 default.filter $(DEBDIR)/etc/privoxy/default.filter
118         install -m 0644 trust $(DEBDIR)/etc/privoxy/trust
119
120         sed -e 's/"1"/"8"/' < privoxy.1 > privoxy.8
121
122         cp -r templates $(DEBDIR)/etc/privoxy/
123         rm -f $(DEBDIR)/etc/privoxy/templates/*~
124         rm -rf $(DEBDIR)/etc/privoxy/templates/CVS
125
126
127 # Build architecture-independent files here.
128 binary-indep: build install
129 # We have nothing to do by default.
130
131 # Build architecture-dependent files here.
132 binary-arch: build install
133         dh_testdir
134         dh_testroot
135 #       dh_installdebconf       
136         dh_installdocs -XCVS
137         (cd $(DEBDIR)/usr/share/doc/privoxy/; \
138          mv privoxy-index.html index.html)
139         dh_installexamples
140         dh_installmenu
141         dh_installlogrotate
142 #       dh_installemacsen
143 #       dh_installpam
144 #       dh_installmime
145         dh_installinit
146         dh_installcron
147         dh_installman
148         dh_installinfo
149 #       dh_undocumented
150         dh_installchangelogs ChangeLog
151         dh_link
152         dh_strip
153         dh_compress -Xpdf
154         dh_fixperms
155 #       dh_makeshlibs
156         dh_installdeb
157 #       dh_perl
158         dh_shlibdeps
159         dh_gencontrol
160         dh_md5sums
161         dh_builddeb
162
163 binary: binary-indep binary-arch
164 .PHONY: build clean binary-indep binary-arch binary install configure