rules 4.1 KB

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