rules 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. #!/usr/bin/make -f
  2. # debian/rules that uses debhelper;
  3. # based on rules.multi2, originally written by Joey Hess.
  4. #
  5. # This version is for a multibinary package. It also allows you to build any
  6. # of the binary packages independantly, via binary-<package> targets.
  7. # Uncomment this to turn on verbose mode.
  8. #export DH_VERBOSE=1
  9. PYTHON_VERSIONS=$(shell pyversions -r debian/control)
  10. # This has to be exported to make some magic below work.
  11. export DH_OPTIONS
  12. # Proper autotools handling as per autotools-dev/README.Debian
  13. export DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
  14. export DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
  15. ifeq ($(DEB_BUILD_GNU_TYPE), $(DEB_HOST_GNU_TYPE))
  16. CONFFLAGS += --build $(DEB_HOST_GNU_TYPE)
  17. else
  18. CONFFLAGS += --build $(DEB_BUILD_GNU_TYPE) --host $(DEB_HOST_GNU_TYPE)
  19. endif
  20. # Initial CFLAGS; HOWMANY is the number of bytes looked at by file
  21. CFLAGS = -DHOWMANY=0x18000
  22. ifneq (,$(findstring debug,$(DEB_BUILD_OPTIONS)))
  23. CFLAGS += -g
  24. endif
  25. ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
  26. CFLAGS += -O0
  27. else
  28. CFLAGS += -O2
  29. endif
  30. build: build-stamp
  31. build-stamp:
  32. dh_testdir
  33. mv config.sub config.sub.upstream && ln -s /usr/share/misc/config.sub
  34. mv config.guess config.guess.upstream && ln -s /usr/share/misc/config.guess
  35. ./configure $(CONFFLAGS) --prefix=/usr \
  36. '--datadir=$${prefix}/share' '--mandir=$${prefix}/share/man' \
  37. --enable-fsect-man5
  38. rm config.sub && mv config.sub.upstream config.sub
  39. rm config.guess && mv config.guess.upstream config.guess
  40. mv libtool libtool.upstream && cp /usr/bin/libtool libtool
  41. make
  42. rm libtool && mv libtool.upstream libtool
  43. set -e; \
  44. for python in $(PYTHON_VERSIONS); do \
  45. (cd python && $$python setup.py build_ext -L$(CURDIR)/src/.libs); \
  46. done
  47. touch build-stamp
  48. clean:
  49. dh_testdir
  50. dh_testroot
  51. rm -f build-stamp build-stamp-* debian/copyright
  52. rm -rf python/build
  53. -$(MAKE) clean
  54. -$(MAKE) distclean
  55. dh_clean
  56. install: DH_OPTIONS=
  57. install: build
  58. dh_testdir
  59. dh_testroot
  60. dh_clean -k
  61. dh_installdirs
  62. # Add here commands to install the package into debian/tmp.
  63. mv libtool libtool.upstream && cp /usr/bin/libtool libtool
  64. $(MAKE) prefix=`pwd`/debian/tmp/usr install
  65. rm libtool && mv libtool.upstream libtool
  66. install -m644 -p -D magic/magic.local debian/tmp/etc/magic
  67. install -m644 -D debian/bug.presubj debian/file/usr/share/bug/file/presubj
  68. install -m644 -D debian/bug.control debian/libmagic1/usr/share/bug/libmagic1/control
  69. install -m644 -D debian/bug.presubj-lib debian/libmagic1/usr/share/bug/libmagic1/presubj
  70. install -m644 -D debian/bug.control debian/libmagic-dev/usr/share/bug/libmagic-dev/control
  71. dh_install --sourcedir=debian/tmp
  72. set -e; \
  73. for python in $(PYTHON_VERSIONS); do \
  74. (cd python && $$python setup.py install --no-compile \
  75. --prefix=$(CURDIR)/debian/python-magic/usr); \
  76. done
  77. # This single target is used to build all the packages, all at once, or
  78. # one at a time. So keep in mind: any options passed to commands here will
  79. # affect _all_ packages. Anything you want to only affect one package
  80. # should be put in another target, such as the install target.
  81. binary-common:
  82. cat debian/copyright-prolog LEGAL.NOTICE > debian/copyright
  83. dh_testdir
  84. dh_testroot
  85. dh_installchangelogs ChangeLog
  86. dh_installdocs
  87. dh_installexamples
  88. dh_installmenu
  89. # dh_installdebconf
  90. # dh_installlogrotate
  91. # dh_installemacsen
  92. # dh_installcatalogs
  93. # dh_installpam
  94. # dh_installmime
  95. # dh_installinit
  96. # dh_installman
  97. # dh_installcron
  98. # dh_installinfo
  99. # dh_undocumented
  100. dh_strip
  101. dh_link
  102. dh_compress
  103. dh_fixperms
  104. # dh_perl
  105. dh_python
  106. dh_makeshlibs
  107. dh_installdeb
  108. dh_shlibdeps -Llibmagic1 -ldebian/libmagic1/usr/lib
  109. dh_gencontrol
  110. dh_md5sums
  111. dh_builddeb
  112. rm -f debian/copyright
  113. # Build architecture independant packages using the common target.
  114. binary-indep: build install
  115. $(MAKE) -f debian/rules DH_OPTIONS=-i binary-common
  116. # Build architecture dependent packages using the common target.
  117. binary-arch: build install
  118. $(MAKE) -f debian/rules DH_OPTIONS=-a binary-common
  119. # Any other binary targets build just one binary package at a time.
  120. binary-%: build install
  121. make -f debian/rules binary-common DH_OPTIONS=-p$*
  122. binary: binary-indep binary-arch
  123. .PHONY: build clean binary-indep binary-arch binary-common binary install