rules 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256
  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. NEWFPDOC=$(PWD)/utils/fpdoc/fpdoc
  20. # Create default options
  21. BUILDOPTS=PP=$(NEWPP)
  22. INSTALLOPTS=PP=$(NEWPP) INSTALL_PREFIX=$(INSTALL_DIR)/usr
  23. export DH_COMPAT=2
  24. # export DH_VERBOSE=1
  25. ###################
  26. # Clean
  27. #
  28. clean:
  29. @echo "--- Cleaning"
  30. dh_testdir
  31. dh_testroot
  32. rm -f build-arch-stamp install-arch-stamp arrange-arch-stamp
  33. rm -f build-indep-stamp install-indep-stamp
  34. rm -f debian-files-stamp
  35. rm -f debian/*.files debian/*.docs debian/*.examples debian/*.postinst debian/*.postrm
  36. $(MAKE) compiler_distclean
  37. $(MAKE) rtl_distclean
  38. $(MAKE) packages_distclean
  39. $(MAKE) fcl_distclean
  40. $(MAKE) utils_distclean
  41. $(MAKE) -C docs clean
  42. -(find . -name \*.a | xargs rm)
  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-gnome1/examples
  85. install -d -m755 $(DOC_DIR)/fp-units-gfx/examples
  86. install -d -m755 $(DOC_DIR)/fp-units-db/examples
  87. install -d -m755 $(DOC_DIR)/fp-units-net/examples
  88. install -d -m755 $(DOC_DIR)/fp-units-misc/examples
  89. install -d -m755 $(DOC_DIR)/fp-units-base/examples
  90. mv -f $(EXAMPLE_TEMP)/fcl $(DOC_DIR)/fp-units-fcl/examples
  91. mv -f $(EXAMPLE_TEMP)/gtk $(DOC_DIR)/fp-units-gtk/examples
  92. # mv -f $(EXAMPLE_TEMP)/fpgtk $(DOC_DIR)/fp-units-gtk/examples
  93. # mv -f $(EXAMPLE_TEMP)/imlib $(DOC_DIR)/fp-units-gnome1/examples
  94. mv -f $(EXAMPLE_TEMP)/zvt $(DOC_DIR)/fp-units-gnome1/examples
  95. # mv -f $(EXAMPLE_TEMP)/gnome $(DOC_DIR)/fp-units-gnome1/examples
  96. mv -f $(EXAMPLE_TEMP)/gconf $(DOC_DIR)/fp-units-gnome1/examples
  97. mv -f $(EXAMPLE_TEMP)/paszlib $(DOC_DIR)/fp-units-base/examples
  98. mv -f $(EXAMPLE_TEMP)/pasjpeg $(DOC_DIR)/fp-units-base/examples
  99. mv -f $(EXAMPLE_TEMP)/regexpr $(DOC_DIR)/fp-units-base/examples
  100. mv -f $(EXAMPLE_TEMP)/ncurses $(DOC_DIR)/fp-units-base/examples
  101. mv -f $(EXAMPLE_TEMP)/forms $(DOC_DIR)/fp-units-gfx/examples
  102. mv -f $(EXAMPLE_TEMP)/ggi $(DOC_DIR)/fp-units-gfx/examples
  103. mv -f $(EXAMPLE_TEMP)/libgd $(DOC_DIR)/fp-units-gfx/examples
  104. mv -f $(EXAMPLE_TEMP)/svgalib $(DOC_DIR)/fp-units-gfx/examples
  105. mv -f $(EXAMPLE_TEMP)/opengl $(DOC_DIR)/fp-units-gfx/examples
  106. mv -f $(EXAMPLE_TEMP)/ibase $(DOC_DIR)/fp-units-db/examples
  107. mv -f $(EXAMPLE_TEMP)/mysql $(DOC_DIR)/fp-units-db/examples
  108. mv -f $(EXAMPLE_TEMP)/oracle $(DOC_DIR)/fp-units-db/examples
  109. mv -f $(EXAMPLE_TEMP)/postgres $(DOC_DIR)/fp-units-db/examples
  110. mv -f $(EXAMPLE_TEMP)/gdbm $(DOC_DIR)/fp-units-db/examples
  111. mv -f $(EXAMPLE_TEMP)/odbc $(DOC_DIR)/fp-units-db/examples
  112. mv -f $(EXAMPLE_TEMP)/gdbint $(DOC_DIR)/fp-units-misc/examples
  113. mv -f $(EXAMPLE_TEMP)/utmp $(DOC_DIR)/fp-units-misc/examples
  114. mv -f $(EXAMPLE_TEMP)/syslog $(DOC_DIR)/fp-units-misc/examples
  115. mv -f $(EXAMPLE_TEMP)/cdrom $(DOC_DIR)/fp-units-misc/examples
  116. mv -f $(EXAMPLE_TEMP)/tcl $(DOC_DIR)/fp-units-misc/examples
  117. mv -f $(EXAMPLE_TEMP)/inet $(DOC_DIR)/fp-units-net/examples
  118. mv -f $(EXAMPLE_TEMP)/netdb $(DOC_DIR)/fp-units-net/examples
  119. # Check if all examples are removed, if not then the rmdir will fail
  120. rmdir $(EXAMPLE_TEMP)
  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