rules 9.8 KB

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