Jamfile.v2 6.9 KB

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