rules 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. #!/usr/bin/make -f
  2. SHELL=bash
  3. .PHONY: clean build binary binary-trees binary-arch binary-indep
  4. BUILD := $(shell pwd)/build
  5. DIR := $(shell pwd)
  6. arch=$(shell dpkg --print-architecture)
  7. mcidir=debian/tmp-main/DEBIAN
  8. $(BUILD)/config.status:
  9. $(checkdir)
  10. $(RM) -r $(BUILD)
  11. install -d $(BUILD)
  12. cd $(BUILD) && $(DIR)/configure \
  13. --enable-shared \
  14. --prefix=/usr \
  15. --datadir=/usr/share \
  16. --mandir=/usr/share/man \
  17. --infodir=/usr/share/info \
  18. --sysconfdir=/etc \
  19. --sharedstatedir=/var/lib \
  20. --localstatedir=/var/lib && \
  21. sed < libtool > libtool-2 \
  22. -e 's/^hardcode_libdir_flag_spec.*$$/hardcode_libdir_flag_spec=" -D__NO_RPATH_PLEASE "/' \
  23. -e '/^archive_cmds="/s/"$$/ \\$$deplibs"/' && \
  24. mv -f libtool-2 libtool && \
  25. chmod 755 libtool
  26. clean:
  27. $(checkdir)
  28. -$(MAKE) -C $(BUILD) -i distclean
  29. $(RM) -r debian/{build,files,substvars,tmp*}
  30. $(RM) $(BUILD)/dpkg-*.tar.gz
  31. $(RM) po/*.gmo
  32. $(RM) config.log
  33. find . \( -name '*~' -o -name '#*#' \) -print0 | xargs -r0 $(RM) --
  34. build: $(BUILD)/config.status
  35. $(checkdir)
  36. $(MAKE) -C $(BUILD)
  37. binary: binary-arch binary-indep
  38. binary-trees: build
  39. $(checkdir)
  40. -$(RM) -r debian/tmp-{main,dev}
  41. install -d debian/tmp-{main,dev}/{DEBIAN,etc,usr/share/doc/dpkg}
  42. install -d debian/tmp-dev/usr/{lib/dpkg,share/doc/dpkg-dev,sbin,bin}
  43. install -d debian/tmp-dev/usr/share/man/{ja/man1,man1,ja/man8,man8}
  44. install -d debian/tmp-dev/usr/share/emacs/site-lisp/dpkg-dev
  45. install -d debian/tmp-main/sbin
  46. set -e; if [ $(arch) = i386 ]; then \
  47. sed -e 's/^# i386elf: //' <debian/preinst >$(mcidir)/preinst ; \
  48. else \
  49. sed -e '/^# i386elf: /d' debian/preinst >$(mcidir)/preinst ; \
  50. fi
  51. set -e; if [ -f debian/shlibs.default.$(arch) ]; then \
  52. echo /etc/dpkg/shlibs.default >debian/tmp-dev/DEBIAN/conffiles ; \
  53. install -d debian/tmp-main/etc/dpkg; \
  54. install -m644 debian/shlibs.default.$(arch) \
  55. debian/tmp-dev/etc/dpkg/shlibs.default ; \
  56. fi
  57. cp debian/{prerm,postinst} $(mcidir)/.
  58. $(MAKE) -C $(BUILD) top_distdir=. dist
  59. $(MAKE) -C $(BUILD) \
  60. prefix=$(DIR)/debian/tmp-main/usr \
  61. sysconfdir=$(DIR)/debian/tmp-main/etc \
  62. datadir=$(DIR)/debian/tmp-main/usr/share \
  63. mandir=$(DIR)/debian/tmp-main/usr/share/man \
  64. infodir=$(DIR)/debian/tmp-main/usr/share/info \
  65. sharedstatedir=$(DIR)/debian/tmp-main/var/lib \
  66. localstatedir=$(DIR)/debian/tmp-main/var/lib \
  67. install
  68. install -m 755 debian/dev-postinst debian/tmp-dev/DEBIAN/postinst
  69. install -m 755 debian/dev-prerm debian/tmp-dev/DEBIAN/prerm
  70. install -d debian/tmp-dev/etc/emacs/site-start.d
  71. install -m 644 debian/50dpkg-dev.el debian/tmp-dev/etc/emacs/site-start.d/.
  72. install -d debian/tmp-dev/usr/lib/emacsen-common/packages/{install,remove}
  73. install -m 755 debian/emacsen-common-remove \
  74. debian/tmp-dev/usr/lib/emacsen-common/packages/remove/dpkg-dev
  75. install -m 755 debian/emacsen-common-install \
  76. debian/tmp-dev/usr/lib/emacsen-common/packages/install/dpkg-dev
  77. cp scripts/debian-changelog-mode.el \
  78. debian/tmp-dev/usr/share/emacs/site-lisp/dpkg-dev
  79. rm -f debian/tmp-main/usr/share/{x,}emacs/site-lisp/debian-changelog-mode.el*
  80. chmod +x $(mcidir)/{postinst,prerm,preinst}
  81. find debian/tmp-main/usr/share/man -type f | xargs gzip -9vf
  82. set -e; for f in dpkg-buildpackage dpkg-gencontrol dpkg-distaddfile \
  83. dpkg-parsechangelog dpkg-genchanges dpkg-shlibdeps; do \
  84. rm debian/tmp-main/usr/share/man/man1/$$f.1; \
  85. ln -s dpkg-source.1.gz debian/tmp-main/usr/share/man/man1/$$f.1.gz ; \
  86. done
  87. ln -s ../man7/undocumented.7.gz debian/tmp-main/usr/share/man/man1/dpkg-divert.1.gz
  88. gzip -9vf debian/tmp-main/usr/share/doc/dpkg/changelog*
  89. cp debian/copyright debian/tmp-main/usr/share/doc/dpkg/copyright
  90. ln -s dpkg debian/tmp-dev/usr/share/doc/dpkg-dev
  91. set -e; for f in \
  92. usr/share/doc/dpkg/{internals.html,changelog.manuals.gz} \
  93. usr/bin/dpkg-{source,genchanges,gencontrol,shlibdeps,buildpackage,parsechangelog} \
  94. usr/bin/{dpkg-distaddfile,822-date,dpkg-scanpackages,dpkg-scansources,dpkg-name,dpkg-architecture} \
  95. usr/share/man/{ja,.}/man1/dpkg-{source,genchanges,gencontrol,shlibdeps,buildpackage,architecture}.1.gz \
  96. usr/share/man/{ja,.}/man1/{dpkg-parsechangelog,dpkg-distaddfile,822-date,dpkg-name}.1.gz \
  97. usr/share/man/{ja,.}/man5 usr/share/man/{ja,.}/man8/dpkg-{scanpackages,scansources}.8.gz \
  98. usr/lib/dpkg/parsechangelog usr/lib/dpkg/controllib.pl \
  99. ; do if [ -e debian/tmp-main/$$f -o -L debian/tmp-main/$$f ] ; \
  100. then mv -v debian/tmp-main/$$f debian/tmp-dev/$$f; \
  101. fi done
  102. binary-indep: binary-trees
  103. $(checkdir)
  104. dpkg-gencontrol -pdpkg-dev -Pdebian/tmp-dev
  105. chown -R root.root debian/tmp-dev
  106. chmod -R g-ws,a+r,u+w debian/tmp-dev
  107. dpkg-deb --build debian/tmp-dev ..
  108. set -e -x; for f in internals; do \
  109. if test -f $(BUILD)/doc/$$f.ps; then \
  110. cp -p $(BUILD)/doc/$$f.ps $(DIR)/..; \
  111. elif test -f $(DIR)/doc/$$f.ps; then \
  112. cp -p $(DIR)/doc/$$f.ps $(DIR)/..; \
  113. else \
  114. echo "unable to locate $$f.ps"; false; \
  115. fi; \
  116. gzip -9vf $(DIR)/../$$f.ps; \
  117. dpkg-distaddfile -f$(DIR)/debian/files $$f.ps.gz byhand -; \
  118. if test -d $(BUILD)/doc/$$f.html; then \
  119. GZIP=-9vf tar -C $(BUILD)/doc -zcf $(DIR)/../$$f.html.tar.gz $$f.html; \
  120. elif test -d $(DIR)/doc/$$f.html; then \
  121. GZIP=-9vf tar -C $(DIR)/doc -zcf $(DIR)/../$$f.html.tar.gz $$f.html; \
  122. else \
  123. echo "unable to locate $$f.html"; false; \
  124. fi; \
  125. dpkg-distaddfile -f$(DIR)/debian/files $$f.html.tar.gz byhand -; \
  126. done
  127. set -e; \
  128. version=`sed -n 's/^Version: //p' $(DIR)/debian/tmp-dev/DEBIAN/control`; \
  129. file=dpkg-$${version}.tar.gz; \
  130. cp $(BUILD)/$${file} $(DIR)/..; \
  131. dpkg-distaddfile -f$(DIR)/debian/files $${file} byhand -;
  132. binary-arch: binary-trees
  133. $(checkdir)
  134. mv debian/tmp-main/usr/sbin/start-stop-daemon debian/tmp-main/sbin/start-stop-daemon
  135. -strip debian/tmp-main/usr/{bin,sbin}/* debian/tmp-main/sbin/*
  136. -strip --strip-unneeded debian/tmp-main/usr/lib/libdpkg.so.*
  137. -strip --strip-debug debian/tmp-main/usr/lib/libdpkg.a
  138. dpkg-shlibdeps -dPre-Depends debian/tmp-main/usr/{bin,sbin}/*
  139. dpkg-gencontrol -pdpkg -Pdebian/tmp-main
  140. chown -R root.root debian/tmp-main
  141. chmod -R g-ws,a+r,u+w debian/tmp-main
  142. set -e; \
  143. version=`sed -n 's/^Version: //p' $(DIR)/debian/tmp-main/DEBIAN/control`; \
  144. file=dpkg_$${version}_$(arch).nondebbin.tar; \
  145. tar -C $(DIR)/debian/tmp-main -cf $(DIR)/../$${file} usr var; \
  146. gzip -9vf $(DIR)/../$${file}; \
  147. dpkg-distaddfile -f$(DIR)/debian/files $${file}.gz byhand -
  148. dpkg-deb --build debian/tmp-main ..
  149. define checkdir
  150. test -f include/dpkg.h.in
  151. endef