add a minimum for CircuitStreamTimeout, plus a man page
[tor.git] / debian / rules
blob28d73595216058a11c0a0876810a2e82eb1093ae
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 export PACKAGE=tor
10 include /usr/share/dpatch/dpatch.make
12 # These are used for cross-compiling and for saving the configure script
13 # from having to guess our platform (since we know it already)
15 # See /usr/share/doc/autotools-dev/README.Debian.gz which suggests
16 # this way of passing --build and --host. Also see the thread on
17 # debian-devel './configure in debian/rules' from February/March 2006,
18 # starting with <43FF212C.5020800@xs4all.nl> by Pjotr Kourzanov.
19 export DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
20 export DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
21 ifeq ($(DEB_BUILD_GNU_TYPE), $(DEB_HOST_GNU_TYPE))
22 confflags += --build $(DEB_HOST_GNU_TYPE)
23 else
24 confflags += --build $(DEB_BUILD_GNU_TYPE) --host $(DEB_HOST_GNU_TYPE)
25 endif
27 CFLAGS ?= -Wall -g
29 LOCALHOST_IP ?= $(shell getent hosts localhost | awk '{print $$1}')
31 # Do not optimize the build with "noopt"
32 ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
33 CFLAGS += -O0
34 else
35 CFLAGS += -O2
36 endif
38 # Do not strip the binary with "nostrip"
39 #ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
40 # INSTALL_PROGRAM += -s
41 #endif
43 # Prevent the unit tests from being run with "nocheck"
44 ifneq (,$(findstring nocheck,$(DEB_BUILD_OPTIONS)))
45 RUN_TEST = no
46 endif
47 ifneq (,$(findstring notest,$(DEB_BUILD_OPTIONS)))
48 RUN_TEST = no
49 endif
51 # Support passing of parallel=<n> in build options
52 ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
53 NUMJOBS = $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
54 MAKEFLAGS += -j$(NUMJOBS)
55 endif
57 CONF_OPTIONS =
58 # build against libdmalloc4 - it better be installed
59 ifneq (,$(findstring with-dmalloc,$(DEB_BUILD_OPTIONS)))
60 CONF_OPTIONS += --with-dmalloc
61 endif
62 # allow building with --enable-openbsd-malloc
63 ifneq (,$(findstring enable-openbsd-malloc,$(DEB_BUILD_OPTIONS)))
64 CONF_OPTIONS += --enable-openbsd-malloc
65 endif
67 configure: patch-stamp
68 config.status: configure
69 # clean up test.h stuff. XXX - expected to no longer be needed after tor-0.2.2.4-alpha
70 rm -f src/test/test.h.orig
71 ! [ -e src/test/test.h ] || mv src/test/test.h src/test/test.h.orig
72 cp debian/src-test-test.h src/test/test.h
74 @if [ "$(LOCALHOST_IP)" != "127.0.0.1" ]; then echo; echo; echo; echo; echo; echo "######################################################################"; echo "WARNING: This system does not think localhost is 127.0.0.1. Will ignore result of testsuite. Please fix your system/chroot."; echo "######################################################################"; echo; echo; echo; echo; echo "Note: 'getent hosts localhost' should return '127.0.0.1 localhost'"; echo; fi
75 dh_testdir
76 CFLAGS="$(CFLAGS)" ./configure \
77 $(confflags) \
78 --prefix=/usr \
79 --mandir=\$${prefix}/share/man \
80 --infodir=\$${prefix}/share/info \
81 --localstatedir=/var \
82 --sysconfdir=/etc \
83 $(CONF_OPTIONS)
86 build: build-stamp
88 build-stamp: config.status
89 dh_testdir
90 ! [ debian/micro-revision.i ] || cp debian/micro-revision.i src/or/micro-revision.i
92 $(MAKE)
93 @echo
94 @echo
95 # Running unit tests
96 @if [ "$(RUN_TEST)" != "no" ]; then \
97 if [ "$(LOCALHOST_IP)" != "127.0.0.1" ]; then \
98 echo; echo; echo "######################################################################"; echo "WARNING: This system does not think localhost is 127.0.0.1. Will ignore result of testsuite. Please fix your system/chroot."; echo "######################################################################"; echo; echo; \
99 echo "make check || true"; \
100 make check || true; \
101 else \
102 echo "make check"; \
103 make check; \
104 fi; \
105 else \
106 echo; echo; echo "Skipping unittests"; echo; \
108 @echo
110 # XXX
111 # So, gs-gpl on s390 is broken (#457568) and fails to properly build
112 # .pdf files from .fig files using fig2dev. Therefore we ship them
113 # until this bug is fixed.
115 # of course we can always give it a try
117 # the hexdumps were built using something like
118 # perl -e 'while (<>) { print unpack ("H*", $_); }' interaction.pdf | fold > hexdump-interaction.pdf
120 # And it fails on a bunch of other archs too.
121 cd doc/design-paper; \
122 fig2dev -L pdf cell-struct.fig cell-struct.pdf || \
123 ( echo "** Using shipped pdf file because fig2dev failed"; \
124 perl -e 'while (<>) { chomp; print pack ("H*", $$_); }' ../../debian/hexdump-cell-struct.pdf > cell-struct.pdf ); \
125 fig2dev -L pdf interaction.fig interaction.pdf || \
126 ( echo "** Using shipped pdf file because fig2dev failed"; \
127 perl -e 'while (<>) { chomp; print pack ("H*", $$_); }' ../../debian/hexdump-interaction.pdf > interaction.pdf ); \
128 # XXX ends
130 make -C doc/design-paper tor-design.ps tor-design.pdf
132 touch build-stamp
134 clean: unpatch
135 dh_testdir
136 dh_testroot
137 rm -f build-stamp
138 rm -f src/common/common_sha1.i src/or/or_sha1.i
139 rm -f src/or/micro-revision.i
141 [ ! -f Makefile ] || $(MAKE) distclean
143 # clean up test.h stuff. XXX - expected to no longer be needed after tor-0.2.2.4-alpha
144 rm -f src/test/test.h
145 ! [ -e src/test/test.h.orig ] || mv src/test/test.h.orig src/test/test.h
147 # Normally the .deb wouldn't ship with a ../.git
148 if [ -d .git ] && which git >/dev/null; then \
149 echo "\"`git rev-parse --short=16 HEAD`\"" > "debian/micro-revision.i" ; \
152 dh_clean
154 install: build
155 dh_testdir
156 dh_testroot
157 dh_clean -k
158 dh_installdirs
160 $(MAKE) install DESTDIR=$(CURDIR)/debian/tor
161 # move tor to where it belongs
162 mv $(CURDIR)/debian/tor/etc/tor/torrc.sample $(CURDIR)/debian/tor/etc/tor/torrc
163 mv $(CURDIR)/debian/tor/usr/bin/tor $(CURDIR)/debian/tor/usr/sbin/tor
164 install -d $(CURDIR)/debian/tor/usr/share/man/man8
165 mv $(CURDIR)/debian/tor/usr/share/man/man1/tor.1 $(CURDIR)/debian/tor/usr/share/man/man8/tor.8
167 install -m 755 contrib/torify $(CURDIR)/debian/tor/usr/bin
168 install -m 644 contrib/torify.1 $(CURDIR)/debian/tor/usr/share/man/man1
169 install -m 644 contrib/tor-tsocks.conf $(CURDIR)/debian/tor/etc/tor
171 install -m 644 debian/tor.lintian-override $(CURDIR)/debian/tor/usr/share/lintian/overrides/tor
173 install -d -m 755 $(CURDIR)/debian/tor/usr/share/doc/tor/spec
174 for i in doc/spec/*txt; do \
175 install -m 644 $$i $(CURDIR)/debian/tor/usr/share/doc/tor/spec || exit 1; \
176 done
178 dh_link usr/share/man/man8/tor.8 usr/share/man/man5/torrc.5
180 rm -f $(CURDIR)/debian/tor/usr/bin/tor-control.py
182 # tor-dbg doc dir
183 install -d -m 755 $(CURDIR)/debian/tor-dbg/usr/share/doc
184 ln -s tor $(CURDIR)/debian/tor-dbg/usr/share/doc/tor-dbg
186 # tor-geoip
187 mv $(CURDIR)/debian/tor/usr/share/tor/geoip $(CURDIR)/debian/tor-geoipdb/usr/share/tor
188 rmdir $(CURDIR)/debian/tor/usr/share/tor || true
190 install -d -m 755 $(CURDIR)/debian/tor-geoipdb/usr/share/doc/tor-geoipdb
191 ln -s ../tor/changelog.gz $(CURDIR)/debian/tor-geoipdb/usr/share/doc/tor-geoipdb
192 ln -s ../tor/changelog.Debian.gz $(CURDIR)/debian/tor-geoipdb/usr/share/doc/tor-geoipdb
194 install -m 644 debian/tor-geoipdb.lintian-override $(CURDIR)/debian/tor-geoipdb/usr/share/lintian/overrides/tor-geoipdb
196 # Must not depend on anything. This is to be called by
197 # binary-arch/binary-indep
198 # in another 'make' thread.
199 binary-common:
200 dh_testdir
201 dh_testroot
202 dh_installchangelogs --package=tor ChangeLog
203 dh_installdocs
204 dh_installexamples
205 dh_installlogrotate
206 dh_installinit
207 dh_installman
208 dh_link
209 dh_strip --dbg-package=tor-dbg
210 dh_compress
211 dh_fixperms
212 dh_installdeb
213 dh_shlibdeps
214 dh_gencontrol
215 dh_md5sums
216 dh_builddeb
218 # Build architecture independant packages using the common target.
219 binary-indep: install
220 $(MAKE) -f debian/rules DH_OPTIONS=-i binary-common
222 # Build architecture dependant packages using the common target.
223 binary-arch: install
224 $(MAKE) -f debian/rules DH_OPTIONS=-s binary-common
225 @if [ "$(LOCALHOST_IP)" != "127.0.0.1" ]; then echo; echo; echo; echo; echo; echo "######################################################################"; echo "WARNING: This system does not think localhost is 127.0.0.1. Result of testsuite has been ignored. Please fix your system/chroot."; echo "######################################################################"; echo; echo; echo; echo; echo "Note: 'getent hosts localhost' should return '127.0.0.1 localhost'"; echo; fi
227 binary: binary-indep binary-arch
228 .PHONY: build clean binary-common binary-indep binary-arch binary install