rules 9.0 KB

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