rules 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
  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. maintainer-configure: Makefile.am configure.in
  9. $(checkdir)
  10. mkdir -p automake
  11. aclocal -I ./automake
  12. autoheader
  13. gettextize --copy --force
  14. libtoolize --copy --force
  15. patch -p0 < debian/ltconfig-1.3.2.diff
  16. automake --copy --add-missing --foreign
  17. autoconf
  18. cd utils ; \
  19. aclocal -I ../automake ; \
  20. autoheader ; \
  21. automake --foreign ; \
  22. autoconf
  23. $(BUILD)/config.status:
  24. $(checkdir)
  25. $(RM) -r debian/build
  26. install -d debian/build
  27. cd $(BUILD) && ../../configure \
  28. --enable-shared \
  29. --prefix=/usr \
  30. --datadir=/usr/share \
  31. --mandir=/usr/share/man \
  32. --infodir=/usr/share/info \
  33. --sysconfdir=/etc \
  34. --sharedstatedir=/var/lib \
  35. --localstatedir=/var/lib
  36. clean:
  37. $(checkdir)
  38. -$(MAKE) -C $(BUILD) -i distclean
  39. $(RM) -r debian/{build,files,substvars,tmp*}
  40. $(RM) $(BUILD)/dpkg-*.tar.gz
  41. $(RM) po/*.gmo
  42. $(RM) config.log
  43. find . \( -name '*~' -o -name '#*#' \) -print0 | xargs -r0 $(RM) --
  44. build: $(BUILD)/config.status
  45. $(checkdir)
  46. $(MAKE) -C $(BUILD)
  47. binary: binary-arch binary-indep
  48. binary-trees: build
  49. $(checkdir)
  50. -$(RM) -r debian/tmp-{main,dev,dselect}
  51. install -d debian/tmp-{main,dev,dselect}/{DEBIAN,etc/dpkg,usr/share/doc/dpkg}
  52. install -d debian/tmp-dev/usr/{lib/dpkg,share/doc/dpkg-dev,sbin,bin}
  53. install -d debian/tmp-dev/usr/share/man/{ja/man1,man1,ja/man8,man8}
  54. install -d debian/tmp-dev/usr/share/emacs/site-lisp/dpkg-dev
  55. install -d debian/tmp-main/sbin
  56. install -d debian/tmp-dselect/usr/share/man/{ja/man1,man1,ja/man8,man8}
  57. install -d debian/tmp-dselect/usr/{bin,lib/dpkg}
  58. install -d debian/tmp-dselect/var/lib/dpkg
  59. $(MAKE) -C $(BUILD) top_distdir=. dist
  60. $(MAKE) -C $(BUILD) \
  61. prefix=$(DIR)/debian/tmp-main/usr \
  62. sysconfdir=$(DIR)/debian/tmp-main/etc \
  63. datadir=$(DIR)/debian/tmp-main/usr/share \
  64. mandir=$(DIR)/debian/tmp-main/usr/share/man \
  65. infodir=$(DIR)/debian/tmp-main/usr/share/info \
  66. sharedstatedir=$(DIR)/debian/tmp-main/var/lib \
  67. localstatedir=$(DIR)/debian/tmp-main/var/lib \
  68. install
  69. # Setup the dpkg-dev tree
  70. set -e; if [ -f debian/shlibs.default.$(arch) ]; then \
  71. echo /etc/dpkg/shlibs.default >debian/tmp-dev/DEBIAN/conffiles ; \
  72. cp debian/shlibs.default.$(arch) \
  73. debian/tmp-dev/etc/dpkg/shlibs.default ; \
  74. fi
  75. install -p -m 755 debian/dev-postinst debian/tmp-dev/DEBIAN/postinst
  76. install -p -m 755 debian/dev-prerm debian/tmp-dev/DEBIAN/prerm
  77. install -d debian/tmp-dev/etc/emacs/site-start.d
  78. install -p -m 644 debian/50dpkg-dev.el debian/tmp-dev/etc/emacs/site-start.d/.
  79. install -d debian/tmp-dev/usr/lib/emacsen-common/packages/{install,remove}
  80. install -p -m 755 debian/emacsen-common-remove \
  81. debian/tmp-dev/usr/lib/emacsen-common/packages/remove/dpkg-dev
  82. install -p -m 755 debian/emacsen-common-install \
  83. debian/tmp-dev/usr/lib/emacsen-common/packages/install/dpkg-dev
  84. cp scripts/debian-changelog-mode.el \
  85. debian/tmp-dev/usr/share/emacs/site-lisp/dpkg-dev
  86. rm -f debian/tmp-main/usr/share/{x,}emacs/site-lisp/debian-changelog-mode.el*
  87. ln -s dpkg debian/tmp-dev/usr/share/doc/dpkg-dev
  88. # Setup the dpkg tree
  89. install -p -m 755 debian/{prerm,postinst} $(mcidir)/
  90. set -e; if [ $(arch) = i386 ]; then \
  91. sed -e 's/^# i386elf: //' <debian/preinst >$(mcidir)/preinst ; \
  92. else \
  93. sed -e '/^# i386elf: /d' debian/preinst >$(mcidir)/preinst ; \
  94. fi
  95. chmod +x $(mcidir)/preinst
  96. find debian/tmp-main/usr/share/man -type f | xargs gzip -9vf
  97. set -e; for f in dpkg-buildpackage dpkg-gencontrol dpkg-distaddfile \
  98. dpkg-parsechangelog dpkg-genchanges dpkg-shlibdeps; do \
  99. rm debian/tmp-main/usr/share/man/man1/$$f.1; \
  100. ln -s dpkg-source.1.gz debian/tmp-main/usr/share/man/man1/$$f.1.gz ; \
  101. done
  102. ln -s ../man7/undocumented.7.gz debian/tmp-main/usr/share/man/man1/dpkg-divert.1.gz
  103. gzip -9vf debian/tmp-main/usr/share/doc/dpkg/changelog*
  104. install -p -m 644 debian/copyright debian/tmp-main/usr/share/doc/dpkg/copyright
  105. # Setup the dselect tree
  106. install -p -m 755 debian/dselect-postinst debian/tmp-dselect/DEBIAN/postinst
  107. install -p -m 755 debian/dselect-prerm debian/tmp-dselect/DEBIAN/prerm
  108. set -e; for f in \
  109. usr/share/man/{ja,.}/man8/dselect.8.gz \
  110. usr/lib/dpkg/methods \
  111. var/lib/dpkg/methods \
  112. usr/bin/dselect \
  113. ; do if [ -e debian/tmp-main/$$f -o -L debian/tmp-main/$$f ] ; \
  114. then mv -v debian/tmp-main/$$f debian/tmp-dselect/$$f; \
  115. fi done
  116. ln -s dpkg debian/tmp-dev/usr/share/doc/dselect
  117. # Move stuff from the dpkg tree to the other trees
  118. set -e; for f in \
  119. usr/share/doc/dpkg/{internals.html,changelog.manuals.gz} \
  120. usr/bin/dpkg-{source,genchanges,gencontrol,shlibdeps,buildpackage,parsechangelog} \
  121. usr/bin/{dpkg-distaddfile,822-date,dpkg-scanpackages,dpkg-scansources,dpkg-name,dpkg-architecture} \
  122. usr/share/man/{ja,.}/man1/dpkg-{source,genchanges,gencontrol,shlibdeps,buildpackage,architecture}.1.gz \
  123. usr/share/man/{ja,.}/man1/{dpkg-parsechangelog,dpkg-distaddfile,822-date,dpkg-name}.1.gz \
  124. usr/share/man/{ja,.}/man5 usr/share/man/{ja,.}/man8/dpkg-{scanpackages,scansources}.8.gz \
  125. usr/lib/dpkg/parsechangelog usr/lib/dpkg/controllib.pl \
  126. ; do if [ -e debian/tmp-main/$$f -o -L debian/tmp-main/$$f ] ; \
  127. then mv -v debian/tmp-main/$$f debian/tmp-dev/$$f; \
  128. fi done
  129. binary-indep: binary-trees
  130. $(checkdir)
  131. dpkg-gencontrol -pdpkg-dev -Pdebian/tmp-dev
  132. chown -R root.root debian/tmp-dev
  133. chmod -R g-ws,a+r,u+w debian/tmp-dev
  134. dpkg-deb --build debian/tmp-dev ..
  135. set -e -x; for f in internals; do \
  136. if test -f $(BUILD)/doc/$$f.ps; then \
  137. cp -p $(BUILD)/doc/$$f.ps $(DIR)/..; \
  138. elif test -f $(DIR)/doc/$$f.ps; then \
  139. cp -p $(DIR)/doc/$$f.ps $(DIR)/..; \
  140. else \
  141. echo "unable to locate $$f.ps"; false; \
  142. fi; \
  143. gzip -9vf $(DIR)/../$$f.ps; \
  144. dpkg-distaddfile -f$(DIR)/debian/files $$f.ps.gz byhand -; \
  145. if test -d $(BUILD)/doc/$$f.html; then \
  146. GZIP=-9vf tar -C $(BUILD)/doc -zcf $(DIR)/../$$f.html.tar.gz $$f.html; \
  147. elif test -d $(DIR)/doc/$$f.html; then \
  148. GZIP=-9vf tar -C $(DIR)/doc -zcf $(DIR)/../$$f.html.tar.gz $$f.html; \
  149. else \
  150. echo "unable to locate $$f.html"; false; \
  151. fi; \
  152. dpkg-distaddfile -f$(DIR)/debian/files $$f.html.tar.gz byhand -; \
  153. done
  154. set -e; \
  155. version=`sed -n 's/^Version: //p' $(DIR)/debian/tmp-dev/DEBIAN/control`; \
  156. file=dpkg-$${version}.tar.gz; \
  157. cp $(BUILD)/$${file} $(DIR)/..; \
  158. dpkg-distaddfile -f$(DIR)/debian/files $${file} byhand -;
  159. binary-arch: binary-trees
  160. $(checkdir)
  161. # mv debian/tmp-main/usr/sbin/start-stop-daemon debian/tmp-main/sbin/start-stop-daemon
  162. -strip debian/tmp-main/usr/{bin,sbin}/* debian/tmp-main/sbin/*
  163. -strip --strip-unneeded debian/tmp-main/usr/lib/libdpkg.so.*
  164. -strip --strip-debug debian/tmp-main/usr/lib/libdpkg.a
  165. dpkg-shlibdeps -dPre-Depends debian/tmp-main/usr/{bin,sbin}/*
  166. dpkg-gencontrol -pdpkg -Pdebian/tmp-main
  167. chown -R root.root debian/tmp-main
  168. chmod -R g-ws,a+r,u+w debian/tmp-main
  169. set -e; \
  170. version=`sed -n 's/^Version: //p' $(DIR)/debian/tmp-main/DEBIAN/control`; \
  171. file=dpkg_$${version}_$(arch).nondebbin.tar; \
  172. tar -C $(DIR)/debian/tmp-main -cf $(DIR)/../$${file} usr var; \
  173. gzip -9vf $(DIR)/../$${file}; \
  174. dpkg-distaddfile -f$(DIR)/debian/files $${file}.gz byhand -
  175. dpkg-deb --build debian/tmp-main ..
  176. -strip debian/tmp-dselect/usr/{bin,sbin}/*
  177. dpkg-shlibdeps -dDepends debian/tmp-dselect/usr/bin/*
  178. dpkg-gencontrol -pdselect -Pdebian/tmp-dselect
  179. chown -R root.root debian/tmp-main
  180. chmod -R g-ws,a+r,u+w debian/tmp-main
  181. dpkg-deb --build debian/tmp-dselect ..
  182. define checkdir
  183. test -f include/dpkg.h.in
  184. endef