rules 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  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. CFLAGS = -g $(WFLAGS)
  6. CXXFLAGS = -g $(WFLAGS)
  7. # Disable optimisations if ‘noopt’ found in $DEB_BUILD_OPTIONS
  8. ifneq (,$(filter noopt,$(DEB_BUILD_OPTIONS)))
  9. CFLAGS += -O0
  10. CXXFLAGS += -O0
  11. else
  12. CFLAGS += -O2
  13. CXXFLAGS += -O2
  14. endif
  15. # These are used for cross-compiling and for saving the configure script
  16. # from having to guess our platform (since we know it already)
  17. DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
  18. DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
  19. ifeq ($(DEB_BUILD_GNU_TYPE), $(DEB_HOST_GNU_TYPE))
  20. confflags += --build=$(DEB_HOST_GNU_TYPE)
  21. else
  22. confflags += --build=$(DEB_BUILD_GNU_TYPE) --host=$(DEB_HOST_GNU_TYPE)
  23. endif
  24. # Don't enable everything on all platforms
  25. DEB_HOST_ARCH_OS ?= $(shell dpkg-architecture -qDEB_HOST_ARCH_OS)
  26. ifeq ($(DEB_HOST_ARCH_OS),linux)
  27. confflags += --with-selinux
  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. CFLAGS="$(CFLAGS)" CXXFLAGS="$(CXXFLAGS)" \
  39. --disable-silent-rules \
  40. --prefix=/usr \
  41. --mandir=\$${datadir}/man \
  42. --infodir=\$${datadir}/info \
  43. --sysconfdir=/etc \
  44. --localstatedir=/var/lib \
  45. --with-zlib \
  46. --with-bz2
  47. # Build the package in build-tree
  48. 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) check
  56. endif
  57. # Install the package underneath debian/tmp
  58. install: check
  59. dh_testdir
  60. dh_testroot
  61. dh_clean -k
  62. dh_installdirs
  63. cd build-tree && $(MAKE) DESTDIR="$(CURDIR)/debian/tmp" install
  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 -XDpkg/Gettext.pm
  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