rules 10 KB

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