rules 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296
  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
  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 package we should provide in the control files
  61. LIBAPTPKG_PROVIDE=libapt-pkg$(LIBAPTPKG_MAJOR)
  62. LIBAPTINST_PROVIDE=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. ifeq (,$(findstring nocheck, $(DEB_BUILD_OPTIONS)))
  83. $(MAKE) test
  84. else
  85. @echo "Tests DISABLED"
  86. endif
  87. touch $@
  88. build/build-doc-stamp: build/configure-stamp
  89. # Add here commands to compile the package.
  90. $(MAKE) doc
  91. touch $@
  92. clean:
  93. dh_testdir
  94. [ ! -f Makefile ] || $(MAKE) clean distclean
  95. rm -rf build
  96. binary-indep: apt-doc libapt-pkg-doc
  97. # Build architecture-independent files here.
  98. libapt-pkg-doc: build-doc
  99. dh_testdir -p$@
  100. dh_testroot -p$@
  101. dh_prep -p$@
  102. dh_installdirs -p$@
  103. #
  104. # libapt-pkg-doc install
  105. #
  106. dh_installdocs -p$@ $(BLD)/docs/design* \
  107. $(BLD)/docs/dpkg-tech* \
  108. $(BLD)/docs/files* \
  109. $(BLD)/docs/method* \
  110. doc/libapt-pkg2_to_3.txt \
  111. doc/style.txt \
  112. $(BLD)/doc/doxygen/html
  113. dh_installexamples -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$@ -- -Vlibapt-pkg:provides=$(LIBAPTPKG_PROVIDE)
  120. dh_md5sums -p$@
  121. dh_builddeb -p$@
  122. apt-doc: build-doc
  123. dh_testdir -p$@
  124. dh_testroot -p$@
  125. dh_prep -p$@
  126. #
  127. # apt-doc install
  128. #
  129. # Copy the guides
  130. dh_installdocs -p$@ $(BLD)/docs/guide*.text \
  131. $(BLD)/docs/guide*.html \
  132. $(BLD)/docs/offline*.text \
  133. $(BLD)/docs/offline*.html
  134. dh_installchangelogs -p$@
  135. dh_compress -p$@
  136. dh_fixperms -p$@
  137. dh_installdeb -p$@
  138. dh_gencontrol -p$@
  139. dh_md5sums -p$@
  140. dh_builddeb -p$@
  141. # Build architecture-dependent files here.
  142. binary-arch: apt libapt-pkg-dev apt-utils apt-transport-https
  143. apt_MANPAGES = apt-cache apt-cdrom apt-config apt-get apt-key apt-mark apt-secure apt apt.conf apt_preferences sources.list
  144. apt: build build-doc
  145. dh_testdir -p$@
  146. dh_testroot -p$@
  147. dh_prep -p$@
  148. dh_installdirs -p$@
  149. #
  150. # apt install
  151. #
  152. cp debian/apt.conf.autoremove debian/$@/etc/apt/apt.conf.d/01autoremove
  153. # make rosetta happy and remove pot files in po/ (but leave stuff
  154. # in po/domains/* untouched) and cp *.po into each domain dir
  155. rm -f build/po/*.pot
  156. rm -f po/*.pot
  157. dh_install -p$@ --sourcedir=$(BLD)
  158. # Remove the bits that are in apt-utils
  159. rm $(addprefix debian/$@/usr/bin/apt-,$(APT_UTILS))
  160. # https has its own package
  161. rm debian/$@/usr/lib/apt/methods/https
  162. # move the mirror failure script in place
  163. #mv debian/$@/usr/bin/apt-report-mirror-failure \
  164. # debian/$@/usr/lib/apt/apt-report-mirror-failure \
  165. dh_bugfiles -p$@
  166. dh_lintian -p$@
  167. dh_installexamples -p$@ $(BLD)/docs/examples/*
  168. dh_installman -p$@ $(wildcard $(patsubst %,doc/%.[158],$(apt_MANPAGES)) $(patsubst %,doc/*/%.*.[158],$(apt_MANPAGES)))
  169. dh_installcron -p$@
  170. dh_installdocs -p$@
  171. dh_installchangelogs -p$@
  172. dh_installlogrotate -p$@
  173. dh_strip -p$@
  174. dh_compress -p$@
  175. dh_fixperms -p$@
  176. dh_makeshlibs -p$@
  177. dh_installdeb -p$@
  178. dh_shlibdeps -p$@ -l$(CURDIR)/debian/apt/usr/lib:$(CURDIR)/debian/$@/usr/lib
  179. dh_gencontrol -p$@ -- -Vlibapt-pkg:provides=$(LIBAPTPKG_PROVIDE)
  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:provides=$(LIBAPTPKG_PROVIDE) -Vlibapt-inst:provides=$(LIBAPTINST_PROVIDE)
  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. dh_install -p$@ --sourcedir=$(BLD)
  208. dh_installdocs -p$@
  209. dh_installexamples -p$@
  210. # Install the man pages..
  211. dh_installman -p$@ $(wildcard $(patsubst %,doc/%.[158],$(apt-utils_MANPAGES)) $(patsubst %,doc/*/%.*.[158],$(apt-utils_MANPAGES)))
  212. dh_installchangelogs -p$@
  213. dh_strip -p$@
  214. dh_compress -p$@
  215. dh_fixperms -p$@
  216. dh_makeshlibs -p$@
  217. dh_installdeb -p$@
  218. dh_shlibdeps -p$@ -l$(CURDIR)/debian/apt/usr/lib:$(CURDIR)/debian/$@/usr/lib
  219. dh_gencontrol -p$@ -- -Vlibapt-inst:provides=$(LIBAPTINST_PROVIDE)
  220. dh_md5sums -p$@
  221. dh_builddeb -p$@
  222. apt-transport-https: build libapt-pkg-dev
  223. dh_testdir -p$@
  224. dh_testroot -p$@
  225. dh_prep -p$@
  226. dh_installdirs -p$@
  227. dh_install -p$@ --sourcedir=$(BLD)
  228. dh_installdocs -p$@ debian/apt-transport-https.README
  229. dh_installexamples -p$@
  230. # Install the man pages..
  231. dh_installman -p$@
  232. dh_installchangelogs -p$@
  233. dh_strip -p$@
  234. dh_compress -p$@
  235. dh_fixperms -p$@
  236. dh_installdeb -p$@
  237. dh_shlibdeps -p$@ -l$(CURDIR)/debian/apt/usr/lib:$(CURDIR)/debian/$@/usr/lib
  238. dh_gencontrol -p$@
  239. dh_md5sums -p$@
  240. dh_builddeb -p$@
  241. configure:
  242. $(MAKE) configure
  243. really-clean: clean
  244. -find . -name Makefile.in -print0 | xargs --null --no-run-if-empty -- rm -f
  245. find -name ChangeLog | xargs rm -f
  246. rm -f l33ch-stamp
  247. binary: binary-indep binary-arch
  248. .PHONY: build clean binary-indep binary-arch binary