rules 9.1 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. # 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. export CXXFLAGS = $(shell dpkg-buildflags --get CXXFLAGS)
  20. export LDFLAGS = $(shell dpkg-buildflags --get LDFLAGS)
  21. export CPPFLAGS = $(shell dpkg-buildflags --get CPPFLAGS)
  22. else
  23. ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
  24. export CXXFLAGS = -O0 -g -Wall
  25. else
  26. export CXXFLAGS = -O2 -g -Wall
  27. endif
  28. endif
  29. # Default rule
  30. build:
  31. PKG=apt
  32. DEB_BUILD_PROG:=debuild --preserve-envvar PATH --preserve-envvar CCACHE_DIR -us -uc $(DEB_BUILD_PROG_OPTS)
  33. # Determine the build directory to use
  34. BASE=.
  35. ifdef BUILD
  36. BUILD_POSSIBLE := $(BUILD) $(BASE)/$(BUILD)
  37. else
  38. BUILD_POSSIBLE := $(BASE) $(BASE)/build-$(shell uname --machine) $(BASE)/build
  39. endif
  40. BUILDX:= $(foreach i,$(BUILD_POSSIBLE),$(wildcard $(i)/environment.mak*))
  41. BUILDX:= $(patsubst %/,%,$(firstword $(dir $(BUILDX))))
  42. override BLD := $(BUILDX)
  43. ifeq ($(words $(BLD)),0)
  44. override BLD := ./build
  45. endif
  46. # APT Programs in apt-utils
  47. APT_UTILS=ftparchive sortpkgs extracttemplates
  48. # Uncomment this to turn on verbose mode.
  49. #export DH_VERBOSE=1
  50. # Find the libapt-pkg major version for use in other control files
  51. include buildlib/libversion.mak
  52. # Determine which library package names to use
  53. LIBAPT_PKG=libapt-pkg$(LIBAPTPKG_MAJOR)
  54. LIBAPT_INST=libapt-inst$(LIBAPTINST_MAJOR)
  55. # do not fail as we are just experimenting with symbol files for now
  56. export DPKG_GENSYMBOLS_CHECK_LEVEL=0
  57. build-binary: build/build-binary-stamp
  58. build-debiandoc: build/build-debiandoc-stamp
  59. build-manpages: build/build-manpages-stamp
  60. # Note that this is unconditionally done first as part of loading environment.mak
  61. # The true is needed to force make to reload environment.mak after running
  62. # configure-stamp. Otherwise we can get stale or invalid, or missing config data.
  63. build/environment.mak: build/configure-stamp
  64. @true
  65. configure: configure.ac
  66. build/configure-stamp: configure buildlib/config.sub buildlib/config.guess
  67. dh_testdir
  68. -mkdir build
  69. cp COPYING debian/copyright
  70. cd build && CXXFLAGS="$(CXXFLAGS)" LDFLAGS="$(LDFLAGS)" CPPFLAGS="$(CPPFLAGS)" ../configure $(confflags)
  71. touch $@
  72. build/build-binary-stamp: build/configure-stamp
  73. # Add here commands to compile the package.
  74. $(MAKE) binary
  75. # compat symlink for the locale split
  76. mkdir -p build/usr/share
  77. cd build/usr/share && ln -f -s ../../locale .
  78. # compile and run tests
  79. ifeq (,$(findstring nocheck, $(DEB_BUILD_OPTIONS)))
  80. $(MAKE) test
  81. else
  82. @echo "Tests DISABLED"
  83. endif
  84. touch $@
  85. build/build-debiandoc-stamp: build/configure-stamp
  86. # Add here commands to compile the package.
  87. $(MAKE) debiandoc
  88. touch $@
  89. build/build-manpages-stamp: build/configure-stamp
  90. # Add here commands to compile the package.
  91. $(MAKE) manpages
  92. touch $@
  93. clean:
  94. dh_testdir
  95. dh_clean
  96. [ ! -f Makefile ] || $(MAKE) clean distclean
  97. rm -rf build
  98. rm -f debian/$(LIBAPT_PKG).install debian/$(LIBAPT_INST).install \
  99. debian/libapt-pkg-dev.install debian/apt.install
  100. test ! -L buildlib/config.guess || rm -f buildlib/config.guess
  101. test ! -L buildlib/config.sub || rm -f buildlib/config.sub
  102. debian/%.install: debian/%.install.in
  103. sed 's/@DEB_HOST_MULTIARCH@/$(DEB_HOST_MULTIARCH)/g' $< > $@
  104. # Build architecture-independent files here.
  105. libapt-pkg-doc: build-debiandoc
  106. dh_testdir -p$@
  107. dh_testroot -p$@
  108. dh_prep -p$@
  109. dh_installdirs -p$@
  110. #
  111. # libapt-pkg-doc install
  112. #
  113. dh_installdocs -p$@ $(BLD)/docs/design* \
  114. $(BLD)/docs/dpkg-tech* \
  115. $(BLD)/docs/files* \
  116. $(BLD)/docs/method* \
  117. doc/libapt-pkg2_to_3.txt \
  118. doc/style.txt \
  119. $(BLD)/doc/doxygen/html
  120. dh_installexamples -p$@
  121. dh_installchangelogs -p$@
  122. dh_strip -p$@
  123. dh_compress -p$@
  124. dh_fixperms -p$@
  125. dh_installdeb -p$@
  126. dh_gencontrol -p$@
  127. dh_md5sums -p$@
  128. dh_builddeb -p$@
  129. apt-doc: build-debiandoc
  130. dh_testdir -p$@
  131. dh_testroot -p$@
  132. dh_prep -p$@
  133. #
  134. # apt-doc install
  135. #
  136. # Copy the guides
  137. dh_installdocs -p$@ $(BLD)/docs/guide*.text \
  138. $(BLD)/docs/guide*.html \
  139. $(BLD)/docs/offline*.text \
  140. $(BLD)/docs/offline*.html
  141. dh_installchangelogs -p$@
  142. dh_compress -p$@
  143. dh_fixperms -p$@
  144. dh_installdeb -p$@
  145. dh_gencontrol -p$@
  146. dh_md5sums -p$@
  147. dh_builddeb -p$@
  148. # Build architecture-dependent files here.
  149. apt_MANPAGES = apt apt-cache apt-cdrom apt-config apt-get apt-key apt-mark apt-secure apt apt.conf apt_preferences sources.list
  150. apt: build-binary build-manpages debian/apt.install
  151. dh_testdir -p$@
  152. dh_testroot -p$@
  153. dh_prep -p$@
  154. dh_installdirs -p$@
  155. #
  156. # apt install
  157. #
  158. cp debian/apt.conf.autoremove debian/$@/etc/apt/apt.conf.d/01autoremove
  159. cp debian/apt.auto-removal.sh debian/$@/etc/kernel/postinst.d/apt-auto-removal
  160. chmod 755 debian/$@/etc/kernel/postinst.d/apt-auto-removal
  161. # make rosetta happy and remove pot files in po/ (but leave stuff
  162. # in po/domains/* untouched) and cp *.po into each domain dir
  163. rm -f build/po/*.pot
  164. rm -f po/*.pot
  165. dh_install -p$@ --sourcedir=$(BLD)
  166. # Remove the bits that are in apt-utils
  167. rm $(addprefix debian/$@/usr/bin/apt-,$(APT_UTILS) dump-solver internal-solver)
  168. # https has its own package
  169. rm debian/$@/usr/lib/apt/methods/https
  170. # move the mirror failure script in place
  171. #mv debian/$@/usr/bin/apt-report-mirror-failure \
  172. # debian/$@/usr/lib/apt/apt-report-mirror-failure \
  173. dh_bugfiles -p$@
  174. dh_lintian -p$@
  175. dh_installexamples -p$@ $(BLD)/docs/examples/*
  176. dh_installman -p$@ $(wildcard $(patsubst %,doc/en/%.[158],$(apt_MANPAGES)) $(patsubst %,doc/*/%.*.[158],$(apt_MANPAGES)))
  177. dh_installcron -p$@
  178. dh_installdocs -p$@
  179. dh_installchangelogs -p$@
  180. dh_installlogrotate -p$@
  181. dh_strip -p$@
  182. dh_compress -p$@
  183. dh_fixperms -p$@
  184. dh_installdeb -p$@
  185. dh_shlibdeps -p$@
  186. dh_gencontrol -p$@
  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$@ debian/apt-transport-https.README
  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-debiandoc
  295. build: build-indep build-arch
  296. .PHONY: build clean binary-indep binary-arch binary