Jamfile.v2 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207
  1. # Copyright (c) 2002 Douglas Gregor <doug.gregor -at- gmail.com>
  2. # Copyright (c) 2016 Rene Rivera
  3. #
  4. # Distributed under the Boost Software License, Version 1.0.
  5. # (See accompanying file LICENSE_1_0.txt or copy at
  6. # http://www.boost.org/LICENSE_1_0.txt)
  7. project boost/doc
  8. : requirements
  9. <xsl:param>boost.libraries=../../libs/libraries.htm
  10. <format>html:<xsl:param>chunker.output.doctype-public="-//W3C//DTD HTML 4.01 Transitional//EN"
  11. <format>html:<xsl:param>chunker.output.doctype-system="http://www.w3.org/TR/html4/loose.dtd"
  12. ;
  13. import boostbook : boostbook ;
  14. import project ;
  15. import targets ;
  16. import print ;
  17. import type ;
  18. import generators ;
  19. import sequence ;
  20. import path ;
  21. import "class" : is-a ;
  22. path-constant BOOST_DOC : . ;
  23. local lib-docs = [ path.glob [ path.glob $(BOOST_DOC)/../libs : */doc ]
  24. : [ modules.peek project : JAMFILE ] ] ;
  25. local rule find-target-of-class-or-type ( root-target : klass ? : type ? )
  26. {
  27. local result ;
  28. if ! $(result) && $(klass) && [ is-a $(root-target) : $(klass) ]
  29. {
  30. result ?= $(root-target) $(klass) ;
  31. }
  32. if ! $(result) && $(type) && $(type:U) = [ modules.peek $(root-target) : self.type ]
  33. {
  34. result ?= $(root-target) $(type:U) ;
  35. }
  36. local alternatives = [ modules.peek $(root-target) : self.alternatives ] ;
  37. if ! $(result)
  38. {
  39. for local alternative in $(alternatives)
  40. {
  41. if $(result) { break ; }
  42. result ?= [ find-target-of-class-or-type $(alternative) : $(klass) : $(type) ] ;
  43. }
  44. }
  45. if ! $(result)
  46. {
  47. for local alternative in $(alternatives)
  48. {
  49. if $(result) { break ; }
  50. local sources = [ modules.peek $(alternative) : self.sources ] ;
  51. for local source in [ $(alternative).sources ]
  52. {
  53. if $(result) { break ; }
  54. result ?= [ find-target-of-class-or-type $(source) : $(klass) : $(type) ] ;
  55. }
  56. }
  57. }
  58. return $(result) ;
  59. }
  60. local rule docbook-target-spec ( main-target )
  61. {
  62. local spec ;
  63. local doc-sub-target
  64. = [ find-target-of-class-or-type $(main-target) : boostbook-target-class : XML ] ;
  65. if $(doc-sub-target)
  66. {
  67. #ECHO *** $(main-target) ;
  68. #ECHO " ::" [ $(main-target).full-name ] ;
  69. #ECHO " ::" $(doc-sub-target) :: [ $(doc-sub-target[0]).full-name ] ;
  70. local full-name = [ $(doc-sub-target[0]).full-name ] ;
  71. local target-path = $(full-name:D) ;
  72. local target-name = $(full-name:B) ;
  73. local this-path = [ path.root [ project.attribute $(__name__) location ] [ path.pwd ] ] ;
  74. target-path = [ path.relative-to $(this-path) $(target-path) ] ;
  75. #ECHO " ::" $(target-path) :: $(target-name) ;
  76. spec = $(target-path)//$(target-name) ;
  77. }
  78. return $(spec) ;
  79. }
  80. local lib-doc-boostdoc-refs ;
  81. local lib-doc-boostrelease-refs ;
  82. local this-path = [ path.root [ project.attribute $(__name__) location ] [ path.pwd ] ] ;
  83. for local lib-doc in $(lib-docs)
  84. {
  85. #ECHO === $(lib-doc) ... ;
  86. local doc-project = $(lib-doc:D) ;
  87. local doc-module = [ project.find $(doc-project)
  88. : [ project.attribute $(__name__) location ] ] ;
  89. local doc-target = [ project.target $(doc-module) ] ;
  90. $(doc-target).build-main-targets ;
  91. local boostrelease-target = [ $(doc-target).main-target boostrelease ] ;
  92. if $(boostrelease-target)
  93. {
  94. local full-name = [ $(boostrelease-target).full-name ] ;
  95. local target-path = [ path.relative-to $(this-path) $(full-name:D) ] ;
  96. lib-doc-boostrelease-refs += $(target-path)//boostrelease ;
  97. #ECHO " ::" $(target-path)//boostrelease ;
  98. }
  99. local boostdoc-target = [ $(doc-target).main-target boostdoc ] ;
  100. if $(boostdoc-target)
  101. {
  102. local full-name = [ $(boostdoc-target).full-name ] ;
  103. local target-path = [ path.relative-to $(this-path) $(full-name:D) ] ;
  104. lib-doc-boostdoc-refs += $(target-path)//boostdoc ;
  105. #ECHO " ::" $(target-path)//boostdoc ;
  106. }
  107. }
  108. # Build non-integrated library docs for release.
  109. if "--release-build" in [ modules.peek : ARGV ]
  110. {
  111. alias release-build : $(lib-doc-boostrelease-refs) ;
  112. }
  113. local rule component-order ( x y )
  114. {
  115. local a = [ MATCH "(/libs/[^/]+)" "(/tools/[^/]+)" : $(x:G) $(x:G=) ] ;
  116. local b = [ MATCH "(/libs/[^/]+)" "(/tools/[^/]+)" : $(y:G) $(y:G=) ] ;
  117. if $(a[1]) < $(b[1])
  118. {
  119. return true ;
  120. }
  121. else if $(a[1]) = $(b[1]) && $(x) < $(y)
  122. {
  123. return true ;
  124. }
  125. }
  126. rule xinclude-generator ( target : sources * : properties * )
  127. {
  128. print.output $(target) ;
  129. local includes ;
  130. sources = [ sequence.insertion-sort $(sources) : component-order ] ;
  131. locate = [ path.root [ on $(target) return $(LOCATE) ] [ path.pwd ] ] ;
  132. for local xml in $(sources)
  133. {
  134. local dir ;
  135. dir ?= [ on $(xml) return $(LOCATE) ] ;
  136. dir ?= [ on $(xml) return $(SEARCH) ] ;
  137. dir ?= "" ;
  138. dir = [ path.root $(dir[1]) [ path.pwd ] ] ;
  139. dir = [ path.relative-to $(locate) $(dir) ] ;
  140. includes += "<xi:include href=\"$(dir[1])/$(xml:G=)\"/>" ;
  141. }
  142. print.text
  143. "<?xml version=\"1.0\" encoding=\"utf-8\"?>"
  144. "<xml xmlns:xi=\"http://www.w3.org/2003/XInclude\">"
  145. $(includes)
  146. "</xml>"
  147. : overwrite ;
  148. }
  149. type.register XINCLUDE_XML : xinclude : XML ;
  150. generators.register-composing $(__name__).xinclude-generator : XML : XINCLUDE_XML ;
  151. rule xinclude ( name : sources * : requirements * : default-build * : usage-requirements * )
  152. {
  153. targets.create-typed-target XINCLUDE_XML
  154. : [ project.current ]
  155. : $(name)
  156. : $(sources)
  157. : $(requirements)
  158. : $(default-build)
  159. : $(usage-requirements)
  160. ;
  161. }
  162. xinclude libraries :
  163. $(lib-doc-boostdoc-refs)
  164. ;
  165. explicit libraries ;
  166. xinclude tools :
  167. ../tools/build/doc//jam_docs
  168. ../tools/quickbook/doc//quickbook
  169. ../tools/boostbook/doc/boostbook.xml
  170. ../tools/build/doc//boostdoc
  171. ;
  172. explicit tools ;
  173. boostbook doc
  174. :
  175. src/boost.xml
  176. :
  177. <xsl:param>generate.consistent.ids=1
  178. <use>$(lib-doc-boostdoc-refs)
  179. <dependency>libraries
  180. <implicit-dependency>libraries
  181. <dependency>tools
  182. <implicit-dependency>tools
  183. <dependency>images
  184. <dependency>callouts
  185. <xsl:path>$(BOOST_DOC)
  186. ;
  187. install images : [ glob src/images/*.png ] : <location>html/images ;
  188. explicit images ;
  189. install callouts : [ glob src/images/callouts/*.png ] : <location>html/images/callouts ;
  190. explicit callouts ;
粤ICP备19079148号