rules 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253
  1. #!/usr/bin/make -f
  2. # debian/rules for Free Pascal
  3. # Documentation type to use pdf/html
  4. DOCTYPE=pdf
  5. # Detect name of new compiler, take care that debian uses amd64 instead of x86_64
  6. CPU_SOURCE=$(subst amd64,x86_64,$(shell dpkg-architecture -qDEB_BUILD_ARCH))
  7. CPU_TARGET=$(subst amd64,x86_64,$(shell dpkg-architecture -qDEB_HOST_ARCH))
  8. ifeq ($(CPU_TARGET),m68k)
  9. PPSUF=68k
  10. endif
  11. ifeq ($(CPU_TARGET),i386)
  12. PPSUF=386
  13. endif
  14. ifeq ($(CPU_TARGET),x86_64)
  15. PPSUF=x64
  16. endif
  17. ifeq ($(CPU_TARGET),powerpc)
  18. PPSUF=ppc
  19. endif
  20. ifeq ($(CPU_TARGET),alpha)
  21. PPSUF=axp
  22. endif
  23. ifeq ($(CPU_TARGET),arm)
  24. PPSUF=arm
  25. endif
  26. ifeq ($(CPU_TARGET),sparc)
  27. PPSUF=sparc
  28. endif
  29. ifneq ($(CPU_SOURCE),$(CPU_TARGET))
  30. PPPRE=ppcross
  31. else
  32. PPPRE=ppc
  33. endif
  34. PPNEW=$(PPPRE)$(PPSUF)
  35. # Reset FPC and FPCDIR if it was set
  36. FPC=
  37. FPCDIR=
  38. # Get Package version and FPC version out of changelog file
  39. PACKAGEVERSION:=$(shell head -n 1 debian/changelog | awk '{ print $$2 }' | tr -d '[()]')
  40. FPCVERSION:=$(shell echo $(PACKAGEVERSION) | awk -F '-' '{ print $$1 }')
  41. FPCTARGET=$(CPU_TARGET)-linux
  42. # Get directories
  43. PWD:=$(shell pwd)
  44. BUILD_DIR=$(PWD)/debian/build
  45. INSTALL_DIR=$(PWD)/debian/tmp
  46. DOC_DIR=$(INSTALL_DIR)/usr/share/doc
  47. EXAMPLE_TEMP=$(DOC_DIR)/fpc-$(FPCVERSION)
  48. # Get utils
  49. NEWPP=$(PWD)/compiler/$(PPNEW)
  50. NEWFPDOC=$(PWD)/utils/fpdoc/fpdoc
  51. # Create default options
  52. BUILDOPTS=PP=$(NEWPP)
  53. INSTALLOPTS=PP=$(NEWPP) INSTALL_PREFIX=$(INSTALL_DIR)/usr
  54. export DH_COMPAT=2
  55. # export DH_VERBOSE=1
  56. ###################
  57. # Clean
  58. #
  59. clean:
  60. @echo "--- Cleaning"
  61. dh_testdir
  62. dh_testroot
  63. rm -f build-arch-stamp install-arch-stamp arrange-arch-stamp
  64. rm -f build-indep-stamp install-indep-stamp
  65. rm -f debian-files-stamp
  66. rm -f debian/*.files debian/*.docs debian/*.examples debian/*.postinst debian/*.postrm
  67. $(MAKE) compiler_distclean
  68. $(MAKE) rtl_distclean
  69. $(MAKE) packages_distclean
  70. $(MAKE) fcl_distclean
  71. $(MAKE) utils_distclean
  72. $(MAKE) -C docs clean
  73. -(find . -name \*.a | xargs rm)
  74. dh_clean
  75. # Cannot do that because the control-file is often needed after a cleanup
  76. # rm -f debian/control
  77. ###################
  78. # Debian files
  79. #
  80. debian-files: debian-files-stamp
  81. debian-files-stamp:
  82. @echo "--- Creating debian files"
  83. bash debian/fixdeb debian $(FPCTARGET) $(PPNEW)
  84. touch debian-files-stamp
  85. ###################
  86. # Arch packages
  87. #
  88. build-arch: build-arch-stamp
  89. build-arch-stamp: debian-files-stamp
  90. @echo "--- Building"
  91. dh_testdir
  92. # First make a new Compiler and RTL using a make cycle
  93. $(MAKE) compiler_cycle
  94. $(MAKE) rtl_clean rtl_smart $(BUILDOPTS)
  95. $(MAKE) packages_base_smart $(BUILDOPTS)
  96. $(MAKE) fcl_smart $(BUILDOPTS)
  97. $(MAKE) packages_extra_smart $(BUILDOPTS)
  98. $(MAKE) utils_all $(BUILDOPTS)
  99. touch build-arch-stamp
  100. install-arch: install-arch-stamp
  101. install-arch-stamp: build-arch-stamp debian-files-stamp
  102. @echo "--- Installing"
  103. dh_testdir
  104. dh_testroot
  105. dh_clean -k
  106. # Specify the compiler to use so installing will use the correct versioned dir
  107. $(MAKE) compiler_distinstall $(INSTALLOPTS)
  108. $(MAKE) rtl_distinstall $(INSTALLOPTS)
  109. $(MAKE) fcl_distinstall $(INSTALLOPTS)
  110. $(MAKE) packages_distinstall $(INSTALLOPTS)
  111. $(MAKE) utils_distinstall $(INSTALLOPTS)
  112. # Copy examples to the correct doc dir
  113. install -d -m755 $(DOC_DIR)/fp-units-fcl/examples
  114. install -d -m755 $(DOC_DIR)/fp-units-gtk/examples
  115. install -d -m755 $(DOC_DIR)/fp-units-gnome1/examples
  116. install -d -m755 $(DOC_DIR)/fp-units-gfx/examples
  117. install -d -m755 $(DOC_DIR)/fp-units-db/examples
  118. install -d -m755 $(DOC_DIR)/fp-units-net/examples
  119. install -d -m755 $(DOC_DIR)/fp-units-misc/examples
  120. install -d -m755 $(DOC_DIR)/fp-units-base/examples
  121. bash debian/moveexamples $(EXAMPLE_TEMP) $(DOC_DIR)
  122. # Install man pages and RTL demos and whatsnew and readme
  123. $(MAKE) man_install $(INSTALLOPTS) INSTALL_PREFIX=$(INSTALL_DIR)/usr/share
  124. $(MAKE) demo_install $(INSTALLOPTS) INSTALL_SOURCEDIR=$(DOC_DIR)/fp-compiler
  125. $(MAKE) doc_install $(INSTALLOPTS) INSTALL_DOCDIR=$(DOC_DIR)/fp-compiler
  126. # Create fpc.cfg which is included as conffile
  127. chmod 755 compiler/utils/samplecfg
  128. compiler/utils/samplecfg "/usr/lib/fpc/\$$fpcversion" $(INSTALL_DIR)/etc
  129. touch install-arch-stamp
  130. arrange-arch: arrange-arch-stamp
  131. arrange-arch-stamp: install-arch-stamp debian-files-stamp
  132. dh_testdir
  133. dh_testroot
  134. dh_install -a --sourcedir=debian/tmp --list-missing
  135. touch arrange-arch-stamp
  136. ###################
  137. # Documentation
  138. #
  139. build-indep: build-indep-stamp
  140. # We depend on the new fpdoc
  141. build-indep-stamp: debian-files-stamp build-arch-stamp
  142. @echo "--- Building Documentation"
  143. dh_testdir
  144. $(MAKE) -C docs $(DOCTYPE) FPDOC=$(NEWFPDOC)
  145. touch build-indep-stamp
  146. install-indep: install-indep-stamp
  147. install-indep-stamp: debian-files build-indep
  148. @echo "--- Installing Documentation"
  149. dh_testdir
  150. dh_testroot
  151. dh_clean -k
  152. $(MAKE) -C docs $(DOCTYPE)install DOCINSTALLDIR=$(INSTALL_DIR)/usr/share/doc/fp-docs
  153. touch install-indep-stamp
  154. ###################
  155. # Generic
  156. #
  157. build: build-arch build-indep
  158. install: install-arch install-indep
  159. binary: binary-arch binary-indep
  160. ###################
  161. # Deb building
  162. #
  163. binary-indep: build-indep install-indep debian-files
  164. @echo "--- Building: arch-indep packages"
  165. dh_testdir
  166. dh_testroot
  167. dh_installdocs -i
  168. dh_installchangelogs -i
  169. dh_installchangelogs -pfp-docs logs/Changes.docs
  170. dh_install -i --sourcedir=debian/tmp --list-missing
  171. dh_compress -i -X.pdf
  172. dh_fixperms -i
  173. dh_installdeb -i
  174. dh_gencontrol -i
  175. dh_md5sums -i
  176. dh_builddeb -i
  177. binary-arch: build-arch arrange-arch debian-files
  178. @echo "--- Building: arch packages"
  179. dh_testdir
  180. dh_testroot
  181. dh_installdocs -a
  182. dh_installchangelogs -a
  183. dh_installchangelogs -pfp-compiler logs/Changes.compiler
  184. dh_installchangelogs -pfp-units-rtl logs/Changes.rtl
  185. dh_installchangelogs -pfp-units-fcl logs/Changes.fcl
  186. dh_installchangelogs -pfp-utils logs/Changes.utils
  187. dh_installexamples -a
  188. dh_compress -a
  189. dh_fixperms -a
  190. dh_installdeb -a
  191. dh_shlibdeps -a
  192. dh_gencontrol -a
  193. dh_md5sums -a
  194. dh_builddeb -a
  195. .PHONY: build clean binary debian-files \
  196. build-arch install-arch binary-arch \
  197. binary-indep