rules 9.6 KB

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