rules 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  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. configure: patch-stamp
  36. config.status: configure
  37. dh_testdir
  38. CFLAGS="$(CFLAGS)" ./configure \
  39. --host=$(DEB_HOST_GNU_TYPE) \
  40. --build=$(DEB_BUILD_GNU_TYPE) \
  41. --prefix=/usr \
  42. --mandir=\$${prefix}/share/man \
  43. --infodir=\$${prefix}/share/info \
  44. --localstatedir=/var \
  45. --sysconfdir=/etc
  46. build: build-stamp
  47. build-stamp: config.status
  48. dh_testdir
  49. $(MAKE)
  50. @echo
  51. @echo
  52. # Running unit tests
  53. date
  54. if [ "$(RUN_TEST)" != "no" ]; then \
  55. src/or/test; \
  56. else \
  57. echo -e "\n\nSkipping unittests\n\n"; \
  58. fi
  59. @echo
  60. # make design paper
  61. date
  62. if [ "$(BUILD_DOC)" != "no" ]; then \
  63. make -C doc/design-paper tor-design.ps tor-design.pdf || \
  64. ( echo -e "*\n*\n*\n*"; \
  65. echo "* Building some docs failed, perhaps because you did not install the"; \
  66. echo "* declared build dependencies and then used -o with dpkg-buildpackage."; \
  67. echo "*"; \
  68. echo "* If you want to skip this part, you can set nodoc in DEB_BUILD_OPTIONS" ; \
  69. echo "* and start the build again. DEB_BUILD_OPTIONS=nodoc dpkg-buildpackage.."; \
  70. echo -e "*\n*\n*\n*"; \
  71. false ); \
  72. else \
  73. echo -e "\n\nSkipping tor-design.{ps,pdf}\n\n"; \
  74. fi
  75. date
  76. touch build-stamp
  77. clean: unpatch
  78. dh_testdir
  79. dh_testroot
  80. rm -f build-stamp
  81. -$(MAKE) distclean
  82. dh_clean
  83. install: build
  84. dh_testdir
  85. dh_testroot
  86. dh_clean -k
  87. dh_installdirs
  88. $(MAKE) install DESTDIR=$(CURDIR)/debian/tor
  89. # move tor to where it belongs
  90. mv $(CURDIR)/debian/tor/etc/tor/torrc.sample $(CURDIR)/debian/tor/etc/tor/torrc
  91. mv $(CURDIR)/debian/tor/usr/bin/tor $(CURDIR)/debian/tor/usr/sbin/tor
  92. install -d $(CURDIR)/debian/tor/usr/share/man/man8
  93. mv $(CURDIR)/debian/tor/usr/share/man/man1/tor.1 $(CURDIR)/debian/tor/usr/share/man/man8/tor.8
  94. install -m 755 contrib/torify $(CURDIR)/debian/tor/usr/bin
  95. install -m 644 contrib/torify.1 $(CURDIR)/debian/tor/usr/share/man/man1
  96. install -m 644 contrib/tor-tsocks.conf $(CURDIR)/debian/tor/etc/tor
  97. install -m 644 debian/tor.lintian-override $(CURDIR)/debian/tor/usr/share/lintian/overrides/tor
  98. dh_link usr/share/man/man8/tor.8 usr/share/man/man5/torrc.5
  99. rm -f $(CURDIR)/debian/tor/usr/bin/tor-control.py
  100. # Build architecture-independent files here.
  101. binary-indep: build install
  102. # We have nothing to do by default.
  103. # Build architecture-dependent files here.
  104. binary-arch: build install
  105. dh_testdir
  106. dh_testroot
  107. dh_installchangelogs ChangeLog
  108. dh_installdocs
  109. if [ "$(BUILD_DOC)" != "no" ]; then \
  110. install -m 644 doc/design-paper/tor-design.ps $(CURDIR)/debian/tor/usr/share/doc/tor/; \
  111. install -m 644 doc/design-paper/tor-design.pdf $(CURDIR)/debian/tor/usr/share/doc/tor/; \
  112. fi
  113. dh_installexamples
  114. # dh_install
  115. # dh_installdebconf
  116. dh_installlogrotate
  117. # dh_installemacsen
  118. # dh_installmime
  119. dh_installinit
  120. # dh_installcron
  121. dh_installman
  122. dh_link
  123. #dh_strip
  124. dh_compress
  125. dh_fixperms
  126. dh_installdeb
  127. dh_shlibdeps
  128. dh_gencontrol
  129. dh_md5sums
  130. dh_builddeb
  131. binary: binary-indep binary-arch
  132. .PHONY: build clean binary-indep binary-arch binary install