rules 5.8 KB

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