rules 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224
  1. #!/usr/bin/make -f
  2. # debian/rules for Free Pascal
  3. # Note: You must unset FPCDIR before using this Makefile
  4. # Documentation type to use pdf/html
  5. DOCTYPE=pdf
  6. # Get Package version and FPC version out of changelog file
  7. PACKAGEVERSION:=$(shell head -n 1 debian/changelog | awk '{ print $$2 }' | tr -d '[()]')
  8. FPCVERSION:=$(shell echo $(PACKAGEVERSION) | awk -F '-' '{ print $$1 }')
  9. # Get directories
  10. PWD:=$(shell pwd)
  11. BUILD_DIR=$(PWD)/debian/build
  12. INSTALL_DIR=$(PWD)/debian/tmp
  13. DOC_DIR=$(INSTALL_DIR)/usr/share/doc
  14. # Get utils
  15. NEWPP=$(PWD)/compiler/ppc386
  16. NEWPPUFILES=$(PWD)/utils/ppufiles
  17. # Create default options
  18. BUILDOPTS=PP=$(NEWPP)
  19. INSTALLOPTS=PP=$(NEWPP) PPUFILES=$(NEWPPUFILES) PREFIXINSTALLDIR=$(INSTALL_DIR)/usr
  20. export DH_COMPAT=2
  21. # export DH_VERBOSE=1
  22. ###################
  23. # Clean
  24. #
  25. clean:
  26. @echo "--- Cleaning"
  27. dh_testdir
  28. dh_testroot
  29. rm -f build-arch-stamp install-arch-stamp arrange-arch-stamp
  30. rm -f build-indep-stamp install-indep-stamp
  31. rm -f debian-files-stamp
  32. rm -f debian/*.files debian/*.docs debian/*.examples debian/*.postinst debian/*.postrm
  33. $(MAKE) compiler_distclean
  34. $(MAKE) rtl_distclean
  35. $(MAKE) fcl_distclean
  36. $(MAKE) api_distclean
  37. $(MAKE) utils_distclean
  38. $(MAKE) packages_distclean
  39. $(MAKE) -C docs clean
  40. -(find . -name \*.a | xargs rm)
  41. rm -f docs/syntax.sty
  42. dh_clean
  43. # Cannot do that because the control-file is often needed after a cleanup
  44. # rm -f debian/control
  45. ###################
  46. # Debian files
  47. #
  48. debian-files: debian-files-stamp
  49. debian-files-stamp:
  50. @echo "--- Creating debian files"
  51. bash debian/fixdeb debian
  52. touch debian-files-stamp
  53. ###################
  54. # Arch packages
  55. #
  56. build-arch: build-arch-stamp
  57. build-arch-stamp: debian-files-stamp
  58. @echo "--- Building"
  59. dh_testdir
  60. # First make a new Compiler and RTL using a make cycle
  61. $(MAKE) compiler_cycle
  62. $(MAKE) rtl_clean rtl_smart $(BUILDOPTS)
  63. $(MAKE) fcl_smart $(BUILDOPTS)
  64. $(MAKE) api_smart $(BUILDOPTS)
  65. $(MAKE) packages_smart $(BUILDOPTS)
  66. $(MAKE) utils_all $(BUILDOPTS)
  67. $(MAKE) compiler_fpcexe $(BUILDOPTS)
  68. touch build-arch-stamp
  69. install-arch: install-arch-stamp
  70. install-arch-stamp: build-arch-stamp debian-files-stamp
  71. @echo "--- Installing"
  72. dh_testdir
  73. dh_testroot
  74. dh_clean -k
  75. # Specify the compiler to use so installing will use the correct versioned dir
  76. $(MAKE) compiler_install $(INSTALLOPTS)
  77. $(MAKE) rtl_install $(INSTALLOPTS)
  78. $(MAKE) fcl_install $(INSTALLOPTS)
  79. $(MAKE) api_install $(INSTALLOPTS)
  80. $(MAKE) utils_install $(INSTALLOPTS)
  81. $(MAKE) packages_install $(INSTALLOPTS)
  82. $(MAKE) fcl_exampleinstall $(INSTALLOPTS) DOCINSTALLDIR=$(DOC_DIR)/fp-units-fcl
  83. $(MAKE) api_exampleinstall $(INSTALLOPTS) DOCINSTALLDIR=$(DOC_DIR)/fp-units-api
  84. $(MAKE) -C packages pkggtk_exampleinstall $(INSTALLOPTS) DOCINSTALLDIR=$(DOC_DIR)/fp-units-gtk
  85. $(MAKE) -C packages pkggfx_exampleinstall $(INSTALLOPTS) DOCINSTALLDIR=$(DOC_DIR)/fp-units-gfx
  86. $(MAKE) -C packages pkgmisc_exampleinstall $(INSTALLOPTS) DOCINSTALLDIR=$(DOC_DIR)/fp-units-misc
  87. $(MAKE) -C packages pkgbase_exampleinstall $(INSTALLOPTS) DOCINSTALLDIR=$(DOC_DIR)/fp-units-base
  88. $(MAKE) -C packages pkgnet_exampleinstall $(INSTALLOPTS) DOCINSTALLDIR=$(DOC_DIR)/fp-units-net
  89. $(MAKE) -C packages pkgdb_exampleinstall $(INSTALLOPTS) DOCINSTALLDIR=$(DOC_DIR)/fp-units-db
  90. $(MAKE) man_install $(INSTALLOPTS) PREFIXINSTALLDIR=$(INSTALL_DIR)/usr/share
  91. $(MAKE) demo_install $(INSTALLOPTS) DOCINSTALLDIR=$(INSTALL_DIR)/usr/share/doc/fp-compiler
  92. $(MAKE) doc_install $(INSTALLOPTS) DOCINSTALLDIR=$(INSTALL_DIR)/usr/share/doc/fp-compiler
  93. # Create ppc386.cfg which is included as conffile
  94. chmod 755 compiler/utils/samplecfg
  95. compiler/utils/samplecfg "/usr/lib/fpc/\$$version" $(INSTALL_DIR)/etc
  96. touch install-arch-stamp
  97. arrange-arch: arrange-arch-stamp
  98. arrange-arch-stamp: install-arch-stamp debian-files-stamp
  99. dh_testversion 2
  100. dh_testdir
  101. dh_testroot
  102. dh_movefiles -a
  103. touch arrange-arch-stamp
  104. ###################
  105. # Documentation
  106. #
  107. build-indep: build-indep-stamp
  108. build-indep-stamp: debian-files-stamp
  109. @echo "--- Building Documentation"
  110. dh_testdir
  111. # We need our own syntax.sty (v1.9) which is not in the current tetex and
  112. # on ctan.org (PFV)
  113. cp debian/syntax.sty docs
  114. $(MAKE) -C docs $(DOCTYPE)
  115. touch build-indep-stamp
  116. install-indep: install-indep-stamp
  117. install-indep-stamp: debian-files build-indep
  118. @echo "--- Installing Documentation"
  119. dh_testdir
  120. dh_testroot
  121. dh_clean -k
  122. $(MAKE) -C docs $(DOCTYPE)install DOCINSTALLDIR=$(INSTALL_DIR)/usr/share/doc/fpc/$(FPCVERSION)/
  123. touch install-indep-stamp
  124. ###################
  125. # Generic
  126. #
  127. build: build-arch build-indep
  128. install: install-arch install-indep
  129. binary: binary-indep binary-arch
  130. ###################
  131. # Deb building
  132. #
  133. binary-indep: build-indep install-indep debian-files
  134. @echo "--- Building: arch-indep packages"
  135. dh_testversion 2
  136. dh_testdir
  137. dh_testroot
  138. dh_installdocs -i
  139. dh_installchangelogs -i
  140. dh_installchangelogs -pfp-docs logs/Changes.docs
  141. dh_movefiles -i
  142. dh_compress -i -X.pdf
  143. dh_fixperms -i
  144. dh_installdeb -i
  145. dh_gencontrol -i
  146. dh_md5sums -i
  147. dh_builddeb -i
  148. binary-arch: build-arch arrange-arch debian-files
  149. @echo "--- Building: arch packages"
  150. dh_testversion 2
  151. dh_testdir
  152. dh_testroot
  153. dh_installdocs -a
  154. dh_installchangelogs -a
  155. dh_installchangelogs -pfp-compiler logs/Changes.compiler
  156. dh_installchangelogs -pfp-units-rtl logs/Changes.rtl
  157. dh_installchangelogs -pfp-utils logs/Changes.utils
  158. dh_installchangelogs -pfp-units-fcl logs/Changes.fcl
  159. dh_installchangelogs -pfp-units-api logs/Changes.api
  160. dh_undocumented -a
  161. dh_installexamples -a
  162. dh_compress -a
  163. dh_fixperms -a
  164. dh_installdeb -a
  165. dh_shlibdeps -a
  166. dh_gencontrol -a
  167. dh_md5sums -a
  168. dh_builddeb -a
  169. .PHONY: build clean binary debian-files \
  170. build-arch install-arch binary-arch \
  171. binary-indep