rules 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  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. CONF_OPTIONS =
  43. # build against libdmalloc4 - it better be installed
  44. ifneq (,$(findstring with-dmalloc,$(DEB_BUILD_OPTIONS)))
  45. CONF_OPTIONS += --with-dmalloc
  46. endif
  47. # inhibit building with --enable-openbsd-malloc
  48. ifeq (,$(findstring no-enable-openbsd-malloc,$(DEB_BUILD_OPTIONS)))
  49. CONF_OPTIONS += --enable-openbsd-malloc
  50. 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. $(confflags) \
  57. --prefix=/usr \
  58. --mandir=\$${prefix}/share/man \
  59. --infodir=\$${prefix}/share/info \
  60. --localstatedir=/var \
  61. --sysconfdir=/etc \
  62. $(CONF_OPTIONS)
  63. build: build-stamp
  64. build-stamp: config.status
  65. dh_testdir
  66. $(MAKE)
  67. @echo
  68. @echo
  69. # Running unit tests
  70. @if [ "$(RUN_TEST)" != "no" ]; then \
  71. if [ "$(LOCALHOST_IP)" != "127.0.0.1" ]; then \
  72. 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; \
  73. echo "src/or/test || true"; \
  74. src/or/test || true; \
  75. else \
  76. echo "src/or/test"; \
  77. src/or/test; \
  78. fi; \
  79. else \
  80. echo -e "\n\nSkipping unittests\n\n"; \
  81. fi
  82. @echo
  83. # XXX
  84. # So, gs-gpl on s390 is broken (#457568) and fails to properly build
  85. # .pdf files from .fig files using fig2dev. Therefore we ship them
  86. # until this bug is fixed.
  87. #
  88. # of course we can always give it a try
  89. #
  90. # the hexdumps were built using something like
  91. # perl -e 'while (<>) { print unpack ("H*", $_); }' interaction.pdf | fold > hexdump-interaction.pdf
  92. #
  93. # And it fails on a bunch of other archs too.
  94. cd doc/design-paper; \
  95. fig2dev -L pdf cell-struct.fig cell-struct.pdf || \
  96. ( echo "** Using shipped pdf file because fig2dev failed"; \
  97. perl -e 'while (<>) { chomp; print pack ("H*", $$_); }' ../../debian/hexdump-cell-struct.pdf > cell-struct.pdf ); \
  98. fig2dev -L pdf interaction.fig interaction.pdf || \
  99. ( echo "** Using shipped pdf file because fig2dev failed"; \
  100. perl -e 'while (<>) { chomp; print pack ("H*", $$_); }' ../../debian/hexdump-interaction.pdf > interaction.pdf ); \
  101. # XXX ends
  102. make -C doc/design-paper tor-design.ps tor-design.pdf
  103. touch build-stamp
  104. clean: unpatch
  105. dh_testdir
  106. dh_testroot
  107. rm -f build-stamp
  108. -$(MAKE) distclean
  109. dh_clean
  110. install: build
  111. dh_testdir
  112. dh_testroot
  113. dh_clean -k
  114. dh_installdirs
  115. $(MAKE) install DESTDIR=$(CURDIR)/debian/tor
  116. # move tor to where it belongs
  117. mv $(CURDIR)/debian/tor/etc/tor/torrc.sample $(CURDIR)/debian/tor/etc/tor/torrc
  118. mv $(CURDIR)/debian/tor/usr/bin/tor $(CURDIR)/debian/tor/usr/sbin/tor
  119. install -d $(CURDIR)/debian/tor/usr/share/man/man8
  120. mv $(CURDIR)/debian/tor/usr/share/man/man1/tor.1 $(CURDIR)/debian/tor/usr/share/man/man8/tor.8
  121. install -m 755 contrib/torify $(CURDIR)/debian/tor/usr/bin
  122. install -m 644 contrib/torify.1 $(CURDIR)/debian/tor/usr/share/man/man1
  123. install -m 644 contrib/tor-tsocks.conf $(CURDIR)/debian/tor/etc/tor
  124. install -m 644 debian/tor.lintian-override $(CURDIR)/debian/tor/usr/share/lintian/overrides/tor
  125. install -d -m 755 $(CURDIR)/debian/tor/usr/share/doc/tor/spec
  126. for i in doc/spec/*txt; do \
  127. install -m 644 $$i $(CURDIR)/debian/tor/usr/share/doc/tor/spec || exit 1; \
  128. done
  129. dh_link usr/share/man/man8/tor.8 usr/share/man/man5/torrc.5
  130. rm -f $(CURDIR)/debian/tor/usr/bin/tor-control.py
  131. install -d -m 755 $(CURDIR)/debian/tor-dbg/usr/share/doc
  132. ln -s tor $(CURDIR)/debian/tor-dbg/usr/share/doc/tor-dbg
  133. # Build architecture-independent files here.
  134. binary-indep: build install
  135. # We have nothing to do by default.
  136. # Build architecture-dependent files here.
  137. binary-arch: build install
  138. dh_testdir
  139. dh_testroot
  140. dh_installchangelogs ChangeLog
  141. dh_installdocs
  142. dh_installexamples
  143. # dh_install
  144. # dh_installdebconf
  145. dh_installlogrotate
  146. # dh_installemacsen
  147. # dh_installmime
  148. dh_installinit
  149. # dh_installcron
  150. dh_installman
  151. dh_link
  152. # Change this for debhelper compatibility level 5 or later!
  153. dh_strip --dbg-package=tor
  154. dh_compress
  155. dh_fixperms
  156. dh_installdeb
  157. dh_shlibdeps
  158. dh_gencontrol
  159. dh_md5sums
  160. dh_builddeb
  161. @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
  162. binary: binary-indep binary-arch
  163. .PHONY: build clean binary-indep binary-arch binary install