rules 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232
  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.22 2000/06/04 05:36:15 doogie Exp $
  6. # For the deb builder, you can run 'debian/rules cvs-build', which does all
  7. # steps nescessary to produce a proper source tarball with the CVS/ removed.
  8. # It builds in debian/cvs-build/apt-<VER>/, and places files in
  9. # debian/cvs-build/. Optionally, you can run 'debian/rules cvs-mkul' to
  10. # create ../upload-<VER>, with all the files needed to be uploaded placed
  11. # in it.
  12. DEB_BUILD_PROG:=debuild -us -uc
  13. APT_DEBVER=$(shell dpkg-parsechangelog |sed -n -e '/^Version:/s/^Version: //p')
  14. APT_CONFVER=$(shell sed -n -e 's/^AC_DEFINE_UNQUOTED(VERSION,"\(.*\)")/\1/p' configure.in)
  15. # Determine the build directory to use
  16. BASE=.
  17. ifdef BUILD
  18. BUILD_POSSIBLE := $(BUILD) $(BASE)/$(BUILD)
  19. else
  20. BUILD_POSSIBLE := $(BASE) $(BASE)/build-$(shell uname -m) $(BASE)/build
  21. endif
  22. BUILDX:= $(foreach i,$(BUILD_POSSIBLE),$(wildcard $(i)/environment.mak*))
  23. BUILDX:= $(patsubst %/,%,$(firstword $(dir $(BUILDX))))
  24. override BLD := $(BUILDX)
  25. ifeq ($(words $(BLD)),0)
  26. override BLD := ./build
  27. endif
  28. ifneq ($(APT_DEBVER),$(APT_CONFVER))
  29. .PHONY: configure.in
  30. configure.in:
  31. sed -e 's/$(APT_CONFVER)/$(APT_DEBVER)/' $@ > $@.$$$$;mv $@.$$$$ $@
  32. else
  33. configure.in:
  34. endif
  35. # Uncomment this to turn on verbose mode.
  36. #export DH_VERBOSE=1
  37. # Find the libapt-pkg major version for use in other control files
  38. export LIBAPT_MAJOR:=$(shell egrep '^MAJOR=' apt-pkg/makefile |cut -d '=' -f 2)
  39. debian/shlibs.local: apt-pkg/makefile
  40. rm -f $@
  41. echo "libapt-pkg $(LIBAPT_MAJOR) libapt-pkg$(LIBAPT_MAJOR)" >> $@
  42. echo "libapt-pkg $(LIBAPT_MAJOR) apt $(APT_DEBVER)" >> $@
  43. build: build-stamp
  44. build-stamp: configure
  45. dh_testdir
  46. -mkdir build
  47. (cd build; ../configure)
  48. # cd build && CXXFLAGS="-g -Wall -D_POSIX_C_SOURCE=199309" ../configure --disable-nls --disable-static --prefix=/usr
  49. # cd build && make all-hdr
  50. # cd build && make -s
  51. # Add here commands to compile the package.
  52. $(MAKE)
  53. touch build-stamp
  54. clean:
  55. dh_testdir
  56. # dh_testroot
  57. rm -f build-stamp debian/shlibs.local
  58. rm -rf build
  59. # Add here commands to clean up after the build process.
  60. -$(MAKE) clean
  61. -$(MAKE) distclean
  62. dh_clean
  63. binary-indep: libapt-pkg-doc
  64. # Build architecture-independent files here.
  65. libapt-pkg-doc: build debian/shlibs.local
  66. dh_testdir -p$@
  67. dh_testroot -p$@
  68. dh_clean -p$@ -k
  69. dh_installdirs -p$@
  70. #
  71. # libapt-pkg-doc install
  72. #
  73. dh_installdocs -p$@ $(BLD)/docs/cache* $(BLD)/docs/design* $(BLD)/docs/dpkg-tech* \
  74. $(BLD)/docs/files* $(BLD)/docs/method*
  75. -cp -a debian/libapt-pkg-doc.dhelp debian/libapt-pkg-doc/usr/doc/libapt-pkg-doc/.dhelp
  76. -cp -a debian/libapt-pkg-doc.dhelp debian/libapt-pkg-doc/usr/share/doc/libapt-pkg-doc/.dhelp
  77. dh_installexamples -p$@
  78. # dh_installmenu -p$@
  79. # dh_installinit -p$@
  80. # dh_installcron -p$@
  81. # dh_installmanpages -p$@
  82. # dh_undocumented -p$@
  83. dh_installchangelogs -p$@
  84. dh_strip -p$@
  85. dh_compress -p$@
  86. dh_fixperms -p$@
  87. # dh_suidregister -p$@
  88. dh_installdeb -p$@
  89. dh_gencontrol -p$@ -u -Vlibapt-pkg:major=${LIBAPT_MAJOR}
  90. dh_md5sums -p$@
  91. dh_builddeb -p$@
  92. # Build architecture-dependent files here.
  93. binary-arch: apt libapt-pkg-dev
  94. apt: build debian/shlibs.local
  95. dh_testdir -p$@
  96. dh_testroot -p$@
  97. dh_clean -p$@ -k
  98. dh_installdirs -p$@
  99. #
  100. # apt install
  101. #
  102. cp $(BLD)/bin/apt-* debian/tmp/usr/bin/
  103. # install the shared libs
  104. find $(BLD)/bin/ -type f -name "libapt-pkg.so.*" -exec cp -a "{}" debian/tmp/usr/lib/ \;
  105. find $(BLD)/bin/ -type l -name "libapt-pkg.so.*" -exec cp -a "{}" debian/tmp/usr/lib/ \;
  106. cp $(BLD)/bin/methods/* debian/tmp/usr/lib/apt/methods/
  107. cp $(BLD)/scripts/dselect/* debian/tmp/usr/lib/dpkg/methods/apt/
  108. # Copy the guides
  109. dh_installdocs -p$@ $(BLD)/docs/guide.text $(BLD)/docs/guide.html \
  110. $(BLD)/docs/offline.text $(BLD)/docs/offline.html
  111. # One or the other..
  112. -cp -a debian/dhelp debian/tmp/usr/doc/apt/.dhelp
  113. -cp -a debian/dhelp debian/tmp/usr/share/doc/apt/.dhelp
  114. # head -n 500 ChangeLog > debian/ChangeLog
  115. dh_installexamples -p$@ $(BLD)/docs/examples/*
  116. dh_installmanpages -p$@
  117. dh_installchangelogs -p$@
  118. dh_strip -p$@
  119. dh_compress -p$@
  120. dh_fixperms -p$@
  121. dh_installdeb -p$@
  122. LD_LIBRARY_PATH=`pwd`/debian/tmp/usr/lib dh_shlibdeps -papt
  123. dh_gencontrol -p$@ -u -Vlibapt-pkg:major=${LIBAPT_MAJOR}
  124. dh_makeshlibs -m${LIBAPT_MAJOR} -Vlibapt-pkg${LIBAPT_MAJOR} -papt
  125. dh_md5sums -p$@
  126. dh_builddeb -p$@
  127. libapt-pkg-dev: build debian/shlibs.local
  128. dh_testdir -p$@
  129. dh_testroot -p$@
  130. dh_clean -p$@ -k
  131. dh_installdirs -p$@
  132. #
  133. # libapt-pkg-dev install
  134. #
  135. cp -a $(BLD)/bin/libapt-pkg.so debian/libapt-pkg-dev/usr/lib/
  136. #ln -s libapt-pkg.so.${LIBAPT_MAJOR} debian/libapt-pkg-dev/usr/lib/libapt-pkg.so
  137. cp $(BLD)/include/apt-pkg/*.h debian/libapt-pkg-dev/usr/include/apt-pkg/
  138. dh_installdocs -p$@
  139. # dh_installmenu -p$@
  140. # dh_installinit -p$@
  141. # dh_installcron -p$@
  142. # dh_installmanpages -p$@
  143. dh_installchangelogs -p$@
  144. dh_strip -p$@
  145. dh_compress -p$@
  146. dh_fixperms -p$@
  147. # dh_suidregister -p$@
  148. dh_installdeb -p$@
  149. dh_gencontrol -p$@ -u -Vlibapt-pkg:major=${LIBAPT_MAJOR}
  150. dh_md5sums -p$@
  151. dh_builddeb -p$@
  152. source diff:
  153. @echo >&2 'source and diff are obsolete - use dpkg-source -b'; false
  154. # Update from CVS
  155. l33ch: really-clean
  156. cvs update
  157. buildlib/mkChangeLog
  158. # Update from CVS and then configure for build
  159. super-l33ch: l33ch Makefile.in
  160. configure:
  161. $(MAKE) configure
  162. l33ch-stamp: super-l33ch
  163. touch l33ch-stamp
  164. really-clean: clean
  165. -find -name Makefile.in -print0 | xargs -0r rm -f
  166. find -name ChangeLog | xargs rm -f
  167. rm -f l33ch-stamp
  168. binary: binary-indep binary-arch
  169. .PHONY: build clean binary-indep binary-arch binary debian/shlibs.local
  170. # Done by the uploader.
  171. #cvs update..
  172. #edit debian/changelog
  173. # configure.in has the version automatically updated now.
  174. # edit configure.in
  175. # debian/rules cvs-build
  176. cvs-build:
  177. rm -rf debian/cvs-build
  178. cvs update
  179. buildlib/mkChangeLog
  180. $(MAKE) startup
  181. $(MAKE) doc
  182. tar c --exclude CVS --exclude debian/cvs-build . |\
  183. (mkdir -p debian/cvs-build/apt-$(APT_DEBVER);cd debian/cvs-build/apt-$(APT_DEBVER);tar x)
  184. # The next line isn't needed, as debuild will make the .tar.gz for us.
  185. # (cd debian/cvs-build;tar zcf apt_$(APT_DEBVER).tar.gz apt-$(APT_DEBVER))
  186. (cd debian/cvs-build/apt-$(APT_DEBVER);$(DEB_BUILD_PROG))
  187. rm ChangeLog
  188. cvs-mkul:
  189. -mkdir -p ../upload-$(APT_DEBVER)
  190. cp `find debian/cvs-build -maxdepth 1 -type f` ../upload-$(APT_DEBVER)