rules 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  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 -p -m 644 debian/50dpkg-dev.el \
  84. debian/tmp-dev/etc/emacs/site-start.d/
  85. install -d debian/tmp-dev/etc/xemacs/site-start-19.d
  86. install -p -m 644 debian/50dpkg-dev.el \
  87. debian/tmp-dev/etc/xemacs/site-start-19.d/
  88. chmod +x $(mcidir)/{postinst,prerm,preinst}
  89. $(MAKE) -C $(BUILD) top_distdir=. dist
  90. $(MAKE) -C $(BUILD) \
  91. prefix=$(DIR)/debian/tmp-main/usr \
  92. sysconfdir=$(DIR)/debian/tmp-main/etc \
  93. datadir=$(DIR)/debian/tmp-main/usr/share \
  94. sharedstatedir=$(DIR)/debian/tmp-main/var/lib \
  95. localstatedir=$(DIR)/debian/tmp-main/var/lib \
  96. install
  97. find debian/tmp-main/usr/man -type f | xargs gzip -9vf
  98. set -e; for f in dpkg-buildpackage dpkg-gencontrol dpkg-distaddfile \
  99. dpkg-parsechangelog dpkg-genchanges dpkg-shlibdeps; do \
  100. rm debian/tmp-main/usr/man/man1/$$f.1; \
  101. ln -s dpkg-source.1.gz debian/tmp-main/usr/man/man1/$$f.1.gz ; \
  102. done
  103. ln -s ../man7/undocumented.7.gz debian/tmp-main/usr/man/man1/dpkg-divert.1.gz
  104. gzip -9vf debian/tmp-main/usr/doc/dpkg/changelog*
  105. cp debian/copyright debian/tmp-main/usr/doc/dpkg/copyright
  106. cp debian/copyright debian/tmp-dev/usr/doc/dpkg-dev/copyright
  107. cp debian/dev-README debian/tmp-dev/usr/doc/dpkg-dev/README
  108. set -e; for f in \
  109. usr/doc/dpkg/{internals.html,changelog.manuals.gz} \
  110. usr/bin/dpkg-{source,genchanges,gencontrol,shlibdeps,buildpackage,parsechangelog} \
  111. usr/bin/{dpkg-distaddfile,822-date,dpkg-scanpackages,dpkg-name} \
  112. usr/man/man1/dpkg-{source,genchanges,gencontrol,shlibdeps,buildpackage}.1.gz \
  113. usr/man/man1/{dpkg-parsechangelog,dpkg-distaddfile,822-date,dpkg-name}.1.gz \
  114. usr/man/man5 usr/man/man8/dpkg-scanpackages.8.gz \
  115. usr/lib/dpkg/parsechangelog usr/lib/dpkg/controllib.pl \
  116. ; do mv debian/tmp-main/$$f debian/tmp-dev/$$f; done
  117. binary-indep: binary-trees
  118. $(checkdir)
  119. dpkg-gencontrol -pdpkg-dev -Pdebian/tmp-dev
  120. chown -R root.root debian/tmp-dev
  121. chmod -R g-ws,a+r,u+w debian/tmp-dev
  122. dpkg-deb --build debian/tmp-dev ..
  123. set -e -x; for f in internals; do \
  124. if test -f $(BUILD)/doc/$$f.ps; then \
  125. cp -p $(BUILD)/doc/$$f.ps $(DIR)/..; \
  126. elif test -f $(DIR)/doc/$$f.ps; then \
  127. cp -p $(DIR)/doc/$$f.ps $(DIR)/..; \
  128. else \
  129. echo "unable to locate $$f.ps"; false; \
  130. fi; \
  131. gzip -9vf $(DIR)/../$$f.ps; \
  132. dpkg-distaddfile -f$(DIR)/debian/files $$f.ps.gz byhand -; \
  133. if test -d $(BUILD)/doc/$$f.html; then \
  134. GZIP=-9vf tar -C $(BUILD)/doc -zcf $(DIR)/../$$f.html.tar.gz $$f.html; \
  135. elif test -d $(DIR)/doc/$$f.html; then \
  136. GZIP=-9vf tar -C $(DIR)/doc -zcf $(DIR)/../$$f.html.tar.gz $$f.html; \
  137. else \
  138. echo "unable to locate $$f.html"; false; \
  139. fi; \
  140. dpkg-distaddfile -f$(DIR)/debian/files $$f.html.tar.gz byhand -; \
  141. done
  142. set -e; \
  143. version=`sed -n 's/^Version: //p' $(DIR)/debian/tmp-dev/DEBIAN/control`; \
  144. file=dpkg-$${version}.tar.gz; \
  145. cp $(BUILD)/$${file} $(DIR)/..; \
  146. dpkg-distaddfile -f$(DIR)/debian/files $${file} byhand -;
  147. binary-arch: binary-trees
  148. $(checkdir)
  149. mv debian/tmp-main/usr/sbin/start-stop-daemon debian/tmp-main/sbin/start-stop-daemon
  150. -strip debian/tmp-main/usr/{bin,sbin}/* debian/tmp-main/sbin/*
  151. -strip --strip-unneeded debian/tmp-main/usr/lib/libdpkg.so.*
  152. -strip --strip-debug debian/tmp-main/usr/lib/libdpkg.a
  153. dpkg-shlibdeps -dPre-Depends debian/tmp-main/usr/{bin,sbin}/*
  154. dpkg-gencontrol -pdpkg -Pdebian/tmp-main
  155. chown -R root.root debian/tmp-main
  156. chmod -R g-ws,a+r,u+w debian/tmp-main
  157. set -e; \
  158. version=`sed -n 's/^Version: //p' $(DIR)/debian/tmp-main/DEBIAN/control`; \
  159. file=dpkg_$${version}_$(arch).nondebbin.tar; \
  160. tar -C $(DIR)/debian/tmp-main -cf $(DIR)/../$${file} usr var; \
  161. gzip -9vf $(DIR)/../$${file}; \
  162. dpkg-distaddfile -f$(DIR)/debian/files $${file}.gz byhand -
  163. dpkg-deb --build debian/tmp-main ..
  164. define checkdir
  165. test -f include/dpkg.h.in
  166. endef