rules 5.1 KB

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