rules 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  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-arch build-indep
  32. build-arch: build-stamp
  33. build-indep: build-stamp
  34. build-stamp: config.status
  35. dh_testdir
  36. $(MAKE)
  37. set -e; \
  38. for python in $(PYTHON_VERSIONS); \
  39. do \
  40. (cd python && $$python setup.py build_ext \
  41. -L$(CURDIR)/src/.libs); \
  42. done
  43. set -e; \
  44. for python in $(PYTHON_VERSIONS); do \
  45. (cd python && $$python-dbg setup.py build_ext -L$(CURDIR)/src/.libs); \
  46. done
  47. touch build-stamp
  48. install: build
  49. dh_testdir
  50. dh_testroot
  51. dh_prep
  52. dh_installdirs
  53. # Installing package
  54. $(MAKE) prefix=$(CURDIR)/debian/tmp/usr install
  55. mv debian/tmp/usr/share/misc debian/tmp/usr/share/file
  56. install -D -m 0644 magic/magic.local debian/tmp/etc/magic
  57. install -D -m 0644 magic/magic.local debian/tmp/etc/magic.mime
  58. set -e; \
  59. for python in $(PYTHON_VERSIONS); \
  60. do \
  61. (cd python && $$python setup.py install --no-compile \
  62. --root=$(CURDIR)/debian/python-magic $(py_setup_install_args)); \
  63. done
  64. set -e; \
  65. for python in $(PYTHON_VERSIONS); do \
  66. (cd python && $$python-dbg setup.py install --no-compile \
  67. --root=$(CURDIR)/debian/python-magic-dbg $(py_setup_install_args)); \
  68. done
  69. find debian/python-*-dbg ! -type d ! -name '*.so' | xargs rm -f
  70. find debian/python-*-dbg -depth -empty -exec rmdir {} \;
  71. # Installing additional headers
  72. mkdir -p debian/libmagic-dev/usr/include/file
  73. cp src/file.h debian/libmagic-dev/usr/include/file
  74. binary: binary-arch
  75. binary-arch: install
  76. dh_testdir
  77. dh_testroot
  78. dh_installchangelogs ChangeLog
  79. dh_installdocs
  80. dh_installexamples
  81. dh_bugfiles
  82. dh_install --sourcedir=debian/tmp
  83. dh_lintian
  84. dh_link
  85. dh_python2
  86. ifeq (,$(findstring -i, $(DH_OPTIONS)))
  87. dh_strip -Npython-magic -Npython-magic-dbg
  88. DH_OPTIONS= dh_strip -ppython-magic --dbg-package=python-magic-dbg
  89. rm -rf debian/python-magic-dbg/usr/share/doc/python-magic-dbg
  90. mkdir -p debian/python-magic-dbg/usr/share/doc
  91. ln -s python-magic debian/python-magic-dbg/usr/share/doc/python-magic-dbg
  92. endif
  93. dh_compress
  94. dh_fixperms
  95. dh_makeshlibs
  96. dh_installdeb
  97. dh_shlibdeps -Llibmagic1 -ldebian/libmagic1/usr/lib
  98. dh_gencontrol
  99. dh_md5sums
  100. dh_builddeb
  101. binary-indep:
  102. .PHONY: clean build install binary binary-arch binary-indep