rules 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298
  1. #!/usr/bin/make -f
  2. # Made with the aid of dh_make, by Craig Small
  3. # Sample debian/rules that uses debhelper. GNU copyright 1997 by Joey Hess.
  4. # Some lines taken from debmake, by Christoph Lameter.
  5. # $Id: rules,v 1.37 2002/09/15 22:51:44 jgg Exp $
  6. # LD_LIBRARY_PATH=pwd/debian/apt/usr/lib dh_shlibdeps -papt
  7. # dpkg: /home/jgg/work/apt2/debian/apt/usr/lib/libapt-pkg.so.2.9 not found.
  8. # For the deb builder, you can run 'debian/rules cvs-build', which does all
  9. # steps nescessary to produce a proper source tarball with the CVS/ removed.
  10. # It builds in debian/cvs-build/apt-<VER>/, and places files in
  11. # debian/cvs-build/. Optionally, you can run 'debian/rules cvs-mkul' to
  12. # create ../upload-<VER>, with all the files needed to be uploaded placed
  13. # in it.
  14. export DH_COMPAT=2
  15. # See below
  16. include build/environment.mak
  17. # Default rule
  18. build:
  19. DEB_BUILD_PROG:=debuild -us -uc
  20. APT_DEBVER=$(shell dpkg-parsechangelog |sed -n -e '/^Version:/s/^Version: //p')
  21. APT_CONFVER=$(shell sed -n -e 's/^AC_DEFINE_UNQUOTED(VERSION,"\(.*\)")/\1/p' configure.in)
  22. # Determine the build directory to use
  23. BASE=.
  24. ifdef BUILD
  25. BUILD_POSSIBLE := $(BUILD) $(BASE)/$(BUILD)
  26. else
  27. BUILD_POSSIBLE := $(BASE) $(BASE)/build-$(shell uname -m) $(BASE)/build
  28. endif
  29. BUILDX:= $(foreach i,$(BUILD_POSSIBLE),$(wildcard $(i)/environment.mak*))
  30. BUILDX:= $(patsubst %/,%,$(firstword $(dir $(BUILDX))))
  31. override BLD := $(BUILDX)
  32. ifeq ($(words $(BLD)),0)
  33. override BLD := ./build
  34. endif
  35. # Rebuild configure.in to have the correct version from the change log
  36. ifneq ($(APT_DEBVER),$(APT_CONFVER))
  37. .PHONY: configure.in
  38. configure.in:
  39. sed -e 's/$(APT_CONFVER)/$(APT_DEBVER)/' $@ > $@.$$$$;mv $@.$$$$ $@
  40. else
  41. configure.in:
  42. endif
  43. # APT Programs in apt-utils
  44. APT_UTILS=ftparchive sortpkgs extracttemplates
  45. # Uncomment this to turn on verbose mode.
  46. #export DH_VERBOSE=1
  47. # Find the libapt-pkg major version for use in other control files
  48. export LIBAPTPKG_MAJOR:=$(shell egrep '^MAJOR=' apt-pkg/makefile |cut -d '=' -f 2)
  49. export LIBAPTINST_MAJOR:=$(shell egrep '^MAJOR=' apt-inst/makefile |cut -d '=' -f 2)
  50. # Determine which package we should provide in the control files
  51. LIBAPTPKG_PROVIDE=libapt-pkg$(GLIBC_VER)$(LIBSTDCPP_VER)-$(LIBAPTPKG_MAJOR)
  52. LIBAPTINST_PROVIDE=libapt-inst$(GLIBC_VER)$(LIBSTDCPP_VER)-$(LIBAPTINST_MAJOR)
  53. debian/shlibs.local: apt-pkg/makefile
  54. # We have 3 shlibs.local files.. One for 'apt', one for 'apt-utils' and
  55. # one for the rest of the packages. This ensures that each package gets
  56. # the right overrides..
  57. rm -rf $@ $@.apt $@.apt-utils
  58. echo "libapt-pkg$(GLIBC_VER)$(LIBSTDCPP_VER) $(LIBAPTPKG_MAJOR)" > $@.apt
  59. echo "libapt-pkg$(GLIBC_VER)$(LIBSTDCPP_VER) $(LIBAPTPKG_MAJOR) $(LIBAPTPKG_PROVIDE)" > $@.apt-utils
  60. echo "libapt-inst$(GLIBC_VER)$(LIBSTDCPP_VER) $(LIBAPTINST_MAJOR)" >> $@.apt-utils
  61. echo "libapt-pkg$(GLIBC_VER)$(LIBSTDCPP_VER) $(LIBAPTPKG_MAJOR) $(LIBAPTPKG_PROVIDE)" > $@
  62. echo "libapt-inst$(GLIBC_VER)$(LIBSTDCPP_VER) $(LIBAPTINST_MAJOR) $(LIBAPTINST_PROVIDE)" >> $@
  63. build: build/build-stamp
  64. # Note that this is unconditionally done first as part of loading environment.mak
  65. # The true is needed to force make to reload environment.mak after running
  66. # configure-stamp. Otherwise we can get stale or invalid, or missing config data.
  67. build/environment.mak: build/configure-stamp
  68. @true
  69. configure: configure.in
  70. build/configure-stamp: configure
  71. dh_testdir
  72. -mkdir build
  73. cp COPYING debian/copyright
  74. (cd build; ../configure)
  75. touch $@
  76. build/build-stamp: build/configure-stamp
  77. # Add here commands to compile the package.
  78. $(MAKE) -s
  79. touch $@
  80. clean:
  81. dh_testdir
  82. # dh_testroot
  83. rm -f build-stamp debian/shlibs.local
  84. rm -rf build
  85. rm -f debian/shlibs.local.apt debian/shlibs.local.apt-utils
  86. # Add here commands to clean up after the build process.
  87. -$(MAKE) clean
  88. -$(MAKE) distclean
  89. dh_clean
  90. binary-indep: libapt-pkg-doc
  91. # Build architecture-independent files here.
  92. libapt-pkg-doc: build debian/shlibs.local
  93. dh_testdir -p$@
  94. dh_testroot -p$@
  95. dh_clean -p$@ -k
  96. dh_installdirs -p$@
  97. #
  98. # libapt-pkg-doc install
  99. #
  100. dh_installdocs -p$@ $(BLD)/docs/cache* $(BLD)/docs/design* $(BLD)/docs/dpkg-tech* \
  101. $(BLD)/docs/files* $(BLD)/docs/method* \
  102. doc/libapt-pkg2_to_3.txt doc/style.txt
  103. -cp -a debian/libapt-pkg-doc.dhelp debian/libapt-pkg-doc/usr/doc/libapt-pkg-doc/.dhelp
  104. -cp -a debian/libapt-pkg-doc.dhelp debian/libapt-pkg-doc/usr/share/doc/libapt-pkg-doc/.dhelp
  105. dh_installexamples -p$@
  106. # dh_installmenu -p$@
  107. # dh_installinit -p$@
  108. # dh_installcron -p$@
  109. # dh_installmanpages -p$@
  110. # dh_undocumented -p$@
  111. dh_installchangelogs -p$@
  112. dh_strip -p$@
  113. dh_compress -p$@
  114. dh_fixperms -p$@
  115. # dh_suidregister -p$@
  116. dh_installdeb -p$@
  117. dh_gencontrol -p$@ -u -Vlibapt-pkg:provides=$(LIBAPTPKG_PROVIDE)
  118. dh_md5sums -p$@
  119. dh_builddeb -p$@
  120. # Build architecture-dependent files here.
  121. binary-arch: apt libapt-pkg-dev apt-utils
  122. apt: build debian/shlibs.local
  123. dh_testdir -p$@
  124. dh_testroot -p$@
  125. dh_clean -p$@ -k
  126. dh_installdirs -p$@
  127. #
  128. # apt install
  129. #
  130. cp $(BLD)/bin/apt-* debian/apt/usr/bin/
  131. # Remove the bits that are in apt-utils
  132. rm $(addprefix debian/apt/usr/bin/apt-,$(APT_UTILS))
  133. # install the shared libs
  134. find $(BLD)/bin/ -type f -name "libapt-pkg*.so.*" -exec cp -a "{}" debian/apt/usr/lib/ \;
  135. find $(BLD)/bin/ -type l -name "libapt-pkg*.so.*" -exec cp -a "{}" debian/apt/usr/lib/ \;
  136. cp $(BLD)/bin/methods/* debian/apt/usr/lib/apt/methods/
  137. cp $(BLD)/scripts/dselect/* debian/apt/usr/lib/dpkg/methods/apt/
  138. # Copy the guides
  139. dh_installdocs -p$@ $(BLD)/docs/guide*.text $(BLD)/docs/guide*.html \
  140. $(BLD)/docs/offline.text $(BLD)/docs/offline.html
  141. # One or the other..
  142. -cp -a debian/dhelp debian/apt/usr/doc/apt/.dhelp
  143. -cp -a debian/dhelp debian/apt/usr/share/doc/apt/.dhelp
  144. # head -n 500 ChangeLog > debian/ChangeLog
  145. dh_installexamples -p$@ $(BLD)/docs/examples/*
  146. dh_installmanpages -p$@ apt-ftparchive.1 apt-sortpkgs.1 apt-extracttemplates.1
  147. dh_installchangelogs -p$@
  148. dh_strip -p$@
  149. dh_compress -p$@
  150. dh_fixperms -p$@
  151. dh_installdeb -p$@
  152. dh_shlibdeps -papt -l`pwd`/debian/apt/usr/lib -- -Ldebian/shlibs.local.apt
  153. dh_gencontrol -p$@ -u -Vlibapt-pkg:provides=$(LIBAPTPKG_PROVIDE)
  154. dh_makeshlibs -m$(LIBAPTPKG_MAJOR) -V '$(LIBAPTPKG_PROVIDE)' -papt
  155. dh_md5sums -p$@
  156. dh_builddeb -p$@
  157. libapt-pkg-dev: build debian/shlibs.local
  158. dh_testdir -p$@
  159. dh_testroot -p$@
  160. dh_clean -p$@ -k
  161. dh_installdirs -p$@
  162. #
  163. # libapt-pkg-dev install
  164. #
  165. cp -a $(BLD)/bin/libapt-pkg*.so debian/libapt-pkg-dev/usr/lib/
  166. cp -a $(BLD)/bin/libapt-inst*.so debian/libapt-pkg-dev/usr/lib/
  167. # ln -s libapt-pkg.so.$(LIBAPTPKG_MAJOR) debian/libapt-pkg-dev/usr/lib/libapt-pkg.so
  168. cp $(BLD)/include/apt-pkg/*.h debian/libapt-pkg-dev/usr/include/apt-pkg/
  169. dh_installdocs -p$@
  170. # dh_installmenu -p$@
  171. # dh_installinit -p$@
  172. # dh_installcron -p$@
  173. # dh_installmanpages -p$@
  174. dh_installchangelogs -p$@
  175. dh_strip -p$@
  176. dh_compress -p$@
  177. dh_fixperms -p$@
  178. # dh_suidregister -p$@
  179. dh_installdeb -p$@
  180. dh_gencontrol -p$@ -u -Vlibapt-pkg:provides=$(LIBAPTPKG_PROVIDE)
  181. dh_md5sums -p$@
  182. dh_builddeb -p$@
  183. apt-utils: build debian/shlibs.local
  184. dh_testdir -p$@
  185. dh_testroot -p$@
  186. dh_clean -p$@ -k
  187. dh_installdirs -p$@
  188. # install the shared libs
  189. find $(BLD)/bin/ -type f -name "libapt-inst*.so.*" -exec cp -a "{}" debian/$@/usr/lib/ \;
  190. find $(BLD)/bin/ -type l -name "libapt-inst*.so.*" -exec cp -a "{}" debian/$@/usr/lib/ \;
  191. cp $(addprefix $(BLD)/bin/apt-,$(APT_UTILS)) debian/$@/usr/bin/
  192. dh_installdocs -p$@
  193. # Install the man pages..
  194. mkdir -p debian/$@/usr/share/man/man1
  195. -cp doc/apt-sortpkgs.1 doc/apt-ftparchive.1 doc/apt-extracttemplates.1 debian/$@/usr/share/man/man1/
  196. dh_installchangelogs -p$@
  197. dh_strip -p$@
  198. dh_compress -p$@
  199. dh_fixperms -p$@
  200. dh_installdeb -p$@
  201. LD_LIBRARY_PATH=$$LD_LIBRARY_PATH:`pwd`/debian/apt/usr/lib:`pwd`/debian/$@/usr/lib dh_shlibdeps -p$@ -- -Ldebian/shlibs.local.apt-utils
  202. dh_gencontrol -p$@ -u -Vlibapt-inst:provides=$(LIBAPTINST_PROVIDE)
  203. dh_makeshlibs -m$(LIBAPTINST_MAJOR) -V '$(LIBAPTINST_PROVIDE)' -p$@
  204. dh_md5sums -p$@
  205. dh_builddeb -p$@
  206. source diff:
  207. @echo >&2 'source and diff are obsolete - use dpkg-source -b'; false
  208. # Update from CVS
  209. l33ch: really-clean
  210. cvs update
  211. buildlib/mkChangeLog
  212. # Update from CVS and then configure for build
  213. super-l33ch: l33ch Makefile.in
  214. configure:
  215. $(MAKE) configure
  216. l33ch-stamp: super-l33ch
  217. touch $@
  218. really-clean: clean
  219. -find -name Makefile.in -print0 | xargs -0r rm -f
  220. find -name ChangeLog | xargs rm -f
  221. rm -f l33ch-stamp
  222. binary: binary-indep binary-arch
  223. .PHONY: build clean binary-indep binary-arch binary debian/shlibs.local
  224. # Done by the uploader.
  225. #cvs update..
  226. #edit debian/changelog
  227. # configure.in has the version automatically updated now.
  228. # edit configure.in
  229. # debian/rules cvs-build
  230. cvs-build:
  231. rm -rf debian/cvs-build
  232. cvs update
  233. $(MAKE) startup
  234. $(MAKE) doc
  235. tar c --exclude CVS --exclude cvs-build . |\
  236. (mkdir -p debian/cvs-build/apt-$(APT_DEBVER);cd debian/cvs-build/apt-$(APT_DEBVER);tar x)
  237. (cd debian/cvs-build/apt-$(APT_DEBVER);$(DEB_BUILD_PROG))
  238. cvs-mkul:
  239. -mkdir -p ../upload-$(APT_DEBVER)
  240. cp `find debian/cvs-build -maxdepth 1 -type f` ../upload-$(APT_DEBVER)