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