summaryrefslogtreecommitdiff
path: root/Jamfile
blob: 5ae2da9227e1a9fb190f77daf8b7e468137c6082 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
#~ Copyright 2003-2005, Rene Rivera.
#~ Distributed under the Boost Software License, Version 1.0.
#~ (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)

if --help in $(ARGV)
{
    ECHO "
Usage:
    bjam [options] [install|stage]

    * install               Installs to the configured location(s).
    * stage                 Stages the build products only to common stage
                            location.

Options:
    --help                  This message.
    
    -sTOOLS=<toolsets>      Indicates the tools to build with.
    
    --show-libraries        Displays the list of Boost libraries that require
                            build and installation steps, then exit.

    --layout=<layout>       Determines what kind of build layout to use. This
                            allows one to control the naming of the resulting
                            libraries, and the locations of the installed
                            files. Default is 'versioned'. Possible values:
                            
                                versioned - Uses the Boost standard names
                                which include version number for Boost the
                                release and version and name of the
                                compiler as part of the library names. Also
                                installs the includes to a versioned
                                sub-directory.
                                
                                system - Builds an install without the
                                Boost standard names, and does not install
                                includes to a versioned sub-directory. This
                                is intended for system integrators to build
                                for packaging of distributions.

Locations:
    --prefix=PREFIX         Install architecture independent files here.
                            Default; C:\\Boost on Win32
                            Default; /usr/local on Unix. Linux, etc.
                            
    --exec-prefix=EPREFIX   Install architecture dependent files here.
                            Default; PREFIX
                            
    --libdir=DIR            Install libraries here.
                            Default; EPREFIX/lib
                            
    --includedir=DIR        Install source headers here.
                            Default; PREFIX/include
                            
    --builddir=DIR          Build in this location instead of building
                            within the distribution tree. Recommended!
                            
    --stagedir=DIR          When staging only, stage to the location.
                            Default; ./stage

Features:
    --with-<library>        Build, stage, or install the specified <library>
                            If used, the default becomes to only build
                            indicated libraries.
                            
    --without-<library>     Do not build, stage, or install the specified
                            <library>. By default all libraries attempt to
                            build.
                            
    --with-python-root[=PYTHON_ROOT]
                            Build Boost.Python libraries with the Python
                            devel packages located at PYTHON_ROOT.
                            Default PYTHON_ROOT; C:\\Python24 on Win32.
                            Default PYTHON_ROOT; /usr on Unix, Linux, Cygwin, etc.
                            
    --with-python-version[=2.4]
                            Build Boost.Python libraries with the Python
                            version indicated.
                            Default; 2.4.
                            
    --with-pydebug          Build Boost.Python libraries using the
                            Python debug runtime.
" ;
    EXIT "" ;
}

local with-install = ;
local with-stage = ;

# build only, or build+install
if install in $(ARGV)
{
    with-install = install ;
    with-stage = ;
}

# stage only? (no install, only build and stage to a common dir)
if stage in $(ARGV)
{
    with-stage = stage ;
    with-install = ;
}

# what kind of layout are we doing?
local layout = [ MATCH "^--layout=(.*)" : $(ARGV) ] ;
layout ?= versioned ;
layout-$(layout) = true ;

# possible stage only location
local stage-locate = [ MATCH "^--stagedir=(.*)" : $(ARGV) ] ;
stage-locate ?= stage ;

# architecture independent files
local boost-locate = [ unless $(with-stage) : [ MATCH "^--prefix=(.*)" : $(ARGV) ] : $(stage-locate) ] ;
if $(NT) { boost-locate ?= C:\\Boost ; }
else if $(UNIX) { boost-locate ?= /usr/local ; }

# architecture dependent files
local exec-locate = [ MATCH "^--exec-prefix=(.*)" : $(ARGV) ] ;
exec-locate ?= $(boost-locate) ;

# object code libraries
local lib-locate = [ MATCH "^--libdir=(.*)" : $(ARGV) ] ;
lib-locate ?= $(exec-locate)/lib ;

# where to build
local all-locate = [ MATCH "^--builddir=(.*)" : $(ARGV) ] ;
ALL_LOCATE_TARGET ?= $(all-locate) ;

# source header files
local include-locate = [ MATCH "^--includedir=(.*)" : $(ARGV) ] ;
include-locate ?= $(boost-locate)/include ;

# location of python
local python-root = [ MATCH "^--with-python-root=(.*)" : $(ARGV) ] ;
PYTHON_ROOT ?= $(python-root) ;

# version of python
local python-version = [ MATCH "^--with-python-version=(.*)" : $(ARGV) ] ;
PYTHON_VERSION ?= $(python-version) ;

# variant for pydebug build
local with-debug-python ;
if --with-pydebug in $(ARGV)
{
    with-debug-python = debug-python ;
}

# libraries to disable building, etc.
local without-libraries = [ MATCH "^--without-(.*)" : $(ARGV) ] ;

# libraries to enable
local with-libraries ;
for local arg in $(ARGV)
{
    switch $(arg)
    {
        case --with-python-root=* : local _ ;
        case --with-python-version=* : local _ ;
        case --with-pydebug : local _ ;
        
        case --with-* :
        with-libraries += [ MATCH "^--with-(.*)" : $(arg) ] ;
    }
}

#
project-root ;

# bring in the rules for python
import python ;

# print out libraries to build/install
if --show-libraries in $(ARGV)
{
    local library-jamfiles ;
    library-jamfiles =
        [ MATCH ^(.*build[/\\:]$(JAMFILE))$ : 
            [ glob-tree $(BOOST_ROOT)/libs : $(JAMFILE) ] ] ;
    libraries =
        [ MATCH ^.*libs[/\\:]([^/\\:]*)[/\\:]build[/\\:]Jamfile$ :
            $(library-jamfiles) ] ;
    EXIT $(libraries) ;
}

#
local version-tag = [ MATCH "^([^.]+)[.]([^.]+)[.]([^.]+)" : $(BOOST_VERSION) ] ;
if $(version-tag[3]) = 0
{
    version-tag = $(version-tag[1-2]) ;
}
version-tag = $(version-tag:J="_") ;

#
install-subinclude
    [ MATCH ^(.*build[/\\:]$(JAMFILE))$ : [ glob-tree $(BOOST_ROOT)/libs : $(JAMFILE) ] ]
    : <exclude>$(without-libraries) <include>$(with-libraries) ;

local lib-sources = [ install-sources lib ] ;

if $(lib-sources)
{
    local gNOWARN_INCOMPATIBLE_BUILDS = TRUE ;
    local gUNVERSIONED_VARIANT_TAG = [ cond $(layout-system) : TRUE ] ;
    
    local lib-build =
        debug release
        [ cond $(with-debug-python) : debug-python ]
        [ cond $(NT) : <runtime-link>static/dynamic ]
        <threading>single/multi
        ;
    local lib-target =
        [ cond $(with-install) : install : all ]
        [ cond $(with-stage) : stage : all ]
        ;
    local lib-dest-files = [
        stage $(lib-locate:D=)
            :
                $(lib-sources)
            :
                <locate>$(lib-locate:D)
                common-variant-tag
                <target>$(lib-target)
            :
                $(lib-build)
                [ unless $(with-install) $(with-stage) : <suppress>true ]
        ] ;
    if ! $(gIN_LIB_INCLUDE) && $(layout-versioned)
    {
        local unversioned-files ;
        if $(with-install) || $(with-stage)
        {
            if $(NT)
            {
                local version-files = [ MATCH "(.*[.]lib)" : $(lib-dest-files) ] ;
                local noversion-files ;
                for local version-file in $(version-files)
                {
                    local noversion-file =
                        [ MATCH "(.*)-[0-9_]+([.]lib)" : $(version-file) ] ;
                    noversion-file = $(noversion-file[1])$(noversion-file[2]) ;
                    MakeLocate $(noversion-file) : [ FDirName [ split-path $(lib-locate) ] ] ;
                    HardLink $(noversion-file) : $(version-file) ;
                    noversion-files += $(noversion-file) ;
                }
                declare-fake-targets $(lib-target) : $(noversion-files) ;
            }
            else if $(UNIX)
            {
                local so-version-files = [ MATCH "(.*[.]so[.0-9]+)" : $(lib-dest-files) ] ;
                so-version-files ?= [ MATCH "(.*[.]so)" : $(lib-dest-files) ] ;
                local version-files = $(so-version-files) [ MATCH "(.*[.]a)" : $(lib-dest-files) ] ;
                local noversion-files ;
                for local version-file in $(version-files)
                {
                    local noversion-file =
                        [ MATCH "(.*)-[0-9_]+([.]so)[.0-9]*" : $(version-file) ]
                        [ MATCH "(.*)-[0-9_]+([.]a)" : $(version-file) ] ;
                    noversion-file = $(noversion-file[1])$(noversion-file[2]) ;
                    MakeLocate $(noversion-file) : [ FDirName [ split-path $(lib-locate) ] ] ;
                    HardLink $(noversion-file) : $(version-file) ;
                    noversion-files += $(noversion-file) ;
                }
                declare-fake-targets $(lib-target) : $(noversion-files) ;
            }
        }
    }
}

stage [ cond $(layout-versioned) : $(include-locate:D=)/boost-$(version-tag) : $(include-locate:D=) ]
    :
        [ glob-tree $(BOOST_ROOT)/boost/compatibility/cpp_c_headers : c* ]
        [ glob-tree $(BOOST_ROOT)/boost : *.hpp *.ipp *.h *.inc ]
    :
        <locate>$(include-locate:D)
        <tree-subdirs>$(BOOST_ROOT)
        [ cond $(with-install) : <target>install : <target>all ]
    :
        [ unless $(with-install) : <suppress>true ]
    ;