Merge in changes from Debian packages 3.0.0-3 to 3.0.0-5
[privoxy.git] / debian / rules
1 #!/usr/bin/make -f
2 # Sample debian/rules that uses debhelper.
3 # GNU copyright 1997 to 1999 by Joey Hess.
4
5 # Uncomment this to turn on verbose mode.
6 #export DH_VERBOSE=1
7
8 # These are used for cross-compiling and for saving the configure script
9 # from having to guess our platform (since we know it already)
10 DEB_HOST_GNU_TYPE   ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
11 DEB_BUILD_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
12
13 DEBDIR=`pwd`/debian/privoxy
14
15 OPTIMIZE=
16 ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
17         OPTIMIZE=-O0
18 else
19         OPTIMIZE=-O2
20 endif
21
22 configure: configure-stamp
23 configure-stamp:
24         dh_testdir
25
26         autoheader
27         autoconf
28         env CFLAGS="$(OPTIMIZE) -g" \
29                 ./configure --prefix=/usr --sysconfdir=/etc \
30                 --mandir=/usr/share/man $(WITHDEBUG) \
31                 --with-docbook=no
32
33         touch configure-stamp
34
35 build: build-stamp
36 build-stamp: configure-stamp 
37         dh_testdir
38
39         $(MAKE)
40
41         touch build-stamp
42
43 clean:
44         dh_testdir
45         dh_testroot
46         rm -f build-stamp configure-stamp
47
48         -$(MAKE) clean
49         -$(MAKE) distclean
50         rm -f privoxy 
51         rm -f configure config.h GNUmakefile 
52         rm -f doc/source/ldp.dsl
53
54         dh_clean
55
56 install: build
57         dh_testdir
58         dh_testroot
59         dh_clean -k
60         dh_installdirs
61
62         install -m 0755 privoxy $(DEBDIR)/usr/sbin/privoxy
63
64         sed -e 's/^\(\(trust\|proxy\)-info-url\|admin-address\)/#\1/'  \
65             -e 's/^\(enable-\(edit-actions\|remote-toggle\)\)[  ]*1/\1 0/' \
66             -e 's#^confdir \.#confdir /etc/privoxy#' \
67             -e 's#^logdir \.#logdir /var/log/privoxy#' \
68             -e 's%^#\(user-manual\).*%\1 /usr/share/doc/privoxy/user-manual%' \
69             -e 's/\(Sample Configuration File for Privoxy\).*/\1/' \
70             -e 's/Id: config,v.*/Id: config,v $$/' \
71                 < config > $(DEBDIR)/etc/privoxy/config
72         install -m 0644 default.action $(DEBDIR)/etc/privoxy/default.action
73         install -m 0644 standard.action $(DEBDIR)/etc/privoxy/standard.action
74         install -m 0644 user.action $(DEBDIR)/etc/privoxy/user.action
75         install -m 0644 default.filter $(DEBDIR)/etc/privoxy/default.filter
76         install -m 0644 trust $(DEBDIR)/etc/privoxy/trust
77
78         cp -r templates $(DEBDIR)/etc/privoxy/
79         rm -f $(DEBDIR)/etc/privoxy/templates/*~
80         rm -rf $(DEBDIR)/etc/privoxy/templates/CVS
81
82
83 # Build architecture-independent files here.
84 binary-indep: build install
85 # We have nothing to do by default.
86
87 # Build architecture-dependent files here.
88 binary-arch: build install
89         dh_testdir
90         dh_testroot
91 #       dh_installdebconf       
92         dh_installdocs -XCVS
93         dh_installexamples
94         dh_installmenu
95         dh_installlogrotate
96 #       dh_installemacsen
97 #       dh_installpam
98 #       dh_installmime
99         dh_installinit
100         dh_installcron
101         dh_installman
102         dh_installinfo
103 #       dh_undocumented
104         dh_installchangelogs ChangeLog
105         dh_link
106         dh_strip
107         dh_compress
108         dh_fixperms
109 #       dh_makeshlibs
110         dh_installdeb
111 #       dh_perl
112         dh_shlibdeps
113         dh_gencontrol
114         dh_md5sums
115         dh_builddeb
116
117 binary: binary-indep binary-arch
118 .PHONY: build clean binary-indep binary-arch binary install configure