rules 3.7 KB

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