rules 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312
  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. touch $@
  83. build/build-doc-stamp: build/configure-stamp
  84. # Add here commands to compile the package.
  85. $(MAKE) doc
  86. touch $@
  87. clean:
  88. dh_testdir
  89. [ ! -f Makefile ] || $(MAKE) clean distclean
  90. rm -rf build
  91. binary-indep: apt-doc libapt-pkg-doc
  92. # Build architecture-independent files here.
  93. libapt-pkg-doc: build-doc
  94. dh_testdir -p$@
  95. dh_testroot -p$@
  96. dh_prep -p$@
  97. dh_installdirs -p$@
  98. #
  99. # libapt-pkg-doc install
  100. #
  101. dh_installdocs -p$@ $(BLD)/docs/design* \
  102. $(BLD)/docs/dpkg-tech* \
  103. $(BLD)/docs/files* \
  104. $(BLD)/docs/method* \
  105. doc/libapt-pkg2_to_3.txt \
  106. doc/style.txt \
  107. $(BLD)/doc/doxygen/html
  108. dh_installexamples -p$@
  109. dh_installchangelogs -p$@
  110. dh_strip -p$@
  111. dh_compress -p$@
  112. dh_fixperms -p$@
  113. dh_installdeb -p$@
  114. dh_gencontrol -p$@ -- -Vlibapt-pkg:provides=$(LIBAPTPKG_PROVIDE)
  115. dh_md5sums -p$@
  116. dh_builddeb -p$@
  117. apt-doc: build-doc
  118. dh_testdir -p$@
  119. dh_testroot -p$@
  120. dh_prep -p$@
  121. #
  122. # apt-doc install
  123. #
  124. # Copy the guides
  125. dh_installdocs -p$@ $(BLD)/docs/guide*.text \
  126. $(BLD)/docs/guide*.html \
  127. $(BLD)/docs/offline*.text \
  128. $(BLD)/docs/offline*.html
  129. dh_installchangelogs -p$@
  130. dh_compress -p$@
  131. dh_fixperms -p$@
  132. dh_installdeb -p$@
  133. dh_gencontrol -p$@
  134. dh_md5sums -p$@
  135. dh_builddeb -p$@
  136. # Build architecture-dependent files here.
  137. binary-arch: apt libapt-pkg-dev apt-utils apt-transport-https
  138. apt_MANPAGES = apt-cache apt-cdrom apt-config apt-get apt-key apt-mark apt-secure apt apt.conf apt_preferences sources.list
  139. apt: build build-doc
  140. dh_testdir -p$@
  141. dh_testroot -p$@
  142. dh_prep -p$@
  143. dh_installdirs -p$@
  144. #
  145. # apt install
  146. #
  147. cp $(BLD)/bin/apt-* debian/$@/usr/bin/
  148. # Remove the bits that are in apt-utils
  149. rm $(addprefix debian/$@/usr/bin/apt-,$(APT_UTILS))
  150. # install the shared libs
  151. find $(BLD)/bin/ -type f -name "libapt-pkg*.so.*" -exec cp -a "{}" debian/$@/usr/lib/ \;
  152. find $(BLD)/bin/ -type l -name "libapt-pkg*.so.*" -exec cp -a "{}" debian/$@/usr/lib/ \;
  153. cp $(BLD)/bin/methods/* debian/$@/usr/lib/apt/methods/
  154. # https has its own package
  155. rm debian/$@/usr/lib/apt/methods/https
  156. cp $(BLD)/scripts/dselect/* debian/$@/usr/lib/dpkg/methods/apt/
  157. cp -r $(BLD)/locale debian/$@/usr/share/
  158. cp debian/bugscript debian/$@/usr/share/bug/apt/script
  159. cp debian/apt.logrotate debian/$@/etc/logrotate.d/apt
  160. cp debian/apt.conf.autoremove debian/$@/etc/apt/apt.conf.d/01autoremove
  161. # copy lintian override
  162. cp share/lintian-overrides debian/$@/usr/share/lintian/overrides/apt
  163. # make rosetta happy and remove pot files in po/ (but leave stuff
  164. # in po/domains/* untouched) and cp *.po into each domain dir
  165. rm -f build/po/*.pot
  166. rm -f po/*.pot
  167. # move the mirror failure script in place
  168. #mv debian/$@/usr/bin/apt-report-mirror-failure \
  169. # debian/$@/usr/lib/apt/apt-report-mirror-failure \
  170. dh_installexamples -p$@ $(BLD)/docs/examples/*
  171. dh_installman -p$@ $(wildcard $(patsubst %,doc/%.[158],$(apt_MANPAGES)) $(patsubst %,doc/*/%.*.[158],$(apt_MANPAGES)))
  172. dh_installcron -p$@
  173. dh_installdocs -p$@
  174. dh_installchangelogs -p$@
  175. dh_strip -p$@
  176. dh_compress -p$@
  177. dh_fixperms -p$@
  178. dh_makeshlibs -p$@
  179. dh_installdeb -p$@
  180. dh_shlibdeps -p$@ -l$(CURDIR)/debian/apt/usr/lib:$(CURDIR)/debian/$@/usr/lib
  181. dh_gencontrol -p$@ -- -Vlibapt-pkg:provides=$(LIBAPTPKG_PROVIDE)
  182. dh_md5sums -p$@
  183. dh_builddeb -p$@
  184. libapt-pkg-dev: build
  185. dh_testdir -p$@
  186. dh_testroot -p$@
  187. dh_prep -p$@
  188. dh_installdirs -p$@
  189. #
  190. # libapt-pkg-dev install
  191. #
  192. cp -a $(BLD)/bin/libapt-pkg*.so debian/libapt-pkg-dev/usr/lib/
  193. cp -a $(BLD)/bin/libapt-inst*.so debian/libapt-pkg-dev/usr/lib/
  194. # ln -s libapt-pkg.so.$(LIBAPTPKG_MAJOR) debian/libapt-pkg-dev/usr/lib/libapt-pkg.so
  195. cp $(BLD)/include/apt-pkg/*.h debian/libapt-pkg-dev/usr/include/apt-pkg/
  196. dh_installdocs -p$@
  197. dh_installchangelogs -p$@
  198. dh_strip -p$@
  199. dh_compress -p$@
  200. dh_fixperms -p$@
  201. dh_installdeb -p$@
  202. dh_gencontrol -p$@ -- -Vlibapt-pkg:provides=$(LIBAPTPKG_PROVIDE) -Vlibapt-inst:provides=$(LIBAPTINST_PROVIDE)
  203. dh_md5sums -p$@
  204. dh_builddeb -p$@
  205. apt-utils_MANPAGES = apt-sortpkgs apt-ftparchive apt-extracttemplates
  206. apt-utils: build
  207. dh_testdir -p$@
  208. dh_testroot -p$@
  209. dh_prep -p$@
  210. dh_installdirs -p$@
  211. # install the shared libs
  212. find $(BLD)/bin/ -type f -name "libapt-inst*.so.*" -exec cp -a "{}" debian/$@/usr/lib/ \;
  213. find $(BLD)/bin/ -type l -name "libapt-inst*.so.*" -exec cp -a "{}" debian/$@/usr/lib/ \;
  214. cp $(addprefix $(BLD)/bin/apt-,$(APT_UTILS)) debian/$@/usr/bin/
  215. dh_installdocs -p$@
  216. dh_installexamples -p$@
  217. # Install the man pages..
  218. dh_installman -p$@ $(wildcard $(patsubst %,doc/%.[158],$(apt-utils_MANPAGES)) $(patsubst %,doc/*/%.*.[158],$(apt-utils_MANPAGES)))
  219. dh_installchangelogs -p$@
  220. dh_strip -p$@
  221. dh_compress -p$@
  222. dh_fixperms -p$@
  223. dh_makeshlibs -p$@
  224. dh_installdeb -p$@
  225. dh_shlibdeps -p$@ -l$(CURDIR)/debian/apt/usr/lib:$(CURDIR)/debian/$@/usr/lib
  226. dh_gencontrol -p$@ -- -Vlibapt-inst:provides=$(LIBAPTINST_PROVIDE)
  227. dh_md5sums -p$@
  228. dh_builddeb -p$@
  229. apt-transport-https: build libapt-pkg-dev
  230. dh_testdir -p$@
  231. dh_testroot -p$@
  232. dh_prep -p$@
  233. dh_installdirs -p$@
  234. # install the method
  235. mkdir --parents debian/$@/usr/lib/apt/methods
  236. cp $(BLD)/bin/methods/https debian/$@/usr/lib/apt/methods
  237. dh_installdocs -p$@ debian/apt-transport-https.README
  238. dh_installexamples -p$@
  239. # Install the man pages..
  240. dh_installman -p$@
  241. dh_installchangelogs -p$@
  242. dh_strip -p$@
  243. dh_compress -p$@
  244. dh_fixperms -p$@
  245. dh_installdeb -p$@
  246. dh_shlibdeps -p$@ -l$(CURDIR)/debian/apt/usr/lib:$(CURDIR)/debian/$@/usr/lib
  247. dh_gencontrol -p$@
  248. dh_md5sums -p$@
  249. dh_builddeb -p$@
  250. configure:
  251. $(MAKE) configure
  252. really-clean: clean
  253. -find . -name Makefile.in -print0 | xargs --null --no-run-if-empty -- rm -f
  254. find -name ChangeLog | xargs rm -f
  255. rm -f l33ch-stamp
  256. binary: binary-indep binary-arch
  257. .PHONY: build clean binary-indep binary-arch binary