rules 9.4 KB

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