rules 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. #!/usr/bin/make -f
  2. # debian/rules for the dpkg suite.
  3. # Copyright © 2004 Scott James Remnant <scott@netsplit.com>
  4. CFLAGS = -Wall -g
  5. CXXFLAGS = -Wall -g
  6. # Disable optimisations if ‘noopt’ found in $DEB_BUILD_OPTIONS
  7. ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
  8. CFLAGS += -O0
  9. CXXFLAGS += -O0
  10. else
  11. CFLAGS += -O2
  12. CXXFLAGS += -O2
  13. endif
  14. # These are used for cross-compiling and for saving the configure script
  15. # from having to guess our platform (since we know it already)
  16. DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
  17. DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
  18. ifeq ($(DEB_BUILD_GNU_TYPE), $(DEB_HOST_GNU_TYPE))
  19. confflags += --build=$(DEB_HOST_GNU_TYPE)
  20. else
  21. confflags += --build=$(DEB_BUILD_GNU_TYPE) --host=$(DEB_HOST_GNU_TYPE)
  22. endif
  23. # Don't enable everything on all platforms
  24. DEB_HOST_ARCH_OS ?= $(shell dpkg-architecture -qDEB_HOST_ARCH_OS)
  25. ifeq ($(DEB_HOST_ARCH_OS),linux)
  26. confflags += --with-selinux=static
  27. endif
  28. # Create configure script if necessary, automake handles rebuilding it.
  29. configure:
  30. dh_testdir
  31. autoreconf -v -i
  32. # Configure the build tree
  33. build-tree/config.status: configure
  34. dh_testdir
  35. install -d build-tree
  36. cd build-tree && ../configure $(confflags) \
  37. CFLAGS="$(CFLAGS)" CXXFLAGS="$(CXXFLAGS)" \
  38. --prefix=/usr \
  39. --mandir=\$${datadir}/man \
  40. --infodir=\$${datadir}/info \
  41. --sysconfdir=/etc \
  42. --localstatedir=/var/lib \
  43. --with-zlib=static \
  44. --with-bz2=static
  45. # Build the package in build-tree
  46. build: build-tree/config.status
  47. dh_testdir
  48. cd build-tree && $(MAKE)
  49. # Install the package underneath debian/tmp
  50. install: build
  51. dh_testdir
  52. dh_testroot
  53. dh_clean -k
  54. dh_installdirs
  55. cd build-tree && $(MAKE) DESTDIR="$(CURDIR)/debian/tmp" install
  56. # Put together the dpkg and dselect packages
  57. binary-arch: install
  58. dh_testdir -a
  59. dh_testroot -a
  60. dh_install --sourcedir=debian/tmp -a
  61. dh_installlogrotate -a
  62. install -d debian/dpkg/sbin
  63. mv debian/dpkg/usr/sbin/start-stop-daemon debian/dpkg/sbin
  64. dh_installchangelogs -pdpkg ChangeLog
  65. dh_installdocs -pdpkg
  66. install -d debian/dselect/usr/share/doc
  67. ln -s dpkg debian/dselect/usr/share/doc/dselect
  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. install -d debian/dpkg-dev/usr/share/doc
  88. ln -s dpkg debian/dpkg-dev/usr/share/doc/dpkg-dev
  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