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