rules 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. #!/usr/bin/make -f
  2. # debian/rules for the dpkg suite.
  3. # Copyright © 2004 Scott James Remnant <scott@netsplit.com>
  4. WFLAGS := -Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers
  5. CFLAGS = -g $(WFLAGS)
  6. CXXFLAGS = -g $(WFLAGS)
  7. # Disable optimisations if ‘noopt’ found in $DEB_BUILD_OPTIONS
  8. ifneq (,$(filter noopt,$(DEB_BUILD_OPTIONS)))
  9. CFLAGS += -O0
  10. CXXFLAGS += -O0
  11. else
  12. CFLAGS += -O2
  13. CXXFLAGS += -O2
  14. endif
  15. # These are used for cross-compiling and for saving the configure script
  16. # from having to guess our platform (since we know it already)
  17. DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
  18. DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
  19. ifeq ($(DEB_BUILD_GNU_TYPE), $(DEB_HOST_GNU_TYPE))
  20. confflags += --build=$(DEB_HOST_GNU_TYPE)
  21. else
  22. confflags += --build=$(DEB_BUILD_GNU_TYPE) --host=$(DEB_HOST_GNU_TYPE)
  23. endif
  24. # Don't enable everything on all platforms
  25. DEB_HOST_ARCH_OS ?= $(shell dpkg-architecture -qDEB_HOST_ARCH_OS)
  26. ifeq ($(DEB_HOST_ARCH_OS),linux)
  27. confflags += --with-selinux
  28. endif
  29. ifeq (,$(filter maintainer-build,$(DEB_BUILD_OPTIONS)))
  30. confflags += --disable-silent-rules
  31. endif
  32. # Create configure script if necessary, automake handles rebuilding it.
  33. configure:
  34. dh_testdir
  35. autoreconf -v -i
  36. # Configure the build tree
  37. build-tree/config.status: configure
  38. dh_testdir
  39. install -d build-tree
  40. cd build-tree && ../configure $(confflags) \
  41. CFLAGS="$(CFLAGS)" CXXFLAGS="$(CXXFLAGS)" \
  42. --prefix=/usr \
  43. --mandir=\$${datadir}/man \
  44. --infodir=\$${datadir}/info \
  45. --sysconfdir=/etc \
  46. --localstatedir=/var \
  47. --with-zlib \
  48. --with-bz2
  49. # Build the package in build-tree
  50. build-indep build-arch build: build-tree/config.status
  51. dh_testdir
  52. cd build-tree && $(MAKE)
  53. # Run the test suites
  54. check: build
  55. dh_testdir
  56. ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
  57. cd build-tree && $(MAKE) check
  58. endif
  59. # Install the package underneath debian/tmp
  60. install: check
  61. dh_testdir
  62. dh_testroot
  63. dh_prep
  64. dh_installdirs
  65. cd build-tree && $(MAKE) DESTDIR="$(CURDIR)/debian/tmp" install
  66. ifeq (yes,$(shell dpkg-vendor --derives-from Ubuntu && echo yes))
  67. # Ubuntu's «i386» architecture is built for i686 (the Debian default
  68. # is i486).
  69. sed -ri 's/^(i386[[:space:]]+)[^[:space:]]+/\1i686/' \
  70. $(CURDIR)/debian/tmp/usr/share/dpkg/cputable
  71. endif
  72. # Put together the dpkg and dselect packages
  73. binary-arch: install
  74. dh_testdir -a
  75. dh_testroot -a
  76. dh_install --sourcedir=debian/tmp -a
  77. dh_installcron -a
  78. dh_installlogrotate -a
  79. install -d debian/dpkg/sbin
  80. mv debian/dpkg/usr/sbin/start-stop-daemon debian/dpkg/sbin
  81. dh_installchangelogs -a ChangeLog*
  82. dh_installdocs -a
  83. dh_link -a
  84. dh_lintian -a
  85. dh_strip -a
  86. dh_compress -a
  87. dh_fixperms -a
  88. dh_installdeb -a
  89. dh_shlibdeps -a
  90. dh_gencontrol -a
  91. dh_md5sums -a
  92. dh_builddeb -a
  93. # Put together the dpkg-dev package
  94. binary-indep: install
  95. dh_testdir -i
  96. dh_testroot -i
  97. dh_install --sourcedir=debian/tmp -i
  98. dh_installcron -i
  99. dh_installchangelogs -i ChangeLog*
  100. dh_installdocs -i
  101. dh_link -i
  102. dh_lintian -i
  103. dh_strip -i
  104. dh_compress -i
  105. dh_fixperms -i
  106. dh_installdeb -i
  107. dh_gencontrol -i
  108. dh_md5sums -i
  109. dh_builddeb -i
  110. binary: binary-arch binary-indep
  111. # Clean up the mess we made
  112. clean:
  113. dh_testdir
  114. [ ! -f Makefile ] || $(MAKE) distclean
  115. rm -rf build-tree
  116. dh_clean
  117. .PHONY: build check install binary-arch binary-indep binary clean