rules 3.2 KB

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