rules 3.9 KB

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