rules 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  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. [ ! -f Makefile ] || $(MAKE) clean
  50. [ ! -f Makefile ] || $(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 additional headers
  78. mkdir -p debian/libmagic-dev/usr/include/file
  79. cp src/file.h src/patchlevel.h debian/libmagic-dev/usr/include/file
  80. # Installing bug congtrols
  81. install -D -m 0644 debian/bug/presubj debian/file/usr/share/bug/file/presubj
  82. install -D -m 0644 debian/bug/control debian/libmagic1/usr/share/bug/libmagic1/control
  83. install -D -m 0644 debian/bug/presubj-lib debian/libmagic1/usr/share/bug/libmagic1/presubj
  84. install -D -m 0644 debian/bug/control debian/libmagic-dev/usr/share/bug/libmagic-dev/control
  85. # Installing lintian overrides
  86. set -e; for LINTIAN in debian/lintian/*; \
  87. do \
  88. install -D -m 0644 $$LINTIAN debian/`basename $$LINTIAN`/usr/share/lintian/overrides/`basename $$LINTIAN`; \
  89. done
  90. binary-indep: build install
  91. binary-arch: build install
  92. dh_testdir
  93. dh_testroot
  94. dh_installchangelogs ChangeLog
  95. dh_installdocs
  96. dh_installexamples
  97. dh_install --sourcedir=debian/tmp
  98. dh_python
  99. dh_link
  100. ifeq (,$(findstring -i, $(DH_OPTIONS)))
  101. dh_strip -Npython-magic -Npython-magic-dbg
  102. DH_OPTIONS= dh_strip -ppython-magic --dbg-package=python-magic-dbg
  103. rm -rf debian/python-magic-dbg/usr/share/doc/python-magic-dbg
  104. mkdir -p debian/python-magic-dbg/usr/share/doc
  105. ln -s python-magic debian/python-magic-dbg/usr/share/doc/python-magic-dbg
  106. endif
  107. dh_compress
  108. dh_fixperms
  109. dh_makeshlibs
  110. dh_installdeb
  111. dh_shlibdeps -Llibmagic1 -ldebian/libmagic1/usr/lib
  112. dh_gencontrol
  113. dh_md5sums
  114. dh_builddeb
  115. binary: binary-indep binary-arch
  116. .PHONY: build clean binary-indep binary-arch binary install