rules 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295
  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.26 2001/02/23 04:29:59 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. debian/shlibs.local: apt-pkg/makefile
  50. # We have 3 shlibs.local files.. One for 'apt', one for 'apt-utils' and
  51. # one for the rest of the packages. This ensures that each package gets
  52. # the right overrides..
  53. rm -rf $@ $@.apt $@.apt-utils
  54. echo "libapt-pkg $(LIBAPTPKG_MAJOR)" > $@.apt
  55. echo "libapt-pkg $(LIBAPTPKG_MAJOR) libapt-pkg$(LIBAPTPKG_MAJOR)" > $@.apt-utils
  56. echo "libapt-inst $(LIBAPTINST_MAJOR)" >> $@.apt-utils
  57. echo "libapt-pkg $(LIBAPTPKG_MAJOR) libapt-pkg$(LIBAPTPKG_MAJOR)" > $@
  58. echo "libapt-inst $(LIBAPTINST_MAJOR) libapt-inst$(LIBAPTINST_MAJOR)" >> $@
  59. build: build/build-stamp
  60. # Note that this is unconditionally done first as part of loading environment.mak
  61. # The true is needed to force make to reload environment.mak after running
  62. # configure-stamp. Otherwise we can get stale or invalid, or missing config data.
  63. build/environment.mak: build/configure-stamp
  64. @true
  65. configure: configure.in
  66. build/configure-stamp: configure
  67. dh_testdir
  68. -mkdir build
  69. (cd build; ../configure)
  70. touch $@
  71. build/build-stamp: build/configure-stamp
  72. # Add here commands to compile the package.
  73. $(MAKE) -s
  74. touch $@
  75. clean:
  76. dh_testdir
  77. # dh_testroot
  78. rm -f build-stamp debian/shlibs.local
  79. rm -rf build
  80. rm -f debian/shlibs.local.apt debian/shlibs.local.apt-utils
  81. # Add here commands to clean up after the build process.
  82. -$(MAKE) clean
  83. -$(MAKE) distclean
  84. dh_clean
  85. binary-indep: libapt-pkg-doc
  86. # Build architecture-independent files here.
  87. libapt-pkg-doc: build debian/shlibs.local
  88. dh_testdir -p$@
  89. dh_testroot -p$@
  90. dh_clean -p$@ -k
  91. dh_installdirs -p$@
  92. #
  93. # libapt-pkg-doc install
  94. #
  95. dh_installdocs -p$@ $(BLD)/docs/cache* $(BLD)/docs/design* $(BLD)/docs/dpkg-tech* \
  96. $(BLD)/docs/files* $(BLD)/docs/method* \
  97. doc/libapt-pkg2_to_3.txt doc/style.txt
  98. -cp -a debian/libapt-pkg-doc.dhelp debian/libapt-pkg-doc/usr/doc/libapt-pkg-doc/.dhelp
  99. -cp -a debian/libapt-pkg-doc.dhelp debian/libapt-pkg-doc/usr/share/doc/libapt-pkg-doc/.dhelp
  100. dh_installexamples -p$@
  101. # dh_installmenu -p$@
  102. # dh_installinit -p$@
  103. # dh_installcron -p$@
  104. # dh_installmanpages -p$@
  105. # dh_undocumented -p$@
  106. dh_installchangelogs -p$@
  107. dh_strip -p$@
  108. dh_compress -p$@
  109. dh_fixperms -p$@
  110. # dh_suidregister -p$@
  111. dh_installdeb -p$@
  112. dh_gencontrol -p$@ -u -Vlibapt-pkg:major=$(LIBAPTPKG_MAJOR)
  113. dh_md5sums -p$@
  114. dh_builddeb -p$@
  115. # Build architecture-dependent files here.
  116. binary-arch: apt libapt-pkg-dev apt-utils
  117. apt: build debian/shlibs.local
  118. dh_testdir -p$@
  119. dh_testroot -p$@
  120. dh_clean -p$@ -k
  121. dh_installdirs -p$@
  122. #
  123. # apt install
  124. #
  125. cp $(BLD)/bin/apt-* debian/tmp/usr/bin/
  126. # Remove the bits that are in apt-utils
  127. rm $(addprefix debian/tmp/usr/bin/apt-,$(APT_UTILS))
  128. # install the shared libs
  129. find $(BLD)/bin/ -type f -name "libapt-pkg.so.*" -exec cp -a "{}" debian/tmp/usr/lib/ \;
  130. find $(BLD)/bin/ -type l -name "libapt-pkg.so.*" -exec cp -a "{}" debian/tmp/usr/lib/ \;
  131. cp $(BLD)/bin/methods/* debian/tmp/usr/lib/apt/methods/
  132. cp $(BLD)/scripts/dselect/* debian/tmp/usr/lib/dpkg/methods/apt/
  133. # Copy the guides
  134. dh_installdocs -p$@ $(BLD)/docs/guide*.text $(BLD)/docs/guide*.html \
  135. $(BLD)/docs/offline.text $(BLD)/docs/offline.html
  136. # One or the other..
  137. -cp -a debian/dhelp debian/tmp/usr/doc/apt/.dhelp
  138. -cp -a debian/dhelp debian/tmp/usr/share/doc/apt/.dhelp
  139. # head -n 500 ChangeLog > debian/ChangeLog
  140. dh_installexamples -p$@ $(BLD)/docs/examples/*
  141. dh_installmanpages -p$@ apt-ftparchive.1 apt-sortpkgs.1
  142. dh_installchangelogs -p$@
  143. dh_strip -p$@
  144. dh_compress -p$@
  145. dh_fixperms -p$@
  146. dh_installdeb -p$@
  147. dh_shlibdeps -papt -l`pwd`/debian/tmp/usr/lib -- -Ldebian/shlibs.local.apt
  148. # LD_LIBRARY_PATH=`pwd`/debian/tmp/usr/lib dh_shlibdeps -papt
  149. dh_gencontrol -p$@ -u -Vlibapt-pkg:major=$(LIBAPTPKG_MAJOR)
  150. dh_makeshlibs -m$(LIBAPTPKG_MAJOR) -V 'libapt-pkg$(LIBAPTPKG_MAJOR)' -papt
  151. dh_md5sums -p$@
  152. dh_builddeb -p$@
  153. libapt-pkg-dev: build debian/shlibs.local
  154. dh_testdir -p$@
  155. dh_testroot -p$@
  156. dh_clean -p$@ -k
  157. dh_installdirs -p$@
  158. #
  159. # libapt-pkg-dev install
  160. #
  161. cp -a $(BLD)/bin/libapt-pkg.so debian/libapt-pkg-dev/usr/lib/
  162. cp -a $(BLD)/bin/libapt-inst.so debian/libapt-pkg-dev/usr/lib/
  163. #ln -s libapt-pkg.so.$(LIBAPTPKG_MAJOR) debian/libapt-pkg-dev/usr/lib/libapt-pkg.so
  164. cp $(BLD)/include/apt-pkg/*.h debian/libapt-pkg-dev/usr/include/apt-pkg/
  165. dh_installdocs -p$@
  166. # dh_installmenu -p$@
  167. # dh_installinit -p$@
  168. # dh_installcron -p$@
  169. # dh_installmanpages -p$@
  170. dh_installchangelogs -p$@
  171. dh_strip -p$@
  172. dh_compress -p$@
  173. dh_fixperms -p$@
  174. # dh_suidregister -p$@
  175. dh_installdeb -p$@
  176. dh_gencontrol -p$@ -u -Vlibapt-pkg:major=$(LIBAPTPKG_MAJOR)
  177. dh_md5sums -p$@
  178. dh_builddeb -p$@
  179. apt-utils: build debian/shlibs.local
  180. dh_testdir -p$@
  181. dh_testroot -p$@
  182. dh_clean -p$@ -k
  183. dh_installdirs -p$@
  184. # install the shared libs
  185. find $(BLD)/bin/ -type f -name "libapt-inst.so.*" -exec cp -a "{}" debian/$@/usr/lib/ \;
  186. find $(BLD)/bin/ -type l -name "libapt-inst.so.*" -exec cp -a "{}" debian/$@/usr/lib/ \;
  187. cp $(addprefix $(BLD)/bin/apt-,$(APT_UTILS)) debian/$@/usr/bin/
  188. dh_installdocs -p$@
  189. # Install the man pages..
  190. mkdir -p debian/$@/usr/share/man/man1
  191. cp doc/apt-sortpkgs.1 doc/apt-ftparchive.1 debian/$@/usr/share/man/man1/
  192. dh_installchangelogs -p$@
  193. dh_strip -p$@
  194. dh_compress -p$@
  195. dh_fixperms -p$@
  196. dh_installdeb -p$@
  197. LD_LIBRARY_PATH=`pwd`/debian/tmp/usr/lib:`pwd`/debian/$@/usr/lib dh_shlibdeps -p$@ -- -Ldebian/shlibs.local.apt-utils
  198. dh_gencontrol -p$@ -u -Vlibapt-inst:major=$(LIBAPTINST_MAJOR)
  199. dh_makeshlibs -m$(LIBAPTINST_MAJOR) -V 'libapt-inst$(LIBAPTINST_MAJOR)' -p$@
  200. dh_md5sums -p$@
  201. dh_builddeb -p$@
  202. source diff:
  203. @echo >&2 'source and diff are obsolete - use dpkg-source -b'; false
  204. # Update from CVS
  205. l33ch: really-clean
  206. cvs update
  207. buildlib/mkChangeLog
  208. # Update from CVS and then configure for build
  209. super-l33ch: l33ch Makefile.in
  210. configure:
  211. $(MAKE) configure
  212. l33ch-stamp: super-l33ch
  213. touch $@
  214. really-clean: clean
  215. -find -name Makefile.in -print0 | xargs -0r rm -f
  216. find -name ChangeLog | xargs rm -f
  217. rm -f l33ch-stamp
  218. binary: binary-indep binary-arch
  219. .PHONY: build clean binary-indep binary-arch binary debian/shlibs.local
  220. # Done by the uploader.
  221. #cvs update..
  222. #edit debian/changelog
  223. # configure.in has the version automatically updated now.
  224. # edit configure.in
  225. # debian/rules cvs-build
  226. cvs-build:
  227. rm -rf debian/cvs-build
  228. cvs update
  229. #buildlib/mkChangeLog
  230. $(MAKE) startup
  231. $(MAKE) doc
  232. tar c --exclude CVS --exclude cvs-build . |\
  233. (mkdir -p debian/cvs-build/apt-$(APT_DEBVER);cd debian/cvs-build/apt-$(APT_DEBVER);tar x)
  234. # The next line isn't needed, as debuild will make the .tar.gz for us.
  235. # (cd debian/cvs-build;tar zcf apt_$(APT_DEBVER).tar.gz apt-$(APT_DEBVER))
  236. (cd debian/cvs-build/apt-$(APT_DEBVER);$(DEB_BUILD_PROG))
  237. #rm ChangeLog
  238. cvs-mkul:
  239. -mkdir -p ../upload-$(APT_DEBVER)
  240. cp `find debian/cvs-build -maxdepth 1 -type f` ../upload-$(APT_DEBVER)