3 # Sample debian/rules that uses debhelper.
4 # GNU copyright 1997 to 1999 by Joey Hess.
6 # Uncomment this to turn on verbose mode.
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
)
24 confflags
+= --build
$(DEB_BUILD_GNU_TYPE
) --host
$(DEB_HOST_GNU_TYPE
)
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
)))
38 # Do not strip the binary with "nostrip"
39 #ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
40 # INSTALL_PROGRAM += -s
43 # Prevent the unit tests from being run with "nocheck"
44 ifneq (,$(findstring nocheck
,$(DEB_BUILD_OPTIONS
)))
47 ifneq (,$(findstring notest
,$(DEB_BUILD_OPTIONS
)))
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
)
58 # build against libdmalloc4 - it better be installed
59 ifneq (,$(findstring with-dmalloc
,$(DEB_BUILD_OPTIONS
)))
60 CONF_OPTIONS
+= --with-dmalloc
62 # allow building with --enable-openbsd-malloc
63 ifneq (,$(findstring enable-openbsd-malloc
,$(DEB_BUILD_OPTIONS
)))
64 CONF_OPTIONS
+= --enable-openbsd-malloc
67 configure
: patch-stamp
68 config.status
: configure
69 @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
71 CFLAGS
="$(CFLAGS)" .
/configure \
74 --mandir=\
$${prefix}/share
/man \
75 --infodir=\
$${prefix}/share
/info \
76 --localstatedir
=/var \
83 build-stamp
: config.status
90 @if
[ "$(RUN_TEST)" != "no" ]; then \
91 if
[ "$(LOCALHOST_IP)" != "127.0.0.1" ]; then \
92 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
; \
93 echo
"src/or/test || true"; \
94 src
/or
/test || true
; \
100 echo
-e
"\n\nSkipping unittests\n\n"; \
105 # So, gs-gpl on s390 is broken (#457568) and fails to properly build
106 # .pdf files from .fig files using fig2dev. Therefore we ship them
107 # until this bug is fixed.
109 # of course we can always give it a try
111 # the hexdumps were built using something like
112 # perl -e 'while (<>) { print unpack ("H*", $_); }' interaction.pdf | fold > hexdump-interaction.pdf
114 # And it fails on a bunch of other archs too.
115 cd doc
/design-paper
; \
116 fig2dev
-L pdf cell-struct.fig cell-struct.pdf || \
117 ( echo
"** Using shipped pdf file because fig2dev failed"; \
118 perl
-e
'while (<>) { chomp; print pack ("H*", $$_); }' ..
/..
/debian
/hexdump-cell-struct.pdf
> cell-struct.pdf
); \
119 fig2dev
-L pdf interaction.fig interaction.pdf || \
120 ( echo
"** Using shipped pdf file because fig2dev failed"; \
121 perl
-e
'while (<>) { chomp; print pack ("H*", $$_); }' ..
/..
/debian
/hexdump-interaction.pdf
> interaction.pdf
); \
124 make
-C doc
/design-paper tor-design.ps tor-design.pdf
133 [ ! -f Makefile
] ||
$(MAKE
) distclean
143 $(MAKE
) install DESTDIR
=$(CURDIR
)/debian
/tor
144 # move tor to where it belongs
145 mv
$(CURDIR
)/debian
/tor
/etc
/tor
/torrc.sample
$(CURDIR
)/debian
/tor
/etc
/tor
/torrc
146 mv
$(CURDIR
)/debian
/tor
/usr
/bin
/tor
$(CURDIR
)/debian
/tor
/usr
/sbin
/tor
147 install -d
$(CURDIR
)/debian
/tor
/usr
/share
/man
/man8
148 mv
$(CURDIR
)/debian
/tor
/usr
/share
/man
/man1
/tor
.1 $(CURDIR
)/debian
/tor
/usr
/share
/man
/man8
/tor
.8
150 install -m
755 contrib
/torify
$(CURDIR
)/debian
/tor
/usr
/bin
151 install -m
644 contrib
/torify
.1 $(CURDIR
)/debian
/tor
/usr
/share
/man
/man1
152 install -m
644 contrib
/tor-tsocks.conf
$(CURDIR
)/debian
/tor
/etc
/tor
154 install -m
644 debian
/tor.lintian-override
$(CURDIR
)/debian
/tor
/usr
/share
/lintian
/overrides
/tor
156 install -d
-m
755 $(CURDIR
)/debian
/tor
/usr
/share
/doc
/tor
/spec
157 for i in doc
/spec
/*txt
; do \
158 install -m
644 $$i $(CURDIR
)/debian
/tor
/usr
/share
/doc
/tor
/spec || exit
1; \
161 dh_link usr
/share
/man
/man8
/tor
.8 usr
/share
/man
/man5
/torrc
.5
163 rm -f
$(CURDIR
)/debian
/tor
/usr
/bin
/tor-control.py
166 install -d
-m
755 $(CURDIR
)/debian
/tor-dbg
/usr
/share
/doc
167 ln
-s tor
$(CURDIR
)/debian
/tor-dbg
/usr
/share
/doc
/tor-dbg
170 mv
$(CURDIR
)/debian
/tor
/usr
/share
/tor
/geoip
$(CURDIR
)/debian
/tor-geoipdb
/usr
/share
/tor
171 rmdir
$(CURDIR
)/debian
/tor
/usr
/share
/tor || true
173 install -d
-m
755 $(CURDIR
)/debian
/tor-geoipdb
/usr
/share
/doc
/tor-geoipdb
174 ln
-s ..
/tor
/changelog.gz
$(CURDIR
)/debian
/tor-geoipdb
/usr
/share
/doc
/tor-geoipdb
175 ln
-s ..
/tor
/changelog.Debian.gz
$(CURDIR
)/debian
/tor-geoipdb
/usr
/share
/doc
/tor-geoipdb
177 install -m
644 debian
/tor-geoipdb.lintian-override
$(CURDIR
)/debian
/tor-geoipdb
/usr
/share
/lintian
/overrides
/tor-geoipdb
179 # Must not depend on anything. This is to be called by
180 # binary-arch/binary-indep
181 # in another 'make' thread.
185 dh_installchangelogs
--package
=tor ChangeLog
192 # Change this for debhelper compatibility level 5 or later!
193 dh_strip
--dbg-package
=tor
202 # Build architecture independant packages using the common target.
203 binary-indep
: install
204 $(MAKE
) -f debian
/rules DH_OPTIONS
=-i binary-common
206 # Build architecture dependant packages using the common target.
208 $(MAKE
) -f debian
/rules DH_OPTIONS
=-s binary-common
209 @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
211 binary
: binary-indep binary-arch
212 .PHONY
: build
clean binary-common binary-indep binary-arch binary
install