Merge in Debian changes from Debian packages 3.0.5-beta-3 and 3.0.6-1.
[privoxy.git] / debian / rules
1 #!/usr/bin/make -f
2 #
3 # (C) 2002-2006 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 # Include dpatch stuff.
18 include /usr/share/dpatch/dpatch.make
19
20 OPTIMIZE=
21 ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
22         OPTIMIZE=-O0
23 else
24         OPTIMIZE=-O2
25 endif
26
27 build: build-stamp
28 build-stamp: patch-stamp
29         dh_testdir
30
31         autoheader
32         autoconf
33         env CFLAGS="$(OPTIMIZE) -g" \
34                 ./configure --prefix=/usr --sysconfdir=/etc \
35                 --mandir=/usr/share/man $(WITHDEBUG) \
36                 --with-docbook=/usr/share/sgml/docbook/stylesheet/dsssl/modular
37         $(MAKE)
38 #       create missing doc/pdf directory if necessary:
39         [ -d doc/pdf ] || mkdir doc/pdf
40         $(MAKE) dok-pdf
41         $(MAKE) dok
42         env -u LANG $(MAKE) man
43         $(MAKE) man2html
44
45 #       remove trailing whitespaces:
46         for x in developer-manual user-manual faq; do \
47                 sed -e 's/[     ]*$$//' < doc/text/$$x.txt > doc/text/$$x.nws;\
48                 mv -f doc/text/$$x.nws doc/text/$$x.txt; \
49         done
50
51         touch build-stamp
52
53 clean: clean1 unpatch
54 clean1:
55         dh_testdir
56         dh_testroot
57         rm -f build-stamp configure-stamp
58
59         -$(MAKE) clean
60         -$(MAKE) distclean
61         rm -f configure config.h GNUmakefile
62         rm -f privoxy.8
63
64         rm -rf obj
65         rm -f ActivityConsole.jar
66         rm -f src/java/org/privoxy/activityconsole/*.class
67
68         rm -f doc/source/ldp.dsl
69         rm -rf doc/source/temp
70 #       rm -rf doc/pdf
71
72         dh_clean -Xrc.privoxy.orig
73
74 install: build-stamp
75         dh_testdir
76         dh_testroot
77         dh_clean -k -Xrc.privoxy.orig
78         dh_installdirs
79
80         install -m 0755 privoxy $(DEBDIR)/usr/sbin/privoxy
81
82         install -m 644 config $(DEBDIR)/etc/privoxy/config
83         install -m 0644 default.action $(DEBDIR)/etc/privoxy/default.action
84         install -m 0644 global.action $(DEBDIR)/etc/privoxy/global.action
85         install -m 0644 standard.action $(DEBDIR)/etc/privoxy/standard.action
86         install -m 0644 user.action $(DEBDIR)/etc/privoxy/user.action
87         install -m 0644 default.filter $(DEBDIR)/etc/privoxy/default.filter
88         install -m 0644 trust $(DEBDIR)/etc/privoxy/trust
89
90         cp -r templates $(DEBDIR)/etc/privoxy/
91         rm -f $(DEBDIR)/etc/privoxy/templates/*~
92         rm -rf $(DEBDIR)/etc/privoxy/templates/CVS
93
94 #       Remove CVS tags and trailing spaces from config files:
95         find $(DEBDIR)/etc/privoxy -type f \
96         | xargs grep -l '\$$[A-Z][^$$]*:[^$$]*\$$' \
97         | while read f; do \
98             sed -e 's/\$$\(Id: [^$$]*,v\)[^$$]*\$$/\1/' \
99                 -e 's/\$$\(Source: [^$$]*\)\$$/\1/' \
100                 -e 's/\$$\(Log: [^$$]*\)\$$/\1/' \
101                 -e 's/ *$$//' < $$f > $$f.new; \
102             mv -f $$f.new $$f; \
103         done
104
105 # Build architecture-independent files here.
106 binary-indep: build-stamp install
107 # We have nothing to do by default.
108
109 # Build architecture-dependent files here.
110 binary-arch: build-stamp install
111         dh_testdir
112         dh_testroot
113 #       dh_installdebconf       
114         dh_installdocs -XCVS
115         (cd $(DEBDIR)/usr/share/doc/privoxy/; \
116          mv privoxy-index.html index.html)
117         dh_installexamples
118         dh_installmenu
119         dh_installlogrotate
120 #       dh_installemacsen
121 #       dh_installpam
122 #       dh_installmime
123         dh_installinit
124         dh_installcron
125         dh_installman
126         dh_installinfo
127 #       dh_undocumented
128         dh_installchangelogs ChangeLog
129         dh_link
130         dh_strip
131         dh_compress -Xpdf
132         dh_fixperms
133 #       dh_makeshlibs
134         dh_installdeb
135 #       dh_perl
136         dh_shlibdeps
137         dh_gencontrol
138         dh_md5sums
139         dh_builddeb
140
141 binary: binary-indep binary-arch
142
143 .PHONY: build clean binary-indep binary-arch binary install patch unpatch \
144         clean1