Add Peter Palfrader's proposal 134: More robust consensus voting with diverse authori...
[tor.git] / debian / rules
blob24d727175b43d2b90dd16424579886bbd0cab185
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 CONF_OPTIONS =
52 # build against libdmalloc4 - it better be installed
53 ifneq (,$(findstring with-dmalloc,$(DEB_BUILD_OPTIONS)))
54 CONF_OPTIONS += --with-dmalloc
55 endif
56 # inhibit building with --enable-openbsd-malloc
57 ifeq (,$(findstring no-enable-openbsd-malloc,$(DEB_BUILD_OPTIONS)))
58 CONF_OPTIONS += --enable-openbsd-malloc
59 endif
61 configure: patch-stamp
62 config.status: configure
63 @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
64 dh_testdir
65 CFLAGS="$(CFLAGS)" ./configure \
66 $(confflags) \
67 --prefix=/usr \
68 --mandir=\$${prefix}/share/man \
69 --infodir=\$${prefix}/share/info \
70 --localstatedir=/var \
71 --sysconfdir=/etc \
72 $(CONF_OPTIONS)
75 build: build-stamp
77 build-stamp: config.status
78 dh_testdir
80 $(MAKE)
81 @echo
82 @echo
83 # Running unit tests
84 @if [ "$(RUN_TEST)" != "no" ]; then \
85 if [ "$(LOCALHOST_IP)" != "127.0.0.1" ]; then \
86 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; \
87 echo "src/or/test || true"; \
88 src/or/test || true; \
89 else \
90 echo "src/or/test"; \
91 src/or/test; \
92 fi; \
93 else \
94 echo -e "\n\nSkipping unittests\n\n"; \
96 @echo
98 # XXX
99 # So, gs-gpl on s390 is broken (#457568) and fails to properly build
100 # .pdf files from .fig files using fig2dev. Therefore we ship them
101 # until this bug is fixed.
103 # of course we can always give it a try
105 # the hexdumps were built using something like
106 # perl -e 'while (<>) { print unpack ("H*", $_); }' interaction.pdf | fold > hexdump-interaction.pdf
108 # And it fails on a bunch of other archs too.
109 cd doc/design-paper; \
110 fig2dev -L pdf cell-struct.fig cell-struct.pdf || \
111 ( echo "** Using shipped pdf file because fig2dev failed"; \
112 perl -e 'while (<>) { chomp; print pack ("H*", $$_); }' ../../debian/hexdump-cell-struct.pdf > cell-struct.pdf ); \
113 fig2dev -L pdf interaction.fig interaction.pdf || \
114 ( echo "** Using shipped pdf file because fig2dev failed"; \
115 perl -e 'while (<>) { chomp; print pack ("H*", $$_); }' ../../debian/hexdump-interaction.pdf > interaction.pdf ); \
116 # XXX ends
118 make -C doc/design-paper tor-design.ps tor-design.pdf
120 touch build-stamp
122 clean: unpatch
123 dh_testdir
124 dh_testroot
125 rm -f build-stamp
127 -$(MAKE) distclean
129 dh_clean
131 install: build
132 dh_testdir
133 dh_testroot
134 dh_clean -k
135 dh_installdirs
137 $(MAKE) install DESTDIR=$(CURDIR)/debian/tor
138 # move tor to where it belongs
139 mv $(CURDIR)/debian/tor/etc/tor/torrc.sample $(CURDIR)/debian/tor/etc/tor/torrc
140 mv $(CURDIR)/debian/tor/usr/bin/tor $(CURDIR)/debian/tor/usr/sbin/tor
141 install -d $(CURDIR)/debian/tor/usr/share/man/man8
142 mv $(CURDIR)/debian/tor/usr/share/man/man1/tor.1 $(CURDIR)/debian/tor/usr/share/man/man8/tor.8
144 install -m 755 contrib/torify $(CURDIR)/debian/tor/usr/bin
145 install -m 644 contrib/torify.1 $(CURDIR)/debian/tor/usr/share/man/man1
146 install -m 644 contrib/tor-tsocks.conf $(CURDIR)/debian/tor/etc/tor
148 install -m 644 debian/tor.lintian-override $(CURDIR)/debian/tor/usr/share/lintian/overrides/tor
150 install -d -m 755 $(CURDIR)/debian/tor/usr/share/doc/tor/spec
151 for i in doc/spec/*txt; do \
152 install -m 644 $$i $(CURDIR)/debian/tor/usr/share/doc/tor/spec || exit 1; \
153 done
155 dh_link usr/share/man/man8/tor.8 usr/share/man/man5/torrc.5
157 rm -f $(CURDIR)/debian/tor/usr/bin/tor-control.py
159 install -d -m 755 $(CURDIR)/debian/tor-dbg/usr/share/doc
160 ln -s tor $(CURDIR)/debian/tor-dbg/usr/share/doc/tor-dbg
163 # Build architecture-independent files here.
164 binary-indep: build install
165 # We have nothing to do by default.
167 # Build architecture-dependent files here.
168 binary-arch: build install
169 dh_testdir
170 dh_testroot
171 dh_installchangelogs ChangeLog
172 dh_installdocs
173 dh_installexamples
174 # dh_install
175 # dh_installdebconf
176 dh_installlogrotate
177 # dh_installemacsen
178 # dh_installmime
179 dh_installinit
180 # dh_installcron
181 dh_installman
182 dh_link
183 # Change this for debhelper compatibility level 5 or later!
184 dh_strip --dbg-package=tor
185 dh_compress
186 dh_fixperms
187 dh_installdeb
188 dh_shlibdeps
189 dh_gencontrol
190 dh_md5sums
191 dh_builddeb
192 @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
194 binary: binary-indep binary-arch
195 .PHONY: build clean binary-indep binary-arch binary install