rules 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252
  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. # Get directories
  42. PWD:=$(shell pwd)
  43. BUILD_DIR=$(PWD)/debian/build
  44. INSTALL_DIR=$(PWD)/debian/tmp
  45. DOC_DIR=$(INSTALL_DIR)/usr/share/doc
  46. EXAMPLE_TEMP=$(DOC_DIR)/fpc-$(FPCVERSION)
  47. # Get utils
  48. NEWPP=$(PWD)/compiler/$(PPNEW)
  49. NEWFPDOC=$(PWD)/utils/fpdoc/fpdoc
  50. # Create default options
  51. BUILDOPTS=PP=$(NEWPP)
  52. INSTALLOPTS=PP=$(NEWPP) INSTALL_PREFIX=$(INSTALL_DIR)/usr
  53. export DH_COMPAT=2
  54. # export DH_VERBOSE=1
  55. ###################
  56. # Clean
  57. #
  58. clean:
  59. @echo "--- Cleaning"
  60. dh_testdir
  61. dh_testroot
  62. rm -f build-arch-stamp install-arch-stamp arrange-arch-stamp
  63. rm -f build-indep-stamp install-indep-stamp
  64. rm -f debian-files-stamp
  65. rm -f debian/*.files debian/*.docs debian/*.examples debian/*.postinst debian/*.postrm
  66. $(MAKE) compiler_distclean
  67. $(MAKE) rtl_distclean
  68. $(MAKE) packages_distclean
  69. $(MAKE) fcl_distclean
  70. $(MAKE) utils_distclean
  71. $(MAKE) -C docs clean
  72. -(find . -name \*.a | xargs rm)
  73. dh_clean
  74. # Cannot do that because the control-file is often needed after a cleanup
  75. # rm -f debian/control
  76. ###################
  77. # Debian files
  78. #
  79. debian-files: debian-files-stamp
  80. debian-files-stamp:
  81. @echo "--- Creating debian files"
  82. bash debian/fixdeb debian $(PPNEW)
  83. touch debian-files-stamp
  84. ###################
  85. # Arch packages
  86. #
  87. build-arch: build-arch-stamp
  88. build-arch-stamp: debian-files-stamp
  89. @echo "--- Building"
  90. dh_testdir
  91. # First make a new Compiler and RTL using a make cycle
  92. $(MAKE) compiler_cycle
  93. $(MAKE) rtl_clean rtl_smart $(BUILDOPTS)
  94. $(MAKE) packages_base_smart $(BUILDOPTS)
  95. $(MAKE) fcl_smart $(BUILDOPTS)
  96. $(MAKE) packages_extra_smart $(BUILDOPTS)
  97. $(MAKE) utils_all $(BUILDOPTS)
  98. touch build-arch-stamp
  99. install-arch: install-arch-stamp
  100. install-arch-stamp: build-arch-stamp debian-files-stamp
  101. @echo "--- Installing"
  102. dh_testdir
  103. dh_testroot
  104. dh_clean -k
  105. # Specify the compiler to use so installing will use the correct versioned dir
  106. $(MAKE) compiler_distinstall $(INSTALLOPTS)
  107. $(MAKE) rtl_distinstall $(INSTALLOPTS)
  108. $(MAKE) fcl_distinstall $(INSTALLOPTS)
  109. $(MAKE) packages_distinstall $(INSTALLOPTS)
  110. $(MAKE) utils_distinstall $(INSTALLOPTS)
  111. # Copy examples to the correct doc dir
  112. install -d -m755 $(DOC_DIR)/fp-units-fcl/examples
  113. install -d -m755 $(DOC_DIR)/fp-units-gtk/examples
  114. install -d -m755 $(DOC_DIR)/fp-units-gnome1/examples
  115. install -d -m755 $(DOC_DIR)/fp-units-gfx/examples
  116. install -d -m755 $(DOC_DIR)/fp-units-db/examples
  117. install -d -m755 $(DOC_DIR)/fp-units-net/examples
  118. install -d -m755 $(DOC_DIR)/fp-units-misc/examples
  119. install -d -m755 $(DOC_DIR)/fp-units-base/examples
  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/\$$version" $(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) 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 DOCINSTALLDIR=$(INSTALL_DIR)/usr/share/doc/fpc/$(FPCVERSION)/
  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