New boost release
[profile/ivi/boost.git] / Jamroot
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 #   bjam [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
35 #   =====                   to the 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
43 #                           of the libraries. Note, that which variants get
44 #                           built 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
50 #                               are static and shared multithreaded libraries
51 #                               in release mode.
52 #
53 #                               complete - Build all possible variations.
54 #
55 #   --build-dir=DIR         Build in this location instead of building
56 #                           within the distribution tree. Recommended!
57 #
58 #   --show-libraries        Displays the list of Boost libraries that require
59 #                           build and installation steps, then exit.
60 #
61 #   --layout=<layout>       Determines whether to choose library names
62 #                           and header locations such that multiple
63 #                           versions of Boost or multiple compilers can
64 #                           be used on the same system.
65 #
66 #                               versioned - Names of boost binaries
67 #                               include the Boost version number, name and
68 #                               version of the compiler and encoded build
69 #                               properties.  Boost headers are installed in a
70 #                               subdirectory of <HDRDIR> whose name contains
71 #                               the Boost version number.
72 #
73 #                               tagged -- Names of boost binaries include the
74 #                               encoded build properties such as variant and
75 #                               threading, but do not including compiler name
76 #                               and version, or Boost version. This option is
77 #                               useful if you build several variants of Boost,
78 #                               using the same compiler.
79 #
80 #                               system - Binaries names do not include the
81 #                               Boost version number or the name and version
82 #                               number of the compiler.  Boost headers are
83 #                               installed directly into <HDRDIR>.  This option
84 #                               is intended for system integrators who are
85 #                               building distribution packages.
86 #
87 #                           The default value is 'versioned' on Windows, and
88 #                           'system' on Unix.
89 #
90 #   --buildid=ID            Adds the specified ID to the name of built
91 #                           libraries.  The default is to not add anything.
92 #
93 #   --python-buildid=ID     Adds the specified ID to the name of built
94 #                           libraries that depend on Python.  The default 
95 #                           is to not add anything. This ID is added in 
96 #                           addition to --buildid.
97 #
98 #
99 #   --help                  This message.
100 #
101 #   --with-<library>        Build and install the specified <library>
102 #                           If this option is used, only libraries
103 #                           specified using this option will be built.
104 #
105 #   --without-<library>     Do not build, stage, or install the specified
106 #                           <library>. By default, all libraries are built.
107 #
108 # Properties:
109 #
110 #   toolset=toolset         Indicates the toolset to build with.
111 #
112 #   variant=debug|release   Select the build variant
113 #
114 #   link=static|shared      Whether to build static or shared libraries
115 #
116 #   threading=single|multi  Whether to build single or multithreaded binaries
117
118 #   runtime-link=static|shared      
119 #                           Whether to link to static or shared C and C++ runtime.
120 #   
121
122 # TODO:
123 #  - handle boost version
124 #  - handle python options such as pydebug
125
126 import boostcpp ;
127 import package ;
128
129 import sequence ;
130 import xsltproc ;
131 import set ;
132 import path ;
133
134 path-constant BOOST_ROOT : . ;
135 constant BOOST_VERSION : 1.51.0 ;
136 constant BOOST_JAMROOT_MODULE : $(__name__) ;
137
138 boostcpp.set-version $(BOOST_VERSION) ;
139
140 project boost
141     : requirements <include>.
142       # Disable auto-linking for all targets here, primarily because it caused
143       # troubles with V2.
144       <define>BOOST_ALL_NO_LIB=1
145       # Used to encode variant in target name. See the 'tag' rule below.
146       <tag>@$(__name__).tag
147       <conditional>@handle-static-runtime
148       # The standard library Sun compilers use by default has no chance
149       # of working with Boost. Override it.
150       <toolset>sun:<stdlib>sun-stlport
151       # Comeau does not support shared lib
152       <toolset>como:<link>static
153       <toolset>como-linux:<define>_GNU_SOURCE=1
154       # When building docs within Boost, we want the standard Boost style
155       <xsl:param>boost.defaults=Boost
156     : usage-requirements <include>.
157     : build-dir bin.v2
158     ;
159
160 # This rule is called by Boost.Build to determine the name of target. We use it
161 # to encode the build variant, compiler name and boost version in the target
162 # name.
163 #
164 rule tag ( name : type ? : property-set )
165 {
166     return [ boostcpp.tag $(name) : $(type) : $(property-set) ] ;
167 }
168    
169 rule handle-static-runtime ( properties * )
170 {
171     # Using static runtime with shared libraries is impossible on Linux,
172     # and dangerous on Windows. Therefore, we disallow it. This might
173     # be drastic, but it was disabled for a while with nobody complaining.
174
175     # For CW, static runtime is needed so that std::locale works.
176     if <link>shared in $(properties) && <runtime-link>static in $(properties) &&
177         ! ( <toolset>cw in $(properties) )
178     {
179         ECHO "error: link=shared together with runtime-link=static is not allowed" ;
180         ECHO "error: such property combination is either impossible " ;
181         ECHO "error: or too dangerious to be of any use" ;
182         EXIT ;
183     }
184 }
185
186 all-libraries = [ MATCH .*libs/(.*)/build/.* : [ glob libs/*/build/Jamfile.v2 ]
187     [ glob libs/*/build/Jamfile ] ]
188     ;
189
190 all-libraries = [ sequence.unique $(all-libraries) ] ;
191 # The function_types library has a Jamfile, but it's used for maintenance
192 # purposes, there's no library to build and install.
193 all-libraries = [ set.difference $(all-libraries) : function_types ] ;
194
195 # Setup convenient aliases for all libraries.
196
197 local rule explicit-alias ( id : targets + )
198 {
199     alias $(id) : $(targets) ;
200     explicit $(id) ;
201 }
202
203 # First, the complicated libraries: where the target name in Jamfile is
204 # different from its directory name.
205 explicit-alias prg_exec_monitor : libs/test/build//boost_prg_exec_monitor ;
206 explicit-alias test_exec_monitor : libs/test/build//boost_test_exec_monitor ;
207 explicit-alias unit_test_framework : libs/test/build//boost_unit_test_framework ;
208 explicit-alias bgl-vis : libs/graps/build//bgl-vis ;
209 explicit-alias serialization : libs/serialization/build//boost_serialization ;
210 explicit-alias wserialization : libs/serialization/build//boost_wserialization ;
211 for local l in $(all-libraries)
212 {
213     if ! $(l) in test graph serialization
214     {
215         explicit-alias $(l) : libs/$(l)/build//boost_$(l) ;
216     }
217 }
218
219 alias headers : : : : <include>. ;
220 explicit headers ;
221
222 # Make project ids of all libraries known.
223 for local l in $(all-libraries)
224 {
225     use-project /boost/$(l) : libs/$(l)/build ;
226 }
227
228 # This rule should be called from libraries' Jamfiles and will create two
229 # targets, "install" and "stage", that will install or stage that library. The
230 # --prefix option is respected, but --with and --without options, naturally, are
231 # ignored.
232 #
233 # - libraries -- list of library targets to install.
234 #
235 rule boost-install ( libraries * )
236 {
237     package.install install
238         : <dependency>/boost//install-proper-headers $(install-requirements)
239         : # No binaries
240         : $(libraries)
241         : # No headers, it is handled by the dependency.
242     ;
243
244     install stage : $(libraries) : <location>$(BOOST_STAGE_LOCATE) ;
245
246     module [ CALLER_MODULE ]
247     {
248         explicit stage ;
249         explicit install ;
250     }
251 }
252
253 headers =
254     # The .SUNWCCh files are present in tr1 include directory and have to be installed,
255     # see http://lists.boost.org/Archives/boost/2007/05/121430.php
256     [ path.glob-tree $(BOOST_ROOT)/boost : *.hpp *.ipp *.h *.inc *.SUNWCCh : CVS .svn ]
257     [ path.glob-tree $(BOOST_ROOT)/boost/compatibility/cpp_c_headers : c* : CVS .svn ] 
258     [ path.glob boost/tr1/tr1 : * : bcc32 sun CVS .svn ]
259     ;
260
261 # Declare special top-level targets that build and install the desired variants
262 # of the libraries.
263 boostcpp.declare-targets $(all-libraries) : $(headers) ;