rules 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340
  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. export DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
  6. export DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
  7. export DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
  8. # FOR AUTOCONF 2.52 AND NEWER ONLY
  9. ifeq ($(DEB_BUILD_GNU_TYPE), $(DEB_HOST_GNU_TYPE))
  10. confflags += --build $(DEB_HOST_GNU_TYPE)
  11. else
  12. confflags += --build $(DEB_BUILD_GNU_TYPE) --host $(DEB_HOST_GNU_TYPE)
  13. endif
  14. # See below
  15. -include build/environment.mak
  16. ifneq (,$(shell which dpkg-buildflags))
  17. export CXXFLAGS = $(shell dpkg-buildflags --get CXXFLAGS)
  18. export LDFLAGS = $(shell dpkg-buildflags --get LDFLAGS)
  19. export CPPFLAGS = $(shell dpkg-buildflags --get CPPFLAGS)
  20. else
  21. ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
  22. export CXXFLAGS = -O0 -g -Wall
  23. else
  24. export CXXFLAGS = -O2 -g -Wall
  25. endif
  26. endif
  27. # Default rule
  28. build:
  29. PKG=apt
  30. DEB_BUILD_PROG:=debuild --preserve-envvar PATH --preserve-envvar CCACHE_DIR -us -uc $(DEB_BUILD_PROG_OPTS)
  31. # Determine the build directory to use
  32. BASE=.
  33. ifdef BUILD
  34. BUILD_POSSIBLE := $(BUILD) $(BASE)/$(BUILD)
  35. else
  36. BUILD_POSSIBLE := $(BASE) $(BASE)/build-$(shell uname --machine) $(BASE)/build
  37. endif
  38. BUILDX:= $(foreach i,$(BUILD_POSSIBLE),$(wildcard $(i)/environment.mak*))
  39. BUILDX:= $(patsubst %/,%,$(firstword $(dir $(BUILDX))))
  40. override BLD := $(BUILDX)
  41. ifeq ($(words $(BLD)),0)
  42. override BLD := ./build
  43. endif
  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: build/build-stamp
  56. build-debiandoc: build/build-debiandoc-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.in
  64. build/configure-stamp: configure
  65. dh_testdir
  66. -mkdir build
  67. cp COPYING debian/copyright
  68. cd build && CXXFLAGS="$(CXXFLAGS)" LDFLAGS="$(LDFLAGS)" CPPFLAGS="$(CPPFLAGS)" ../configure $(confflags)
  69. touch $@
  70. build/build-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-debiandoc-stamp: build/configure-stamp
  84. # Add here commands to compile the package.
  85. $(MAKE) debiandoc
  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. [ ! -f Makefile ] || $(MAKE) clean distclean
  94. rm -rf build
  95. rm -f debian/$(LIBAPT_PKG).install debian/$(LIBAPT_INST).install \
  96. debian/libapt-pkg-dev.install
  97. debian/%.install: debian/%.install.in
  98. sed 's/@DEB_HOST_MULTIARCH@/$(DEB_HOST_MULTIARCH)/g' $< > $@
  99. binary-indep: apt-doc libapt-pkg-doc
  100. # Build architecture-independent files here.
  101. libapt-pkg-doc: build-debiandoc
  102. dh_testdir -p$@
  103. dh_testroot -p$@
  104. dh_prep -p$@
  105. dh_installdirs -p$@
  106. #
  107. # libapt-pkg-doc install
  108. #
  109. dh_installdocs -p$@ $(BLD)/docs/design* \
  110. $(BLD)/docs/dpkg-tech* \
  111. $(BLD)/docs/files* \
  112. $(BLD)/docs/method* \
  113. doc/libapt-pkg2_to_3.txt \
  114. doc/style.txt \
  115. $(BLD)/doc/doxygen/html
  116. dh_installexamples -p$@
  117. dh_installchangelogs -p$@
  118. dh_strip -p$@
  119. dh_compress -p$@
  120. dh_fixperms -p$@
  121. dh_installdeb -p$@
  122. dh_gencontrol -p$@
  123. dh_md5sums -p$@
  124. dh_builddeb -p$@
  125. apt-doc: build-debiandoc
  126. dh_testdir -p$@
  127. dh_testroot -p$@
  128. dh_prep -p$@
  129. #
  130. # apt-doc install
  131. #
  132. # Copy the guides
  133. dh_installdocs -p$@ $(BLD)/docs/guide*.text \
  134. $(BLD)/docs/guide*.html \
  135. $(BLD)/docs/offline*.text \
  136. $(BLD)/docs/offline*.html
  137. dh_installchangelogs -p$@
  138. dh_compress -p$@
  139. dh_fixperms -p$@
  140. dh_installdeb -p$@
  141. dh_gencontrol -p$@
  142. dh_md5sums -p$@
  143. dh_builddeb -p$@
  144. # Build architecture-dependent files here.
  145. binary-arch: $(LIBAPT_PKG) $(LIBAPT_INST) apt libapt-pkg-dev apt-utils apt-transport-https
  146. apt_MANPAGES = apt apt-cache apt-cdrom apt-config apt-get apt-key apt-mark apt-secure apt apt.conf apt_preferences sources.list
  147. apt: build build-manpages
  148. dh_testdir -p$@
  149. dh_testroot -p$@
  150. dh_prep -p$@
  151. dh_installdirs -p$@
  152. #
  153. # apt install
  154. #
  155. cp debian/apt.conf.autoremove debian/$@/etc/apt/apt.conf.d/01autoremove
  156. # make rosetta happy and remove pot files in po/ (but leave stuff
  157. # in po/domains/* untouched) and cp *.po into each domain dir
  158. rm -f build/po/*.pot
  159. rm -f po/*.pot
  160. dh_install -p$@ --sourcedir=$(BLD)
  161. # Remove the bits that are in apt-utils
  162. rm $(addprefix debian/$@/usr/bin/apt-,$(APT_UTILS) dump-solver internal-solver)
  163. # https has its own package
  164. rm debian/$@/usr/lib/apt/methods/https
  165. # move the mirror failure script in place
  166. #mv debian/$@/usr/bin/apt-report-mirror-failure \
  167. # debian/$@/usr/lib/apt/apt-report-mirror-failure \
  168. dh_bugfiles -p$@
  169. dh_lintian -p$@
  170. dh_installexamples -p$@ $(BLD)/docs/examples/*
  171. dh_installman -p$@ $(wildcard $(patsubst %,doc/%.[158],$(apt_MANPAGES)) $(patsubst %,doc/*/%.*.[158],$(apt_MANPAGES)))
  172. dh_installcron -p$@
  173. dh_installdocs -p$@
  174. dh_installchangelogs -p$@
  175. dh_installlogrotate -p$@
  176. dh_strip -p$@
  177. dh_compress -p$@
  178. dh_fixperms -p$@
  179. dh_installdeb -p$@
  180. dh_shlibdeps -p$@
  181. dh_gencontrol -p$@
  182. dh_md5sums -p$@
  183. dh_builddeb -p$@
  184. libapt-pkg-dev: build debian/libapt-pkg-dev.install
  185. dh_testdir -p$@
  186. dh_testroot -p$@
  187. dh_prep -p$@
  188. dh_installdirs -p$@
  189. #
  190. # libapt-pkg-dev install
  191. #
  192. dh_install -p$@ --sourcedir=$(BLD)
  193. dh_installdocs -p$@
  194. dh_installchangelogs -p$@
  195. dh_strip -p$@
  196. dh_compress -p$@
  197. dh_fixperms -p$@
  198. dh_installdeb -p$@
  199. dh_gencontrol -p$@ -- -Vlibapt-pkg-name=$(LIBAPT_PKG) -Vlibapt-inst-name=$(LIBAPT_INST)
  200. dh_md5sums -p$@
  201. dh_builddeb -p$@
  202. apt-utils_MANPAGES = apt-sortpkgs apt-ftparchive apt-extracttemplates
  203. apt-utils: build build-manpages
  204. dh_testdir -p$@
  205. dh_testroot -p$@
  206. dh_prep -p$@
  207. dh_installdirs -p$@
  208. cp $(addprefix $(BLD)/bin/apt-,$(APT_UTILS)) debian/$@/usr/bin/
  209. cp $(BLD)/bin/apt-dump-solver debian/$@/usr/lib/apt/solvers/dump
  210. cp $(BLD)/bin/apt-internal-solver debian/$@/usr/lib/apt/solvers/apt
  211. dh_install -p$@ --sourcedir=$(BLD)
  212. dh_link -p$@
  213. dh_installdocs -p$@
  214. dh_installexamples -p$@
  215. # Install the man pages..
  216. dh_installman -p$@ $(wildcard $(patsubst %,doc/%.[158],$(apt-utils_MANPAGES)) $(patsubst %,doc/*/%.*.[158],$(apt-utils_MANPAGES)))
  217. dh_installchangelogs -p$@
  218. dh_strip -p$@
  219. dh_compress -p$@
  220. dh_fixperms -p$@
  221. dh_makeshlibs -p$@
  222. dh_installdeb -p$@
  223. dh_shlibdeps -p$@
  224. dh_gencontrol -p$@
  225. dh_md5sums -p$@
  226. dh_builddeb -p$@
  227. $(LIBAPT_PKG): build debian/$(LIBAPT_PKG).install
  228. dh_testdir -p$@
  229. dh_testroot -p$@
  230. dh_prep -p$@
  231. dh_installdirs -p$@
  232. dh_install -p$@ --sourcedir=$(BLD)
  233. dh_installdocs -p$@
  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_INST): build debian/$(LIBAPT_INST).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. apt-transport-https: build libapt-pkg-dev
  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$@ debian/apt-transport-https.README
  268. dh_installexamples -p$@
  269. # Install the man pages..
  270. dh_installman -p$@
  271. dh_installchangelogs -p$@
  272. dh_strip -p$@
  273. dh_compress -p$@
  274. dh_fixperms -p$@
  275. dh_installdeb -p$@
  276. dh_shlibdeps -p$@
  277. dh_gencontrol -p$@
  278. dh_md5sums -p$@
  279. dh_builddeb -p$@
  280. configure:
  281. $(MAKE) configure
  282. really-clean: clean
  283. -find . -name Makefile.in -print0 | xargs --null --no-run-if-empty -- rm -f
  284. find -name ChangeLog | xargs rm -f
  285. rm -f l33ch-stamp
  286. binary: binary-indep binary-arch
  287. .PHONY: build clean binary-indep binary-arch binary