Drop redundant exit policy entries, not just identical ones.
[tor.git] / debian / rules
blob25c16e25f997543bcb0e38e974eb7c88575614ef
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)
13 LOCALHOST_IP ?= $(shell getent hosts localhost | awk '{print $$1}')
15 CFLAGS = -Wall -g
17 export PACKAGE=tor
18 include /usr/share/dpatch/dpatch.make
20 # Do not optimize the build with "noopt"
21 ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
22 CFLAGS += -O0
23 else
24 CFLAGS += -O2
25 endif
27 # Do not strip the binary with "nostrip"
28 #ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
29 # INSTALL_PROGRAM += -s
30 #endif
32 # Prevent the design paper from being built with "nodoc"
33 ifneq (,$(findstring nodoc,$(DEB_BUILD_OPTIONS)))
34 BUILD_DOC = no
35 endif
37 # Prevent the unit tests from being run with "nocheck"
38 ifneq (,$(findstring nocheck,$(DEB_BUILD_OPTIONS)))
39 RUN_TEST = no
40 endif
41 ifneq (,$(findstring notest,$(DEB_BUILD_OPTIONS)))
42 RUN_TEST = no
43 endif
45 CONF_OPTIONS =
46 # build against libdmalloc4 - it better be installed
47 ifneq (,$(findstring with-dmalloc,$(DEB_BUILD_OPTIONS)))
48 CONF_OPTIONS += --with-dmalloc
49 endif
51 configure: patch-stamp
52 config.status: configure
53 @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
54 dh_testdir
55 CFLAGS="$(CFLAGS)" ./configure \
56 --host=$(DEB_HOST_GNU_TYPE) \
57 --build=$(DEB_BUILD_GNU_TYPE) \
58 --prefix=/usr \
59 --mandir=\$${prefix}/share/man \
60 --infodir=\$${prefix}/share/info \
61 --localstatedir=/var \
62 --sysconfdir=/etc \
63 $(CONF_OPTIONS)
66 build: build-stamp
68 build-stamp: config.status
69 dh_testdir
71 $(MAKE)
72 @echo
73 @echo
74 # Running unit tests
75 @if [ "$(RUN_TEST)" != "no" ]; then \
76 if [ "$(LOCALHOST_IP)" != "127.0.0.1" ]; then \
77 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; \
78 echo "src/or/test || true"; \
79 src/or/test || true; \
80 else \
81 echo "src/or/test"; \
82 src/or/test; \
83 fi; \
84 else \
85 echo -e "\n\nSkipping unittests\n\n"; \
87 @echo
89 # XXX
90 # So, gs-gpl on s390 is broken (#321435) and fails to properly build
91 # .pdf files from .fig files using fig2dev. Therefore we ship them
92 # until this bug is fixed.
94 # of course we can always give it a try
96 # the hexdumps were built using something like
97 # perl -e 'while (<>) { print unpack ("H*", $_); }' interaction.pdf | fold > hexdump-interaction.pdf
98 if [ "$(DEB_BUILD_GNU_TYPE)" = "s390-linux-gnu" ]; then \
99 cd doc/design-paper; \
100 fig2dev -L pdf cell-struct.fig cell-struct.pdf || \
101 ( echo "** Using shipped pdf file because fig2dev failed"; \
102 perl -e 'while (<>) { chomp; print pack ("H*", $$_); }' ../../debian/hexdump-cell-struct.pdf > cell-struct.pdf ); \
103 fig2dev -L pdf interaction.fig interaction.pdf || \
104 ( echo "** Using shipped pdf file because fig2dev failed"; \
105 perl -e 'while (<>) { chomp; print pack ("H*", $$_); }' ../../debian/hexdump-interaction.pdf > interaction.pdf ); \
107 # XXX ends
109 if [ "$(BUILD_DOC)" != "no" ]; then \
110 make -C doc/design-paper tor-design.ps tor-design.pdf || \
111 ( echo -e "*\n*\n*\n*"; \
112 echo "* Building some docs failed, perhaps because you did not install the"; \
113 echo "* declared build dependencies and then used -o with dpkg-buildpackage."; \
114 echo "*"; \
115 echo "* If you want to skip this part, you can set nodoc in DEB_BUILD_OPTIONS" ; \
116 echo "* and start the build again. DEB_BUILD_OPTIONS=nodoc dpkg-buildpackage.."; \
117 echo -e "*\n*\n*\n*"; \
118 false ); \
119 else \
120 echo -e "\n\nSkipping tor-design.{ps,pdf}\n\n"; \
123 touch build-stamp
125 clean: unpatch
126 dh_testdir
127 dh_testroot
128 rm -f build-stamp
130 -$(MAKE) distclean
132 dh_clean
134 install: build
135 dh_testdir
136 dh_testroot
137 dh_clean -k
138 dh_installdirs
140 $(MAKE) install DESTDIR=$(CURDIR)/debian/tor
141 # move tor to where it belongs
142 mv $(CURDIR)/debian/tor/etc/tor/torrc.sample $(CURDIR)/debian/tor/etc/tor/torrc
143 mv $(CURDIR)/debian/tor/usr/bin/tor $(CURDIR)/debian/tor/usr/sbin/tor
144 install -d $(CURDIR)/debian/tor/usr/share/man/man8
145 mv $(CURDIR)/debian/tor/usr/share/man/man1/tor.1 $(CURDIR)/debian/tor/usr/share/man/man8/tor.8
147 install -m 755 contrib/torify $(CURDIR)/debian/tor/usr/bin
148 install -m 644 contrib/torify.1 $(CURDIR)/debian/tor/usr/share/man/man1
149 install -m 644 contrib/tor-tsocks.conf $(CURDIR)/debian/tor/etc/tor
151 install -m 644 debian/tor.lintian-override $(CURDIR)/debian/tor/usr/share/lintian/overrides/tor
153 dh_link usr/share/man/man8/tor.8 usr/share/man/man5/torrc.5
155 rm -f $(CURDIR)/debian/tor/usr/bin/tor-control.py
157 install -d -m 755 $(CURDIR)/debian/tor-dbg/usr/share/doc
158 ln -s tor $(CURDIR)/debian/tor-dbg/usr/share/doc/tor-dbg
161 # Build architecture-independent files here.
162 binary-indep: build install
163 # We have nothing to do by default.
165 # Build architecture-dependent files here.
166 binary-arch: build install
167 dh_testdir
168 dh_testroot
169 dh_installchangelogs ChangeLog
170 dh_installdocs
171 if [ "$(BUILD_DOC)" != "no" ]; then \
172 install -m 644 doc/design-paper/tor-design.ps $(CURDIR)/debian/tor/usr/share/doc/tor/; \
173 install -m 644 doc/design-paper/tor-design.pdf $(CURDIR)/debian/tor/usr/share/doc/tor/; \
175 dh_installexamples
176 # dh_install
177 # dh_installdebconf
178 dh_installlogrotate
179 # dh_installemacsen
180 # dh_installmime
181 dh_installinit
182 # dh_installcron
183 dh_installman
184 dh_link
185 # Change this for debhelper compatibility level 5 or later!
186 dh_strip --dbg-package=tor
187 dh_compress
188 dh_fixperms
189 dh_installdeb
190 dh_shlibdeps
191 dh_gencontrol
192 dh_md5sums
193 dh_builddeb
194 @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
196 binary: binary-indep binary-arch
197 .PHONY: build clean binary-indep binary-arch binary install