3 # Sample debian/rules that uses debhelper.
4 # GNU copyright 1997 to 1999 by Joey Hess.
6 # Uncomment this to turn on verbose mode.
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}')
18 include /usr
/share
/dpatch
/dpatch.make
20 # Do not optimize the build with "noopt"
21 ifneq (,$(findstring noopt
,$(DEB_BUILD_OPTIONS
)))
27 # Do not strip the binary with "nostrip"
28 #ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
29 # INSTALL_PROGRAM += -s
32 # Prevent the design paper from being built with "nodoc"
33 ifneq (,$(findstring nodoc
,$(DEB_BUILD_OPTIONS
)))
37 # Prevent the unit tests from being run with "nocheck"
38 ifneq (,$(findstring nocheck
,$(DEB_BUILD_OPTIONS
)))
41 ifneq (,$(findstring notest
,$(DEB_BUILD_OPTIONS
)))
46 # build against libdmalloc4 - it better be installed
47 ifneq (,$(findstring with-dmalloc
,$(DEB_BUILD_OPTIONS
)))
48 CONF_OPTIONS
+= --with-dmalloc
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
55 CFLAGS
="$(CFLAGS)" .
/configure \
56 --host
=$(DEB_HOST_GNU_TYPE
) \
57 --build
=$(DEB_BUILD_GNU_TYPE
) \
59 --mandir=\
$${prefix}/share
/man \
60 --infodir=\
$${prefix}/share
/info \
61 --localstatedir
=/var \
68 build-stamp
: config.status
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
; \
85 echo
-e
"\n\nSkipping unittests\n\n"; \
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
); \
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."; \
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*"; \
120 echo
-e
"\n\nSkipping tor-design.{ps,pdf}\n\n"; \
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
169 dh_installchangelogs ChangeLog
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
/; \
185 # Change this for debhelper compatibility level 5 or later!
186 dh_strip
--dbg-package
=tor
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