Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/boost_1_34_1/Jamfile.v2 @ 56

Last change on this file since 56 was 29, checked in by landauf, 16 years ago

updated boost from 1_33_1 to 1_34_1

File size: 14.5 KB
Line 
1# Copyright Vladimir Prus 2002-2006.
2# Copyright Dave Abrahams 2005-2006.
3# Copyright Rene Rivera 2005-2006.
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] [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#   --builddir=DIR          Build in this location instead of building
43#                           within the distribution tree. Recommended!
44#
45#   --toolset=toolset       Indicates the toolset to build with.
46#
47#   --show-libraries        Displays the list of Boost libraries that require
48#                           build and installation steps, then exit.
49#
50#   --layout=<layout>       Determines whether to choose library names
51#                           and header locations such that multiple
52#                           versions of Boost or multiple compilers can
53#                           be used on the same system.
54#
55#                               versioned (default) - Names of boost
56#                               binaries include the Boost version
57#                               number and the name and version of the
58#                               compiler.  Boost headers are installed
59#                               in a subdirectory of <HDRDIR> whose
60#                               name contains the Boost version
61#                               number.
62#
63#                               system - Binaries names do not include
64#                               the Boost version number or the name
65#                               and version number of the compiler.
66#                               Boost headers are installed directly
67#                               into <HDRDIR>.  This option is
68#                               intended for system integrators who
69#                               are building distribution packages.
70#
71#   --buildid=ID            Adds the specified ID to the name of built
72#                           libraries.  The default is to not add anything.
73#
74#   --help                  This message.
75#
76#   --with-<library>        Build and install the specified <library>
77#                           If this option is used, only libraries
78#                           specified using this option will be built.
79#
80#   --without-<library>     Do not build, stage, or install the specified
81#                           <library>. By default, all libraries are built.
82
83# TODO:
84#  - handle boost version
85#  - handle python options such as pydebug
86
87import modules ;
88import set ;
89import stage ;
90import package ;
91import path ;
92import common ;
93import os ;
94import regex ;
95import errors ;
96import "class" : new ;
97import common ;
98
99constant BOOST_VERSION : 1.34.1 ;
100
101local version-tag = [ MATCH "^([^.]+)[.]([^.]+)[.]([^.]+)" : $(BOOST_VERSION) ] ;
102if $(version-tag[3]) = 0
103{
104    version-tag = $(version-tag[1-2]) ;
105}
106
107constant BOOST_VERSION_TAG : $(version-tag:J="_") ;
108
109local default-build ;
110if $(__file__:D) = ""
111{
112    default-build =
113        debug release
114        <threading>single <threading>multi
115        <link>shared <link>static
116        ;
117   
118    if [ os.name ] = NT
119    {
120        default-build += <runtime-link>shared <runtime-link>static ;
121    }
122}
123else
124{
125    default-build =
126        debug
127        ;
128}
129
130
131rule handle-static-runtime ( properties * )
132{   
133    # This property combination is dangerous.
134    # Ideally, we'd add constraint to default build,
135    # so that user can build with property combination
136    # by hand. But we don't have any 'constraint' mechanism
137    # for default-build, so disable such builds in requirements.
138   
139    # For CW, static runtime is needed so that
140    # std::locale works.
141    if <link>shared in $(properties)
142      && <runtime-link>static in $(properties)
143        && ! ( <toolset>cw in $(properties) )   
144    {
145        return <build>no ;
146    }
147}
148
149
150project boost
151    : requirements <include>.
152      # disable auto-linking for all targets here,
153      # primarily because it caused troubles with V2
154      <define>BOOST_ALL_NO_LIB=1
155      # Used to encode variant in target name. See the
156      # 'tag' rule below.
157      <tag>@$(__name__).tag
158      <conditional>@handle-static-runtime
159           
160    : usage-requirements <include>.
161    : build-dir bin.v2
162    : default-build $(default-build)
163    ;
164
165# Setup convenient aliases for all libraries.
166
167all-libraries =
168    [ MATCH .*libs/(.*)/build/.* : [ glob libs/*/build/Jamfile.v2 ] ]
169    ;
170
171# First, the complicated libraries: where the target name in
172# Jamfile is different from directory name.
173alias prg_exec_monitor : libs/test/build//boost_prg_exec_monitor ;
174alias test_exec_monitor : libs/test/build//boost_test_exec_monitor ;
175alias unit_test_framework : libs/test/build//boost_unit_test_framework ;
176alias bgl-vis : libs/graps/build//bgl-vis ;
177alias serialization : libs/serialization/build//boost_serialization ;
178alias wserialization : libs/serialization/build//boost_wserialization ;
179
180explicit prg_exec_monitor test_exec_monitor unit_test_framework
181    bgl-vis serialization wserialization ;
182
183for local l in $(all-libraries)
184{
185    if ! $(l) in test graph serialization
186    {
187        alias $(l) : libs/$(l)/build//boost_$(l) ;
188        explicit $(l) ;
189    }
190}
191
192alias headers : : : : <include>. ;
193
194
195# Decides which libraries are to be installed by looking at --with-<library>
196# --without-<library> arguments. Returns the list of directories under "libs"
197# which must be built at installed.
198rule libraries-to-install ( existing-libraries * )
199{
200   local argv = [ modules.peek : ARGV ] ;
201   local with-parameter = [ MATCH --with-(.*) : $(argv) ] ;
202   local without-parameter = [ MATCH --without-(.*) : $(argv) ] ;
203
204   # Do some checks
205   if $(with-parameter) && $(without-parameter)
206   {
207       ECHO "error: both --with-<library> and --without-<library> specified" ;
208       EXIT ;
209   }
210
211   local wrong = [ set.difference $(with-parameter) : $(existing-libraries) ] ;
212   if $(wrong)
213   {
214       ECHO "error: wrong library name '$(wrong[1])' in the --with-<library> option." ;
215       EXIT ;
216   }
217   local wrong = [ set.difference $(without-parameter) : $(existing-libraries) ] ;
218   if $(wrong)
219   {
220       ECHO "error: wrong library name '$(wrong[1])' in the --without-<library> option." ;
221       EXIT ;
222   }
223
224   if $(with-parameter)
225   {
226       return [ set.intersection $(existing-libraries) : $(with-parameter) ] ;
227   }
228   else
229   {
230       return [ set.difference $(existing-libraries) : $(without-parameter) ] ;
231   }
232}
233
234# what kind of layout are we doing?
235layout = [ MATCH "^--layout=(.*)" : [ modules.peek : ARGV ] ] ;
236layout ?= versioned ;
237layout-$(layout) = true ;
238
239# possible stage only location
240local stage-locate = [ MATCH "^--stagedir=(.*)" : [ modules.peek : ARGV ] ] ;
241stage-locate ?= stage ;
242
243path-constant BOOST_STAGE_LOCATE : $(stage-locate) ;
244
245
246# location of python
247local python-root = [ MATCH "^--with-python-root=(.*)" : [ modules.peek : ARGV ] ] ;
248PYTHON_ROOT ?= $(python-root) ;
249
250# Select the libraries to install.
251libraries = [ libraries-to-install $(all-libraries) ] ;
252
253if --show-libraries in [ modules.peek : ARGV ]
254{
255    ECHO "The following libraries require building:" ;
256    for local l in $(libraries)
257    {
258        ECHO "    - $(l)" ;
259    }
260    EXIT ;
261}
262
263# Custom build ID.
264local build-id = [ MATCH "^--buildid=(.*)" : [ modules.peek : ARGV ] ] ;
265if $(build-id)
266{
267    constant BUILD_ID : [ regex.replace $(build-id) "[*\\/:.\"\' ]" "_" ] ;
268}
269
270# This rule is called by Boost.Build to determine the name of
271# target. We use it to encode build variant, compiler name and
272# boost version in the target name
273rule tag ( name : type ? : property-set )
274{
275    if $(type) in STATIC_LIB SHARED_LIB IMPORT_LIB
276    {
277        if $(layout) = versioned
278        {
279            local result = [ common.format-name
280                <base> <toolset> <threading> <runtime> -$(BOOST_VERSION_TAG)
281                -$(BUILD_ID)
282                : $(name) : $(type) : $(property-set) ] ;
283           
284            # Optionally add version suffix.
285            # On NT, library with version suffix won't be recognized
286            # by linkers. On CYGWIN, we get strage duplicate symbol
287            # errors when library is generated with version suffix.
288            # On OSX, version suffix is not needed -- the linker expets
289            # libFoo.1.2.3.dylib format.
290            # AIX linkers don't accept version suffixes either.
291            if $(type) = SHARED_LIB &&
292              ! ( [ $(property-set).get <target-os> ] in windows cygwin darwin aix )
293            {
294                result = $(result).$(BOOST_VERSION)  ;
295            }
296           
297            return $(result) ;
298        }
299        else
300        {
301            return [ common.format-name
302                <base> <threading> <runtime> -$(BUILD_ID)
303                : $(name) : $(type) : $(property-set) ] ;
304        }
305    }
306}
307
308# Install to system location.
309
310local install-requirements =
311    <install-source-root>boost
312    ;
313if $(layout-versioned)
314{
315    install-requirements += <install-header-subdir>boost-$(BOOST_VERSION_TAG)/boost ;
316}
317else
318{
319    install-requirements += <install-header-subdir>boost ;
320}
321if [ modules.peek : NT ]
322{
323    install-requirements += <install-default-prefix>C:/Boost ;
324}
325else if [ modules.peek : UNIX ]
326{
327    install-requirements += <install-default-prefix>/usr/local ;
328}
329
330local headers =
331    [ path.glob-tree boost : *.hpp *.ipp *.h *.inc : CVS ]
332    [ path.glob-tree boost/compatibility/cpp_c_headers : c* : CVS ]
333    [ path.glob-tree boost/test/utils/runtime : *.cpp : CVS ]
334    [ path.glob-tree boost/spirit/tree :
335        parsetree.dtd : CVS ]
336    [ path.glob-tree boost/tr1/tr1 :
337        algorithm array bitset complex deque exception fstream functional
338        iomanip ios iostream istream iterator limits list locale map
339        memory new numeric ostream queue random regex set sstream stack
340        stdexcept streambuf string strstream tuple type_traits typeinfo
341        utility valarray vector *.SUNWCCh : CVS ]
342    ;
343
344
345# Complete install
346package.install install-proper
347    :   $(install-requirements) <install-no-version-symlinks>on
348    :
349    :   libs/$(libraries)/build
350    :   $(headers)
351    ;
352explicit install-proper ;
353
354# Install just library.
355install stage-proper
356    :   libs/$(libraries)/build
357    :   <location>$(stage-locate)/lib
358        <install-dependencies>on <install-type>LIB
359        <install-no-version-symlinks>on
360    ;
361explicit stage-proper ;
362
363
364if $(layout-versioned)
365  && ( [ modules.peek : NT ] || [ modules.peek : UNIX ] )
366{
367    rule make-unversioned-links ( project name ? : property-set : sources * )
368    {
369        local result ;
370        local filtered ;
371        local pattern ;       
372        local nt = [ modules.peek : NT ] ;
373       
374        # Collect the libraries that have the version number in 'filtered'.
375        for local s in $(sources)
376        {
377            local m ;
378            if $(nt)
379            {
380                m = [ MATCH "(.*[.]lib)" : [ $(s).name ] ] ;
381            }
382            else
383            {
384                m = [ MATCH "(.*[.]so[.0-9]+)" "(.*[.]a)" : [ $(s).name ] ] ;
385            }           
386            if $(m)
387            {
388                filtered += $(s) ;
389            }
390        }
391       
392        # Create hardlinks without version.
393        for local s in $(filtered)
394        {
395            local name = [ $(s).name ] ;
396            local ea = [ $(s).action ] ;
397            local ep = [ $(ea).properties ] ;
398            local a  = [
399              new non-scanning-action $(s) : common.hard-link : $(ep) ] ;
400           
401            local noversion-file ;
402            if $(nt)
403            {
404                noversion-file = [ MATCH "(.*)-[0-9_]+([.]lib)" : $(name) ] ;
405            }
406            else
407            {
408                noversion-file =
409                  [ MATCH "(.*)-[0-9_]+([.]so)[.0-9]*" : $(name) ]
410                  [ MATCH "(.*)-[0-9_]+([.]a)" : $(name) ]
411                  [ MATCH "(.*)-[0-9_]+([.]dll[.]a)" : $(name) ] ;
412            }
413                       
414            local new-name =
415               $(noversion-file[1])$(noversion-file[2]) ;
416            result += [ new file-target $(new-name) exact : [ $(s).type ] : $(project)
417                    : $(a) ] ;
418
419        }
420        return $(result) ;
421    }   
422           
423    generate stage-unversioned : stage-proper :
424      <generating-rule>@make-unversioned-links ;
425    explicit stage-unversioned ;
426   
427    generate install-unversioned : install-proper :
428      <generating-rule>@make-unversioned-links ;
429    explicit install-unversioned ;
430}
431else
432{
433    # Create do-nothing aliases
434    alias stage-unversioned ;
435    alias install-unversioned ;
436}
437
438alias install : install-proper install-unversioned ;
439alias stage : stage-proper stage-unversioned ;
440explicit install ;
441explicit stage ;
442
443
444# Just build the libraries, don't install them anywhere.
445# This is what happens with just "bjam --v2".
446alias build_all : libs/$(libraries)/build ;
447
448# This rule should be called from libraries' Jamfiles and will
449# create two targets, "install" and "stage", that will install
450# or stage that library. The --prefix option is respected, by
451# --with and --without options, naturally, are ignored.
452#
453# - libraries -- list of library targets to install.
454rule boost-install ( libraries * )
455{
456    package.install install
457        : <dependency>/boost//install-headers $(install-requirements)
458        : # No binaries
459        : $(libraries)
460        : # No headers, it's handled by the dependency
461    ;
462
463    install stage : $(libraries) : <location>$(BOOST_STAGE_LOCATE) ;
464
465    local c = [ project.current ] ;
466    local project-module = [ $(c).project-module ] ;
467    module $(project-module)
468    {
469        explicit stage ;
470    }
471}
472
473# Make project ids of all libraries known.
474for local l in $(libraries)
475{
476    use-project /boost/$(l) : libs/$(l)/build ;
477}
Note: See TracBrowser for help on using the repository browser.