make doxygen output look prettier
[tor.git] / debian / rules
blob6ad7bd5b873c4c75c9a580aa8400c2ad942ae83c
1 #!/usr/bin/make -f
2 # -*- makefile -*-
3 # Sample debian/rules that uses debhelper.
4 # GNU copyright 1997 to 1999 by Joey Hess.
6 # Uncomment this to turn on verbose mode.
7 #export DH_VERBOSE=1
9 # These are used for cross-compiling and for saving the configure script
10 # from having to guess our platform (since we know it already)
11 DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
12 DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
14 CFLAGS = -Wall -g
16 export PACKAGE=tor
17 include /usr/share/dpatch/dpatch.make
19 # Do not optimize the build with "noopt"
20 ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
21 CFLAGS += -O0
22 else
23 CFLAGS += -O2
24 endif
26 # Do not strip the binary with "nostrip"
27 #ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
28 # INSTALL_PROGRAM += -s
29 #endif
31 # Prevent the design paper from being built with "nodoc"
32 ifneq (,$(findstring nodoc,$(DEB_BUILD_OPTIONS)))
33 BUILD_DOC = no
34 endif
36 # Prevent the unit tests from being run with "nocheck"
37 ifneq (,$(findstring nocheck,$(DEB_BUILD_OPTIONS)))
38 RUN_TEST = no
39 endif
40 ifneq (,$(findstring notest,$(DEB_BUILD_OPTIONS)))
41 RUN_TEST = no
42 endif
44 CONF_OPTIONS =
45 # build against libdmalloc4 - it better be installed
46 ifneq (,$(findstring with-dmalloc,$(DEB_BUILD_OPTIONS)))
47 CONF_OPTIONS += --with-dmalloc
48 endif
50 configure: patch-stamp
51 config.status: configure
52 dh_testdir
53 CFLAGS="$(CFLAGS)" ./configure \
54 --host=$(DEB_HOST_GNU_TYPE) \
55 --build=$(DEB_BUILD_GNU_TYPE) \
56 --prefix=/usr \
57 --mandir=\$${prefix}/share/man \
58 --infodir=\$${prefix}/share/info \
59 --localstatedir=/var \
60 --sysconfdir=/etc \
61 $(CONF_OPTIONS)
64 build: build-stamp
66 build-stamp: config.status
67 dh_testdir
69 $(MAKE)
70 @echo
71 @echo
72 # Running unit tests
73 if [ "$(RUN_TEST)" != "no" ]; then \
74 src/or/test || true; \
75 else \
76 echo -e "\n\nSkipping unittests\n\n"; \
78 @echo
80 # XXX
81 # So, gs-gpl on s390 is broken (#321435) and fails to properly build
82 # .pdf files from .fig files using fig2dev. Therefore we ship them
83 # until this bug is fixed.
85 # of course we can always give it a try
87 # the hexdumps were built using something like
88 # perl -e 'while (<>) { print unpack ("H*", $_); }' interaction.pdf | fold > hexdump-interaction.pdf
89 if [ "$(DEB_BUILD_GNU_TYPE)" = "s390-linux-gnu" ]; then \
90 cd doc/design-paper; \
91 fig2dev -L pdf cell-struct.fig cell-struct.pdf || \
92 ( echo "** Using shipped pdf file because fig2dev failed"; \
93 perl -e 'while (<>) { chomp; print pack ("H*", $$_); }' ../../debian/hexdump-cell-struct.pdf > cell-struct.pdf ); \
94 fig2dev -L pdf interaction.fig interaction.pdf || \
95 ( echo "** Using shipped pdf file because fig2dev failed"; \
96 perl -e 'while (<>) { chomp; print pack ("H*", $$_); }' ../../debian/hexdump-interaction.pdf > interaction.pdf ); \
98 # XXX ends
100 if [ "$(BUILD_DOC)" != "no" ]; then \
101 make -C doc/design-paper tor-design.ps tor-design.pdf || \
102 ( echo -e "*\n*\n*\n*"; \
103 echo "* Building some docs failed, perhaps because you did not install the"; \
104 echo "* declared build dependencies and then used -o with dpkg-buildpackage."; \
105 echo "*"; \
106 echo "* If you want to skip this part, you can set nodoc in DEB_BUILD_OPTIONS" ; \
107 echo "* and start the build again. DEB_BUILD_OPTIONS=nodoc dpkg-buildpackage.."; \
108 echo -e "*\n*\n*\n*"; \
109 false ); \
110 else \
111 echo -e "\n\nSkipping tor-design.{ps,pdf}\n\n"; \
114 touch build-stamp
116 clean: unpatch
117 dh_testdir
118 dh_testroot
119 rm -f build-stamp
121 -$(MAKE) distclean
123 dh_clean
125 install: build
126 dh_testdir
127 dh_testroot
128 dh_clean -k
129 dh_installdirs
131 $(MAKE) install DESTDIR=$(CURDIR)/debian/tor
132 # move tor to where it belongs
133 mv $(CURDIR)/debian/tor/etc/tor/torrc.sample $(CURDIR)/debian/tor/etc/tor/torrc
134 mv $(CURDIR)/debian/tor/usr/bin/tor $(CURDIR)/debian/tor/usr/sbin/tor
135 install -d $(CURDIR)/debian/tor/usr/share/man/man8
136 mv $(CURDIR)/debian/tor/usr/share/man/man1/tor.1 $(CURDIR)/debian/tor/usr/share/man/man8/tor.8
138 install -m 755 contrib/torify $(CURDIR)/debian/tor/usr/bin
139 install -m 644 contrib/torify.1 $(CURDIR)/debian/tor/usr/share/man/man1
140 install -m 644 contrib/tor-tsocks.conf $(CURDIR)/debian/tor/etc/tor
142 install -m 644 debian/tor.lintian-override $(CURDIR)/debian/tor/usr/share/lintian/overrides/tor
144 dh_link usr/share/man/man8/tor.8 usr/share/man/man5/torrc.5
146 rm -f $(CURDIR)/debian/tor/usr/bin/tor-control.py
149 # Build architecture-independent files here.
150 binary-indep: build install
151 # We have nothing to do by default.
153 # Build architecture-dependent files here.
154 binary-arch: build install
155 dh_testdir
156 dh_testroot
157 dh_installchangelogs ChangeLog
158 dh_installdocs
159 if [ "$(BUILD_DOC)" != "no" ]; then \
160 install -m 644 doc/design-paper/tor-design.ps $(CURDIR)/debian/tor/usr/share/doc/tor/; \
161 install -m 644 doc/design-paper/tor-design.pdf $(CURDIR)/debian/tor/usr/share/doc/tor/; \
163 dh_installexamples
164 # dh_install
165 # dh_installdebconf
166 dh_installlogrotate
167 # dh_installemacsen
168 # dh_installmime
169 dh_installinit
170 # dh_installcron
171 dh_installman
172 dh_link
173 #dh_strip
174 dh_compress
175 dh_fixperms
176 dh_installdeb
177 dh_shlibdeps
178 dh_gencontrol
179 dh_md5sums
180 dh_builddeb
182 binary: binary-indep binary-arch
183 .PHONY: build clean binary-indep binary-arch binary install