rules 4.2 KB

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