rules 10 KB

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