rules 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325
  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. debian/shlibs.local: apt-pkg/makefile
  64. # We have 3 shlibs.local files: One for 'apt', one for 'apt-utils' and
  65. # one for the rest of the packages. This ensures that each package gets
  66. # the right overrides…
  67. rm -rf $@ $@.apt $@.apt-utils
  68. echo "libapt-pkg $(LIBAPTPKG_MAJOR)" > $@.apt
  69. echo "libapt-pkg $(LIBAPTPKG_MAJOR) $(LIBAPTPKG_PROVIDE)" > $@.apt-utils
  70. echo "libapt-inst $(LIBAPTINST_MAJOR)" >> $@.apt-utils
  71. echo "libapt-pkg $(LIBAPTPKG_MAJOR) $(LIBAPTPKG_PROVIDE)" > $@
  72. echo "libapt-inst $(LIBAPTINST_MAJOR) $(LIBAPTINST_PROVIDE)" >> $@
  73. build: build/build-stamp
  74. build-doc: build/build-doc-stamp
  75. # Note that this is unconditionally done first as part of loading environment.mak
  76. # The true is needed to force make to reload environment.mak after running
  77. # configure-stamp. Otherwise we can get stale or invalid, or missing config data.
  78. build/environment.mak: build/configure-stamp
  79. @true
  80. configure: configure.in
  81. build/configure-stamp: configure
  82. dh_testdir
  83. -mkdir build
  84. cp COPYING debian/copyright
  85. cd build && CXXFLAGS="$(CXXFLAGS)" ../configure $(confflags)
  86. touch $@
  87. build/build-stamp: build/configure-stamp
  88. # Add here commands to compile the package.
  89. $(MAKE) binary
  90. touch $@
  91. build/build-doc-stamp: build/configure-stamp
  92. # Add here commands to compile the package.
  93. $(MAKE) doc
  94. touch $@
  95. clean:
  96. dh_testdir
  97. [ ! -f Makefile ] || $(MAKE) clean distclean
  98. rm -rf build
  99. # Add here commands to clean up after the build process.
  100. dh_clean debian/copyright debian/shlibs.local debian/shlibs.local.apt debian/shlibs.local.apt-utils
  101. binary-indep: apt-doc libapt-pkg-doc
  102. # Build architecture-independent files here.
  103. libapt-pkg-doc: build-doc debian/shlibs.local
  104. dh_testdir -p$@
  105. dh_testroot -p$@
  106. dh_prep -p$@
  107. dh_installdirs -p$@
  108. #
  109. # libapt-pkg-doc install
  110. #
  111. dh_installdocs -p$@ $(BLD)/docs/design* \
  112. $(BLD)/docs/dpkg-tech* \
  113. $(BLD)/docs/files* \
  114. $(BLD)/docs/method* \
  115. doc/libapt-pkg2_to_3.txt \
  116. doc/style.txt \
  117. $(BLD)/doc/doxygen/html
  118. dh_installexamples -p$@
  119. dh_installchangelogs -p$@
  120. dh_strip -p$@
  121. dh_compress -p$@
  122. dh_fixperms -p$@
  123. dh_installdeb -p$@
  124. dh_gencontrol -p$@ -u -Vlibapt-pkg:provides=$(LIBAPTPKG_PROVIDE)
  125. dh_md5sums -p$@
  126. dh_builddeb -p$@
  127. apt-doc: build-doc
  128. dh_testdir -p$@
  129. dh_testroot -p$@
  130. dh_prep -p$@
  131. #
  132. # apt-doc install
  133. #
  134. # Copy the guides
  135. dh_installdocs -p$@ $(BLD)/docs/guide*.text \
  136. $(BLD)/docs/guide*.html \
  137. $(BLD)/docs/offline*.text \
  138. $(BLD)/docs/offline*.html
  139. dh_installchangelogs -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. # Build architecture-dependent files here.
  147. binary-arch: apt libapt-pkg-dev apt-utils apt-transport-https
  148. apt_MANPAGES = apt-cache apt-cdrom apt-config apt-get apt-key apt-mark apt-secure apt apt.conf apt_preferences sources.list
  149. apt: build build-doc debian/shlibs.local
  150. dh_testdir -p$@
  151. dh_testroot -p$@
  152. dh_prep -p$@
  153. dh_installdirs -p$@
  154. #
  155. # apt install
  156. #
  157. cp $(BLD)/bin/apt-* debian/$@/usr/bin/
  158. # Remove the bits that are in apt-utils
  159. rm $(addprefix debian/$@/usr/bin/apt-,$(APT_UTILS))
  160. # install the shared libs
  161. find $(BLD)/bin/ -type f -name "libapt-pkg*.so.*" -exec cp -a "{}" debian/$@/usr/lib/ \;
  162. find $(BLD)/bin/ -type l -name "libapt-pkg*.so.*" -exec cp -a "{}" debian/$@/usr/lib/ \;
  163. cp $(BLD)/bin/methods/* debian/$@/usr/lib/apt/methods/
  164. # https has its own package
  165. rm debian/$@/usr/lib/apt/methods/https
  166. cp $(BLD)/scripts/dselect/* debian/$@/usr/lib/dpkg/methods/apt/
  167. cp -r $(BLD)/locale debian/$@/usr/share/
  168. cp debian/bugscript debian/$@/usr/share/bug/apt/script
  169. cp debian/apt.logrotate debian/$@/etc/logrotate.d/apt
  170. cp debian/apt.conf.autoremove debian/$@/etc/apt/apt.conf.d/01autoremove
  171. # copy lintian override
  172. cp share/lintian-overrides debian/$@/usr/share/lintian/overrides/apt
  173. # make rosetta happy and remove pot files in po/ (but leave stuff
  174. # in po/domains/* untouched) and cp *.po into each domain dir
  175. rm -f build/po/*.pot
  176. rm -f po/*.pot
  177. # move the mirror failure script in place
  178. #mv debian/$@/usr/bin/apt-report-mirror-failure \
  179. # debian/$@/usr/lib/apt/apt-report-mirror-failure \
  180. dh_installexamples -p$@ $(BLD)/docs/examples/*
  181. dh_installman -p$@ $(wildcard $(patsubst %,doc/%.[158],$(apt_MANPAGES)) $(patsubst %,doc/*/%.*.[158],$(apt_MANPAGES)))
  182. dh_installcron -p$@
  183. dh_installdocs -p$@
  184. dh_installchangelogs -p$@
  185. dh_strip -p$@
  186. dh_compress -p$@
  187. dh_fixperms -p$@
  188. dh_makeshlibs -p$@ --major=$(LIBAPTPKG_MAJOR) --version-info='$(LIBAPTPKG_PROVIDE)'
  189. dh_installdeb -p$@
  190. dh_shlibdeps -p$@ -l$(CURDIR)/debian/apt/usr/lib:$(CURDIR)/debian/$@/usr/lib -- -Ldebian/shlibs.local.apt
  191. dh_gencontrol -p$@ -u -Vlibapt-pkg:provides=$(LIBAPTPKG_PROVIDE)
  192. dh_md5sums -p$@
  193. dh_builddeb -p$@
  194. libapt-pkg-dev: build debian/shlibs.local
  195. dh_testdir -p$@
  196. dh_testroot -p$@
  197. dh_prep -p$@
  198. dh_installdirs -p$@
  199. #
  200. # libapt-pkg-dev install
  201. #
  202. cp -a $(BLD)/bin/libapt-pkg*.so debian/libapt-pkg-dev/usr/lib/
  203. cp -a $(BLD)/bin/libapt-inst*.so debian/libapt-pkg-dev/usr/lib/
  204. # ln -s libapt-pkg.so.$(LIBAPTPKG_MAJOR) debian/libapt-pkg-dev/usr/lib/libapt-pkg.so
  205. cp $(BLD)/include/apt-pkg/*.h debian/libapt-pkg-dev/usr/include/apt-pkg/
  206. dh_installdocs -p$@
  207. dh_installchangelogs -p$@
  208. dh_strip -p$@
  209. dh_compress -p$@
  210. dh_fixperms -p$@
  211. dh_installdeb -p$@
  212. dh_gencontrol -p$@ -u -Vlibapt-pkg:provides=$(LIBAPTPKG_PROVIDE) -Vlibapt-inst:provides=$(LIBAPTINST_PROVIDE)
  213. dh_md5sums -p$@
  214. dh_builddeb -p$@
  215. apt-utils_MANPAGES = apt-sortpkgs apt-ftparchive apt-extracttemplates
  216. apt-utils: build debian/shlibs.local
  217. dh_testdir -p$@
  218. dh_testroot -p$@
  219. dh_prep -p$@
  220. dh_installdirs -p$@
  221. # install the shared libs
  222. find $(BLD)/bin/ -type f -name "libapt-inst*.so.*" -exec cp -a "{}" debian/$@/usr/lib/ \;
  223. find $(BLD)/bin/ -type l -name "libapt-inst*.so.*" -exec cp -a "{}" debian/$@/usr/lib/ \;
  224. cp $(addprefix $(BLD)/bin/apt-,$(APT_UTILS)) debian/$@/usr/bin/
  225. dh_installdocs -p$@
  226. dh_installexamples -p$@
  227. # Install the man pages..
  228. dh_installman -p$@ $(wildcard $(patsubst %,doc/%.[158],$(apt-utils_MANPAGES)) $(patsubst %,doc/*/%.*.[158],$(apt-utils_MANPAGES)))
  229. dh_installchangelogs -p$@
  230. dh_strip -p$@
  231. dh_compress -p$@
  232. dh_fixperms -p$@
  233. dh_makeshlibs -p$@ --major=$(LIBAPTINST_MAJOR) --version-info='$(LIBAPTINST_PROVIDE)'
  234. dh_installdeb -p$@
  235. dh_shlibdeps -p$@ -l$(CURDIR)/debian/apt/usr/lib:$(CURDIR)/debian/$@/usr/lib -- -Ldebian/shlibs.local.apt-utils
  236. dh_gencontrol -p$@ -u -Vlibapt-inst:provides=$(LIBAPTINST_PROVIDE)
  237. dh_md5sums -p$@
  238. dh_builddeb -p$@
  239. apt-transport-https: build debian/shlibs.local libapt-pkg-dev
  240. dh_testdir -p$@
  241. dh_testroot -p$@
  242. dh_prep -p$@
  243. dh_installdirs -p$@
  244. # install the method
  245. mkdir --parents debian/$@/usr/lib/apt/methods
  246. cp $(BLD)/bin/methods/https debian/$@/usr/lib/apt/methods
  247. dh_installdocs -p$@ debian/apt-transport-https.README
  248. dh_installexamples -p$@
  249. # Install the man pages..
  250. dh_installman -p$@
  251. dh_installchangelogs -p$@
  252. dh_strip -p$@
  253. dh_compress -p$@
  254. dh_fixperms -p$@
  255. dh_installdeb -p$@
  256. dh_shlibdeps -p$@ -l$(CURDIR)/debian/apt/usr/lib:$(CURDIR)/debian/$@/usr/lib
  257. dh_gencontrol -p$@
  258. dh_md5sums -p$@
  259. dh_builddeb -p$@
  260. configure:
  261. $(MAKE) configure
  262. really-clean: clean
  263. -find . -name Makefile.in -print0 | xargs --null --no-run-if-empty -- rm -f
  264. find -name ChangeLog | xargs rm -f
  265. rm -f l33ch-stamp
  266. binary: binary-indep binary-arch
  267. .PHONY: build clean binary-indep binary-arch binary debian/shlibs.local