rules 6.7 KB

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