rules 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. #!/usr/bin/make -f
  2. SHELL := sh -e
  3. -include /usr/share/python/python.mk
  4. DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
  5. DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
  6. DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
  7. ifneq ($(DEB_HOST_GNU_TYPE),$(DEB_BUILD_GNU_TYPE))
  8. CROSS= --build=$(DEB_BUILD_GNU_TYPE) --host=$(DEB_HOST_GNU_TYPE) CC=$(DEB_HOST_GNU_TYPE)-gcc LD=$(DEB_HOST_GNU_TYPE)-ld
  9. else
  10. CROSS= --build=$(DEB_BUILD_GNU_TYPE)
  11. endif
  12. # HOWMANY is the number of bytes looked at by file
  13. CFLAGS += -DHOWMANY=0x18000
  14. PYTHON_VERSIONS=$(shell pyversions -r debian/control)
  15. PYTHON3_VERSIONS=$(shell py3versions -r debian/control)
  16. %:
  17. dh ${@} --with autotools_dev,python2,python3
  18. override_dh_auto_clean:
  19. dh_auto_clean
  20. rm -rf python/build
  21. rm -rf python/__pycache__
  22. rm -f python/*.pyc
  23. override_dh_auto_build:
  24. dh_auto_build
  25. for python in $(PYTHON_VERSIONS); \
  26. do \
  27. (cd python && $$python setup.py build_ext \
  28. -L$(CURDIR)/src/.libs); \
  29. done
  30. for python in $(PYTHON3_VERSIONS); \
  31. do \
  32. (cd python && $$python setup.py build_ext \
  33. -L$(CURDIR)/src/.libs); \
  34. done
  35. override_dh_auto_configure:
  36. dh_auto_configure -- $(CROSS) --prefix=/usr --datadir=\$${prefix}/share --libdir=\$${prefix}/lib/$(DEB_HOST_MULTIARCH) --mandir=\$${prefix}/share/man --enable-fsect-man5 --enable-static --disable-silent-rules CFLAGS="$(CFLAGS)"
  37. override_dh_auto_install:
  38. dh_auto_install
  39. mv debian/tmp/usr/share/misc debian/tmp/usr/share/file
  40. install -D -m 0644 magic/magic.local debian/tmp/etc/magic
  41. install -D -m 0644 magic/magic.local debian/tmp/etc/magic.mime
  42. for python in $(PYTHON_VERSIONS); \
  43. do \
  44. (cd python && $$python setup.py install --no-compile \
  45. --root=$(CURDIR)/debian/python-magic $(py_setup_install_args)); \
  46. done
  47. for python in $(PYTHON3_VERSIONS); \
  48. do \
  49. (cd python && $$python setup.py install --no-compile \
  50. --root=$(CURDIR)/debian/python3-magic $(py_setup_install_args)); \
  51. done
  52. # Installing additional headers
  53. mkdir -p debian/libmagic-dev/usr/include/file
  54. cp src/file.h debian/libmagic-dev/usr/include/file
  55. # Removing useless files
  56. rm -f debian/tmp/usr/lib/*/*.la
  57. override_dh_builddeb:
  58. dh_builddeb -- -Zxz
  59. override_dh_install:
  60. dh_install --fail-missing
  61. override_dh_shlibdeps:
  62. dh_shlibdeps -Llibmagic1 -ldebian/libmagic1/usr/lib
  63. override_dh_strip:
  64. dh_strip --dbg-package=file-dbg