Create HTML and ASCII versions of the documentation using docbook now.
[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 DB2HTML=jw -f docbook -b html -d `pwd`/ldpOK.dsl\#html
19
20
21 CFLAGS="-O2"
22 WITHDEBUG=""
23 ifneq (,$(findstring debug,$(DEB_BUILD_OPTIONS)))
24         CFLAGS += -g
25         WITHDEBUG="--with-debug"
26 endif
27
28 configure: configure-stamp
29 configure-stamp:
30         dh_testdir
31
32         autoheader
33         autoconf
34         env CFLAGS=$(CFLAGS) \
35                 ./configure --prefix=/usr --sysconfdir=/etc \
36                 --mandir=/usr/share/man $(WITHDEBUG) \
37                 --with-docbook=/usr/share/sgml/docbook/stylesheet/dsssl/modular
38
39         touch configure-stamp
40
41 build: build-stamp
42 build-stamp: configure-stamp 
43         dh_testdir
44
45         $(MAKE)
46
47 #       And now we create the documentation (manually):
48         $(MAKE) doc/source/ldpOK.dsl
49         (cd doc/source; \
50          $(DB2HTML) -o faq faq.sgml; \
51          $(DB2HTML) -o user-manual user-manual.sgml; \
52          $(DB2HTML) -o developer-manual developer-manual.sgml; \
53          docbook2txt faq.sgml; \
54          docbook2txt user-manual.sgml; \
55          docbook2txt developer-manual.sgml)
56
57         touch build-stamp
58
59 clean:
60         dh_testdir
61         dh_testroot
62         rm -f build-stamp configure-stamp
63
64         -$(MAKE) clobber
65         rm -f privoxy 
66         rm -f configure config.h GNUmakefile 
67         rm -f doc/source/ldpOK.dsl
68         rm -rf doc/source/faq doc/source/user-manual \
69                 doc/source/developer-manual
70         rm -f doc/source/*.txt
71
72         dh_clean
73
74 install: build
75         dh_testdir
76         dh_testroot
77         dh_clean -k
78         dh_installdirs
79
80         install -m 0755 privoxy $(DEBDIR)/usr/sbin/privoxy
81
82         sed -e 's/^\(\(trust\|proxy\)-info-url\|admin-address\)/#\1/'  \
83             -e 's#^confdir \.#confdir /etc/privoxy#' \
84             -e 's#^logdir \.#logdir /var/log/privoxy#' \
85                 < config > $(DEBDIR)/etc/privoxy/config
86         install -m 0644 default.action $(DEBDIR)/etc/privoxy/default.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
95 # Build architecture-independent files here.
96 binary-indep: build install
97 # We have nothing to do by default.
98
99 # Build architecture-dependent files here.
100 binary-arch: build install
101         dh_testdir
102         dh_testroot
103 #       dh_installdebconf       
104         dh_installdocs
105         dh_installexamples
106         dh_installmenu
107         dh_installlogrotate
108 #       dh_installemacsen
109 #       dh_installpam
110 #       dh_installmime
111         dh_installinit
112         dh_installcron
113         dh_installman
114         dh_installinfo
115 #       dh_undocumented
116         dh_installchangelogs ChangeLog
117         dh_link
118         dh_strip
119         dh_compress
120         dh_fixperms
121 #       dh_makeshlibs
122         dh_installdeb
123 #       dh_perl
124         dh_shlibdeps
125         dh_gencontrol
126         dh_md5sums
127         dh_builddeb
128
129 binary: binary-indep binary-arch
130 .PHONY: build clean binary-indep binary-arch binary install configure