rules 9.7 KB

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