rules 6.5 KB

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