rules 9.5 KB

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