rules 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  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. # Put together the dpkg and dselect packages
  65. binary-arch: install
  66. dh_testdir -a
  67. dh_testroot -a
  68. dh_install --sourcedir=debian/tmp -a
  69. dh_installcron -a
  70. dh_installlogrotate -a
  71. install -d debian/dpkg/sbin
  72. mv debian/dpkg/usr/sbin/start-stop-daemon debian/dpkg/sbin
  73. dh_installchangelogs -a ChangeLog*
  74. dh_installdocs -a
  75. dh_link -a
  76. dh_lintian -a
  77. dh_strip -a
  78. dh_compress -a
  79. dh_fixperms -a
  80. dh_installdeb -a
  81. dh_shlibdeps -a
  82. dh_gencontrol -a
  83. dh_md5sums -a
  84. dh_builddeb -a
  85. # Put together the dpkg-dev package
  86. binary-indep: install
  87. dh_testdir -i
  88. dh_testroot -i
  89. dh_install --sourcedir=debian/tmp -i
  90. dh_installcron -i
  91. dh_installchangelogs -i ChangeLog*
  92. dh_installdocs -i
  93. dh_link -i
  94. dh_lintian -i
  95. dh_strip -i
  96. dh_compress -i
  97. dh_fixperms -i
  98. dh_installdeb -i
  99. dh_gencontrol -i
  100. dh_md5sums -i
  101. dh_builddeb -i
  102. binary: binary-arch binary-indep
  103. # Clean up the mess we made
  104. clean:
  105. dh_testdir
  106. [ ! -f Makefile ] || $(MAKE) distclean
  107. rm -rf build-tree
  108. dh_clean
  109. .PHONY: build check install binary-arch binary-indep binary clean