Jamroot 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757
  1. # Copyright Vladimir Prus 2002-2006.
  2. # Copyright Dave Abrahams 2005-2006.
  3. # Copyright Rene Rivera 2005-2007.
  4. # Copyright Douglas Gregor 2005.
  5. #
  6. # Distributed under the Boost Software License, Version 1.0.
  7. # (See accompanying file LICENSE_1_0.txt or copy at
  8. # http://www.boost.org/LICENSE_1_0.txt)
  9. # Usage:
  10. #
  11. # bjam [options] [properties] [install|stage]
  12. #
  13. # Builds and installs Boost.
  14. #
  15. # Targets and Related Options:
  16. #
  17. # install Install headers and compiled library files to the
  18. # ======= configured locations (below).
  19. #
  20. # --prefix=<PREFIX> Install architecture independent files here.
  21. # Default; C:\Boost on Win32
  22. # Default; /usr/local on Unix. Linux, etc.
  23. #
  24. # --exec-prefix=<EPREFIX> Install architecture dependent files here.
  25. # Default; <PREFIX>
  26. #
  27. # --libdir=<DIR> Install library files here.
  28. # Default; <EPREFIX>/lib
  29. #
  30. # --includedir=<HDRDIR> Install header files here.
  31. # Default; <PREFIX>/include
  32. #
  33. # stage Build and install only compiled library files
  34. # ===== to the stage directory.
  35. #
  36. # --stagedir=<STAGEDIR> Install library files here
  37. # Default; ./stage
  38. #
  39. # Other Options:
  40. #
  41. # --build-type=<type> Build the specified pre-defined set of variations
  42. # of the libraries. Note, that which variants get
  43. # built depends on what each library supports.
  44. #
  45. # minimal (default) - Builds a minimal set of
  46. # variants. On Windows, these are static
  47. # multithreaded libraries in debug and release
  48. # modes, using shared runtime. On Linux, these
  49. # are static and shared multithreaded libraries
  50. # in release mode.
  51. #
  52. # complete - Build all possible variations.
  53. #
  54. # --build-dir=DIR Build in this location instead of building
  55. # within the distribution tree. Recommended!
  56. #
  57. # --show-libraries Displays the list of Boost libraries that require
  58. # build and installation steps, then exit.
  59. #
  60. # --layout=<layout> Determines whether to choose library names
  61. # and header locations such that multiple
  62. # versions of Boost or multiple compilers can
  63. # be used on the same system.
  64. #
  65. # versioned - Names of boost binaries
  66. # include the Boost version number, name and
  67. # version of the compiler and encoded build
  68. # properties. Boost headers are installed in a
  69. # subdirectory of <HDRDIR> whose name contains
  70. # the Boost version number.
  71. #
  72. # tagged -- Names of boost binaries include the
  73. # encoded build properties such as variant and
  74. # threading, but do not including compiler name
  75. # and version, or Boost version. This option is
  76. # useful if you build several variants of Boost,
  77. # using the same compiler.
  78. #
  79. # system - Binaries names do not include the
  80. # Boost version number or the name and version
  81. # number of the compiler. Boost headers are
  82. # installed directly into <HDRDIR>. This option
  83. # is intended for system integrators who are
  84. # building distribution packages.
  85. #
  86. # The default value is 'versioned' on Windows, and
  87. # 'system' on Unix.
  88. #
  89. # --buildid=ID Adds the specified ID to the name of built
  90. # libraries. The default is to not add anything.
  91. #
  92. # --python-buildid=ID Adds the specified ID to the name of built
  93. # libraries that depend on Python. The default
  94. # is to not add anything. This ID is added in
  95. # addition t --buildid.
  96. #
  97. #
  98. # --help This message.
  99. #
  100. # --with-<library> Build and install the specified <library>
  101. # If this option is used, only libraries
  102. # specified using this option will be built.
  103. #
  104. # --without-<library> Do not build, stage, or install the specified
  105. # <library>. By default, all libraries are built.
  106. #
  107. # Properties:
  108. #
  109. # toolset=toolset Indicates the toolset to build with.
  110. #
  111. # variant=debug|release Select the build variant
  112. #
  113. # link=static|shared Whether to build static or shared libraries
  114. #
  115. # threading=single|multi Whether to build single or multithreaded binaries
  116. #
  117. # runtime-link=static|shared
  118. # Whether to link to static or shared C and C++ runtime.
  119. #
  120. # TODO:
  121. # - handle boost version
  122. # - handle python options such as pydebug
  123. import generate ;
  124. import modules ;
  125. import set ;
  126. import stage ;
  127. import package ;
  128. import path ;
  129. import common ;
  130. import os ;
  131. import regex ;
  132. import errors ;
  133. import "class" : new ;
  134. import common ;
  135. import sequence ;
  136. import symlink ;
  137. import targets ;
  138. import project ;
  139. import option ;
  140. import xsltproc ;
  141. import build-system ;
  142. import configure ;
  143. path-constant BOOST_ROOT : . ;
  144. constant BOOST_VERSION : 1.47.0 ;
  145. constant BOOST_JAMROOT_MODULE : $(__name__) ;
  146. local version-tag = [ MATCH "^([^.]+)[.]([^.]+)[.]([^.]+)" : $(BOOST_VERSION) ]
  147. ;
  148. if $(version-tag[3]) = 0
  149. {
  150. version-tag = $(version-tag[1-2]) ;
  151. }
  152. constant BOOST_VERSION_TAG : $(version-tag:J="_") ;
  153. # Option to choose how many variants to build. The default is "minimal".
  154. local build-type = [ MATCH "^--build-type=(.*)" : [ modules.peek : ARGV ] ] ;
  155. build-type ?= minimal ;
  156. if ! ( $(build-type) in minimal complete )
  157. {
  158. ECHO "The value of the --build-type option should be either 'complete' or 'minimal'" ;
  159. EXIT ;
  160. }
  161. rule handle-static-runtime ( properties * )
  162. {
  163. # Using static runtime with shared libraries is impossible on Linux,
  164. # and dangerous on Windows. Therefore, we disallow it. This might
  165. # be drastic, but it was disabled for a while with nobody complaining.
  166. # For CW, static runtime is needed so that std::locale works.
  167. if <link>shared in $(properties) && <runtime-link>static in $(properties) &&
  168. ! ( <toolset>cw in $(properties) )
  169. {
  170. ECHO "error: link=shared together with runtime-link=static is not allowed" ;
  171. ECHO "error: such property combination is either impossible " ;
  172. ECHO "error: or too dangerious to be of any use" ;
  173. EXIT ;
  174. }
  175. }
  176. project boost
  177. : requirements <include>.
  178. # Disable auto-linking for all targets here, primarily because it caused
  179. # troubles with V2.
  180. <define>BOOST_ALL_NO_LIB=1
  181. # Used to encode variant in target name. See the 'tag' rule below.
  182. <tag>@$(__name__).tag
  183. <conditional>@handle-static-runtime
  184. # The standard library Sun compilers use by default has no chance
  185. # of working with Boost. Override it.
  186. <toolset>sun:<stdlib>sun-stlport
  187. # Comeau does not support shared lib
  188. <toolset>como:<link>static
  189. <toolset>como-linux:<define>_GNU_SOURCE=1
  190. # When building docs within Boost, we want the standard Boost style
  191. <xsl:param>boost.defaults=Boost
  192. : usage-requirements <include>.
  193. : build-dir bin.v2
  194. ;
  195. # Setup convenient aliases for all libraries.
  196. all-libraries = [ MATCH .*libs/(.*)/build/.* : [ glob libs/*/build/Jamfile.v2 ]
  197. [ glob libs/*/build/Jamfile ] ]
  198. ;
  199. all-libraries = [ sequence.unique $(all-libraries) ] ;
  200. # The function_types library has a Jamfile, but it's used for maintenance
  201. # purposes, there's no library to build and install.
  202. all-libraries = [ set.difference $(all-libraries) : function_types ] ;
  203. configure.register-components $(all-libraries) ;
  204. local rule explicit-alias ( id : targets + )
  205. {
  206. alias $(id) : $(targets) ;
  207. explicit $(id) ;
  208. }
  209. # First, the complicated libraries: where the target name in Jamfile is
  210. # different from its directory name.
  211. explicit-alias prg_exec_monitor : libs/test/build//boost_prg_exec_monitor ;
  212. explicit-alias test_exec_monitor : libs/test/build//boost_test_exec_monitor ;
  213. explicit-alias unit_test_framework : libs/test/build//boost_unit_test_framework ;
  214. explicit-alias bgl-vis : libs/graps/build//bgl-vis ;
  215. explicit-alias serialization : libs/serialization/build//boost_serialization ;
  216. explicit-alias wserialization : libs/serialization/build//boost_wserialization ;
  217. for local l in $(all-libraries)
  218. {
  219. if ! $(l) in test graph serialization
  220. {
  221. explicit-alias $(l) : libs/$(l)/build//boost_$(l) ;
  222. }
  223. }
  224. alias headers : : : : <include>. ;
  225. # Decides which libraries are to be installed by looking at --with-<library>
  226. # --without-<library> arguments. Returns the list of directories under "libs"
  227. # which must be built and installed.
  228. #
  229. rule libraries-to-install ( existing-libraries * )
  230. {
  231. local argv = [ modules.peek : ARGV ] ;
  232. local with-parameter = [ MATCH --with-(.*) : $(argv) ] ;
  233. local without-parameter = [ MATCH --without-(.*) : $(argv) ] ;
  234. if ! $(with-parameter) && ! $(without-parameter)
  235. {
  236. # Nothing is specified on command line. See if maybe
  237. # project-config.jam has some choices.
  238. local project-config-libs = [ modules.peek project-config : libraries ] ;
  239. with-parameter = [ MATCH --with-(.*) : $(project-config-libs) ] ;
  240. without-parameter = [ MATCH --without-(.*) : $(project-config-libs) ] ;
  241. }
  242. # Do some checks.
  243. if $(with-parameter) && $(without-parameter)
  244. {
  245. ECHO "error: both --with-<library> and --without-<library> specified" ;
  246. EXIT ;
  247. }
  248. local wrong = [ set.difference $(with-parameter) : $(existing-libraries) ] ;
  249. if $(wrong)
  250. {
  251. ECHO "error: wrong library name '$(wrong[1])' in the --with-<library> option." ;
  252. EXIT ;
  253. }
  254. local wrong = [ set.difference $(without-parameter) : $(existing-libraries) ] ;
  255. if $(wrong)
  256. {
  257. ECHO "error: wrong library name '$(wrong[1])' in the --without-<library> option." ;
  258. EXIT ;
  259. }
  260. if $(with-parameter)
  261. {
  262. return [ set.intersection $(existing-libraries) : $(with-parameter) ] ;
  263. }
  264. else
  265. {
  266. return [ set.difference $(existing-libraries) : $(without-parameter) ] ;
  267. }
  268. }
  269. # What kind of layout are we doing?
  270. layout = [ option.get layout : "" ] ;
  271. # On Windows, we used versioned layout by default in order to
  272. # be compatible with autolink. On other systems, we use system
  273. # layout which is what every other program uses. Note that windows
  274. # check is static, and won't
  275. if ! $(layout)
  276. {
  277. if [ modules.peek : NT ]
  278. {
  279. layout = versioned ;
  280. }
  281. else
  282. {
  283. layout = system ;
  284. }
  285. }
  286. layout-$(layout) = true ;
  287. if $(layout) = system && $(build-type) = complete
  288. {
  289. ECHO "error: Cannot use --layout=system with --build-type complete." ;
  290. ECHO "error: Please used either --layout=versioned or --layout=tagged " ;
  291. ECHO "error: if you wish to build multiple variants." ;
  292. if ! [ modules.peek : NT ]
  293. {
  294. ECHO "error: Note that --layout=system is default on Unix starting with Boost 1.40." ;
  295. }
  296. EXIT ;
  297. }
  298. # Possible stage only location.
  299. local stage-locate = [ MATCH "^--stagedir=(.*)" : [ modules.peek : ARGV ] ] ;
  300. stage-locate ?= stage ;
  301. path-constant BOOST_STAGE_LOCATE : $(stage-locate) ;
  302. # Python location.
  303. local python-root = [ MATCH "^--with-python-root=(.*)" : [ modules.peek : ARGV ]
  304. ] ;
  305. PYTHON_ROOT ?= $(python-root) ;
  306. # Select the libraries to install.
  307. libraries = [ libraries-to-install $(all-libraries) ] ;
  308. configure.components-building $(libraries) ;
  309. if --show-libraries in [ modules.peek : ARGV ]
  310. {
  311. ECHO "The following libraries require building:" ;
  312. for local l in $(libraries)
  313. {
  314. ECHO " - $(l)" ;
  315. }
  316. EXIT ;
  317. }
  318. # Custom build ID.
  319. local build-id = [ MATCH "^--buildid=(.*)" : [ modules.peek : ARGV ] ] ;
  320. if $(build-id)
  321. {
  322. constant BUILD_ID : [ regex.replace $(build-id) "[*\\/:.\"\' ]" "_" ] ;
  323. }
  324. # Python build id (only for Python libraries)
  325. local python-id = [ MATCH "^--python-buildid=(.*)" : [ modules.peek : ARGV ] ] ;
  326. if $(python-id)
  327. {
  328. constant PYTHON_ID : [ regex.replace $(python-id) "[*\\/:.\"\']" "_" ] ;
  329. }
  330. # This rule is called by Boost.Build to determine the name of target. We use it
  331. # to encode the build variant, compiler name and boost version in the target
  332. # name.
  333. #
  334. rule tag ( name : type ? : property-set )
  335. {
  336. if $(type) in STATIC_LIB SHARED_LIB IMPORT_LIB
  337. {
  338. local result ;
  339. if $(layout) = versioned
  340. {
  341. result = [ common.format-name
  342. <base> <toolset> <threading> <runtime> -$(BOOST_VERSION_TAG)
  343. -$(BUILD_ID)
  344. : $(name) : $(type) : $(property-set) ] ;
  345. }
  346. else if $(layout) = tagged
  347. {
  348. result = [ common.format-name
  349. <base> <threading> <runtime>
  350. -$(BUILD_ID)
  351. : $(name) : $(type) : $(property-set) ] ;
  352. }
  353. else if $(layout) = system
  354. {
  355. result = [ common.format-name
  356. <base>
  357. -$(BUILD_ID)
  358. : $(name) : $(type) : $(property-set) ] ;
  359. }
  360. else
  361. {
  362. ECHO "error: invalid layout '$(layout)'" ;
  363. EXIT ;
  364. }
  365. # Optionally add version suffix. On NT, library with version suffix
  366. # will not be recognized by linkers. On CYGWIN, we get strage
  367. # duplicate symbol errors when library is generated with version
  368. # suffix. On OSX, version suffix is not needed -- the linker expects
  369. # the libFoo.1.2.3.dylib format. AIX linkers do not accept version
  370. # suffixes either. Pgi compilers can not accept library with version
  371. # suffix.
  372. if $(type) = SHARED_LIB &&
  373. ( ! ( [ $(property-set).get <target-os> ] in windows cygwin darwin aix ) &&
  374. ! ( [ $(property-set).get <toolset> ] in pgi ) )
  375. {
  376. result = $(result).$(BOOST_VERSION) ;
  377. }
  378. return $(result) ;
  379. }
  380. }
  381. # Install to system location.
  382. install-requirements = <install-source-root>$(BOOST_ROOT)/boost ;
  383. if $(layout-versioned)
  384. {
  385. install-requirements += <install-header-subdir>boost-$(BOOST_VERSION_TAG)/boost ;
  386. }
  387. else
  388. {
  389. install-requirements += <install-header-subdir>boost ;
  390. }
  391. if [ modules.peek : NT ]
  392. {
  393. install-requirements += <install-default-prefix>C:/Boost ;
  394. }
  395. else if [ modules.peek : UNIX ]
  396. {
  397. install-requirements += <install-default-prefix>/usr/local ;
  398. }
  399. local headers =
  400. # The .SUNWCCh files are present in tr1 include directory and have to be installed,
  401. # see http://lists.boost.org/Archives/boost/2007/05/121430.php
  402. [ path.glob-tree $(BOOST_ROOT)/boost : *.hpp *.ipp *.h *.inc *.SUNWCCh : CVS .svn ]
  403. [ path.glob-tree $(BOOST_ROOT)/boost/compatibility/cpp_c_headers : c* : CVS .svn ]
  404. [ path.glob boost/tr1/tr1 : * : bcc32 sun CVS .svn ]
  405. ;
  406. # Complete install.
  407. package.install install-proper
  408. : $(install-requirements) <install-no-version-symlinks>on
  409. :
  410. : libs/$(libraries)/build
  411. : $(headers)
  412. ;
  413. explicit install-proper ;
  414. # Install just library.
  415. install stage-proper
  416. : libs/$(libraries)/build
  417. : <location>$(stage-locate)/lib
  418. <install-dependencies>on <install-type>LIB
  419. <install-no-version-symlinks>on
  420. ;
  421. explicit stage-proper ;
  422. if $(layout-versioned) && ( [ modules.peek : NT ] || [ modules.peek : UNIX ] )
  423. {
  424. rule make-unversioned-links ( project name ? : property-set : sources * )
  425. {
  426. local result ;
  427. local filtered ;
  428. local pattern ;
  429. local nt = [ modules.peek : NT ] ;
  430. # Collect the libraries that have the version number in 'filtered'.
  431. for local s in $(sources)
  432. {
  433. local m ;
  434. if $(nt)
  435. {
  436. m = [ MATCH "(.*[.]lib)" : [ $(s).name ] ] ;
  437. }
  438. else
  439. {
  440. m = [ MATCH "(.*[.]so[.0-9]+)" "(.*[.]dylib)" "(.*[.]a)" :
  441. [ $(s).name ] ] ;
  442. }
  443. if $(m)
  444. {
  445. filtered += $(s) ;
  446. }
  447. }
  448. # Create links without version.
  449. for local s in $(filtered)
  450. {
  451. local name = [ $(s).name ] ;
  452. local ea = [ $(s).action ] ;
  453. local ep = [ $(ea).properties ] ;
  454. local a = [ new non-scanning-action $(s) : symlink.ln : $(ep) ] ;
  455. local noversion-file ;
  456. if $(nt)
  457. {
  458. noversion-file = [ MATCH "(.*)-[0-9_]+(.*[.]lib)" : $(name) ] ;
  459. }
  460. else
  461. {
  462. noversion-file =
  463. [ MATCH "(.*)-[0-9_]+(.*[.]so)[.0-9]*" : $(name) ]
  464. [ MATCH "(.*)-[0-9_]+(.*[.]dylib)" : $(name) ]
  465. [ MATCH "(.*)-[0-9_]+(.*[.]a)" : $(name) ]
  466. [ MATCH "(.*)-[0-9_]+(.*[.]dll[.]a)" : $(name) ] ;
  467. }
  468. local new-name =
  469. $(noversion-file[1])$(noversion-file[2]) ;
  470. result += [ new file-target $(new-name) exact : [ $(s).type ] : $(project)
  471. : $(a) ] ;
  472. }
  473. return $(result) ;
  474. }
  475. generate stage-unversioned : stage-proper :
  476. <generating-rule>@make-unversioned-links ;
  477. explicit stage-unversioned ;
  478. generate install-unversioned : install-proper :
  479. <generating-rule>@make-unversioned-links ;
  480. explicit install-unversioned ;
  481. }
  482. else
  483. {
  484. # Create do-nothing aliases.
  485. alias stage-unversioned ;
  486. explicit stage-unversioned ;
  487. alias install-unversioned ;
  488. explicit install-unversioned ;
  489. }
  490. # This is a special metatarget class that handles the --build-type=complete
  491. # option.
  492. class top-level-target : alias-target-class
  493. {
  494. import modules ;
  495. import errors ;
  496. rule __init__ ( name : project : sources * : requirements *
  497. : default-build * : usage-requirements * )
  498. {
  499. alias-target-class.__init__ $(name) : $(project) : $(sources) :
  500. $(requirements) : $(default-build) : $(usage-requirements) ;
  501. local m = [ $(project).project-module ] ;
  502. self.build-type = [ modules.peek $(m) : build-type ] ;
  503. # On Linux, we build release variant by default, since few users will
  504. # ever want to debug C++ Boost libraries, and there's no ABI
  505. # incompatibility between debug and release variants. We build
  506. # shared and static libraries since that's what most packages
  507. # seem to provide (.so in libfoo and .a in libfoo-dev).
  508. self.minimal-properties = [ property-set.create
  509. <variant>release <threading>multi <link>shared <link>static <runtime-link>shared ] ;
  510. # On Windows, new IDE projects use:
  511. #
  512. # runtime-link=dynamic, threading=multi, variant=(debug|release)
  513. #
  514. # and in addition, C++ Boost's autolink defaults to static linking.
  515. self.minimal-properties-win = [ property-set.create
  516. <variant>debug <variant>release <threading>multi <link>static <runtime-link>shared ] ;
  517. self.complete-properties = [ property-set.create
  518. <variant>debug <variant>release
  519. <threading>single <threading>multi
  520. <link>shared <link>static
  521. <runtime-link>shared <runtime-link>static ] ;
  522. }
  523. rule generate ( property-set )
  524. {
  525. local x = [ modules.peek : top-level-targets ] ;
  526. x += $(self.name) ;
  527. modules.poke : top-level-targets : $(x) ;
  528. if $(self.build-type) = minimal
  529. {
  530. local expanded ;
  531. local os = [ $(property-set).get <target-os> ] ;
  532. # Because we completely override parent's 'generate'
  533. # we need to check for default value of feature ourself.
  534. if ! $(os)
  535. {
  536. os = [ feature.defaults <target-os> ] ;
  537. os = $(os:G=) ;
  538. }
  539. if $(os) = windows
  540. {
  541. expanded = [ targets.apply-default-build $(property-set)
  542. : $(self.minimal-properties-win) ] ;
  543. }
  544. else
  545. {
  546. expanded = [ targets.apply-default-build $(property-set)
  547. : $(self.minimal-properties) ] ;
  548. }
  549. return [ build-multiple $(expanded) ] ;
  550. }
  551. else if $(self.build-type) = complete
  552. {
  553. local expanded = [ targets.apply-default-build $(property-set)
  554. : $(self.complete-properties) ] ;
  555. # Filter inappopriate combinations
  556. local filtered ;
  557. for local p in $(expanded)
  558. {
  559. # See comment in handle-static-runtime regarding this logic.
  560. if [ $(p).get <link> ] = shared && [ $(p).get <runtime-link> ] = static
  561. && [ $(p).get <toolset> ] != cw
  562. {
  563. # Skip this
  564. }
  565. else
  566. {
  567. filtered += $(p) ;
  568. }
  569. }
  570. return [ build-multiple $(filtered) ] ;
  571. }
  572. else
  573. {
  574. errors.error "Unknown build type" ;
  575. }
  576. }
  577. rule build-multiple ( property-sets * )
  578. {
  579. local usage-requirements = [ property-set.empty ] ;
  580. local result ;
  581. for local p in $(property-sets)
  582. {
  583. local r = [ alias-target-class.generate $(p) ] ;
  584. if $(r)
  585. {
  586. usage-requirements = [ $(usage-requirements).add $(r[1]) ] ;
  587. result += $(r[2-]) ;
  588. }
  589. }
  590. return $(usage-requirements) [ sequence.unique $(result) ] ;
  591. }
  592. }
  593. targets.create-metatarget top-level-target : [ project.current ]
  594. : install
  595. : install-proper install-unversioned
  596. ;
  597. targets.create-metatarget top-level-target : [ project.current ]
  598. : stage
  599. : stage-proper stage-unversioned
  600. ;
  601. explicit install ;
  602. explicit stage ;
  603. stage-abs = [ path.native [ path.root $(stage-locate)/lib [ path.pwd ] ] ] ;
  604. # This target is built by default, and will forward to 'stage'
  605. # after producing some explanations.
  606. targets.create-metatarget top-level-target : [ project.current ]
  607. : forward
  608. : explain stage
  609. ;
  610. message explain :
  611. "\nBuilding the Boost C++ Libraries.\n\n" ;
  612. explicit explain ;
  613. rule pre-build ( )
  614. {
  615. local tl = [ modules.peek : top-level-targets ] ;
  616. if stage in $(tl) || install in $(tl)
  617. {
  618. # FIXME: remove if when Boost regression tests use trunk
  619. # bjam.
  620. if PAD in [ RULENAMES ]
  621. {
  622. configure.print-component-configuration ;
  623. }
  624. }
  625. }
  626. IMPORT $(__name__) : pre-build : : $(__name__).pre-build ;
  627. build-system.set-pre-build-hook $(__name__).pre-build ;
  628. rule post-build ( ok ? )
  629. {
  630. if forward in [ modules.peek : top-level-targets ]
  631. {
  632. if $(ok)
  633. {
  634. ECHO
  635. "\n\nThe Boost C++ Libraries were successfully built!
  636. The following directory should be added to compiler include paths:
  637. $(BOOST_ROOT)
  638. The following directory should be added to linker library paths:
  639. $(stage-abs)
  640. " ;
  641. }
  642. }
  643. }
  644. IMPORT $(__name__) : post-build : : $(__name__).post-build ;
  645. build-system.set-post-build-hook $(__name__).post-build ;
  646. # This rule should be called from libraries' Jamfiles and will create two
  647. # targets, "install" and "stage", that will install or stage that library. The
  648. # --prefix option is respected, but --with and --without options, naturally, are
  649. # ignored.
  650. #
  651. # - libraries -- list of library targets to install.
  652. #
  653. rule boost-install ( libraries * )
  654. {
  655. package.install install
  656. : <dependency>/boost//install-proper-headers $(install-requirements)
  657. : # No binaries
  658. : $(libraries)
  659. : # No headers, it is handled by the dependency.
  660. ;
  661. install stage : $(libraries) : <location>$(BOOST_STAGE_LOCATE) ;
  662. local c = [ project.current ] ;
  663. local project-module = [ $(c).project-module ] ;
  664. module $(project-module)
  665. {
  666. explicit stage ;
  667. explicit install ;
  668. }
  669. }
  670. # Make project ids of all libraries known.
  671. for local l in $(all-libraries)
  672. {
  673. use-project /boost/$(l) : libs/$(l)/build ;
  674. }
粤ICP备19079148号