rules 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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. %:
  16. dh ${@} --with autotools_dev,python2
  17. override_dh_auto_clean:
  18. dh_auto_clean
  19. rm -rf python/build
  20. override_dh_auto_build:
  21. dh_auto_build
  22. for python in $(PYTHON_VERSIONS); \
  23. do \
  24. (cd python && $$python setup.py build_ext \
  25. -L$(CURDIR)/src/.libs); \
  26. done
  27. for python in $(PYTHON_VERSIONS); do \
  28. (cd python && $$python-dbg setup.py build_ext -L$(CURDIR)/src/.libs); \
  29. done
  30. override_dh_auto_configure:
  31. dh_auto_configure -- $(CROSS) --prefix=/usr --datadir=\$${prefix}/share --libdir=\$${prefix}/lib/$(DEB_HOST_MULTIARCH) --mandir=\$${prefix}/share/man --enable-fsect-man5 CFLAGS="$(CFLAGS)"
  32. override_dh_auto_install:
  33. dh_auto_install
  34. mv debian/tmp/usr/share/misc debian/tmp/usr/share/file
  35. install -D -m 0644 magic/magic.local debian/tmp/etc/magic
  36. install -D -m 0644 magic/magic.local debian/tmp/etc/magic.mime
  37. for python in $(PYTHON_VERSIONS); \
  38. do \
  39. (cd python && $$python setup.py install --no-compile \
  40. --root=$(CURDIR)/debian/python-magic $(py_setup_install_args)); \
  41. done
  42. # Installing additional headers
  43. mkdir -p debian/libmagic-dev/usr/include/file
  44. cp src/file.h debian/libmagic-dev/usr/include/file
  45. # Removing useless files
  46. rm -f debian/tmp/usr/lib/*/*.la
  47. override_dh_builddeb:
  48. dh_builddeb -- -Zxz -z9
  49. override_dh_install:
  50. dh_install --fail-missing
  51. override_dh_shlibdeps:
  52. dh_shlibdeps -Llibmagic1 -ldebian/libmagic1/usr/lib