rules 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. #!/usr/bin/make -f
  2. -include /usr/share/python/python.mk
  3. DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
  4. DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
  5. DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
  6. ifneq ($(DEB_HOST_GNU_TYPE),$(DEB_BUILD_GNU_TYPE))
  7. CROSS= --build=$(DEB_BUILD_GNU_TYPE) --host=$(DEB_HOST_GNU_TYPE) CC=$(DEB_HOST_GNU_TYPE)-gcc LD=$(DEB_HOST_GNU_TYPE)-ld
  8. else
  9. CROSS= --build=$(DEB_BUILD_GNU_TYPE)
  10. endif
  11. # HOWMANY is the number of bytes looked at by file
  12. CFLAGS += -DHOWMANY=0x18000
  13. PYTHON_VERSIONS=$(shell pyversions -r debian/control)
  14. clean:
  15. dh_testdir
  16. dh_testroot
  17. rm -f build-stamp
  18. rm -f config.guess config.sub
  19. [ ! -f Makefile ] || $(MAKE) clean
  20. [ ! -f Makefile ] || $(MAKE) distclean
  21. rm -rf python/build
  22. dh_clean
  23. config.status: configure
  24. dh_testdir
  25. ifneq "$(wildcard /usr/share/misc/config.guess)" ""
  26. cp -f /usr/share/misc/config.guess config.guess
  27. endif
  28. ifneq "$(wildcard /usr/share/misc/config.sub)" ""
  29. cp -f /usr/share/misc/config.sub config.sub
  30. endif
  31. ./configure $(CROSS) --prefix=/usr --datadir=\$${prefix}/share --libdir=\$${prefix}/lib/$(DEB_HOST_MULTIARCH) --mandir=\$${prefix}/share/man --enable-fsect-man5 CFLAGS="$(CFLAGS)"
  32. build: build-arch build-indep
  33. build-arch: build-stamp
  34. build-indep: build-stamp
  35. build-stamp: config.status
  36. dh_testdir
  37. $(MAKE)
  38. set -e; \
  39. for python in $(PYTHON_VERSIONS); \
  40. do \
  41. (cd python && $$python setup.py build_ext \
  42. -L$(CURDIR)/src/.libs); \
  43. done
  44. set -e; \
  45. for python in $(PYTHON_VERSIONS); do \
  46. (cd python && $$python-dbg setup.py build_ext -L$(CURDIR)/src/.libs); \
  47. done
  48. touch build-stamp
  49. install: build
  50. dh_testdir
  51. dh_testroot
  52. dh_prep
  53. dh_installdirs
  54. # Installing package
  55. $(MAKE) prefix=$(CURDIR)/debian/tmp/usr install
  56. mv debian/tmp/usr/share/misc debian/tmp/usr/share/file
  57. install -D -m 0644 magic/magic.local debian/tmp/etc/magic
  58. install -D -m 0644 magic/magic.local debian/tmp/etc/magic.mime
  59. set -e; \
  60. for python in $(PYTHON_VERSIONS); \
  61. do \
  62. (cd python && $$python setup.py install --no-compile \
  63. --root=$(CURDIR)/debian/python-magic $(py_setup_install_args)); \
  64. done
  65. set -e; \
  66. for python in $(PYTHON_VERSIONS); do \
  67. (cd python && $$python-dbg setup.py install --no-compile \
  68. --root=$(CURDIR)/debian/python-magic-dbg $(py_setup_install_args)); \
  69. done
  70. find debian/python-*-dbg ! -type d ! -name '*.so' | xargs rm -f
  71. find debian/python-*-dbg -depth -empty -exec rmdir {} \;
  72. # Installing additional headers
  73. mkdir -p debian/libmagic-dev/usr/include/file
  74. cp src/file.h debian/libmagic-dev/usr/include/file
  75. binary: binary-arch
  76. binary-arch: install
  77. dh_testdir
  78. dh_testroot
  79. dh_installchangelogs ChangeLog
  80. dh_installdocs
  81. dh_installexamples
  82. dh_bugfiles
  83. dh_install --sourcedir=debian/tmp
  84. dh_lintian
  85. dh_link
  86. dh_python2
  87. ifeq (,$(findstring -i, $(DH_OPTIONS)))
  88. dh_strip -Npython-magic -Npython-magic-dbg
  89. DH_OPTIONS= dh_strip -ppython-magic --dbg-package=python-magic-dbg
  90. rm -rf debian/python-magic-dbg/usr/share/doc/python-magic-dbg
  91. mkdir -p debian/python-magic-dbg/usr/share/doc
  92. ln -s python-magic debian/python-magic-dbg/usr/share/doc/python-magic-dbg
  93. endif
  94. dh_compress
  95. dh_fixperms
  96. dh_makeshlibs
  97. dh_installdeb
  98. dh_shlibdeps -Llibmagic1 -ldebian/libmagic1/usr/lib
  99. dh_gencontrol
  100. dh_md5sums
  101. dh_builddeb
  102. binary-indep:
  103. .PHONY: clean build install binary binary-arch binary-indep