rules 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362
  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. else
  19. ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
  20. export CXXFLAGS = -O0 -g -Wall
  21. else
  22. export CXXFLAGS = -O2 -g -Wall
  23. endif
  24. endif
  25. # Default rule
  26. build:
  27. PKG=apt
  28. DEB_BUILD_PROG:=debuild --preserve-envvar PATH --preserve-envvar CCACHE_DIR -us -uc $(DEB_BUILD_PROG_OPTS)
  29. APT_DEBVER=$(shell dpkg-parsechangelog |sed -n -e '/^Version:/s/^Version: //p' | sed -e 's/\+.*$$//')
  30. APT_CONFVER=$(shell sed -n -e 's/^AC_DEFINE_UNQUOTED(VERSION,"\(.*\)")/\1/p' configure.in)
  31. APT_CVSTAG=$(shell echo "$(APT_DEBVER)" | sed -e 's/^/v/' -e 's/\./_/g')
  32. # Determine the build directory to use
  33. BASE=.
  34. ifdef BUILD
  35. BUILD_POSSIBLE := $(BUILD) $(BASE)/$(BUILD)
  36. else
  37. BUILD_POSSIBLE := $(BASE) $(BASE)/build-$(shell uname --machine) $(BASE)/build
  38. endif
  39. BUILDX:= $(foreach i,$(BUILD_POSSIBLE),$(wildcard $(i)/environment.mak*))
  40. BUILDX:= $(patsubst %/,%,$(firstword $(dir $(BUILDX))))
  41. override BLD := $(BUILDX)
  42. ifeq ($(words $(BLD)),0)
  43. override BLD := ./build
  44. endif
  45. # Rebuild configure.in to have the correct version from the change log
  46. ifneq ($(APT_DEBVER),$(APT_CONFVER))
  47. ifneq ($(APT_DEBVER),)
  48. .PHONY: configure.in
  49. configure.in:
  50. sed -e 's/$(APT_CONFVER)/$(APT_DEBVER)/' $@ > $@.$$$$ && mv $@.$$$$ $@
  51. endif
  52. else
  53. configure.in:
  54. endif
  55. # APT Programs in apt-utils
  56. APT_UTILS=ftparchive sortpkgs extracttemplates internal-solver
  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: build/build-stamp
  67. build-doc: build/build-doc-stamp
  68. # Note that this is unconditionally done first as part of loading environment.mak
  69. # The true is needed to force make to reload environment.mak after running
  70. # configure-stamp. Otherwise we can get stale or invalid, or missing config data.
  71. build/environment.mak: build/configure-stamp
  72. @true
  73. configure: configure.in
  74. build/configure-stamp: configure
  75. dh_testdir
  76. -mkdir build
  77. cp COPYING debian/copyright
  78. cd build && CXXFLAGS="$(CXXFLAGS)" ../configure $(confflags)
  79. touch $@
  80. build/build-stamp: build/configure-stamp
  81. # Add here commands to compile the package.
  82. $(MAKE) binary
  83. # compat symlink for the locale split
  84. mkdir -p build/usr/share
  85. cd build/usr/share && ln -f -s ../../locale .
  86. # compile and run tests
  87. ifeq (,$(findstring nocheck, $(DEB_BUILD_OPTIONS)))
  88. $(MAKE) test
  89. else
  90. @echo "Tests DISABLED"
  91. endif
  92. touch $@
  93. build/build-doc-stamp: build/configure-stamp
  94. # Add here commands to compile the package.
  95. $(MAKE) doc
  96. touch $@
  97. clean:
  98. dh_testdir
  99. [ ! -f Makefile ] || $(MAKE) clean distclean
  100. rm -rf build
  101. rm -f debian/$(LIBAPT_PKG).install debian/$(LIBAPT_INST).install \
  102. debian/libapt-pkg-dev.install
  103. debian/%.install: debian/%.install.in
  104. sed 's/@DEB_HOST_MULTIARCH@/$(DEB_HOST_MULTIARCH)/g' $< > $@
  105. binary-indep: libapt-common apt-doc libapt-pkg-doc
  106. # Build architecture-independent files here.
  107. libapt-common: build
  108. dh_testdir -p$@
  109. dh_testroot -p$@
  110. dh_prep -p$@
  111. dh_installdirs -p$@
  112. dh_install -p$@ --sourcedir=$(BLD)
  113. dh_installdocs -p$@
  114. dh_installchangelogs -p$@
  115. dh_strip -p$@
  116. dh_compress -p$@
  117. dh_fixperms -p$@
  118. dh_installdeb -p$@
  119. dh_gencontrol -p$@
  120. dh_md5sums -p$@
  121. dh_builddeb -p$@
  122. libapt-pkg-doc: build-doc
  123. dh_testdir -p$@
  124. dh_testroot -p$@
  125. dh_prep -p$@
  126. dh_installdirs -p$@
  127. #
  128. # libapt-pkg-doc install
  129. #
  130. dh_installdocs -p$@ $(BLD)/docs/design* \
  131. $(BLD)/docs/dpkg-tech* \
  132. $(BLD)/docs/files* \
  133. $(BLD)/docs/method* \
  134. doc/libapt-pkg2_to_3.txt \
  135. doc/style.txt \
  136. $(BLD)/doc/doxygen/html
  137. dh_installexamples -p$@
  138. dh_installchangelogs -p$@
  139. dh_strip -p$@
  140. dh_compress -p$@
  141. dh_fixperms -p$@
  142. dh_installdeb -p$@
  143. dh_gencontrol -p$@
  144. dh_md5sums -p$@
  145. dh_builddeb -p$@
  146. apt-doc: build-doc
  147. dh_testdir -p$@
  148. dh_testroot -p$@
  149. dh_prep -p$@
  150. #
  151. # apt-doc install
  152. #
  153. # Copy the guides
  154. dh_installdocs -p$@ $(BLD)/docs/guide*.text \
  155. $(BLD)/docs/guide*.html \
  156. $(BLD)/docs/offline*.text \
  157. $(BLD)/docs/offline*.html
  158. dh_installchangelogs -p$@
  159. dh_compress -p$@
  160. dh_fixperms -p$@
  161. dh_installdeb -p$@
  162. dh_gencontrol -p$@
  163. dh_md5sums -p$@
  164. dh_builddeb -p$@
  165. # Build architecture-dependent files here.
  166. binary-arch: $(LIBAPT_PKG) $(LIBAPT_INST) apt libapt-pkg-dev apt-utils apt-transport-https
  167. apt_MANPAGES = apt-cache apt-cdrom apt-config apt-get apt-key apt-mark apt-secure apt apt.conf apt_preferences sources.list
  168. apt: build build-doc
  169. dh_testdir -p$@
  170. dh_testroot -p$@
  171. dh_prep -p$@
  172. dh_installdirs -p$@
  173. #
  174. # apt install
  175. #
  176. cp debian/apt.conf.autoremove debian/$@/etc/apt/apt.conf.d/01autoremove
  177. # make rosetta happy and remove pot files in po/ (but leave stuff
  178. # in po/domains/* untouched) and cp *.po into each domain dir
  179. rm -f build/po/*.pot
  180. rm -f po/*.pot
  181. dh_install -p$@ --sourcedir=$(BLD)
  182. # Remove the bits that are in apt-utils
  183. rm $(addprefix debian/$@/usr/bin/apt-,$(APT_UTILS) dump-solver)
  184. # https has its own package
  185. rm debian/$@/usr/lib/apt/methods/https
  186. # move the mirror failure script in place
  187. #mv debian/$@/usr/bin/apt-report-mirror-failure \
  188. # debian/$@/usr/lib/apt/apt-report-mirror-failure \
  189. dh_bugfiles -p$@
  190. dh_lintian -p$@
  191. dh_installexamples -p$@ $(BLD)/docs/examples/*
  192. dh_installman -p$@ $(wildcard $(patsubst %,doc/%.[158],$(apt_MANPAGES)) $(patsubst %,doc/*/%.*.[158],$(apt_MANPAGES)))
  193. dh_installcron -p$@
  194. dh_installdocs -p$@
  195. dh_installchangelogs -p$@
  196. dh_installlogrotate -p$@
  197. dh_strip -p$@
  198. dh_compress -p$@
  199. dh_fixperms -p$@
  200. dh_installdeb -p$@
  201. dh_shlibdeps -p$@
  202. dh_gencontrol -p$@
  203. dh_md5sums -p$@
  204. dh_builddeb -p$@
  205. libapt-pkg-dev: build debian/libapt-pkg-dev.install
  206. dh_testdir -p$@
  207. dh_testroot -p$@
  208. dh_prep -p$@
  209. dh_installdirs -p$@
  210. #
  211. # libapt-pkg-dev install
  212. #
  213. dh_install -p$@ --sourcedir=$(BLD)
  214. dh_installdocs -p$@
  215. dh_installchangelogs -p$@
  216. dh_strip -p$@
  217. dh_compress -p$@
  218. dh_fixperms -p$@
  219. dh_installdeb -p$@
  220. dh_gencontrol -p$@ -- -Vlibapt-pkg-name=$(LIBAPT_PKG) -Vlibapt-inst-name=$(LIBAPT_INST)
  221. dh_md5sums -p$@
  222. dh_builddeb -p$@
  223. apt-utils_MANPAGES = apt-sortpkgs apt-ftparchive apt-extracttemplates
  224. apt-utils: build
  225. dh_testdir -p$@
  226. dh_testroot -p$@
  227. dh_prep -p$@
  228. dh_installdirs -p$@
  229. cp $(addprefix $(BLD)/bin/apt-,$(APT_UTILS)) debian/$@/usr/bin/
  230. cp $(BLD)/bin/apt-dump-solver debian/$@/usr/lib/apt/solvers/dump
  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/%.[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 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 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 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. configure:
  301. $(MAKE) configure
  302. really-clean: clean
  303. -find . -name Makefile.in -print0 | xargs --null --no-run-if-empty -- rm -f
  304. find -name ChangeLog | xargs rm -f
  305. rm -f l33ch-stamp
  306. binary: binary-indep binary-arch
  307. .PHONY: build clean binary-indep binary-arch binary