rules 3.9 KB

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