rules 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  1. #!/usr/bin/make -f
  2. SHELL=bash
  3. .PHONY: clean build binary binary-trees binary-arch binary-indep
  4. BUILD := $(shell pwd)/debian/build
  5. DIR := $(shell pwd)
  6. arch=$(shell dpkg --print-architecture)
  7. mcidir=debian/tmp-main/DEBIAN
  8. Makefile.in: Makefile.am
  9. $(checkdir)
  10. $(RM) config.status
  11. mkdir -p automake
  12. aclocal -I ./automake
  13. autoheader
  14. autoconf
  15. gettextize --force
  16. libtoolize --automake --copy --force
  17. $(RM) config.sub config.guess
  18. ln -s /usr/share/automake/config.sub .
  19. automake --add-missing
  20. $(BUILD)/Makefile: Makefile.in
  21. $(checkdir)
  22. $(RM) -r debian/build
  23. install -d debian/build
  24. cd $(BUILD) && ../../configure \
  25. --enable-shared --with-included-gettext \
  26. --prefix=/usr \
  27. --datadir=/usr/share \
  28. --sysconfdir=/etc \
  29. --sharedstatedir=/var/lib \
  30. --localstatedir=/var/lib
  31. # libtool -rpath workaround based on a suggestion by Yann Dirson
  32. # <dirson@debian.org>
  33. #
  34. # It is supposed to be inserted in configure.in, but I didn't want
  35. # to re-run autoconf (since that bloats the Debian diff unnecessarily),
  36. # so I just patch libtool after running configure. -- Richard Braakman
  37. # <dark@xs4all.nl>
  38. #
  39. # The version of libtool included with LessTif unfortunately insists on
  40. # linking with -rpath, i.e. hardwiring locations. This is not desirable.
  41. #
  42. # The dummy define is improbable enough not to conflict with anything; it is
  43. # just here to fool libtool by making it believe it gave some useful info to
  44. # gcc.
  45. sed < $(BUILD)/libtool > $(BUILD)/libtool.foo \
  46. 's/^hardcode_libdir_flag_spec.*$$/hardcode_libdir_flag_spec=" -D__LIBTOOL_IS_A_FOOL__ "/'
  47. mv $(BUILD)/libtool.foo $(BUILD)/libtool
  48. # More hackery: this will also patch the generated libtool to explicitly
  49. # link libraries against the libraries they depend on. (particularly libc)
  50. sed < $(BUILD)/libtool > $(BUILD)/libtool.foo '/^archive_cmds="/s/"$$/ \\$$deplibs"/'
  51. mv $(BUILD)/libtool.foo $(BUILD)/libtool
  52. chmod 755 $(BUILD)/libtool
  53. clean: $(BUILD)/Makefile
  54. $(checkdir)
  55. $(MAKE) -C $(BUILD) -i maintainer-clean
  56. $(RM) -r debian/{build,files,substvars,tmp*}
  57. $(RM) $(BUILD)/dpkg-*.tar.gz
  58. $(RM) po/*.gmo
  59. $(RM) config.log
  60. find . \( -name '*~' -o -name '#*#' \) -print0 | xargs -r0 $(RM) --
  61. build: $(BUILD)/Makefile
  62. $(checkdir)
  63. $(MAKE) -C $(BUILD)
  64. binary: binary-arch binary-indep
  65. binary-trees: build
  66. $(checkdir)
  67. -$(RM) -r debian/tmp-{main,dev}
  68. install -d debian/tmp-{main,dev}/{DEBIAN,etc/dpkg,usr/doc/dpkg}
  69. install -d debian/tmp-dev/usr/{lib/dpkg,doc/dpkg-dev,man/man1,man/man8,sbin,bin}
  70. install -d debian/tmp-main/sbin
  71. set -e; if [ $(arch) = i386 ]; then \
  72. sed -e 's/^# i386elf: //' <debian/preinst >$(mcidir)/preinst ; \
  73. else \
  74. sed -e '/^# i386elf: /d' debian/preinst >$(mcidir)/preinst ; \
  75. fi
  76. set -e; if [ -f debian/shlibs.default.$(arch) ]; then \
  77. echo /etc/dpkg/shlibs.default >debian/tmp-dev/DEBIAN/conffiles ; \
  78. cp debian/shlibs.default.$(arch) \
  79. debian/tmp-dev/etc/dpkg/shlibs.default ; \
  80. fi
  81. cp debian/{prerm,postinst} $(mcidir)/.
  82. install -d debian/tmp-dev/etc/emacs/site-start.d
  83. install -c debian/50dpkg-dev.el debian/tmp-dev/etc/emacs/site-start.d/
  84. install -d debian/tmp-dev/etc/xemacs/site-start-19.d
  85. install -c debian/50dpkg-dev.el debian/tmp-dev/etc/xemacs/site-start-19.d/
  86. chmod +x $(mcidir)/{postinst,prerm,preinst}
  87. $(MAKE) -C $(BUILD) top_distdir=. dist
  88. $(MAKE) -C $(BUILD) \
  89. prefix=$(DIR)/debian/tmp-main/usr \
  90. sysconfdir=$(DIR)/debian/tmp-main/etc \
  91. datadir=$(DIR)/debian/tmp-main/usr/share \
  92. sharedstatedir=$(DIR)/debian/tmp-main/var/lib \
  93. localstatedir=$(DIR)/debian/tmp-main/var/lib \
  94. install
  95. find debian/tmp-main/usr/man -type f | xargs gzip -9vf
  96. set -e; for f in dpkg-buildpackage dpkg-gencontrol dpkg-distaddfile \
  97. dpkg-parsechangelog dpkg-genchanges dpkg-shlibdeps; do \
  98. rm debian/tmp-main/usr/man/man1/$$f.1; \
  99. ln -s dpkg-source.1.gz debian/tmp-main/usr/man/man1/$$f.1.gz ; \
  100. done
  101. ln -s ../man7/undocumented.7.gz debian/tmp-main/usr/man/man1/dpkg-divert.1.gz
  102. gzip -9vf debian/tmp-main/usr/doc/dpkg/changelog*
  103. cp debian/copyright debian/tmp-main/usr/doc/dpkg/copyright
  104. cp debian/copyright debian/tmp-dev/usr/doc/dpkg-dev/copyright
  105. cp debian/dev-README debian/tmp-dev/usr/doc/dpkg-dev/README
  106. set -e; for f in \
  107. usr/doc/dpkg/{internals.html,changelog.manuals.gz} \
  108. usr/bin/dpkg-{source,genchanges,gencontrol,shlibdeps,buildpackage,parsechangelog} \
  109. usr/bin/{dpkg-distaddfile,822-date,dpkg-scanpackages,dpkg-name} \
  110. usr/man/man1/dpkg-{source,genchanges,gencontrol,shlibdeps,buildpackage}.1.gz \
  111. usr/man/man1/{dpkg-parsechangelog,dpkg-distaddfile,822-date,dpkg-name}.1.gz \
  112. usr/man/man5 usr/man/man8/dpkg-scanpackages.8.gz \
  113. usr/lib/dpkg/parsechangelog usr/lib/dpkg/controllib.pl \
  114. ; do mv debian/tmp-main/$$f debian/tmp-dev/$$f; done
  115. binary-indep: binary-trees
  116. $(checkdir)
  117. dpkg-gencontrol -pdpkg-dev -Pdebian/tmp-dev
  118. chown -R root.root debian/tmp-dev
  119. chmod -R g-ws,a+r,u+w debian/tmp-dev
  120. dpkg-deb --build debian/tmp-dev ..
  121. set -e -x; for f in internals; do \
  122. if test -f $(BUILD)/doc/$$f.ps; then \
  123. cp -p $(BUILD)/doc/$$f.ps $(DIR)/..; \
  124. elif test -f $(DIR)/doc/$$f.ps; then \
  125. cp -p $(DIR)/doc/$$f.ps $(DIR)/..; \
  126. else \
  127. echo "unable to locate $$f.ps"; false; \
  128. fi; \
  129. gzip -9vf $(DIR)/../$$f.ps; \
  130. dpkg-distaddfile -f$(DIR)/debian/files $$f.ps.gz byhand -; \
  131. if test -d $(BUILD)/doc/$$f.html; then \
  132. GZIP=-9vf tar -C $(BUILD)/doc -zcf $(DIR)/../$$f.html.tar.gz $$f.html; \
  133. elif test -d $(DIR)/doc/$$f.html; then \
  134. GZIP=-9vf tar -C $(DIR)/doc -zcf $(DIR)/../$$f.html.tar.gz $$f.html; \
  135. else \
  136. echo "unable to locate $$f.html"; false; \
  137. fi; \
  138. dpkg-distaddfile -f$(DIR)/debian/files $$f.html.tar.gz byhand -; \
  139. done
  140. set -e; \
  141. version=`sed -n 's/^Version: //p' $(DIR)/debian/tmp-dev/DEBIAN/control`; \
  142. file=dpkg-$${version}.tar.gz; \
  143. cp $(BUILD)/$${file} $(DIR)/..; \
  144. dpkg-distaddfile -f$(DIR)/debian/files $${file} byhand -;
  145. binary-arch: binary-trees
  146. $(checkdir)
  147. mv debian/tmp-main/usr/sbin/start-stop-daemon debian/tmp-main/sbin/start-stop-daemon
  148. -strip debian/tmp-main/usr/{bin,sbin}/* debian/tmp-main/sbin/*
  149. -strip --strip-unneeded debian/tmp-main/usr/lib/libdpkg.so.*
  150. -strip --strip-debug debian/tmp-main/usr/lib/libdpkg.a
  151. dpkg-shlibdeps -dPre-Depends debian/tmp-main/usr/{bin,sbin}/*
  152. dpkg-gencontrol -pdpkg -Pdebian/tmp-main
  153. chown -R root.root debian/tmp-main
  154. chmod -R g-ws,a+r,u+w debian/tmp-main
  155. set -e; \
  156. version=`sed -n 's/^Version: //p' $(DIR)/debian/tmp-main/DEBIAN/control`; \
  157. file=dpkg_$${version}_$(arch).nondebbin.tar; \
  158. tar -C $(DIR)/debian/tmp-main -cf $(DIR)/../$${file} usr var; \
  159. gzip -9vf $(DIR)/../$${file}; \
  160. dpkg-distaddfile -f$(DIR)/debian/files $${file}.gz byhand -
  161. dpkg-deb --build debian/tmp-main ..
  162. define checkdir
  163. test -f include/dpkg.h.in
  164. endef