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