rules 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358
  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. # build in verbose mode by default to make it easy to diangose issues
  6. export NOISY=1
  7. export DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
  8. export DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
  9. export DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
  10. # FOR AUTOCONF 2.52 AND NEWER ONLY
  11. ifeq ($(DEB_BUILD_GNU_TYPE), $(DEB_HOST_GNU_TYPE))
  12. confflags += --build $(DEB_HOST_GNU_TYPE)
  13. else
  14. confflags += --build $(DEB_BUILD_GNU_TYPE) --host $(DEB_HOST_GNU_TYPE)
  15. endif
  16. # See below
  17. -include build/environment.mak
  18. ifneq (,$(shell which dpkg-buildflags))
  19. export CXXFLAGS = $(shell dpkg-buildflags --get CXXFLAGS)
  20. export LDFLAGS = $(shell dpkg-buildflags --get LDFLAGS)
  21. export CPPFLAGS = $(shell dpkg-buildflags --get CPPFLAGS)
  22. else
  23. ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
  24. export CXXFLAGS = -O0 -g -Wall
  25. else
  26. export CXXFLAGS = -O2 -g -Wall
  27. endif
  28. endif
  29. # Default rule
  30. build:
  31. PKG=apt
  32. DEB_BUILD_PROG:=debuild --preserve-envvar PATH --preserve-envvar CCACHE_DIR -us -uc $(DEB_BUILD_PROG_OPTS)
  33. # Determine the build directory to use
  34. BASE=.
  35. ifdef BUILD
  36. BUILD_POSSIBLE := $(BUILD) $(BASE)/$(BUILD)
  37. else
  38. BUILD_POSSIBLE := $(BASE) $(BASE)/build-$(shell uname --machine) $(BASE)/build
  39. endif
  40. BUILDX:= $(foreach i,$(BUILD_POSSIBLE),$(wildcard $(i)/environment.mak*))
  41. BUILDX:= $(patsubst %/,%,$(firstword $(dir $(BUILDX))))
  42. override BLD := $(BUILDX)
  43. ifeq ($(words $(BLD)),0)
  44. override BLD := ./build
  45. endif
  46. # APT Programs in apt-utils
  47. APT_UTILS=ftparchive sortpkgs extracttemplates
  48. # Uncomment this to turn on verbose mode.
  49. #export DH_VERBOSE=1
  50. # Find the libapt-pkg major version for use in other control files
  51. include buildlib/libversion.mak
  52. # Determine which library package names to use
  53. LIBAPT_PKG=libapt-pkg$(LIBAPTPKG_MAJOR)
  54. LIBAPT_INST=libapt-inst$(LIBAPTINST_MAJOR)
  55. # do not fail as we are just experimenting with symbol files for now
  56. export DPKG_GENSYMBOLS_CHECK_LEVEL=0
  57. build-binary: build/build-binary-stamp
  58. build-docbook: build/build-docbook-stamp
  59. build-manpages: build/build-manpages-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.ac
  66. build/configure-stamp: configure buildlib/config.sub buildlib/config.guess
  67. dh_testdir
  68. -mkdir build
  69. cp COPYING debian/copyright
  70. cd build && CXXFLAGS="$(CXXFLAGS)" LDFLAGS="$(LDFLAGS)" CPPFLAGS="$(CPPFLAGS)" ../configure $(confflags)
  71. touch $@
  72. build/build-binary-stamp: build/configure-stamp
  73. # Add here commands to compile the package.
  74. $(MAKE) binary
  75. # compat symlink for the locale split
  76. mkdir -p build/usr/share
  77. cd build/usr/share && ln -f -s ../../locale .
  78. # compile and run tests
  79. ifeq (,$(findstring nocheck, $(DEB_BUILD_OPTIONS)))
  80. $(MAKE) test
  81. else
  82. @echo "Tests DISABLED"
  83. endif
  84. touch $@
  85. build/build-docbook-stamp: build/configure-stamp
  86. # Add here commands to compile the package.
  87. $(MAKE) docbook
  88. touch $@
  89. build/build-manpages-stamp: build/configure-stamp
  90. # Add here commands to compile the package.
  91. $(MAKE) manpages
  92. touch $@
  93. clean:
  94. dh_testdir
  95. dh_clean
  96. [ ! -f Makefile ] || $(MAKE) clean distclean
  97. rm -rf build
  98. rm -f debian/$(LIBAPT_PKG).install debian/$(LIBAPT_INST).install \
  99. debian/libapt-pkg-dev.install debian/apt.install
  100. test ! -L buildlib/config.guess || rm -f buildlib/config.guess
  101. test ! -L buildlib/config.sub || rm -f buildlib/config.sub
  102. debian/%.install: debian/%.install.in
  103. sed 's/@DEB_HOST_MULTIARCH@/$(DEB_HOST_MULTIARCH)/g' $< > $@
  104. # Build architecture-independent files here.
  105. libapt-pkg-doc: build-docbook
  106. dh_testdir -p$@
  107. dh_testroot -p$@
  108. dh_prep -p$@
  109. dh_installdirs -p$@
  110. #
  111. # libapt-pkg-doc install
  112. #
  113. rm -f $(BLD)/doc/doxygen/html/*.map $(BLD)/doc/doxygen/html/*.md5
  114. dh_installdocs -p$@ $(BLD)/docs/design* \
  115. $(BLD)/docs/dpkg-tech* \
  116. $(BLD)/docs/files* \
  117. $(BLD)/docs/method* \
  118. doc/libapt-pkg2_to_3.txt \
  119. doc/style.txt \
  120. $(BLD)/doc/doxygen/html
  121. dh_installexamples -p$@
  122. dh_installchangelogs -p$@
  123. dh_strip -p$@
  124. dh_compress -p$@ -X.xhtml
  125. dh_fixperms -p$@
  126. dh_installdeb -p$@
  127. dh_gencontrol -p$@
  128. dh_md5sums -p$@
  129. dh_builddeb -p$@
  130. apt-doc: build-docbook
  131. dh_testdir -p$@
  132. dh_testroot -p$@
  133. dh_prep -p$@
  134. #
  135. # apt-doc install
  136. #
  137. # Copy the guides
  138. dh_installdocs -p$@ $(BLD)/docs/guide*.text \
  139. $(BLD)/docs/guide*.html \
  140. $(BLD)/docs/offline*.text \
  141. $(BLD)/docs/offline*.html
  142. dh_installchangelogs -p$@
  143. dh_compress -p$@
  144. dh_fixperms -p$@
  145. dh_installdeb -p$@
  146. dh_gencontrol -p$@
  147. dh_md5sums -p$@
  148. dh_builddeb -p$@
  149. # Build architecture-dependent files here.
  150. apt_MANPAGES = apt apt-cache apt-cdrom apt-config apt-get apt-key apt-mark apt-secure apt apt.conf apt_preferences sources.list
  151. apt: build-binary build-manpages debian/apt.install
  152. dh_testdir -p$@
  153. dh_testroot -p$@
  154. dh_prep -p$@
  155. dh_installdirs -p$@
  156. #
  157. # apt install
  158. #
  159. cp debian/apt.conf.autoremove debian/$@/etc/apt/apt.conf.d/01autoremove
  160. cp debian/apt.auto-removal.sh debian/$@/etc/kernel/postinst.d/apt-auto-removal
  161. chmod 755 debian/$@/etc/kernel/postinst.d/apt-auto-removal
  162. # install vendor specific apt confs
  163. find -L vendor/current -name 'apt.conf-*' | while read conf; do cp "$${conf}" "debian/$@/etc/apt/apt.conf.d/$${conf#*-}"; done
  164. # make rosetta happy and remove pot files in po/ (but leave stuff
  165. # in po/domains/* untouched) and cp *.po into each domain dir
  166. rm -f build/po/*.pot
  167. rm -f po/*.pot
  168. dh_install -p$@ --sourcedir=$(BLD)
  169. # Remove the bits that are in apt-utils
  170. rm $(addprefix debian/$@/usr/bin/apt-,$(APT_UTILS) dump-solver internal-solver)
  171. # https has its own package
  172. rm debian/$@/usr/lib/apt/methods/https
  173. # move the mirror failure script in place
  174. #mv debian/$@/usr/bin/apt-report-mirror-failure \
  175. # debian/$@/usr/lib/apt/apt-report-mirror-failure \
  176. # move the apt-helper in place
  177. mv debian/$@/usr/bin/apt-helper debian/$@/usr/lib/apt/apt-helper
  178. dh_bugfiles -p$@
  179. dh_lintian -p$@
  180. dh_installexamples -p$@ $(BLD)/docs/examples/*
  181. dh_installman -p$@ $(wildcard $(patsubst %,doc/en/%.[158],$(apt_MANPAGES)) $(patsubst %,doc/*/%.*.[158],$(apt_MANPAGES)))
  182. dh_installcron -p$@
  183. dh_installdocs -p$@
  184. dh_installchangelogs -p$@
  185. dh_installlogrotate -p$@
  186. dh_strip -p$@
  187. dh_compress -p$@
  188. dh_fixperms -p$@
  189. dh_makeshlibs -p$@
  190. dh_installdeb -p$@
  191. dh_shlibdeps -p$@
  192. dh_gencontrol -p$@ -- -Vapt:keyring="$(shell ./vendor/getinfo keyring-package)"
  193. dh_md5sums -p$@
  194. dh_builddeb -p$@
  195. libapt-pkg-dev: build-binary debian/libapt-pkg-dev.install
  196. dh_testdir -p$@
  197. dh_testroot -p$@
  198. dh_prep -p$@
  199. dh_installdirs -p$@
  200. #
  201. # libapt-pkg-dev install
  202. #
  203. dh_install -p$@ --sourcedir=$(BLD)
  204. dh_installdocs -p$@
  205. dh_installchangelogs -p$@
  206. dh_strip -p$@
  207. dh_compress -p$@
  208. dh_fixperms -p$@
  209. dh_installdeb -p$@
  210. dh_gencontrol -p$@ -- -Vlibapt-pkg-name=$(LIBAPT_PKG) -Vlibapt-inst-name=$(LIBAPT_INST)
  211. dh_md5sums -p$@
  212. dh_builddeb -p$@
  213. apt-utils_MANPAGES = apt-sortpkgs apt-ftparchive apt-extracttemplates
  214. apt-utils: build-binary build-manpages
  215. dh_testdir -p$@
  216. dh_testroot -p$@
  217. dh_prep -p$@
  218. dh_installdirs -p$@
  219. cp $(addprefix $(BLD)/bin/apt-,$(APT_UTILS)) debian/$@/usr/bin/
  220. cp $(BLD)/bin/apt-dump-solver debian/$@/usr/lib/apt/solvers/dump
  221. cp $(BLD)/bin/apt-internal-solver debian/$@/usr/lib/apt/solvers/apt
  222. dh_install -p$@ --sourcedir=$(BLD)
  223. dh_link -p$@
  224. dh_installdocs -p$@
  225. dh_installexamples -p$@
  226. # Install the man pages..
  227. dh_installman -p$@ $(wildcard $(patsubst %,doc/en/%.[158],$(apt-utils_MANPAGES)) $(patsubst %,doc/*/%.*.[158],$(apt-utils_MANPAGES)))
  228. dh_installchangelogs -p$@
  229. dh_strip -p$@
  230. dh_compress -p$@
  231. dh_fixperms -p$@
  232. dh_makeshlibs -p$@
  233. dh_installdeb -p$@
  234. dh_shlibdeps -p$@
  235. dh_gencontrol -p$@
  236. dh_md5sums -p$@
  237. dh_builddeb -p$@
  238. $(LIBAPT_PKG): build-binary debian/$(LIBAPT_PKG).install
  239. dh_testdir -p$@
  240. dh_testroot -p$@
  241. dh_prep -p$@
  242. dh_installdirs -p$@
  243. dh_install -p$@ --sourcedir=$(BLD)
  244. dh_installdocs -p$@
  245. dh_installchangelogs -p$@
  246. dh_strip -p$@
  247. dh_compress -p$@
  248. dh_fixperms -p$@
  249. dh_makeshlibs -p$@
  250. dh_installdeb -p$@
  251. dh_shlibdeps -p$@
  252. dh_gencontrol -p$@
  253. dh_md5sums -p$@
  254. dh_builddeb -p$@
  255. $(LIBAPT_INST): build-binary debian/$(LIBAPT_INST).install
  256. dh_testdir -p$@
  257. dh_testroot -p$@
  258. dh_prep -p$@
  259. dh_installdirs -p$@
  260. dh_install -p$@ --sourcedir=$(BLD)
  261. dh_installdocs -p$@
  262. dh_installchangelogs -p$@
  263. dh_strip -p$@
  264. dh_compress -p$@
  265. dh_fixperms -p$@
  266. dh_makeshlibs -p$@
  267. dh_installdeb -p$@
  268. dh_shlibdeps -p$@
  269. dh_gencontrol -p$@
  270. dh_md5sums -p$@
  271. dh_builddeb -p$@
  272. apt-transport-https: build-binary libapt-pkg-dev
  273. dh_testdir -p$@
  274. dh_testroot -p$@
  275. dh_prep -p$@
  276. dh_installdirs -p$@
  277. dh_install -p$@ --sourcedir=$(BLD)
  278. dh_installdocs -p$@ debian/apt-transport-https.README
  279. dh_installexamples -p$@
  280. # Install the man pages..
  281. dh_installman -p$@
  282. dh_installchangelogs -p$@
  283. dh_strip -p$@
  284. dh_compress -p$@
  285. dh_fixperms -p$@
  286. dh_installdeb -p$@
  287. dh_shlibdeps -p$@
  288. dh_gencontrol -p$@
  289. dh_md5sums -p$@
  290. dh_builddeb -p$@
  291. buildlib/config.guess buildlib/config.sub:
  292. $(MAKE) "$@"
  293. configure:
  294. $(MAKE) configure
  295. # translate targets to targets required by debian-policy
  296. binary-arch: $(LIBAPT_PKG) $(LIBAPT_INST) apt libapt-pkg-dev apt-utils apt-transport-https
  297. binary-indep: apt-doc libapt-pkg-doc
  298. binary: binary-indep binary-arch
  299. build-arch: build-binary
  300. build-indep: build-manpages build-docbook
  301. build: build-indep build-arch
  302. .PHONY: build clean binary-indep binary-arch binary