rules 3.6 KB

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