rules 9.6 KB

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