rules 6.3 KB

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