rules 3.2 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. CFLAGS = -g $(WFLAGS)
  6. CXXFLAGS = -g $(WFLAGS)
  7. # Disable optimisations if ‘noopt’ found in $DEB_BUILD_OPTIONS
  8. ifneq (,$(findstring 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=static
  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. --prefix=/usr \
  40. --mandir=\$${datadir}/man \
  41. --infodir=\$${datadir}/info \
  42. --sysconfdir=/etc \
  43. --localstatedir=/var/lib \
  44. --with-zlib=static \
  45. --with-bz2=static
  46. # Build the package in build-tree
  47. build: build-tree/config.status
  48. dh_testdir
  49. cd build-tree && $(MAKE)
  50. cd build-tree && $(MAKE) check
  51. # Install the package underneath debian/tmp
  52. install: build
  53. dh_testdir
  54. dh_testroot
  55. dh_clean -k
  56. dh_installdirs
  57. cd build-tree && $(MAKE) DESTDIR="$(CURDIR)/debian/tmp" install
  58. # Put together the dpkg and dselect packages
  59. binary-arch: install
  60. dh_testdir -a
  61. dh_testroot -a
  62. dh_install --sourcedir=debian/tmp -a
  63. dh_installlogrotate -a
  64. install -d debian/dpkg/sbin
  65. mv debian/dpkg/usr/sbin/start-stop-daemon debian/dpkg/sbin
  66. dh_installchangelogs -a ChangeLog
  67. dh_installdocs -a
  68. install -d debian/dpkg/usr/share/lintian/overrides
  69. install -m 644 debian/dpkg.lintian-overrides \
  70. debian/dpkg/usr/share/lintian/overrides/dpkg
  71. install -d debian/dselect/usr/share/lintian/overrides
  72. install -m 644 debian/dselect.lintian-overrides \
  73. debian/dselect/usr/share/lintian/overrides/dselect
  74. dh_strip -a
  75. dh_compress -a
  76. dh_fixperms -a
  77. dh_installdeb -a
  78. dh_shlibdeps -a
  79. dh_gencontrol -a
  80. dh_md5sums -a
  81. dh_builddeb -a
  82. # Put together the dpkg-dev package
  83. binary-indep: install
  84. dh_testdir -i
  85. dh_testroot -i
  86. dh_install --sourcedir=debian/tmp -i
  87. dh_installchangelogs -i ChangeLog
  88. dh_installdocs -i
  89. install -d debian/dpkg-dev/usr/share/lintian/overrides
  90. install -m 644 debian/dpkg-dev.lintian-overrides \
  91. debian/dpkg-dev/usr/share/lintian/overrides/dpkg-dev
  92. dh_strip -i
  93. dh_compress -i
  94. dh_fixperms -i
  95. dh_installdeb -i
  96. dh_gencontrol -i
  97. dh_md5sums -i
  98. dh_builddeb -i
  99. binary: binary-arch binary-indep
  100. # Clean up the mess we made
  101. clean:
  102. dh_testdir
  103. rm -rf build-tree
  104. dh_clean
  105. .PHONY: build install binary-arch binary-indep binary clean