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