rules 6.1 KB

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