rules 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212
  1. #!/usr/bin/make -f
  2. # -*- makefile -*-
  3. # Sample debian/rules that uses debhelper.
  4. # GNU copyright 1997 to 1999 by Joey Hess.
  5. # Uncomment this to turn on verbose mode.
  6. #export DH_VERBOSE=1
  7. export PACKAGE=tor
  8. include /usr/share/dpatch/dpatch.make
  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. #
  12. # See /usr/share/doc/autotools-dev/README.Debian.gz which suggests
  13. # this way of passing --build and --host. Also see the thread on
  14. # debian-devel './configure in debian/rules' from February/March 2006,
  15. # starting with <43FF212C.5020800@xs4all.nl> by Pjotr Kourzanov.
  16. export DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
  17. export DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
  18. ifeq ($(DEB_BUILD_GNU_TYPE), $(DEB_HOST_GNU_TYPE))
  19. confflags += --build $(DEB_HOST_GNU_TYPE)
  20. else
  21. confflags += --build $(DEB_BUILD_GNU_TYPE) --host $(DEB_HOST_GNU_TYPE)
  22. endif
  23. CFLAGS ?= -Wall -g
  24. LOCALHOST_IP ?= $(shell getent hosts localhost | awk '{print $$1}')
  25. # Do not optimize the build with "noopt"
  26. ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
  27. CFLAGS += -O0
  28. else
  29. CFLAGS += -O2
  30. endif
  31. # Do not strip the binary with "nostrip"
  32. #ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
  33. # INSTALL_PROGRAM += -s
  34. #endif
  35. # Prevent the unit tests from being run with "nocheck"
  36. ifneq (,$(findstring nocheck,$(DEB_BUILD_OPTIONS)))
  37. RUN_TEST = no
  38. endif
  39. ifneq (,$(findstring notest,$(DEB_BUILD_OPTIONS)))
  40. RUN_TEST = no
  41. endif
  42. # Support passing of parallel=<n> in build options
  43. ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
  44. NUMJOBS = $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
  45. MAKEFLAGS += -j$(NUMJOBS)
  46. endif
  47. CONF_OPTIONS =
  48. # build against libdmalloc4 - it better be installed
  49. ifneq (,$(findstring with-dmalloc,$(DEB_BUILD_OPTIONS)))
  50. CONF_OPTIONS += --with-dmalloc
  51. endif
  52. # inhibit building with --enable-openbsd-malloc
  53. ifeq (,$(findstring no-enable-openbsd-malloc,$(DEB_BUILD_OPTIONS)))
  54. CONF_OPTIONS += --enable-openbsd-malloc
  55. endif
  56. configure: patch-stamp
  57. config.status: configure
  58. @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
  59. dh_testdir
  60. CFLAGS="$(CFLAGS)" ./configure \
  61. $(confflags) \
  62. --prefix=/usr \
  63. --mandir=\$${prefix}/share/man \
  64. --infodir=\$${prefix}/share/info \
  65. --localstatedir=/var \
  66. --sysconfdir=/etc \
  67. $(CONF_OPTIONS)
  68. build: build-stamp
  69. build-stamp: config.status
  70. 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"; \
  86. fi
  87. @echo
  88. # XXX
  89. # So, gs-gpl on s390 is broken (#457568) and fails to properly build
  90. # .pdf files from .fig files using fig2dev. Therefore we ship them
  91. # until this bug is fixed.
  92. #
  93. # of course we can always give it a try
  94. #
  95. # the hexdumps were built using something like
  96. # perl -e 'while (<>) { print unpack ("H*", $_); }' interaction.pdf | fold > hexdump-interaction.pdf
  97. #
  98. # And it fails on a bunch of other archs too.
  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 ); \
  106. # XXX ends
  107. make -C doc/design-paper tor-design.ps tor-design.pdf
  108. touch build-stamp
  109. clean: unpatch
  110. dh_testdir
  111. dh_testroot
  112. rm -f build-stamp
  113. [ ! -f Makefile ] || $(MAKE) distclean
  114. dh_clean
  115. install: build
  116. dh_testdir
  117. dh_testroot
  118. dh_clean -k
  119. dh_installdirs
  120. $(MAKE) install DESTDIR=$(CURDIR)/debian/tor
  121. # move tor to where it belongs
  122. mv $(CURDIR)/debian/tor/etc/tor/torrc.sample $(CURDIR)/debian/tor/etc/tor/torrc
  123. mv $(CURDIR)/debian/tor/usr/bin/tor $(CURDIR)/debian/tor/usr/sbin/tor
  124. install -d $(CURDIR)/debian/tor/usr/share/man/man8
  125. mv $(CURDIR)/debian/tor/usr/share/man/man1/tor.1 $(CURDIR)/debian/tor/usr/share/man/man8/tor.8
  126. install -m 755 contrib/torify $(CURDIR)/debian/tor/usr/bin
  127. install -m 644 contrib/torify.1 $(CURDIR)/debian/tor/usr/share/man/man1
  128. install -m 644 contrib/tor-tsocks.conf $(CURDIR)/debian/tor/etc/tor
  129. install -m 644 debian/tor.lintian-override $(CURDIR)/debian/tor/usr/share/lintian/overrides/tor
  130. install -d -m 755 $(CURDIR)/debian/tor/usr/share/doc/tor/spec
  131. for i in doc/spec/*txt; do \
  132. install -m 644 $$i $(CURDIR)/debian/tor/usr/share/doc/tor/spec || exit 1; \
  133. done
  134. dh_link usr/share/man/man8/tor.8 usr/share/man/man5/torrc.5
  135. rm -f $(CURDIR)/debian/tor/usr/bin/tor-control.py
  136. # tor-dbg doc dir
  137. install -d -m 755 $(CURDIR)/debian/tor-dbg/usr/share/doc
  138. ln -s tor $(CURDIR)/debian/tor-dbg/usr/share/doc/tor-dbg
  139. # tor-geoip
  140. mv $(CURDIR)/debian/tor/usr/share/tor/geoip $(CURDIR)/debian/tor-geoipdb/usr/share/tor
  141. rmdir $(CURDIR)/debian/tor/usr/share/tor || true
  142. install -d -m 755 $(CURDIR)/debian/tor-geoipdb/usr/share/doc/tor-geoipdb
  143. ln -s ../tor/changelog.gz $(CURDIR)/debian/tor-geoipdb/usr/share/doc/tor-geoipdb
  144. ln -s ../tor/changelog.Debian.gz $(CURDIR)/debian/tor-geoipdb/usr/share/doc/tor-geoipdb
  145. install -m 644 debian/tor-geoipdb.lintian-override $(CURDIR)/debian/tor-geoipdb/usr/share/lintian/overrides/tor-geoipdb
  146. # Must not depend on anything. This is to be called by
  147. # binary-arch/binary-indep
  148. # in another 'make' thread.
  149. binary-common:
  150. dh_testdir
  151. dh_testroot
  152. dh_installchangelogs --package=tor ChangeLog
  153. dh_installdocs
  154. dh_installexamples
  155. dh_installlogrotate
  156. dh_installinit
  157. dh_installman
  158. dh_link
  159. # Change this for debhelper compatibility level 5 or later!
  160. dh_strip --dbg-package=tor
  161. dh_compress
  162. dh_fixperms
  163. dh_installdeb
  164. dh_shlibdeps
  165. dh_gencontrol
  166. dh_md5sums
  167. dh_builddeb
  168. # Build architecture independant packages using the common target.
  169. binary-indep: install
  170. $(MAKE) -f debian/rules DH_OPTIONS=-i binary-common
  171. # Build architecture dependant packages using the common target.
  172. binary-arch: install
  173. $(MAKE) -f debian/rules DH_OPTIONS=-s binary-common
  174. @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
  175. binary: binary-indep binary-arch
  176. .PHONY: build clean binary-common binary-indep binary-arch binary install