rules 3.1 KB

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