rules 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291
  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. export DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
  6. export DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
  7. # FOR AUTOCONF 2.52 AND NEWER ONLY
  8. ifeq ($(DEB_BUILD_GNU_TYPE), $(DEB_HOST_GNU_TYPE))
  9. confflags += --build $(DEB_HOST_GNU_TYPE)
  10. else
  11. confflags += --build $(DEB_BUILD_GNU_TYPE) --host $(DEB_HOST_GNU_TYPE)
  12. endif
  13. # See below
  14. -include build/environment.mak
  15. ifneq (,$(shell which dpkg-buildflags))
  16. export CXXFLAGS = $(shell dpkg-buildflags --get CXXFLAGS)
  17. else
  18. ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
  19. export CXXFLAGS = -O0 -g -Wall
  20. else
  21. export CXXFLAGS = -O2 -g -Wall
  22. endif
  23. endif
  24. # Default rule
  25. build:
  26. PKG=apt
  27. DEB_BUILD_PROG:=debuild --preserve-envvar PATH --preserve-envvar CCACHE_DIR -us -uc $(DEB_BUILD_PROG_OPTS)
  28. APT_DEBVER=$(shell dpkg-parsechangelog |sed -n -e '/^Version:/s/^Version: //p' | sed -e 's/\+.*$$//')
  29. APT_CONFVER=$(shell sed -n -e 's/^AC_DEFINE_UNQUOTED(VERSION,"\(.*\)")/\1/p' configure.in)
  30. APT_CVSTAG=$(shell echo "$(APT_DEBVER)" | sed -e 's/^/v/' -e 's/\./_/g')
  31. # Determine the build directory to use
  32. BASE=.
  33. ifdef BUILD
  34. BUILD_POSSIBLE := $(BUILD) $(BASE)/$(BUILD)
  35. else
  36. BUILD_POSSIBLE := $(BASE) $(BASE)/build-$(shell uname --machine) $(BASE)/build
  37. endif
  38. BUILDX:= $(foreach i,$(BUILD_POSSIBLE),$(wildcard $(i)/environment.mak*))
  39. BUILDX:= $(patsubst %/,%,$(firstword $(dir $(BUILDX))))
  40. override BLD := $(BUILDX)
  41. ifeq ($(words $(BLD)),0)
  42. override BLD := ./build
  43. endif
  44. # Rebuild configure.in to have the correct version from the change log
  45. ifneq ($(APT_DEBVER),$(APT_CONFVER))
  46. ifneq ($(APT_DEBVER),)
  47. .PHONY: configure.in
  48. configure.in:
  49. sed -e 's/$(APT_CONFVER)/$(APT_DEBVER)/' $@ > $@.$$$$ && mv $@.$$$$ $@
  50. endif
  51. else
  52. configure.in:
  53. endif
  54. # APT Programs in apt-utils
  55. APT_UTILS=ftparchive sortpkgs extracttemplates internal-solver
  56. # Uncomment this to turn on verbose mode.
  57. #export DH_VERBOSE=1
  58. # Find the libapt-pkg major version for use in other control files
  59. include buildlib/libversion.mak
  60. # Determine which package we should provide in the control files
  61. LIBAPTPKG_PROVIDE=libapt-pkg$(LIBAPTPKG_MAJOR)
  62. LIBAPTINST_PROVIDE=libapt-inst$(LIBAPTINST_MAJOR)
  63. # do not fail as we are just experimenting with symbol files for now
  64. export DPKG_GENSYMBOLS_CHECK_LEVEL=0
  65. build: build/build-stamp
  66. build-doc: build/build-doc-stamp
  67. # Note that this is unconditionally done first as part of loading environment.mak
  68. # The true is needed to force make to reload environment.mak after running
  69. # configure-stamp. Otherwise we can get stale or invalid, or missing config data.
  70. build/environment.mak: build/configure-stamp
  71. @true
  72. configure: configure.in
  73. build/configure-stamp: configure
  74. dh_testdir
  75. -mkdir build
  76. cp COPYING debian/copyright
  77. cd build && CXXFLAGS="$(CXXFLAGS)" ../configure $(confflags)
  78. touch $@
  79. build/build-stamp: build/configure-stamp
  80. # Add here commands to compile the package.
  81. $(MAKE) binary
  82. touch $@
  83. build/build-doc-stamp: build/configure-stamp
  84. # Add here commands to compile the package.
  85. $(MAKE) doc
  86. touch $@
  87. clean:
  88. dh_testdir
  89. [ ! -f Makefile ] || $(MAKE) clean distclean
  90. rm -rf build
  91. binary-indep: apt-doc libapt-pkg-doc
  92. # Build architecture-independent files here.
  93. libapt-pkg-doc: build-doc
  94. dh_testdir -p$@
  95. dh_testroot -p$@
  96. dh_prep -p$@
  97. dh_installdirs -p$@
  98. #
  99. # libapt-pkg-doc install
  100. #
  101. dh_installdocs -p$@ $(BLD)/docs/design* \
  102. $(BLD)/docs/dpkg-tech* \
  103. $(BLD)/docs/files* \
  104. $(BLD)/docs/method* \
  105. doc/libapt-pkg2_to_3.txt \
  106. doc/style.txt \
  107. $(BLD)/doc/doxygen/html
  108. dh_installexamples -p$@
  109. dh_installchangelogs -p$@
  110. dh_strip -p$@
  111. dh_compress -p$@
  112. dh_fixperms -p$@
  113. dh_installdeb -p$@
  114. dh_gencontrol -p$@ -- -Vlibapt-pkg:provides=$(LIBAPTPKG_PROVIDE)
  115. dh_md5sums -p$@
  116. dh_builddeb -p$@
  117. apt-doc: build-doc
  118. dh_testdir -p$@
  119. dh_testroot -p$@
  120. dh_prep -p$@
  121. #
  122. # apt-doc install
  123. #
  124. # Copy the guides
  125. dh_installdocs -p$@ $(BLD)/docs/guide*.text \
  126. $(BLD)/docs/guide*.html \
  127. $(BLD)/docs/offline*.text \
  128. $(BLD)/docs/offline*.html
  129. dh_installchangelogs -p$@
  130. dh_compress -p$@
  131. dh_fixperms -p$@
  132. dh_installdeb -p$@
  133. dh_gencontrol -p$@
  134. dh_md5sums -p$@
  135. dh_builddeb -p$@
  136. # Build architecture-dependent files here.
  137. binary-arch: apt libapt-pkg-dev apt-utils apt-transport-https
  138. apt_MANPAGES = apt-cache apt-cdrom apt-config apt-get apt-key apt-mark apt-secure apt apt.conf apt_preferences sources.list
  139. apt: build build-doc
  140. dh_testdir -p$@
  141. dh_testroot -p$@
  142. dh_prep -p$@
  143. dh_installdirs -p$@
  144. #
  145. # apt install
  146. #
  147. cp debian/apt.conf.autoremove debian/$@/etc/apt/apt.conf.d/01autoremove
  148. # make rosetta happy and remove pot files in po/ (but leave stuff
  149. # in po/domains/* untouched) and cp *.po into each domain dir
  150. rm -f build/po/*.pot
  151. rm -f po/*.pot
  152. dh_install -p$@ --sourcedir=$(BLD)
  153. # Remove the bits that are in apt-utils
  154. rm $(addprefix debian/$@/usr/bin/apt-,$(APT_UTILS) dump-solver)
  155. # https has its own package
  156. rm debian/$@/usr/lib/apt/methods/https
  157. # move the mirror failure script in place
  158. #mv debian/$@/usr/bin/apt-report-mirror-failure \
  159. # debian/$@/usr/lib/apt/apt-report-mirror-failure \
  160. dh_bugfiles -p$@
  161. dh_lintian -p$@
  162. dh_installexamples -p$@ $(BLD)/docs/examples/*
  163. dh_installman -p$@ $(wildcard $(patsubst %,doc/%.[158],$(apt_MANPAGES)) $(patsubst %,doc/*/%.*.[158],$(apt_MANPAGES)))
  164. dh_installcron -p$@
  165. dh_installdocs -p$@
  166. dh_installchangelogs -p$@
  167. dh_installlogrotate -p$@
  168. dh_strip -p$@
  169. dh_compress -p$@
  170. dh_fixperms -p$@
  171. dh_makeshlibs -p$@
  172. dh_installdeb -p$@
  173. dh_shlibdeps -p$@ -l$(CURDIR)/debian/apt/usr/lib:$(CURDIR)/debian/$@/usr/lib
  174. dh_gencontrol -p$@ -- -Vlibapt-pkg:provides=$(LIBAPTPKG_PROVIDE)
  175. dh_md5sums -p$@
  176. dh_builddeb -p$@
  177. libapt-pkg-dev: build
  178. dh_testdir -p$@
  179. dh_testroot -p$@
  180. dh_prep -p$@
  181. dh_installdirs -p$@
  182. #
  183. # libapt-pkg-dev install
  184. #
  185. dh_install -p$@ --sourcedir=$(BLD)
  186. dh_installdocs -p$@
  187. dh_installchangelogs -p$@
  188. dh_strip -p$@
  189. dh_compress -p$@
  190. dh_fixperms -p$@
  191. dh_installdeb -p$@
  192. dh_gencontrol -p$@ -- -Vlibapt-pkg:provides=$(LIBAPTPKG_PROVIDE) -Vlibapt-inst:provides=$(LIBAPTINST_PROVIDE)
  193. dh_md5sums -p$@
  194. dh_builddeb -p$@
  195. apt-utils_MANPAGES = apt-sortpkgs apt-ftparchive apt-extracttemplates
  196. apt-utils: build
  197. dh_testdir -p$@
  198. dh_testroot -p$@
  199. dh_prep -p$@
  200. dh_installdirs -p$@
  201. cp $(addprefix $(BLD)/bin/apt-,$(APT_UTILS)) debian/$@/usr/bin/
  202. dh_install -p$@ --sourcedir=$(BLD)
  203. dh_installdocs -p$@
  204. dh_installexamples -p$@
  205. # Install the man pages..
  206. dh_installman -p$@ $(wildcard $(patsubst %,doc/%.[158],$(apt-utils_MANPAGES)) $(patsubst %,doc/*/%.*.[158],$(apt-utils_MANPAGES)))
  207. dh_installchangelogs -p$@
  208. dh_strip -p$@
  209. dh_compress -p$@
  210. dh_fixperms -p$@
  211. dh_makeshlibs -p$@
  212. dh_installdeb -p$@
  213. dh_shlibdeps -p$@ -l$(CURDIR)/debian/apt/usr/lib:$(CURDIR)/debian/$@/usr/lib
  214. dh_gencontrol -p$@ -- -Vlibapt-inst:provides=$(LIBAPTINST_PROVIDE)
  215. dh_md5sums -p$@
  216. dh_builddeb -p$@
  217. apt-transport-https: build libapt-pkg-dev
  218. dh_testdir -p$@
  219. dh_testroot -p$@
  220. dh_prep -p$@
  221. dh_installdirs -p$@
  222. dh_install -p$@ --sourcedir=$(BLD)
  223. dh_installdocs -p$@ debian/apt-transport-https.README
  224. dh_installexamples -p$@
  225. # Install the man pages..
  226. dh_installman -p$@
  227. dh_installchangelogs -p$@
  228. dh_strip -p$@
  229. dh_compress -p$@
  230. dh_fixperms -p$@
  231. dh_installdeb -p$@
  232. dh_shlibdeps -p$@ -l$(CURDIR)/debian/apt/usr/lib:$(CURDIR)/debian/$@/usr/lib
  233. dh_gencontrol -p$@
  234. dh_md5sums -p$@
  235. dh_builddeb -p$@
  236. configure:
  237. $(MAKE) configure
  238. really-clean: clean
  239. -find . -name Makefile.in -print0 | xargs --null --no-run-if-empty -- rm -f
  240. find -name ChangeLog | xargs rm -f
  241. rm -f l33ch-stamp
  242. binary: binary-indep binary-arch
  243. .PHONY: build clean binary-indep binary-arch binary