|
| 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 | + |
| 10 | +# Usage: |
| 11 | +# |
| 12 | +# b2 [options] [properties] [install|stage] |
| 13 | +# |
| 14 | +# Builds and installs Boost. |
| 15 | +# |
| 16 | +# Targets and Related Options: |
| 17 | +# |
| 18 | +# install Install headers and compiled library files to the |
| 19 | +# ======= configured locations (below). |
| 20 | +# |
| 21 | +# --prefix=<PREFIX> Install architecture independent files here. |
| 22 | +# Default; C:\Boost on Win32 |
| 23 | +# Default; /usr/local on Unix. Linux, etc. |
| 24 | +# |
| 25 | +# --exec-prefix=<EPREFIX> Install architecture dependent files here. |
| 26 | +# Default; <PREFIX> |
| 27 | +# |
| 28 | +# --libdir=<DIR> Install library files here. |
| 29 | +# Default; <EPREFIX>/lib |
| 30 | +# |
| 31 | +# --includedir=<HDRDIR> Install header files here. |
| 32 | +# Default; <PREFIX>/include |
| 33 | +# |
| 34 | +# stage Build and install only compiled library files to the |
| 35 | +# ===== stage directory. |
| 36 | +# |
| 37 | +# --stagedir=<STAGEDIR> Install library files here |
| 38 | +# Default; ./stage |
| 39 | +# |
| 40 | +# Other Options: |
| 41 | +# |
| 42 | +# --build-type=<type> Build the specified pre-defined set of variations of |
| 43 | +# the libraries. Note, that which variants get built |
| 44 | +# depends on what each library supports. |
| 45 | +# |
| 46 | +# -- minimal -- (default) Builds a minimal set of |
| 47 | +# variants. On Windows, these are static |
| 48 | +# multithreaded libraries in debug and release |
| 49 | +# modes, using shared runtime. On Linux, these are |
| 50 | +# static and shared multithreaded libraries in |
| 51 | +# release mode. |
| 52 | +# |
| 53 | +# -- complete -- Build all possible variations. |
| 54 | +# |
| 55 | +# --build-dir=DIR Build in this location instead of building within |
| 56 | +# the distribution tree. Recommended! |
| 57 | +# |
| 58 | +# --show-libraries Display the list of Boost libraries that require |
| 59 | +# build and installation steps, and then exit. |
| 60 | +# |
| 61 | +# --layout=<layout> Determine whether to choose library names and header |
| 62 | +# locations such that multiple versions of Boost or |
| 63 | +# multiple compilers can be used on the same system. |
| 64 | +# |
| 65 | +# -- versioned -- Names of boost binaries include |
| 66 | +# the Boost version number, name and version of |
| 67 | +# the compiler and encoded build properties. Boost |
| 68 | +# headers are installed in a subdirectory of |
| 69 | +# <HDRDIR> whose name contains the Boost version |
| 70 | +# 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 is |
| 83 | +# intended for system integrators building |
| 84 | +# distribution packages. |
| 85 | +# |
| 86 | +# The default value is 'versioned' on Windows, and |
| 87 | +# 'system' on Unix. |
| 88 | +# |
| 89 | +# --buildid=ID Add the specified ID to the name of built libraries. |
| 90 | +# The default is to not add anything. |
| 91 | +# |
| 92 | +# --python-buildid=ID Add the specified ID to the name of built libraries |
| 93 | +# that depend on Python. The default is to not add |
| 94 | +# anything. This ID is added in addition to --buildid. |
| 95 | +# |
| 96 | +# --help This message. |
| 97 | +# |
| 98 | +# --with-<library> Build and install the specified <library>. If this |
| 99 | +# option is used, only libraries specified using this |
| 100 | +# option will be built. |
| 101 | +# |
| 102 | +# --without-<library> Do not build, stage, or install the specified |
| 103 | +# <library>. By default, all libraries are built. |
| 104 | +# |
| 105 | +# Properties: |
| 106 | +# |
| 107 | +# toolset=toolset Indicate the toolset to build with. |
| 108 | +# |
| 109 | +# variant=debug|release Select the build variant |
| 110 | +# |
| 111 | +# link=static|shared Whether to build static or shared libraries |
| 112 | +# |
| 113 | +# threading=single|multi Whether to build single or multithreaded binaries |
| 114 | +# |
| 115 | +# runtime-link=static|shared |
| 116 | +# Whether to link to static or shared C and C++ |
| 117 | +# runtime. |
| 118 | +# |
| 119 | + |
| 120 | +# TODO: |
| 121 | +# - handle boost version |
| 122 | +# - handle python options such as pydebug |
| 123 | + |
| 124 | +import boostcpp ; |
| 125 | +import package ; |
| 126 | + |
| 127 | +import sequence ; |
| 128 | +import xsltproc ; |
| 129 | +import set ; |
| 130 | +import path ; |
| 131 | +import link ; |
| 132 | + |
| 133 | +path-constant BOOST_ROOT : . ; |
| 134 | +constant BOOST_VERSION : 1.58.0 ; |
| 135 | +constant BOOST_JAMROOT_MODULE : $(__name__) ; |
| 136 | + |
| 137 | +boostcpp.set-version $(BOOST_VERSION) ; |
| 138 | + |
| 139 | +use-project /boost/architecture : libs/config/checks/architecture ; |
| 140 | + |
| 141 | +local all-headers = |
| 142 | + [ MATCH .*libs/(.*)/include/boost : [ glob libs/*/include/boost ] ] ; |
| 143 | + |
| 144 | +for dir in $(all-headers) |
| 145 | +{ |
| 146 | + link-directory $(dir)-headers : libs/$(dir)/include/boost : <location>. ; |
| 147 | + explicit $(dir)-headers ; |
| 148 | +} |
| 149 | + |
| 150 | +local numeric-headers = |
| 151 | + [ MATCH .*libs/numeric/(.*)/include/boost : [ glob libs/*/*/include/boost ] ] ; |
| 152 | + |
| 153 | +for dir in $(numeric-headers) |
| 154 | +{ |
| 155 | + link-directory numeric-$(dir)-headers : libs/numeric/$(dir)/include/boost : <location>. ; |
| 156 | + explicit numeric-$(dir)-headers ; |
| 157 | +} |
| 158 | + |
| 159 | +if $(all-headers) |
| 160 | +{ |
| 161 | + constant BOOST_MODULARLAYOUT : $(all-headers) $(numeric-headers) ; |
| 162 | +} |
| 163 | + |
| 164 | +project boost |
| 165 | + : requirements <include>. |
| 166 | + |
| 167 | + [ boostcpp.architecture ] |
| 168 | + [ boostcpp.address-model ] |
| 169 | + |
| 170 | + # Disable auto-linking for all targets here, primarily because it caused |
| 171 | + # troubles with V2. |
| 172 | + <define>BOOST_ALL_NO_LIB=1 |
| 173 | + # Used to encode variant in target name. See the 'tag' rule below. |
| 174 | + <tag>@$(__name__).tag |
| 175 | + <conditional>@handle-static-runtime |
| 176 | + # The standard library Sun compilers use by default has no chance |
| 177 | + # of working with Boost. Override it. |
| 178 | + <toolset>sun:<stdlib>sun-stlport |
| 179 | + # Comeau does not support shared lib |
| 180 | + <toolset>como:<link>static |
| 181 | + <toolset>como-linux:<define>_GNU_SOURCE=1 |
| 182 | + # When building docs within Boost, we want the standard Boost style |
| 183 | + <xsl:param>boost.defaults=Boost |
| 184 | + : usage-requirements <include>. |
| 185 | + : build-dir bin.v2 |
| 186 | + ; |
| 187 | + |
| 188 | +# This rule is called by Boost.Build to determine the name of target. We use it |
| 189 | +# to encode the build variant, compiler name and boost version in the target |
| 190 | +# name. |
| 191 | +# |
| 192 | +rule tag ( name : type ? : property-set ) |
| 193 | +{ |
| 194 | + return [ boostcpp.tag $(name) : $(type) : $(property-set) ] ; |
| 195 | +} |
| 196 | + |
| 197 | +rule handle-static-runtime ( properties * ) |
| 198 | +{ |
| 199 | + # Using static runtime with shared libraries is impossible on Linux, and |
| 200 | + # dangerous on Windows. Therefore, we disallow it. This might be drastic, |
| 201 | + # but it was disabled for a while without anybody complaining. |
| 202 | + |
| 203 | + # For CW, static runtime is needed so that std::locale works. |
| 204 | + if <link>shared in $(properties) && <runtime-link>static in $(properties) && |
| 205 | + ! ( <toolset>cw in $(properties) ) |
| 206 | + { |
| 207 | + ECHO "error: link=shared together with runtime-link=static is not allowed" ; |
| 208 | + ECHO "error: such property combination is either impossible " ; |
| 209 | + ECHO "error: or too dangerious to be of any use" ; |
| 210 | + EXIT ; |
| 211 | + } |
| 212 | +} |
| 213 | + |
| 214 | +all-libraries = [ MATCH .*libs/(.*)/build/.* : [ glob libs/*/build/Jamfile.v2 ] |
| 215 | + [ glob libs/*/build/Jamfile ] ] ; |
| 216 | + |
| 217 | +all-libraries = [ sequence.unique $(all-libraries) ] ; |
| 218 | +# The function_types library has a Jamfile, but it's used for maintenance |
| 219 | +# purposes, there's no library to build and install. |
| 220 | +all-libraries = [ set.difference $(all-libraries) : function_types ] ; |
| 221 | + |
| 222 | +# Setup convenient aliases for all libraries. |
| 223 | + |
| 224 | +local rule explicit-alias ( id : targets + ) |
| 225 | +{ |
| 226 | + alias $(id) : $(targets) ; |
| 227 | + explicit $(id) ; |
| 228 | +} |
| 229 | + |
| 230 | +# First, the complicated libraries: where the target name in Jamfile is |
| 231 | +# different from its directory name. |
| 232 | +explicit-alias prg_exec_monitor : libs/test/build//boost_prg_exec_monitor ; |
| 233 | +explicit-alias test_exec_monitor : libs/test/build//boost_test_exec_monitor ; |
| 234 | +explicit-alias unit_test_framework : libs/test/build//boost_unit_test_framework ; |
| 235 | +explicit-alias bgl-vis : libs/graps/build//bgl-vis ; |
| 236 | +explicit-alias serialization : libs/serialization/build//boost_serialization ; |
| 237 | +explicit-alias wserialization : libs/serialization/build//boost_wserialization ; |
| 238 | +for local l in $(all-libraries) |
| 239 | +{ |
| 240 | + if ! $(l) in test graph serialization |
| 241 | + { |
| 242 | + explicit-alias $(l) : libs/$(l)/build//boost_$(l) ; |
| 243 | + } |
| 244 | +} |
| 245 | + |
| 246 | +alias headers : $(all-headers)-headers numeric-$(numeric-headers)-headers : : : <include>. ; |
| 247 | +explicit headers ; |
| 248 | + |
| 249 | +# Make project ids of all libraries known. |
| 250 | +for local l in $(all-libraries) |
| 251 | +{ |
| 252 | + use-project /boost/$(l) : libs/$(l)/build ; |
| 253 | +} |
| 254 | + |
| 255 | +use-project /boost/tools/inspect : tools/inspect/build ; |
| 256 | +use-project /boost/libs/wave/tool : libs/wave/tool/build ; |
| 257 | + |
| 258 | +# This rule should be called from libraries' Jamfiles and will create two |
| 259 | +# targets, "install" and "stage", that will install or stage that library. The |
| 260 | +# --prefix option is respected, but --with and --without options, naturally, are |
| 261 | +# ignored. |
| 262 | +# |
| 263 | +# - libraries -- list of library targets to install. |
| 264 | +# |
| 265 | +rule boost-install ( libraries * ) |
| 266 | +{ |
| 267 | + package.install install |
| 268 | + : <dependency>/boost//install-proper-headers $(install-requirements) |
| 269 | + : # No binaries |
| 270 | + : $(libraries) |
| 271 | + : # No headers, it is handled by the dependency. |
| 272 | + ; |
| 273 | + |
| 274 | + install stage : $(libraries) : <location>$(BOOST_STAGE_LOCATE) ; |
| 275 | + |
| 276 | + module [ CALLER_MODULE ] |
| 277 | + { |
| 278 | + explicit stage ; |
| 279 | + explicit install ; |
| 280 | + } |
| 281 | +} |
| 282 | + |
| 283 | +headers = |
| 284 | + # The .SUNWCCh files are present in tr1 include directory and have to be |
| 285 | + # installed (see http://lists.boost.org/Archives/boost/2007/05/121430.php). |
| 286 | + [ path.glob-tree $(BOOST_ROOT)/boost : *.hpp *.ipp *.h *.inc *.SUNWCCh : CVS .svn ] |
| 287 | + [ path.glob-tree $(BOOST_ROOT)/boost/compatibility/cpp_c_headers : c* : CVS .svn ] |
| 288 | + [ path.glob boost/tr1/tr1 : * : bcc32 sun CVS .svn ] |
| 289 | + ; |
| 290 | + |
| 291 | +# Declare special top-level targets that build and install the desired variants |
| 292 | +# of the libraries. |
| 293 | +boostcpp.declare-targets $(all-libraries) : $(headers) ; |
0 commit comments