rules 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  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. set -e; \
  40. for python in $(PYTHON_VERSIONS); do \
  41. (cd python && $$python-dbg setup.py build_ext -L$(CURDIR)/src/.libs); \
  42. done
  43. touch build-stamp
  44. clean: unpatch
  45. dh_testdir
  46. dh_testroot
  47. rm -f build-stamp
  48. # Cleaning package
  49. -$(MAKE) clean
  50. -$(MAKE) distclean
  51. rm -rf python/build
  52. dh_clean
  53. install: build
  54. dh_testdir
  55. dh_testroot
  56. dh_clean -k
  57. dh_installdirs
  58. # Installing package
  59. mv libtool libtool.upstream && ln -s /usr/bin/libtool libtool
  60. $(MAKE) prefix=$(CURDIR)/debian/tmp/usr install
  61. rm libtool && mv libtool.upstream libtool
  62. install -D -m 0644 magic/magic.local debian/tmp/etc/magic
  63. install -D -m 0644 magic/magic.local debian/tmp/etc/magic.mime
  64. set -e; \
  65. for python in $(PYTHON_VERSIONS); \
  66. do \
  67. (cd python && $$python setup.py install --no-compile \
  68. --root=$(CURDIR)/debian/python-magic); \
  69. done
  70. set -e; \
  71. for python in $(PYTHON_VERSIONS); do \
  72. (cd python && $$python-dbg setup.py install --no-compile \
  73. --root=$(CURDIR)/debian/python-magic-dbg); \
  74. done
  75. find debian/python-*-dbg ! -type d ! -name '*.so' | xargs rm -f
  76. find debian/python-*-dbg -depth -empty -exec rmdir {} \;
  77. # Installing bug congtrols
  78. install -D -m 0644 debian/bug/presubj debian/file/usr/share/bug/file/presubj
  79. install -D -m 0644 debian/bug/control debian/libmagic1/usr/share/bug/libmagic1/control
  80. install -D -m 0644 debian/bug/presubj-lib debian/libmagic1/usr/share/bug/libmagic1/presubj
  81. install -D -m 0644 debian/bug/control debian/libmagic-dev/usr/share/bug/libmagic-dev/control
  82. # Installing lintian overrides
  83. for LINTIAN in debian/lintian/*; \
  84. do \
  85. install -D -m 0644 $$LINTIAN debian/`basename $$LINTIAN`/usr/share/lintian/overrides/`basename $$LINTIAN` || exit 1; \
  86. done
  87. binary-indep: build install
  88. binary-arch: build install
  89. dh_testdir
  90. dh_testroot
  91. dh_installchangelogs ChangeLog
  92. dh_installdocs
  93. dh_installexamples
  94. dh_install --sourcedir=debian/tmp
  95. dh_python
  96. dh_link
  97. ifeq (,$(findstring -i, $(DH_OPTIONS)))
  98. dh_strip -Npython-magic -Npython-magic-dbg
  99. DH_OPTIONS= dh_strip -ppython-magic --dbg-package=python-magic-dbg
  100. rm -rf debian/python-magic-dbg/usr/share/doc/python-magic-dbg
  101. mkdir -p debian/python-magic-dbg/usr/share/doc
  102. ln -s python-magic debian/python-magic-dbg/usr/share/doc/python-magic-dbg
  103. endif
  104. dh_compress
  105. dh_fixperms
  106. dh_makeshlibs
  107. dh_installdeb
  108. dh_shlibdeps -Llibmagic1 -ldebian/libmagic1/usr/lib
  109. dh_gencontrol
  110. dh_md5sums
  111. dh_builddeb
  112. binary: binary-indep binary-arch
  113. .PHONY: build clean binary-indep binary-arch binary install