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=2.4 2.3
  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 $(patsubst %,build-stamp-%,$(PYTHON_VERSIONS))
  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. touch build-stamp
  44. build-stamp-%:
  45. dh_testdir
  46. cd python && python$* setup.py build_ext -L$(CURDIR)/src/.libs
  47. touch $@
  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. $(MAKE) -f debian/rules $(patsubst %,install-%,$(PYTHON_VERSIONS))
  73. install-%:
  74. dh_testdir
  75. dh_testroot
  76. dh_installdirs
  77. cd python && python$* setup.py install --no-compile\
  78. --prefix=$(CURDIR)/debian/python$*-magic/usr
  79. # This single target is used to build all the packages, all at once, or
  80. # one at a time. So keep in mind: any options passed to commands here will
  81. # affect _all_ packages. Anything you want to only affect one package
  82. # should be put in another target, such as the install target.
  83. binary-common:
  84. cat debian/copyright-prolog LEGAL.NOTICE > debian/copyright
  85. dh_testdir
  86. dh_testroot
  87. dh_installchangelogs ChangeLog
  88. dh_installdocs
  89. dh_installexamples
  90. dh_installmenu
  91. # dh_installdebconf
  92. # dh_installlogrotate
  93. # dh_installemacsen
  94. # dh_installcatalogs
  95. # dh_installpam
  96. # dh_installmime
  97. # dh_installinit
  98. # dh_installman
  99. # dh_installcron
  100. # dh_installinfo
  101. # dh_undocumented
  102. dh_strip
  103. dh_link
  104. dh_compress
  105. dh_fixperms
  106. # dh_perl
  107. dh_python
  108. dh_makeshlibs
  109. dh_installdeb
  110. dh_shlibdeps -Llibmagic1 -ldebian/libmagic1/usr/lib
  111. dh_gencontrol
  112. dh_md5sums
  113. dh_builddeb
  114. rm -f debian/copyright
  115. # Build architecture independant packages using the common target.
  116. binary-indep: build install
  117. $(MAKE) -f debian/rules DH_OPTIONS=-i binary-common
  118. # Build architecture dependent packages using the common target.
  119. binary-arch: build install
  120. $(MAKE) -f debian/rules DH_OPTIONS=-a binary-common
  121. # Any other binary targets build just one binary package at a time.
  122. binary-%: build install
  123. make -f debian/rules binary-common DH_OPTIONS=-p$*
  124. binary: binary-indep binary-arch
  125. .PHONY: build clean binary-indep binary-arch binary-common binary install