rules 10 KB

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