rules 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337
  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. # FOR AUTOCONF 2.52 AND NEWER ONLY
  8. ifeq ($(DEB_BUILD_GNU_TYPE), $(DEB_HOST_GNU_TYPE))
  9. confflags += --build $(DEB_HOST_GNU_TYPE)
  10. else
  11. confflags += --build $(DEB_BUILD_GNU_TYPE) --host $(DEB_HOST_GNU_TYPE)
  12. endif
  13. # See below
  14. -include build/environment.mak
  15. ifneq (,$(shell which dpkg-buildflags))
  16. export CXXFLAGS = $(shell dpkg-buildflags --get CXXFLAGS)
  17. else
  18. ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
  19. export CXXFLAGS = -O0 -g -Wall
  20. else
  21. export CXXFLAGS = -O2 -g -Wall
  22. endif
  23. endif
  24. # Default rule
  25. build:
  26. PKG=apt
  27. DEB_BUILD_PROG:=debuild --preserve-envvar PATH --preserve-envvar CCACHE_DIR -us -uc $(DEB_BUILD_PROG_OPTS)
  28. APT_DEBVER=$(shell dpkg-parsechangelog |sed -n -e '/^Version:/s/^Version: //p' | sed -e 's/\+.*$$//')
  29. APT_CONFVER=$(shell sed -n -e 's/^AC_DEFINE_UNQUOTED(VERSION,"\(.*\)")/\1/p' configure.in)
  30. APT_CVSTAG=$(shell echo "$(APT_DEBVER)" | sed -e 's/^/v/' -e 's/\./_/g')
  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. # Rebuild configure.in to have the correct version from the change log
  45. ifneq ($(APT_DEBVER),$(APT_CONFVER))
  46. ifneq ($(APT_DEBVER),)
  47. .PHONY: configure.in
  48. configure.in:
  49. sed -e 's/$(APT_CONFVER)/$(APT_DEBVER)/' $@ > $@.$$$$ && mv $@.$$$$ $@
  50. endif
  51. else
  52. configure.in:
  53. endif
  54. # APT Programs in apt-utils
  55. APT_UTILS=ftparchive sortpkgs extracttemplates internal-solver
  56. # Uncomment this to turn on verbose mode.
  57. #export DH_VERBOSE=1
  58. # Find the libapt-pkg major version for use in other control files
  59. include buildlib/libversion.mak
  60. # Determine which library package names to use
  61. LIBAPT_PKG=libapt-pkg$(LIBAPTPKG_MAJOR)
  62. LIBAPT_INST=libapt-inst$(LIBAPTINST_MAJOR)
  63. # do not fail as we are just experimenting with symbol files for now
  64. export DPKG_GENSYMBOLS_CHECK_LEVEL=0
  65. build: build/build-stamp
  66. build-doc: build/build-doc-stamp
  67. # Note that this is unconditionally done first as part of loading environment.mak
  68. # The true is needed to force make to reload environment.mak after running
  69. # configure-stamp. Otherwise we can get stale or invalid, or missing config data.
  70. build/environment.mak: build/configure-stamp
  71. @true
  72. configure: configure.in
  73. build/configure-stamp: configure
  74. dh_testdir
  75. -mkdir build
  76. cp COPYING debian/copyright
  77. cd build && CXXFLAGS="$(CXXFLAGS)" ../configure $(confflags)
  78. touch $@
  79. build/build-stamp: build/configure-stamp
  80. # Add here commands to compile the package.
  81. $(MAKE) binary
  82. # compat symlink for the locale split
  83. mkdir -p build/usr/share
  84. cd build/usr/share && ln -f -s ../../locale .
  85. # done here
  86. touch $@
  87. build/build-doc-stamp: build/configure-stamp
  88. # Add here commands to compile the package.
  89. $(MAKE) doc
  90. touch $@
  91. clean:
  92. dh_testdir
  93. [ ! -f Makefile ] || $(MAKE) clean distclean
  94. rm -rf build
  95. binary-indep: apt-doc libapt-pkg-doc
  96. # Build architecture-independent files here.
  97. libapt-pkg-doc: build-doc
  98. dh_testdir -p$@
  99. dh_testroot -p$@
  100. dh_prep -p$@
  101. dh_installdirs -p$@
  102. #
  103. # libapt-pkg-doc install
  104. #
  105. # remove doxygen's embedded jquery as we don't use it anyway (#622147)
  106. rm -f $(BLD)/doc/doxygen/html/jquery.js
  107. dh_installdocs -p$@ $(BLD)/docs/design* \
  108. $(BLD)/docs/dpkg-tech* \
  109. $(BLD)/docs/files* \
  110. $(BLD)/docs/method* \
  111. doc/libapt-pkg2_to_3.txt \
  112. doc/style.txt \
  113. $(BLD)/doc/doxygen/html
  114. dh_installexamples -p$@
  115. dh_installchangelogs -p$@
  116. dh_strip -p$@
  117. dh_compress -p$@
  118. dh_fixperms -p$@
  119. dh_installdeb -p$@
  120. dh_gencontrol -p$@
  121. dh_md5sums -p$@
  122. dh_builddeb -p$@
  123. apt-doc: build-doc
  124. dh_testdir -p$@
  125. dh_testroot -p$@
  126. dh_prep -p$@
  127. #
  128. # apt-doc install
  129. #
  130. # Copy the guides
  131. dh_installdocs -p$@ $(BLD)/docs/guide*.text \
  132. $(BLD)/docs/guide*.html \
  133. $(BLD)/docs/offline*.text \
  134. $(BLD)/docs/offline*.html
  135. dh_installchangelogs -p$@
  136. dh_compress -p$@
  137. dh_fixperms -p$@
  138. dh_installdeb -p$@
  139. dh_gencontrol -p$@
  140. dh_md5sums -p$@
  141. dh_builddeb -p$@
  142. # Build architecture-dependent files here.
  143. binary-arch: $(LIBAPT_PKG) $(LIBAPT_INST) apt libapt-pkg-dev apt-utils apt-transport-https
  144. apt_MANPAGES = apt-cache apt-cdrom apt-config apt-get apt-key apt-mark apt-secure apt apt.conf apt_preferences sources.list
  145. apt: build build-doc
  146. dh_testdir -p$@
  147. dh_testroot -p$@
  148. dh_prep -p$@
  149. dh_installdirs -p$@
  150. #
  151. # apt install
  152. #
  153. cp debian/apt.conf.autoremove debian/$@/etc/apt/apt.conf.d/01autoremove
  154. # make rosetta happy and remove pot files in po/ (but leave stuff
  155. # in po/domains/* untouched) and cp *.po into each domain dir
  156. rm -f build/po/*.pot
  157. rm -f po/*.pot
  158. dh_install -p$@ --sourcedir=$(BLD)
  159. # Remove the bits that are in apt-utils
  160. rm $(addprefix debian/$@/usr/bin/apt-,$(APT_UTILS) dump-solver)
  161. # https has its own package
  162. rm debian/$@/usr/lib/apt/methods/https
  163. # move the mirror failure script in place
  164. #mv debian/$@/usr/bin/apt-report-mirror-failure \
  165. # debian/$@/usr/lib/apt/apt-report-mirror-failure \
  166. dh_bugfiles -p$@
  167. dh_lintian -p$@
  168. dh_installexamples -p$@ $(BLD)/docs/examples/*
  169. dh_installman -p$@ $(wildcard $(patsubst %,doc/%.[158],$(apt_MANPAGES)) $(patsubst %,doc/*/%.*.[158],$(apt_MANPAGES)))
  170. dh_installcron -p$@
  171. dh_installdocs -p$@
  172. dh_installchangelogs -p$@
  173. dh_installlogrotate -p$@
  174. dh_strip -p$@
  175. dh_compress -p$@
  176. dh_fixperms -p$@
  177. dh_installdeb -p$@
  178. dh_shlibdeps -p$@
  179. dh_gencontrol -p$@
  180. dh_md5sums -p$@
  181. dh_builddeb -p$@
  182. libapt-pkg-dev: build
  183. dh_testdir -p$@
  184. dh_testroot -p$@
  185. dh_prep -p$@
  186. dh_installdirs -p$@
  187. #
  188. # libapt-pkg-dev install
  189. #
  190. dh_install -p$@ --sourcedir=$(BLD)
  191. dh_installdocs -p$@
  192. dh_installchangelogs -p$@
  193. dh_strip -p$@
  194. dh_compress -p$@
  195. dh_fixperms -p$@
  196. dh_installdeb -p$@
  197. dh_gencontrol -p$@ -- -Vlibapt-pkg-name=$(LIBAPT_PKG) -Vlibapt-inst-name=$(LIBAPT_INST)
  198. dh_md5sums -p$@
  199. dh_builddeb -p$@
  200. apt-utils_MANPAGES = apt-sortpkgs apt-ftparchive apt-extracttemplates
  201. apt-utils: build
  202. dh_testdir -p$@
  203. dh_testroot -p$@
  204. dh_prep -p$@
  205. dh_installdirs -p$@
  206. cp $(addprefix $(BLD)/bin/apt-,$(APT_UTILS)) debian/$@/usr/bin/
  207. cp $(BLD)/bin/apt-dump-solver debian/$@/usr/lib/apt/solvers/dump
  208. dh_install -p$@ --sourcedir=$(BLD)
  209. dh_link -p$@
  210. dh_installdocs -p$@
  211. dh_installexamples -p$@
  212. # Install the man pages..
  213. dh_installman -p$@ $(wildcard $(patsubst %,doc/%.[158],$(apt-utils_MANPAGES)) $(patsubst %,doc/*/%.*.[158],$(apt-utils_MANPAGES)))
  214. dh_installchangelogs -p$@
  215. dh_strip -p$@
  216. dh_compress -p$@
  217. dh_fixperms -p$@
  218. dh_makeshlibs -p$@
  219. dh_installdeb -p$@
  220. dh_shlibdeps -p$@
  221. dh_gencontrol -p$@
  222. dh_md5sums -p$@
  223. dh_builddeb -p$@
  224. $(LIBAPT_PKG): build
  225. dh_testdir -p$@
  226. dh_testroot -p$@
  227. dh_prep -p$@
  228. dh_installdirs -p$@
  229. dh_install -p$@ --sourcedir=$(BLD)
  230. dh_installdocs -p$@
  231. dh_installchangelogs -p$@
  232. dh_strip -p$@
  233. dh_compress -p$@
  234. dh_fixperms -p$@
  235. dh_makeshlibs -p$@
  236. dh_installdeb -p$@
  237. dh_shlibdeps -p$@
  238. dh_gencontrol -p$@
  239. dh_md5sums -p$@
  240. dh_builddeb -p$@
  241. $(LIBAPT_INST): build
  242. dh_testdir -p$@
  243. dh_testroot -p$@
  244. dh_prep -p$@
  245. dh_installdirs -p$@
  246. dh_install -p$@ --sourcedir=$(BLD)
  247. dh_installdocs -p$@
  248. dh_installchangelogs -p$@
  249. dh_strip -p$@
  250. dh_compress -p$@
  251. dh_fixperms -p$@
  252. dh_makeshlibs -p$@
  253. dh_installdeb -p$@
  254. dh_shlibdeps -p$@
  255. dh_gencontrol -p$@
  256. dh_md5sums -p$@
  257. dh_builddeb -p$@
  258. apt-transport-https: build libapt-pkg-dev
  259. dh_testdir -p$@
  260. dh_testroot -p$@
  261. dh_prep -p$@
  262. dh_installdirs -p$@
  263. dh_install -p$@ --sourcedir=$(BLD)
  264. dh_installdocs -p$@ debian/apt-transport-https.README
  265. dh_installexamples -p$@
  266. # Install the man pages..
  267. dh_installman -p$@
  268. dh_installchangelogs -p$@
  269. dh_strip -p$@
  270. dh_compress -p$@
  271. dh_fixperms -p$@
  272. dh_installdeb -p$@
  273. dh_shlibdeps -p$@
  274. dh_gencontrol -p$@
  275. dh_md5sums -p$@
  276. dh_builddeb -p$@
  277. configure:
  278. $(MAKE) configure
  279. really-clean: clean
  280. -find . -name Makefile.in -print0 | xargs --null --no-run-if-empty -- rm -f
  281. find -name ChangeLog | xargs rm -f
  282. rm -f l33ch-stamp
  283. binary: binary-indep binary-arch
  284. .PHONY: build clean binary-indep binary-arch binary