rules 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329
  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. DEB_BUILD_PROG:=debuild --preserve-envvar PATH --preserve-envvar CCACHE_DIR -us -uc
  32. APT_DEBVER=$(shell dpkg-parsechangelog |sed -n -e '/^Version:/s/^Version: //p')
  33. APT_CONFVER=$(shell sed -n -e 's/^AC_DEFINE_UNQUOTED(VERSION,"\(.*\)")/\1/p' configure.in)
  34. APT_CVSTAG=$(shell echo "$(APT_DEBVER)" | sed -e 's/^/v/' -e 's/\./_/g')
  35. # Determine the build directory to use
  36. BASE=.
  37. ifdef BUILD
  38. BUILD_POSSIBLE := $(BUILD) $(BASE)/$(BUILD)
  39. else
  40. BUILD_POSSIBLE := $(BASE) $(BASE)/build-$(shell uname -m) $(BASE)/build
  41. endif
  42. BUILDX:= $(foreach i,$(BUILD_POSSIBLE),$(wildcard $(i)/environment.mak*))
  43. BUILDX:= $(patsubst %/,%,$(firstword $(dir $(BUILDX))))
  44. override BLD := $(BUILDX)
  45. ifeq ($(words $(BLD)),0)
  46. override BLD := ./build
  47. endif
  48. # Rebuild configure.in to have the correct version from the change log
  49. ifneq ($(APT_DEBVER),$(APT_CONFVER))
  50. .PHONY: configure.in
  51. configure.in:
  52. sed -e 's/$(APT_CONFVER)/$(APT_DEBVER)/' $@ > $@.$$$$ && mv $@.$$$$ $@
  53. else
  54. configure.in:
  55. endif
  56. # APT Programs in apt-utils
  57. APT_UTILS=ftparchive sortpkgs extracttemplates
  58. # Uncomment this to turn on verbose mode.
  59. #export DH_VERBOSE=1
  60. # Find the libapt-pkg major version for use in other control files
  61. export LIBAPTPKG_MAJOR:=$(shell egrep '^MAJOR=' apt-pkg/makefile |cut -d '=' -f 2)
  62. export LIBAPTINST_MAJOR:=$(shell egrep '^MAJOR=' apt-inst/makefile |cut -d '=' -f 2)
  63. # Determine which package we should provide in the control files
  64. LIBAPTPKG_PROVIDE=libapt-pkg$(GLIBC_VER)$(LIBSTDCPP_VER)-$(LIBAPTPKG_MAJOR)
  65. LIBAPTINST_PROVIDE=libapt-inst$(GLIBC_VER)$(LIBSTDCPP_VER)-$(LIBAPTINST_MAJOR)
  66. debian/shlibs.local: apt-pkg/makefile
  67. # We have 3 shlibs.local files.. One for 'apt', one for 'apt-utils' and
  68. # one for the rest of the packages. This ensures that each package gets
  69. # the right overrides..
  70. rm -rf $@ $@.apt $@.apt-utils
  71. echo "libapt-pkg$(GLIBC_VER)$(LIBSTDCPP_VER) $(LIBAPTPKG_MAJOR)" > $@.apt
  72. echo "libapt-pkg$(GLIBC_VER)$(LIBSTDCPP_VER) $(LIBAPTPKG_MAJOR) $(LIBAPTPKG_PROVIDE)" > $@.apt-utils
  73. echo "libapt-inst$(GLIBC_VER)$(LIBSTDCPP_VER) $(LIBAPTINST_MAJOR)" >> $@.apt-utils
  74. echo "libapt-pkg$(GLIBC_VER)$(LIBSTDCPP_VER) $(LIBAPTPKG_MAJOR) $(LIBAPTPKG_PROVIDE)" > $@
  75. echo "libapt-inst$(GLIBC_VER)$(LIBSTDCPP_VER) $(LIBAPTINST_MAJOR) $(LIBAPTINST_PROVIDE)" >> $@
  76. build: build/build-stamp
  77. build-doc: build/build-doc-stamp
  78. # Note that this is unconditionally done first as part of loading environment.mak
  79. # The true is needed to force make to reload environment.mak after running
  80. # configure-stamp. Otherwise we can get stale or invalid, or missing config data.
  81. build/environment.mak: build/configure-stamp
  82. @true
  83. configure: configure.in
  84. build/configure-stamp: configure
  85. dh_testdir
  86. -mkdir build
  87. cp COPYING debian/copyright
  88. cd build && ../configure $(confflags)
  89. touch $@
  90. build/build-stamp: build/configure-stamp
  91. # Add here commands to compile the package.
  92. $(MAKE) binary
  93. touch $@
  94. build/build-doc-stamp: build/configure-stamp
  95. # Add here commands to compile the package.
  96. $(MAKE) doc
  97. touch $@
  98. clean:
  99. dh_testdir
  100. # dh_testroot
  101. -$(MAKE) clean
  102. -$(MAKE) 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/cache* $(BLD)/docs/design* $(BLD)/docs/dpkg-tech* \
  117. $(BLD)/docs/files* $(BLD)/docs/method* \
  118. doc/libapt-pkg2_to_3.txt doc/style.txt
  119. dh_installexamples -p$@
  120. # dh_installmenu -p$@
  121. # dh_installinit -p$@
  122. # dh_installcron -p$@
  123. # dh_installman -p$@
  124. # dh_undocumented -p$@
  125. dh_installchangelogs -p$@
  126. dh_strip -p$@
  127. dh_compress -p$@
  128. dh_fixperms -p$@
  129. # dh_suidregister -p$@
  130. dh_installdeb -p$@
  131. dh_gencontrol -p$@ -u -Vlibapt-pkg:provides=$(LIBAPTPKG_PROVIDE)
  132. dh_md5sums -p$@
  133. dh_builddeb -p$@
  134. apt-doc: build-doc
  135. dh_testdir -p$@
  136. dh_testroot -p$@
  137. dh_clean -p$@ -k
  138. #
  139. # apt-doc install
  140. #
  141. # Copy the guides
  142. dh_installdocs -p$@ $(BLD)/docs/guide*.text $(BLD)/docs/guide*.html \
  143. $(BLD)/docs/offline.text $(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
  153. apt: build debian/shlibs.local
  154. dh_testdir -p$@
  155. dh_testroot -p$@
  156. dh_clean -p$@ -k
  157. dh_installdirs -p$@ /usr/share/bug/$@
  158. #
  159. # apt install
  160. #
  161. cp $(BLD)/bin/apt-* debian/apt/usr/bin/
  162. # Remove the bits that are in apt-utils
  163. rm $(addprefix debian/apt/usr/bin/apt-,$(APT_UTILS))
  164. # install the shared libs
  165. find $(BLD)/bin/ -type f -name "libapt-pkg*.so.*" -exec cp -a "{}" debian/apt/usr/lib/ \;
  166. find $(BLD)/bin/ -type l -name "libapt-pkg*.so.*" -exec cp -a "{}" debian/apt/usr/lib/ \;
  167. cp $(BLD)/bin/methods/* debian/apt/usr/lib/apt/methods/
  168. cp $(BLD)/scripts/dselect/* debian/apt/usr/lib/dpkg/methods/apt/
  169. cp -r $(BLD)/locale debian/apt/usr/share/
  170. cp debian/bugscript debian/apt/usr/share/bug/apt/script
  171. # head -n 500 ChangeLog > debian/ChangeLog
  172. dh_installexamples -p$@ $(BLD)/docs/examples/*
  173. dh_installman -p$@
  174. dh_installdocs -p$@
  175. dh_installchangelogs -p$@
  176. dh_strip -p$@
  177. dh_compress -p$@
  178. dh_fixperms -p$@
  179. dh_makeshlibs -p$@ -m$(LIBAPTPKG_MAJOR) -V '$(LIBAPTPKG_PROVIDE)'
  180. dh_installdeb -p$@
  181. dh_shlibdeps -p$@ -l`pwd`/debian/apt/usr/lib -- -Ldebian/shlibs.local.apt
  182. dh_gencontrol -p$@ -u -Vlibapt-pkg:provides=$(LIBAPTPKG_PROVIDE)
  183. dh_md5sums -p$@
  184. dh_builddeb -p$@
  185. libapt-pkg-dev: build debian/shlibs.local
  186. dh_testdir -p$@
  187. dh_testroot -p$@
  188. dh_clean -p$@ -k
  189. dh_installdirs -p$@
  190. #
  191. # libapt-pkg-dev install
  192. #
  193. cp -a $(BLD)/bin/libapt-pkg*.so debian/libapt-pkg-dev/usr/lib/
  194. cp -a $(BLD)/bin/libapt-inst*.so debian/libapt-pkg-dev/usr/lib/
  195. # ln -s libapt-pkg.so.$(LIBAPTPKG_MAJOR) debian/libapt-pkg-dev/usr/lib/libapt-pkg.so
  196. cp $(BLD)/include/apt-pkg/*.h debian/libapt-pkg-dev/usr/include/apt-pkg/
  197. dh_installdocs -p$@
  198. # dh_installmenu -p$@
  199. # dh_installinit -p$@
  200. # dh_installcron -p$@
  201. # dh_installman -p$@
  202. dh_installchangelogs -p$@
  203. dh_strip -p$@
  204. dh_compress -p$@
  205. dh_fixperms -p$@
  206. # dh_suidregister -p$@
  207. dh_installdeb -p$@
  208. dh_gencontrol -p$@ -u -Vlibapt-pkg:provides=$(LIBAPTPKG_PROVIDE) -Vlibapt-inst:provides=$(LIBAPTINST_PROVIDE)
  209. dh_md5sums -p$@
  210. dh_builddeb -p$@
  211. apt-utils: build debian/shlibs.local
  212. dh_testdir -p$@
  213. dh_testroot -p$@
  214. dh_clean -p$@ -k
  215. dh_installdirs -p$@
  216. # install the shared libs
  217. find $(BLD)/bin/ -type f -name "libapt-inst*.so.*" -exec cp -a "{}" debian/$@/usr/lib/ \;
  218. find $(BLD)/bin/ -type l -name "libapt-inst*.so.*" -exec cp -a "{}" debian/$@/usr/lib/ \;
  219. cp $(addprefix $(BLD)/bin/apt-,$(APT_UTILS)) debian/$@/usr/bin/
  220. dh_installdocs -p$@
  221. # Install the man pages..
  222. dh_installman -p$@
  223. dh_installchangelogs -p$@
  224. dh_strip -p$@
  225. dh_compress -p$@
  226. dh_fixperms -p$@
  227. dh_makeshlibs -m$(LIBAPTINST_MAJOR) -V '$(LIBAPTINST_PROVIDE)' -p$@
  228. dh_installdeb -p$@
  229. dh_shlibdeps -p$@ -l`pwd`/debian/apt/usr/lib:`pwd`/debian/$@/usr/lib -- -Ldebian/shlibs.local.apt-utils
  230. dh_gencontrol -p$@ -u -Vlibapt-inst:provides=$(LIBAPTINST_PROVIDE)
  231. dh_md5sums -p$@
  232. dh_builddeb -p$@
  233. source diff:
  234. @echo >&2 'source and diff are obsolete - use dpkg-source -b'; false
  235. # Update from CVS
  236. l33ch: really-clean
  237. cvs update
  238. buildlib/mkChangeLog
  239. # Update from CVS and then configure for build
  240. super-l33ch: l33ch Makefile.in
  241. configure:
  242. $(MAKE) configure
  243. l33ch-stamp: super-l33ch
  244. touch $@
  245. really-clean: clean
  246. -find -name Makefile.in -print0 | xargs -0r rm -f
  247. find -name ChangeLog | xargs rm -f
  248. rm -f l33ch-stamp
  249. binary: binary-indep binary-arch
  250. .PHONY: build clean binary-indep binary-arch binary debian/shlibs.local
  251. # Done by the uploader.
  252. #cvs update..
  253. #edit debian/changelog
  254. # configure.in has the version automatically updated now.
  255. # edit configure.in
  256. # debian/rules cvs-build
  257. CVS_BUILDDIR=apt-$(APT_DEBVER)
  258. CVS_ROOT=$(shell cat CVS/Root)
  259. CVS_MODULE=$(shell cat CVS/Repository)
  260. cvs-build:
  261. rm -rf debian/cvs-build
  262. mkdir -p debian/cvs-build
  263. (cd debian/cvs-build;cvs -d $(CVS_ROOT) export -r$(APT_CVSTAG) -d apt-$(APT_DEBVER) $(CVS_MODULE))
  264. $(MAKE) -C debian/cvs-build/$(CVS_BUILDDIR) startup doc
  265. (cd debian/cvs-build/$(CVS_BUILDDIR);$(DEB_BUILD_PROG))
  266. cvs-mkul:
  267. -mkdir -p ../upload-$(APT_DEBVER)
  268. cp `find debian/cvs-build -maxdepth 1 -type f` ../upload-$(APT_DEBVER)