rules 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. #!/usr/bin/make -f
  2. export DEB_BUILD_MAINT_OPTIONS = hardening=+all
  3. SHELL := sh -e
  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. %:
  15. dh $@ $(DH_ADDONS)
  16. binary-arch build-arch install-arch: DH_ADDONS=--with autoreconf
  17. binary-indep build-indep install-indep: DH_ADDONS=--with python2,python3
  18. binary build install: DH_ADDONS=--with autoreconf,python2,python3
  19. override_dh_auto_clean:
  20. dh_auto_clean
  21. rm -rf python/build
  22. rm -rf python/__pycache__
  23. rm -f python/*.pyc
  24. override_dh_auto_configure-indep:
  25. dh_auto_configure --buildsystem=pybuild --sourcedirectory=python
  26. override_dh_auto_build-indep:
  27. dh_auto_build --buildsystem=pybuild --sourcedirectory=python
  28. override_dh_auto_test-indep:
  29. override_dh_auto_install-indep:
  30. dh_auto_install --buildsystem=pybuild --sourcedirectory=python
  31. override_dh_auto_configure-arch:
  32. dh_auto_configure -- $(CROSS) --prefix=/usr --datadir=\$${prefix}/share --libdir=\$${prefix}/lib/$(DEB_HOST_MULTIARCH) --mandir=\$${prefix}/share/man --enable-fsect-man5 --enable-static --disable-silent-rules CFLAGS="$(CFLAGS)"
  33. override_dh_auto_install-arch:
  34. dh_auto_install
  35. mv debian/tmp/usr/share/misc debian/tmp/usr/share/file
  36. install -D -m 0644 magic/magic.local debian/tmp/etc/magic
  37. install -D -m 0644 magic/magic.local debian/tmp/etc/magic.mime
  38. # Install additional headers
  39. mkdir -p debian/libmagic-dev/usr/include/file
  40. cp src/file.h debian/libmagic-dev/usr/include/file
  41. # Remove useless files
  42. rm -f debian/tmp/usr/lib/*/*.la
  43. override_dh_install:
  44. dh_install --fail-missing
  45. override_dh_shlibdeps:
  46. ifeq ($(DEB_BUILD_ARCH),$(DEB_HOST_ARCH))
  47. # use the just built file in dh_shlibdeps
  48. PATH=$(CURDIR)/debian/file/usr/bin:$$PATH \
  49. LD_LIBRARY_PATH=$(CURDIR)/debian/libmagic1/usr/lib/$(DEB_HOST_MULTIARCH)$${LD_LIBRARY_PATH+:$${LD_LIBRARY_PATH}} \
  50. MAGIC=$(CURDIR)/debian/libmagic-mgc/usr/share/file/magic.mgc \
  51. dh_shlibdeps -Llibmagic1 -ldebian/libmagic1/usr/lib
  52. else
  53. dh_shlibdeps -Llibmagic1 -ldebian/libmagic1/usr/lib
  54. endif