rules 5.8 KB

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