rules 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250
  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) fv_distclean
  72. $(MAKE) ide_distclean
  73. $(MAKE) utils_distclean
  74. $(MAKE) -C docs clean
  75. -(find . -name \*.a | xargs rm)
  76. dh_clean
  77. # Cannot do that because the control-file is often needed after a cleanup
  78. # rm -f debian/control
  79. ###################
  80. # Debian files
  81. #
  82. debian-files: debian-files-stamp
  83. debian-files-stamp:
  84. @echo "--- Creating debian files"
  85. bash debian/fixdeb debian $(FPCTARGET) $(PPNEW)
  86. touch debian-files-stamp
  87. ###################
  88. # Arch packages
  89. #
  90. build-arch: build-arch-stamp
  91. build-arch-stamp: debian-files-stamp
  92. @echo "--- Building"
  93. dh_testdir
  94. # First make a new Compiler and RTL using a make cycle
  95. $(MAKE) compiler_cycle
  96. $(MAKE) rtl_clean rtl_smart $(BUILDOPTS)
  97. $(MAKE) packages_base_smart $(BUILDOPTS)
  98. $(MAKE) fcl_smart $(BUILDOPTS)
  99. $(MAKE) fv_smart $(BUILDOPTS)
  100. $(MAKE) packages_extra_smart $(BUILDOPTS)
  101. $(MAKE) ide_all $(BUILDOPTS)
  102. $(MAKE) utils_all $(BUILDOPTS)
  103. touch build-arch-stamp
  104. install-arch: install-arch-stamp
  105. install-arch-stamp: build-arch-stamp debian-files-stamp
  106. @echo "--- Installing"
  107. dh_testdir
  108. dh_testroot
  109. dh_clean -k
  110. # Specify the compiler to use so installing will use the correct versioned dir
  111. $(MAKE) compiler_distinstall $(INSTALLOPTS)
  112. $(MAKE) rtl_distinstall $(INSTALLOPTS)
  113. $(MAKE) fcl_distinstall $(INSTALLOPTS)
  114. $(MAKE) fv_distinstall $(INSTALLOPTS)
  115. $(MAKE) packages_distinstall $(INSTALLOPTS)
  116. $(MAKE) ide_distinstall $(INSTALLOPTS) INSTALL_DOCDIR=$(DOC_DIR)/fp-ide
  117. $(MAKE) utils_distinstall $(INSTALLOPTS)
  118. # Copy examples to the correct doc dir
  119. bash debian/moveexamples $(EXAMPLE_TEMP) $(DOC_DIR)
  120. # Install man pages and RTL demos and whatsnew and readme
  121. $(MAKE) man_install $(INSTALLOPTS) INSTALL_PREFIX=$(INSTALL_DIR)/usr/share
  122. $(MAKE) demo_install $(INSTALLOPTS) INSTALL_SOURCEDIR=$(DOC_DIR)/fp-compiler
  123. $(MAKE) doc_install $(INSTALLOPTS) INSTALL_DOCDIR=$(DOC_DIR)/fp-compiler
  124. # Create fpc.cfg which is included as conffile
  125. chmod 755 compiler/utils/samplecfg
  126. compiler/utils/samplecfg "/usr/lib/fpc/\$$fpcversion" $(INSTALL_DIR)/etc
  127. touch install-arch-stamp
  128. arrange-arch: arrange-arch-stamp
  129. arrange-arch-stamp: install-arch-stamp debian-files-stamp
  130. dh_testdir
  131. dh_testroot
  132. dh_install -a --sourcedir=debian/tmp --list-missing
  133. touch arrange-arch-stamp
  134. ###################
  135. # Documentation
  136. #
  137. build-indep: build-indep-stamp
  138. # We depend on the new fpdoc
  139. build-indep-stamp: debian-files-stamp build-arch-stamp
  140. @echo "--- Building Documentation"
  141. dh_testdir
  142. $(MAKE) -C docs $(DOCTYPE) FPDOC=$(NEWFPDOC)
  143. touch build-indep-stamp
  144. install-indep: install-indep-stamp
  145. install-indep-stamp: debian-files build-indep
  146. @echo "--- Installing Documentation"
  147. dh_testdir
  148. dh_testroot
  149. dh_clean -k
  150. $(MAKE) -C docs $(DOCTYPE)install DOCINSTALLDIR=$(INSTALL_DIR)/usr/share/doc/fp-docs
  151. touch install-indep-stamp
  152. ###################
  153. # Generic
  154. #
  155. build: build-arch build-indep
  156. install: install-arch install-indep
  157. binary: binary-arch binary-indep
  158. ###################
  159. # Deb building
  160. #
  161. binary-indep: build-indep install-indep debian-files
  162. @echo "--- Building: arch-indep packages"
  163. dh_testdir
  164. dh_testroot
  165. dh_installdocs -i
  166. dh_installchangelogs -i
  167. dh_installchangelogs -pfp-docs logs/Changes.docs
  168. dh_install -i --sourcedir=debian/tmp --list-missing
  169. dh_compress -i -X.pdf
  170. dh_fixperms -i
  171. dh_installdeb -i
  172. dh_gencontrol -i
  173. dh_md5sums -i
  174. dh_builddeb -i
  175. binary-arch: build-arch arrange-arch debian-files
  176. @echo "--- Building: arch packages"
  177. dh_testdir
  178. dh_testroot
  179. dh_installdocs -a
  180. dh_installchangelogs -a
  181. dh_installchangelogs -pfp-compiler logs/Changes.compiler
  182. dh_installchangelogs -pfp-units-rtl logs/Changes.rtl
  183. dh_installchangelogs -pfp-units-fcl logs/Changes.fcl
  184. dh_installchangelogs -pfp-utils logs/Changes.utils
  185. dh_installexamples -a
  186. dh_compress -a
  187. dh_fixperms -a
  188. dh_installdeb -a
  189. dh_shlibdeps -a
  190. dh_gencontrol -a
  191. dh_md5sums -a
  192. dh_builddeb -a
  193. .PHONY: build clean binary debian-files \
  194. build-arch install-arch binary-arch \
  195. binary-indep