rules 8.8 KB

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