rules 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345
  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: apt-doc libapt-pkg-doc
  106. # Build architecture-independent files here.
  107. libapt-pkg-doc: build-doc
  108. dh_testdir -p$@
  109. dh_testroot -p$@
  110. dh_prep -p$@
  111. dh_installdirs -p$@
  112. #
  113. # libapt-pkg-doc install
  114. #
  115. dh_installdocs -p$@ $(BLD)/docs/design* \
  116. $(BLD)/docs/dpkg-tech* \
  117. $(BLD)/docs/files* \
  118. $(BLD)/docs/method* \
  119. doc/libapt-pkg2_to_3.txt \
  120. doc/style.txt \
  121. $(BLD)/doc/doxygen/html
  122. dh_installexamples -p$@
  123. dh_installchangelogs -p$@
  124. dh_strip -p$@
  125. dh_compress -p$@
  126. dh_fixperms -p$@
  127. dh_installdeb -p$@
  128. dh_gencontrol -p$@
  129. dh_md5sums -p$@
  130. dh_builddeb -p$@
  131. apt-doc: build-doc
  132. dh_testdir -p$@
  133. dh_testroot -p$@
  134. dh_prep -p$@
  135. #
  136. # apt-doc install
  137. #
  138. # Copy the guides
  139. dh_installdocs -p$@ $(BLD)/docs/guide*.text \
  140. $(BLD)/docs/guide*.html \
  141. $(BLD)/docs/offline*.text \
  142. $(BLD)/docs/offline*.html
  143. dh_installchangelogs -p$@
  144. dh_compress -p$@
  145. dh_fixperms -p$@
  146. dh_installdeb -p$@
  147. dh_gencontrol -p$@
  148. dh_md5sums -p$@
  149. dh_builddeb -p$@
  150. # Build architecture-dependent files here.
  151. binary-arch: $(LIBAPT_PKG) $(LIBAPT_INST) apt libapt-pkg-dev apt-utils apt-transport-https
  152. apt_MANPAGES = apt-cache apt-cdrom apt-config apt-get apt-key apt-mark apt-secure apt apt.conf apt_preferences sources.list
  153. apt: build build-doc
  154. dh_testdir -p$@
  155. dh_testroot -p$@
  156. dh_prep -p$@
  157. dh_installdirs -p$@
  158. #
  159. # apt install
  160. #
  161. cp debian/apt.conf.autoremove debian/$@/etc/apt/apt.conf.d/01autoremove
  162. # make rosetta happy and remove pot files in po/ (but leave stuff
  163. # in po/domains/* untouched) and cp *.po into each domain dir
  164. rm -f build/po/*.pot
  165. rm -f po/*.pot
  166. dh_install -p$@ --sourcedir=$(BLD)
  167. # Remove the bits that are in apt-utils
  168. rm $(addprefix debian/$@/usr/bin/apt-,$(APT_UTILS) dump-solver)
  169. # https has its own package
  170. rm debian/$@/usr/lib/apt/methods/https
  171. # move the mirror failure script in place
  172. #mv debian/$@/usr/bin/apt-report-mirror-failure \
  173. # debian/$@/usr/lib/apt/apt-report-mirror-failure \
  174. dh_bugfiles -p$@
  175. dh_lintian -p$@
  176. dh_installexamples -p$@ $(BLD)/docs/examples/*
  177. dh_installman -p$@ $(wildcard $(patsubst %,doc/%.[158],$(apt_MANPAGES)) $(patsubst %,doc/*/%.*.[158],$(apt_MANPAGES)))
  178. dh_installcron -p$@
  179. dh_installdocs -p$@
  180. dh_installchangelogs -p$@
  181. dh_installlogrotate -p$@
  182. dh_strip -p$@
  183. dh_compress -p$@
  184. dh_fixperms -p$@
  185. dh_installdeb -p$@
  186. dh_shlibdeps -p$@
  187. dh_gencontrol -p$@
  188. dh_md5sums -p$@
  189. dh_builddeb -p$@
  190. libapt-pkg-dev: build debian/libapt-pkg-dev.install
  191. dh_testdir -p$@
  192. dh_testroot -p$@
  193. dh_prep -p$@
  194. dh_installdirs -p$@
  195. #
  196. # libapt-pkg-dev install
  197. #
  198. dh_install -p$@ --sourcedir=$(BLD)
  199. dh_installdocs -p$@
  200. dh_installchangelogs -p$@
  201. dh_strip -p$@
  202. dh_compress -p$@
  203. dh_fixperms -p$@
  204. dh_installdeb -p$@
  205. dh_gencontrol -p$@ -- -Vlibapt-pkg-name=$(LIBAPT_PKG) -Vlibapt-inst-name=$(LIBAPT_INST)
  206. dh_md5sums -p$@
  207. dh_builddeb -p$@
  208. apt-utils_MANPAGES = apt-sortpkgs apt-ftparchive apt-extracttemplates
  209. apt-utils: build
  210. dh_testdir -p$@
  211. dh_testroot -p$@
  212. dh_prep -p$@
  213. dh_installdirs -p$@
  214. cp $(addprefix $(BLD)/bin/apt-,$(APT_UTILS)) debian/$@/usr/bin/
  215. cp $(BLD)/bin/apt-dump-solver debian/$@/usr/lib/apt/solvers/dump
  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/%.[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 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 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 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. configure:
  286. $(MAKE) configure
  287. really-clean: clean
  288. -find . -name Makefile.in -print0 | xargs --null --no-run-if-empty -- rm -f
  289. find -name ChangeLog | xargs rm -f
  290. rm -f l33ch-stamp
  291. binary: binary-indep binary-arch
  292. .PHONY: build clean binary-indep binary-arch binary