rules 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379
  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 -m) $(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. export LIBAPTPKG_MAJOR:=$(shell egrep '^MAJOR=' apt-pkg/makefile |cut -d '=' -f 2)
  65. export LIBAPTINST_MAJOR:=$(shell egrep '^MAJOR=' apt-inst/makefile |cut -d '=' -f 2)
  66. # Determine which package we should provide in the control files
  67. LIBAPTPKG_PROVIDE=libapt-pkg$(GLIBC_VER)$(LIBSTDCPP_VER)-$(LIBAPTPKG_MAJOR)
  68. LIBAPTINST_PROVIDE=libapt-inst$(GLIBC_VER)$(LIBSTDCPP_VER)-$(LIBAPTINST_MAJOR)
  69. debian/shlibs.local: apt-pkg/makefile
  70. # We have 3 shlibs.local files.. One for 'apt', one for 'apt-utils' and
  71. # one for the rest of the packages. This ensures that each package gets
  72. # the right overrides..
  73. rm -rf $@ $@.apt $@.apt-utils
  74. echo "libapt-pkg$(GLIBC_VER)$(LIBSTDCPP_VER) $(LIBAPTPKG_MAJOR)" > $@.apt
  75. echo "libapt-pkg$(GLIBC_VER)$(LIBSTDCPP_VER) $(LIBAPTPKG_MAJOR) $(LIBAPTPKG_PROVIDE)" > $@.apt-utils
  76. echo "libapt-inst$(GLIBC_VER)$(LIBSTDCPP_VER) $(LIBAPTINST_MAJOR)" >> $@.apt-utils
  77. echo "libapt-pkg$(GLIBC_VER)$(LIBSTDCPP_VER) $(LIBAPTPKG_MAJOR) $(LIBAPTPKG_PROVIDE)" > $@
  78. echo "libapt-inst$(GLIBC_VER)$(LIBSTDCPP_VER) $(LIBAPTINST_MAJOR) $(LIBAPTINST_PROVIDE)" >> $@
  79. build: build/build-stamp
  80. build-doc: build/build-doc-stamp
  81. # Note that this is unconditionally done first as part of loading environment.mak
  82. # The true is needed to force make to reload environment.mak after running
  83. # configure-stamp. Otherwise we can get stale or invalid, or missing config data.
  84. build/environment.mak: build/configure-stamp
  85. @true
  86. configure: configure.in
  87. build/configure-stamp: configure
  88. dh_testdir
  89. -mkdir build
  90. cp COPYING debian/copyright
  91. cd build && CXXFLAGS="$(confcxxflags)" ../configure $(confflags)
  92. touch $@
  93. build/build-stamp: build/configure-stamp
  94. # Add here commands to compile the package.
  95. $(MAKE) binary
  96. touch $@
  97. build/build-doc-stamp: build/configure-stamp
  98. # Add here commands to compile the package.
  99. $(MAKE) doc
  100. touch $@
  101. clean:
  102. dh_testdir
  103. # dh_testroot
  104. [ -f Makefile ] && $(MAKE) clean
  105. [ -f Makefile ] && $(MAKE) distclean
  106. rm -rf build
  107. # Add here commands to clean up after the build process.
  108. dh_clean debian/copyright debian/shlibs.local debian/shlibs.local.apt debian/shlibs.local.apt-utils
  109. binary-indep: apt-doc libapt-pkg-doc
  110. # Build architecture-independent files here.
  111. libapt-pkg-doc: build-doc debian/shlibs.local
  112. dh_testdir -p$@
  113. dh_testroot -p$@
  114. dh_clean -p$@ -k
  115. dh_installdirs -p$@
  116. #
  117. # libapt-pkg-doc install
  118. #
  119. dh_installdocs -p$@ $(BLD)/docs/cache* $(BLD)/docs/design* $(BLD)/docs/dpkg-tech* \
  120. $(BLD)/docs/files* $(BLD)/docs/method* \
  121. doc/libapt-pkg2_to_3.txt doc/style.txt
  122. dh_installexamples -p$@
  123. # dh_installmenu -p$@
  124. # dh_installinit -p$@
  125. # dh_installcron -p$@
  126. # dh_installman -p$@
  127. # dh_undocumented -p$@
  128. dh_installchangelogs -p$@
  129. dh_strip -p$@
  130. dh_compress -p$@
  131. dh_fixperms -p$@
  132. # dh_suidregister -p$@
  133. dh_installdeb -p$@
  134. dh_gencontrol -p$@ -u -Vlibapt-pkg:provides=$(LIBAPTPKG_PROVIDE)
  135. dh_md5sums -p$@
  136. dh_builddeb -p$@
  137. apt-doc: build-doc
  138. dh_testdir -p$@
  139. dh_testroot -p$@
  140. dh_clean -p$@ -k
  141. #
  142. # apt-doc install
  143. #
  144. # Copy the guides
  145. dh_installdocs -p$@ $(BLD)/docs/guide*.text $(BLD)/docs/guide*.html \
  146. $(BLD)/docs/offline*.text $(BLD)/docs/offline*.html
  147. dh_installchangelogs -p$@
  148. dh_compress -p$@
  149. dh_fixperms -p$@
  150. dh_installdeb -p$@
  151. dh_gencontrol -p$@
  152. dh_md5sums -p$@
  153. dh_builddeb -p$@
  154. # Build architecture-dependent files here.
  155. binary-arch: apt libapt-pkg-dev apt-utils apt-transport-https
  156. apt: build build-doc debian/shlibs.local
  157. dh_testdir -p$@
  158. dh_testroot -p$@
  159. dh_clean -p$@ -k
  160. dh_installdirs -p$@ /usr/share/bug/$@ /usr/share/$@
  161. #
  162. # apt install
  163. #
  164. cp $(BLD)/bin/apt-* debian/$@/usr/bin/
  165. # Remove the bits that are in apt-utils
  166. rm $(addprefix debian/$@/usr/bin/apt-,$(APT_UTILS))
  167. # install the shared libs
  168. find $(BLD)/bin/ -type f -name "libapt-pkg*.so.*" -exec cp -a "{}" debian/$@/usr/lib/ \;
  169. find $(BLD)/bin/ -type l -name "libapt-pkg*.so.*" -exec cp -a "{}" debian/$@/usr/lib/ \;
  170. cp $(BLD)/bin/methods/* debian/$@/usr/lib/apt/methods/
  171. # https has its own package
  172. rm debian/$@/usr/lib/apt/methods/https
  173. cp $(BLD)/scripts/dselect/* debian/$@/usr/lib/dpkg/methods/apt/
  174. cp -r $(BLD)/locale debian/$@/usr/share/
  175. cp debian/bugscript debian/$@/usr/share/bug/apt/script
  176. cp debian/apt.logrotate debian/$@/etc/logrotate.d/apt
  177. cp share/debian-archive.gpg debian/$@/usr/share/$@
  178. cp debian/apt.conf.autoremove debian/$@/etc/apt/apt.conf.d/01autoremove
  179. # head -n 500 ChangeLog > debian/ChangeLog
  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. dh_installexamples -p$@ $(BLD)/docs/examples/*
  187. dh_installman -p$@
  188. dh_installcron -p$@
  189. dh_installdocs -p$@
  190. dh_installchangelogs -p$@
  191. dh_strip -p$@
  192. dh_compress -p$@
  193. dh_fixperms -p$@
  194. dh_makeshlibs -p$@ -m$(LIBAPTPKG_MAJOR) -V '$(LIBAPTPKG_PROVIDE)'
  195. dh_installdeb -p$@
  196. dh_shlibdeps -p$@ -l`pwd`/debian/apt/usr/lib:`pwd`/debian/$@/usr/lib -- -Ldebian/shlibs.local.apt
  197. dh_gencontrol -p$@ -u -Vlibapt-pkg:provides=$(LIBAPTPKG_PROVIDE)
  198. dh_md5sums -p$@
  199. dh_builddeb -p$@
  200. libapt-pkg-dev: build debian/shlibs.local
  201. dh_testdir -p$@
  202. dh_testroot -p$@
  203. dh_clean -p$@ -k
  204. dh_installdirs -p$@
  205. #
  206. # libapt-pkg-dev install
  207. #
  208. cp -a $(BLD)/bin/libapt-pkg*.so debian/libapt-pkg-dev/usr/lib/
  209. cp -a $(BLD)/bin/libapt-inst*.so debian/libapt-pkg-dev/usr/lib/
  210. # ln -s libapt-pkg.so.$(LIBAPTPKG_MAJOR) debian/libapt-pkg-dev/usr/lib/libapt-pkg.so
  211. cp $(BLD)/include/apt-pkg/*.h debian/libapt-pkg-dev/usr/include/apt-pkg/
  212. dh_installdocs -p$@
  213. # dh_installmenu -p$@
  214. # dh_installinit -p$@
  215. # dh_installcron -p$@
  216. # dh_installman -p$@
  217. dh_installchangelogs -p$@
  218. dh_strip -p$@
  219. dh_compress -p$@
  220. dh_fixperms -p$@
  221. # dh_suidregister -p$@
  222. dh_installdeb -p$@
  223. dh_gencontrol -p$@ -u -Vlibapt-pkg:provides=$(LIBAPTPKG_PROVIDE) -Vlibapt-inst:provides=$(LIBAPTINST_PROVIDE)
  224. dh_md5sums -p$@
  225. dh_builddeb -p$@
  226. apt-utils: build debian/shlibs.local
  227. dh_testdir -p$@
  228. dh_testroot -p$@
  229. dh_clean -p$@ -k
  230. dh_installdirs -p$@
  231. # install the shared libs
  232. find $(BLD)/bin/ -type f -name "libapt-inst*.so.*" -exec cp -a "{}" debian/$@/usr/lib/ \;
  233. find $(BLD)/bin/ -type l -name "libapt-inst*.so.*" -exec cp -a "{}" debian/$@/usr/lib/ \;
  234. cp $(addprefix $(BLD)/bin/apt-,$(APT_UTILS)) debian/$@/usr/bin/
  235. dh_installdocs -p$@
  236. dh_installexamples -p$@
  237. # Install the man pages..
  238. dh_installman -p$@
  239. dh_installchangelogs -p$@
  240. dh_strip -p$@
  241. dh_compress -p$@
  242. dh_fixperms -p$@
  243. dh_makeshlibs -m$(LIBAPTINST_MAJOR) -V '$(LIBAPTINST_PROVIDE)' -p$@
  244. dh_installdeb -p$@
  245. dh_shlibdeps -p$@ -l`pwd`/debian/apt/usr/lib:`pwd`/debian/$@/usr/lib -- -Ldebian/shlibs.local.apt-utils
  246. dh_gencontrol -p$@ -u -Vlibapt-inst:provides=$(LIBAPTINST_PROVIDE)
  247. dh_md5sums -p$@
  248. dh_builddeb -p$@
  249. apt-transport-https: build debian/shlibs.local libapt-pkg-dev
  250. dh_testdir -p$@
  251. dh_testroot -p$@
  252. dh_clean -p$@ -k
  253. dh_installdirs -p$@
  254. # install the method
  255. mkdir -p debian/$@/usr/lib/apt/methods
  256. cp $(BLD)/bin/methods/https debian/$@/usr/lib/apt/methods
  257. dh_installdocs -p$@ debian/apt-transport-https.README
  258. dh_installexamples -p$@
  259. # Install the man pages..
  260. dh_installman -p$@
  261. dh_installchangelogs -p$@
  262. dh_strip -p$@
  263. dh_compress -p$@
  264. dh_fixperms -p$@
  265. dh_installdeb -p$@
  266. dh_shlibdeps -p$@ -l`pwd`/debian/apt/usr/lib:`pwd`/debian/$@/usr/lib
  267. dh_gencontrol -p$@
  268. dh_md5sums -p$@
  269. dh_builddeb -p$@
  270. source diff:
  271. @echo >&2 'source and diff are obsolete - use dpkg-source -b'; false
  272. # Update from CVS
  273. l33ch: really-clean
  274. cvs update
  275. buildlib/mkChangeLog
  276. # Update from CVS and then configure for build
  277. super-l33ch: l33ch Makefile.in
  278. configure:
  279. $(MAKE) configure
  280. l33ch-stamp: super-l33ch
  281. touch $@
  282. really-clean: clean
  283. -find -name Makefile.in -print0 | xargs -0r rm -f
  284. find -name ChangeLog | xargs rm -f
  285. rm -f l33ch-stamp
  286. binary: binary-indep binary-arch
  287. .PHONY: build clean binary-indep binary-arch binary debian/shlibs.local
  288. # Done by the uploader.
  289. #cvs update..
  290. #edit debian/changelog
  291. # configure.in has the version automatically updated now.
  292. # edit configure.in
  293. # debian/rules cvs-build
  294. CVS_BUILDDIR=apt-$(APT_DEBVER)
  295. CVS_ROOT=$(shell cat CVS/Root)
  296. CVS_MODULE=$(shell cat CVS/Repository)
  297. cvs-build:
  298. rm -rf debian/cvs-build
  299. mkdir -p debian/cvs-build
  300. (cd debian/cvs-build;cvs -d $(CVS_ROOT) export -r$(APT_CVSTAG) -d apt-$(APT_DEBVER) $(CVS_MODULE))
  301. $(MAKE) -C debian/cvs-build/$(CVS_BUILDDIR) startup doc
  302. (cd debian/cvs-build/$(CVS_BUILDDIR);$(DEB_BUILD_PROG))
  303. cvs-mkul:
  304. -mkdir -p ../upload-$(APT_DEBVER)
  305. cp `find debian/cvs-build -maxdepth 1 -type f` ../upload-$(APT_DEBVER)
  306. arch-build:
  307. rm -rf debian/arch-build
  308. mkdir -p debian/arch-build/apt-$(APT_DEBVER)
  309. tar -c --exclude=arch-build --no-recursion -f - `bzr inventory` | (cd debian/arch-build/$(PKG)-$(APT_DEBVER);tar xf -)
  310. $(MAKE) -C debian/arch-build/apt-$(APT_DEBVER) startup doc
  311. (cd debian/arch-build/apt-$(APT_DEBVER); $(DEB_BUILD_PROG); dpkg-genchanges -S > ../apt_$(APT_DEBVER)_source.changes)