rules 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. #!/usr/bin/make -f
  2. # Uncomment this to turn on verbose mode.
  3. #export DH_VERBOSE=1
  4. include /usr/share/dpatch/dpatch.make
  5. # These are used for cross-compiling and for saving the configure script
  6. # from having to guess our platform (since we know it already)
  7. DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
  8. DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
  9. # HOWMANY is the number of bytes looked at by file
  10. CFLAGS = -DHOWMANY=0x18000
  11. CFLAGS += -Wall -g
  12. ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
  13. CFLAGS += -O0
  14. else
  15. CFLAGS += -O2
  16. endif
  17. PYTHON_VERSIONS=$(shell pyversions -r debian/control)
  18. config.status: configure patch
  19. dh_testdir
  20. # Configuring package
  21. mv config.sub config.sub.upstream && ln -s /usr/share/misc/config.sub
  22. mv config.guess config.guess.upstream && ln -s /usr/share/misc/config.guess
  23. CFLAGS="$(CFLAGS)" ./configure --host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE) --prefix=/usr --datadir=\$${prefix}/share --mandir=\$${prefix}/share/man --enable-fsect-man5
  24. rm config.sub && mv config.sub.upstream config.sub
  25. rm config.guess && mv config.guess.upstream config.guess
  26. build: build-stamp
  27. build-stamp: config.status
  28. dh_testdir
  29. # Building package
  30. mv libtool libtool.upstream && ln -s /usr/bin/libtool libtool
  31. $(MAKE)
  32. rm libtool && mv libtool.upstream libtool
  33. set -e; \
  34. for python in $(PYTHON_VERSIONS); \
  35. do \
  36. (cd python && $$python setup.py build_ext \
  37. -L$(CURDIR)/src/.libs); \
  38. done
  39. touch build-stamp
  40. clean: unpatch
  41. dh_testdir
  42. dh_testroot
  43. rm -f build-stamp
  44. # Cleaning package
  45. -$(MAKE) clean
  46. -$(MAKE) distclean
  47. rm -rf python/build
  48. dh_clean
  49. install: build
  50. dh_testdir
  51. dh_testroot
  52. dh_clean -k
  53. dh_installdirs
  54. # Installing package
  55. mv libtool libtool.upstream && ln -s /usr/bin/libtool libtool
  56. $(MAKE) prefix=$(CURDIR)/debian/tmp/usr install
  57. rm libtool && mv libtool.upstream libtool
  58. install -D -m 0644 magic/magic.local debian/tmp/etc/magic
  59. install -D -m 0644 magic/magic.local debian/tmp/etc/magic.mime
  60. set -e; \
  61. for python in $(PYTHON_VERSIONS); \
  62. do \
  63. (cd python && $$python setup.py install --no-compile \
  64. --prefix=$(CURDIR)/debian/python-magic/usr); \
  65. done
  66. # Installing bug congtrols
  67. install -D -m 0644 debian/bug/presubj debian/file/usr/share/bug/file/presubj
  68. install -D -m 0644 debian/bug/control debian/libmagic1/usr/share/bug/libmagic1/control
  69. install -D -m 0644 debian/bug/presubj-lib debian/libmagic1/usr/share/bug/libmagic1/presubj
  70. install -D -m 0644 debian/bug/control debian/libmagic-dev/usr/share/bug/libmagic-dev/control
  71. # Installing lintian overrides
  72. for LINTIAN in debian/lintian/*; \
  73. do \
  74. install -D -m 0644 $$LINTIAN debian/`basename $$LINTIAN`/usr/share/lintian/overrides/`basename $$LINTIAN` || exit 1; \
  75. done
  76. binary-indep: build install
  77. binary-arch: build install
  78. dh_testdir
  79. dh_testroot
  80. dh_installchangelogs ChangeLog
  81. dh_installdocs
  82. dh_installexamples
  83. dh_install --sourcedir=debian/tmp
  84. dh_python
  85. dh_link
  86. dh_strip
  87. dh_compress
  88. dh_fixperms
  89. dh_makeshlibs
  90. dh_installdeb
  91. dh_shlibdeps -Llibmagic1 -ldebian/libmagic1/usr/lib
  92. dh_gencontrol
  93. dh_md5sums
  94. dh_builddeb
  95. binary: binary-indep binary-arch
  96. .PHONY: build clean binary-indep binary-arch binary install