rules 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336
  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. # $Id: rules,v 1.68 2004/05/30 18:21:43 mdz Exp $
  6. # LD_LIBRARY_PATH=pwd/debian/apt/usr/lib dh_shlibdeps -papt
  7. # dpkg: /home/jgg/work/apt2/debian/apt/usr/lib/libapt-pkg.so.2.9 not found.
  8. # For the deb builder, you can run 'debian/rules cvs-build', which does all
  9. # steps nescessary to produce a proper source tarball with the CVS/ removed.
  10. # It builds in debian/cvs-build/apt-<VER>/, and places files in
  11. # debian/cvs-build/. Optionally, you can run 'debian/rules cvs-mkul' to
  12. # create ../upload-<VER>, with all the files needed to be uploaded placed
  13. # in it.
  14. export DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
  15. export DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
  16. # FOR AUTOCONF 2.52 AND NEWER ONLY
  17. ifeq ($(DEB_BUILD_GNU_TYPE), $(DEB_HOST_GNU_TYPE))
  18. confflags += --build $(DEB_HOST_GNU_TYPE)
  19. else
  20. confflags += --build $(DEB_BUILD_GNU_TYPE) --host $(DEB_HOST_GNU_TYPE)
  21. endif
  22. # See below
  23. -include build/environment.mak
  24. ifneq (,$(shell which dpkg-buildflags))
  25. export CXXFLAGS = $(shell dpkg-buildflags --get CXXFLAGS)
  26. else
  27. ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
  28. export CXXFLAGS = -O0 -g -Wall
  29. else
  30. export CXXFLAGS = -O2 -g -Wall
  31. endif
  32. endif
  33. # Default rule
  34. build:
  35. PKG=apt
  36. DEB_BUILD_PROG:=debuild --preserve-envvar PATH --preserve-envvar CCACHE_DIR -us -uc $(DEB_BUILD_PROG_OPTS)
  37. APT_DEBVER=$(shell dpkg-parsechangelog |sed -n -e '/^Version:/s/^Version: //p' | sed -e 's/\+.*$$//')
  38. APT_CONFVER=$(shell sed -n -e 's/^AC_DEFINE_UNQUOTED(VERSION,"\(.*\)")/\1/p' configure.in)
  39. APT_CVSTAG=$(shell echo "$(APT_DEBVER)" | sed -e 's/^/v/' -e 's/\./_/g')
  40. # Determine the build directory to use
  41. BASE=.
  42. ifdef BUILD
  43. BUILD_POSSIBLE := $(BUILD) $(BASE)/$(BUILD)
  44. else
  45. BUILD_POSSIBLE := $(BASE) $(BASE)/build-$(shell uname --machine) $(BASE)/build
  46. endif
  47. BUILDX:= $(foreach i,$(BUILD_POSSIBLE),$(wildcard $(i)/environment.mak*))
  48. BUILDX:= $(patsubst %/,%,$(firstword $(dir $(BUILDX))))
  49. override BLD := $(BUILDX)
  50. ifeq ($(words $(BLD)),0)
  51. override BLD := ./build
  52. endif
  53. # Rebuild configure.in to have the correct version from the change log
  54. ifneq ($(APT_DEBVER),$(APT_CONFVER))
  55. ifneq ($(APT_DEBVER),)
  56. .PHONY: configure.in
  57. configure.in:
  58. sed -e 's/$(APT_CONFVER)/$(APT_DEBVER)/' $@ > $@.$$$$ && mv $@.$$$$ $@
  59. endif
  60. else
  61. configure.in:
  62. endif
  63. # APT Programs in apt-utils
  64. APT_UTILS=ftparchive sortpkgs extracttemplates
  65. # Uncomment this to turn on verbose mode.
  66. #export DH_VERBOSE=1
  67. # Find the libapt-pkg major version for use in other control files
  68. include buildlib/libversion.mak
  69. # Determine which package we should provide in the control files
  70. LIBAPTPKG_PROVIDE=libapt-pkg$(LIBAPTPKG_MAJOR)
  71. LIBAPTINST_PROVIDE=libapt-inst$(LIBAPTINST_MAJOR)
  72. debian/shlibs.local: apt-pkg/makefile
  73. # We have 3 shlibs.local files: One for 'apt', one for 'apt-utils' and
  74. # one for the rest of the packages. This ensures that each package gets
  75. # the right overrides…
  76. rm -rf $@ $@.apt $@.apt-utils
  77. echo "libapt-pkg $(LIBAPTPKG_MAJOR)" > $@.apt
  78. echo "libapt-pkg $(LIBAPTPKG_MAJOR) $(LIBAPTPKG_PROVIDE)" > $@.apt-utils
  79. echo "libapt-inst $(LIBAPTINST_MAJOR)" >> $@.apt-utils
  80. echo "libapt-pkg $(LIBAPTPKG_MAJOR) $(LIBAPTPKG_PROVIDE)" > $@
  81. echo "libapt-inst $(LIBAPTINST_MAJOR) $(LIBAPTINST_PROVIDE)" >> $@
  82. build: build/build-stamp
  83. build-doc: build/build-doc-stamp
  84. # Note that this is unconditionally done first as part of loading environment.mak
  85. # The true is needed to force make to reload environment.mak after running
  86. # configure-stamp. Otherwise we can get stale or invalid, or missing config data.
  87. build/environment.mak: build/configure-stamp
  88. @true
  89. configure: configure.in
  90. build/configure-stamp: configure
  91. dh_testdir
  92. -mkdir build
  93. cp COPYING debian/copyright
  94. cd build && CXXFLAGS="$(confcxxflags)" ../configure $(confflags)
  95. touch $@
  96. build/build-stamp: build/configure-stamp
  97. # Add here commands to compile the package.
  98. $(MAKE) binary
  99. touch $@
  100. build/build-doc-stamp: build/configure-stamp
  101. # Add here commands to compile the package.
  102. $(MAKE) doc
  103. touch $@
  104. clean:
  105. dh_testdir
  106. [ ! -f Makefile ] || $(MAKE) clean distclean
  107. rm -rf build
  108. # Add here commands to clean up after the build process.
  109. dh_clean debian/copyright debian/shlibs.local debian/shlibs.local.apt debian/shlibs.local.apt-utils
  110. binary-indep: apt-doc libapt-pkg-doc
  111. # Build architecture-independent files here.
  112. libapt-pkg-doc: build-doc debian/shlibs.local
  113. dh_testdir -p$@
  114. dh_testroot -p$@
  115. dh_clean -p$@ -k
  116. dh_installdirs -p$@
  117. #
  118. # libapt-pkg-doc install
  119. #
  120. dh_installdocs -p$@ $(BLD)/docs/design* \
  121. $(BLD)/docs/dpkg-tech* \
  122. $(BLD)/docs/files* \
  123. $(BLD)/docs/method* \
  124. doc/libapt-pkg2_to_3.txt \
  125. doc/style.txt \
  126. $(BLD)/doc/doxygen/html
  127. dh_installexamples -p$@
  128. dh_installchangelogs -p$@
  129. dh_strip -p$@
  130. dh_compress -p$@
  131. dh_fixperms -p$@
  132. dh_installdeb -p$@
  133. dh_gencontrol -p$@ -u -Vlibapt-pkg:provides=$(LIBAPTPKG_PROVIDE)
  134. dh_md5sums -p$@
  135. dh_builddeb -p$@
  136. apt-doc: build-doc
  137. dh_testdir -p$@
  138. dh_testroot -p$@
  139. dh_clean -p$@ -k
  140. #
  141. # apt-doc install
  142. #
  143. # Copy the guides
  144. dh_installdocs -p$@ $(BLD)/docs/guide*.text \
  145. $(BLD)/docs/guide*.html \
  146. $(BLD)/docs/offline*.text \
  147. $(BLD)/docs/offline*.html
  148. dh_installchangelogs -p$@
  149. dh_compress -p$@
  150. dh_fixperms -p$@
  151. dh_installdeb -p$@
  152. dh_gencontrol -p$@
  153. dh_md5sums -p$@
  154. dh_builddeb -p$@
  155. # Build architecture-dependent files here.
  156. binary-arch: apt libapt-pkg-dev apt-utils apt-transport-https
  157. apt_MANPAGES = apt-cache apt-cdrom apt-config apt-get apt-key apt-mark apt-secure apt apt.conf apt_preferences sources.list
  158. apt: build build-doc debian/shlibs.local
  159. dh_testdir -p$@
  160. dh_testroot -p$@
  161. dh_clean -p$@ -k
  162. dh_installdirs -p$@
  163. #
  164. # apt install
  165. #
  166. cp $(BLD)/bin/apt-* debian/$@/usr/bin/
  167. # Remove the bits that are in apt-utils
  168. rm $(addprefix debian/$@/usr/bin/apt-,$(APT_UTILS))
  169. # install the shared libs
  170. find $(BLD)/bin/ -type f -name "libapt-pkg*.so.*" -exec cp -a "{}" debian/$@/usr/lib/ \;
  171. find $(BLD)/bin/ -type l -name "libapt-pkg*.so.*" -exec cp -a "{}" debian/$@/usr/lib/ \;
  172. cp $(BLD)/bin/methods/* debian/$@/usr/lib/apt/methods/
  173. # https has its own package
  174. rm debian/$@/usr/lib/apt/methods/https
  175. cp $(BLD)/scripts/dselect/* debian/$@/usr/lib/dpkg/methods/apt/
  176. cp -r $(BLD)/locale debian/$@/usr/share/
  177. cp debian/bugscript debian/$@/usr/share/bug/apt/script
  178. cp debian/apt.logrotate debian/$@/etc/logrotate.d/apt
  179. cp debian/apt.conf.autoremove debian/$@/etc/apt/apt.conf.d/01autoremove
  180. # copy lintian override
  181. cp share/lintian-overrides debian/$@/usr/share/lintian/overrides/apt
  182. # make rosetta happy and remove pot files in po/ (but leave stuff
  183. # in po/domains/* untouched) and cp *.po into each domain dir
  184. rm -f build/po/*.pot
  185. rm -f po/*.pot
  186. # move the mirror failure script in place
  187. #mv debian/$@/usr/bin/apt-report-mirror-failure \
  188. # debian/$@/usr/lib/apt/apt-report-mirror-failure \
  189. dh_installexamples -p$@ $(BLD)/docs/examples/*
  190. dh_installman -p$@ $(wildcard $(patsubst %,doc/%.[158],$(apt_MANPAGES)) $(patsubst %,doc/*/%.*.[158],$(apt_MANPAGES)))
  191. dh_installcron -p$@
  192. dh_installdocs -p$@
  193. dh_installchangelogs -p$@
  194. dh_strip -p$@
  195. dh_compress -p$@
  196. dh_fixperms -p$@
  197. dh_makeshlibs -p$@ --major=$(LIBAPTPKG_MAJOR) --version-info='$(LIBAPTPKG_PROVIDE)'
  198. dh_installdeb -p$@
  199. dh_shlibdeps -p$@ -l$(CURDIR)/debian/apt/usr/lib:$(CURDIR)/debian/$@/usr/lib -- -Ldebian/shlibs.local.apt
  200. dh_gencontrol -p$@ -u -Vlibapt-pkg:provides=$(LIBAPTPKG_PROVIDE)
  201. dh_md5sums -p$@
  202. dh_builddeb -p$@
  203. libapt-pkg-dev: build debian/shlibs.local
  204. dh_testdir -p$@
  205. dh_testroot -p$@
  206. dh_clean -p$@ -k
  207. dh_installdirs -p$@
  208. #
  209. # libapt-pkg-dev install
  210. #
  211. cp -a $(BLD)/bin/libapt-pkg*.so debian/libapt-pkg-dev/usr/lib/
  212. cp -a $(BLD)/bin/libapt-inst*.so debian/libapt-pkg-dev/usr/lib/
  213. # ln -s libapt-pkg.so.$(LIBAPTPKG_MAJOR) debian/libapt-pkg-dev/usr/lib/libapt-pkg.so
  214. cp $(BLD)/include/apt-pkg/*.h debian/libapt-pkg-dev/usr/include/apt-pkg/
  215. dh_installdocs -p$@
  216. dh_installchangelogs -p$@
  217. dh_strip -p$@
  218. dh_compress -p$@
  219. dh_fixperms -p$@
  220. dh_installdeb -p$@
  221. dh_gencontrol -p$@ -u -Vlibapt-pkg:provides=$(LIBAPTPKG_PROVIDE) -Vlibapt-inst:provides=$(LIBAPTINST_PROVIDE)
  222. dh_md5sums -p$@
  223. dh_builddeb -p$@
  224. apt-utils_MANPAGES = apt-sortpkgs apt-ftparchive apt-extracttemplates
  225. apt-utils: build debian/shlibs.local
  226. dh_testdir -p$@
  227. dh_testroot -p$@
  228. dh_clean -p$@ -k
  229. dh_installdirs -p$@
  230. # install the shared libs
  231. find $(BLD)/bin/ -type f -name "libapt-inst*.so.*" -exec cp -a "{}" debian/$@/usr/lib/ \;
  232. find $(BLD)/bin/ -type l -name "libapt-inst*.so.*" -exec cp -a "{}" debian/$@/usr/lib/ \;
  233. cp $(addprefix $(BLD)/bin/apt-,$(APT_UTILS)) debian/$@/usr/bin/
  234. dh_installdocs -p$@
  235. dh_installexamples -p$@
  236. # Install the man pages..
  237. dh_installman -p$@ $(wildcard $(patsubst %,doc/%.[158],$(apt-utils_MANPAGES)) $(patsubst %,doc/*/%.*.[158],$(apt-utils_MANPAGES)))
  238. dh_installchangelogs -p$@
  239. dh_strip -p$@
  240. dh_compress -p$@
  241. dh_fixperms -p$@
  242. dh_makeshlibs -p$@ --major=$(LIBAPTINST_MAJOR) --version-info='$(LIBAPTINST_PROVIDE)'
  243. dh_installdeb -p$@
  244. dh_shlibdeps -p$@ -l$(CURDIR)/debian/apt/usr/lib:$(CURDIR)/debian/$@/usr/lib -- -Ldebian/shlibs.local.apt-utils
  245. dh_gencontrol -p$@ -u -Vlibapt-inst:provides=$(LIBAPTINST_PROVIDE)
  246. dh_md5sums -p$@
  247. dh_builddeb -p$@
  248. apt-transport-https: build debian/shlibs.local libapt-pkg-dev
  249. dh_testdir -p$@
  250. dh_testroot -p$@
  251. dh_clean -p$@ -k
  252. dh_installdirs -p$@
  253. # install the method
  254. mkdir --parents debian/$@/usr/lib/apt/methods
  255. cp $(BLD)/bin/methods/https debian/$@/usr/lib/apt/methods
  256. dh_installdocs -p$@ debian/apt-transport-https.README
  257. dh_installexamples -p$@
  258. # Install the man pages..
  259. dh_installman -p$@
  260. dh_installchangelogs -p$@
  261. dh_strip -p$@
  262. dh_compress -p$@
  263. dh_fixperms -p$@
  264. dh_installdeb -p$@
  265. dh_shlibdeps -p$@ -l$(CURDIR)/debian/apt/usr/lib:$(CURDIR)/debian/$@/usr/lib
  266. dh_gencontrol -p$@
  267. dh_md5sums -p$@
  268. dh_builddeb -p$@
  269. configure:
  270. $(MAKE) configure
  271. really-clean: clean
  272. -find . -name Makefile.in -print0 | xargs --null --no-run-if-empty -- rm -f
  273. find -name ChangeLog | xargs rm -f
  274. rm -f l33ch-stamp
  275. binary: binary-indep binary-arch
  276. .PHONY: build clean binary-indep binary-arch binary debian/shlibs.local