rules 9.9 KB

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