1 | #~ Copyright 2003-2005, Rene Rivera. |
---|
2 | #~ Distributed under the Boost Software License, Version 1.0. |
---|
3 | #~ (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) |
---|
4 | |
---|
5 | if --help in $(ARGV) |
---|
6 | { |
---|
7 | ECHO " |
---|
8 | Usage: |
---|
9 | bjam [options] [install|stage] |
---|
10 | |
---|
11 | * install Installs to the configured location(s). |
---|
12 | * stage Stages the build products only to common stage |
---|
13 | location. |
---|
14 | |
---|
15 | Options: |
---|
16 | --help This message. |
---|
17 | |
---|
18 | -sTOOLS=<toolsets> Indicates the tools to build with. |
---|
19 | |
---|
20 | --show-libraries Displays the list of Boost libraries that require |
---|
21 | build and installation steps, then exit. |
---|
22 | |
---|
23 | --layout=<layout> Determines what kind of build layout to use. This |
---|
24 | allows one to control the naming of the resulting |
---|
25 | libraries, and the locations of the installed |
---|
26 | files. Default is 'versioned'. Possible values: |
---|
27 | |
---|
28 | versioned - Uses the Boost standard names |
---|
29 | which include version number for Boost the |
---|
30 | release and version and name of the |
---|
31 | compiler as part of the library names. Also |
---|
32 | installs the includes to a versioned |
---|
33 | sub-directory. |
---|
34 | |
---|
35 | system - Builds an install without the |
---|
36 | Boost standard names, and does not install |
---|
37 | includes to a versioned sub-directory. This |
---|
38 | is intended for system integrators to build |
---|
39 | for packaging of distributions. |
---|
40 | |
---|
41 | Locations: |
---|
42 | --prefix=PREFIX Install architecture independent files here. |
---|
43 | Default; C:\\Boost on Win32 |
---|
44 | Default; /usr/local on Unix. Linux, etc. |
---|
45 | |
---|
46 | --exec-prefix=EPREFIX Install architecture dependent files here. |
---|
47 | Default; PREFIX |
---|
48 | |
---|
49 | --libdir=DIR Install libraries here. |
---|
50 | Default; EPREFIX/lib |
---|
51 | |
---|
52 | --includedir=DIR Install source headers here. |
---|
53 | Default; PREFIX/include |
---|
54 | |
---|
55 | --builddir=DIR Build in this location instead of building |
---|
56 | within the distribution tree. Recommended! |
---|
57 | |
---|
58 | --stagedir=DIR When staging only, stage to the location. |
---|
59 | Default; ./stage |
---|
60 | |
---|
61 | Features: |
---|
62 | --with-<library> Build, stage, or install the specified <library> |
---|
63 | If used, the default becomes to only build |
---|
64 | indicated libraries. |
---|
65 | |
---|
66 | --without-<library> Do not build, stage, or install the specified |
---|
67 | <library>. By default all libraries attempt to |
---|
68 | build. |
---|
69 | |
---|
70 | --with-python-root[=PYTHON_ROOT] |
---|
71 | Build Boost.Python libraries with the Python |
---|
72 | devel packages located at PYTHON_ROOT. |
---|
73 | Default PYTHON_ROOT; C:\\Python24 on Win32. |
---|
74 | Default PYTHON_ROOT; /usr on Unix, Linux, Cygwin, etc. |
---|
75 | |
---|
76 | --with-python-version[=2.4] |
---|
77 | Build Boost.Python libraries with the Python |
---|
78 | version indicated. |
---|
79 | Default; 2.4. |
---|
80 | |
---|
81 | --with-pydebug Build Boost.Python libraries using the |
---|
82 | Python debug runtime. |
---|
83 | " ; |
---|
84 | EXIT "" ; |
---|
85 | } |
---|
86 | |
---|
87 | local with-install = ; |
---|
88 | local with-stage = ; |
---|
89 | |
---|
90 | # build only, or build+install |
---|
91 | if install in $(ARGV) |
---|
92 | { |
---|
93 | with-install = install ; |
---|
94 | with-stage = ; |
---|
95 | } |
---|
96 | |
---|
97 | # stage only? (no install, only build and stage to a common dir) |
---|
98 | if stage in $(ARGV) |
---|
99 | { |
---|
100 | with-stage = stage ; |
---|
101 | with-install = ; |
---|
102 | } |
---|
103 | |
---|
104 | # what kind of layout are we doing? |
---|
105 | local layout = [ MATCH "^--layout=(.*)" : $(ARGV) ] ; |
---|
106 | layout ?= versioned ; |
---|
107 | layout-$(layout) = true ; |
---|
108 | |
---|
109 | # possible stage only location |
---|
110 | local stage-locate = [ MATCH "^--stagedir=(.*)" : $(ARGV) ] ; |
---|
111 | stage-locate ?= stage ; |
---|
112 | |
---|
113 | # architecture independent files |
---|
114 | local boost-locate = [ unless $(with-stage) : [ MATCH "^--prefix=(.*)" : $(ARGV) ] : $(stage-locate) ] ; |
---|
115 | if $(NT) { boost-locate ?= C:\\Boost ; } |
---|
116 | else if $(UNIX) { boost-locate ?= /usr/local ; } |
---|
117 | |
---|
118 | # architecture dependent files |
---|
119 | local exec-locate = [ MATCH "^--exec-prefix=(.*)" : $(ARGV) ] ; |
---|
120 | exec-locate ?= $(boost-locate) ; |
---|
121 | |
---|
122 | # object code libraries |
---|
123 | local lib-locate = [ MATCH "^--libdir=(.*)" : $(ARGV) ] ; |
---|
124 | lib-locate ?= $(exec-locate)/lib ; |
---|
125 | |
---|
126 | # where to build |
---|
127 | local all-locate = [ MATCH "^--builddir=(.*)" : $(ARGV) ] ; |
---|
128 | ALL_LOCATE_TARGET ?= $(all-locate) ; |
---|
129 | |
---|
130 | # source header files |
---|
131 | local include-locate = [ MATCH "^--includedir=(.*)" : $(ARGV) ] ; |
---|
132 | include-locate ?= $(boost-locate)/include ; |
---|
133 | |
---|
134 | # location of python |
---|
135 | local python-root = [ MATCH "^--with-python-root=(.*)" : $(ARGV) ] ; |
---|
136 | PYTHON_ROOT ?= $(python-root) ; |
---|
137 | |
---|
138 | # version of python |
---|
139 | local python-version = [ MATCH "^--with-python-version=(.*)" : $(ARGV) ] ; |
---|
140 | PYTHON_VERSION ?= $(python-version) ; |
---|
141 | |
---|
142 | # variant for pydebug build |
---|
143 | local with-debug-python ; |
---|
144 | if --with-pydebug in $(ARGV) |
---|
145 | { |
---|
146 | with-debug-python = debug-python ; |
---|
147 | } |
---|
148 | |
---|
149 | # libraries to disable building, etc. |
---|
150 | local without-libraries = [ MATCH "^--without-(.*)" : $(ARGV) ] ; |
---|
151 | |
---|
152 | # libraries to enable |
---|
153 | local with-libraries ; |
---|
154 | for local arg in $(ARGV) |
---|
155 | { |
---|
156 | switch $(arg) |
---|
157 | { |
---|
158 | case --with-python-root=* : local _ ; |
---|
159 | case --with-python-version=* : local _ ; |
---|
160 | case --with-pydebug : local _ ; |
---|
161 | |
---|
162 | case --with-* : |
---|
163 | with-libraries += [ MATCH "^--with-(.*)" : $(arg) ] ; |
---|
164 | } |
---|
165 | } |
---|
166 | |
---|
167 | # |
---|
168 | project-root ; |
---|
169 | |
---|
170 | # bring in the rules for python |
---|
171 | import python ; |
---|
172 | |
---|
173 | # print out libraries to build/install |
---|
174 | if --show-libraries in $(ARGV) |
---|
175 | { |
---|
176 | local library-jamfiles ; |
---|
177 | library-jamfiles = |
---|
178 | [ MATCH ^(.*build[/\\:]$(JAMFILE))$ : |
---|
179 | [ glob-tree $(BOOST_ROOT)/libs : $(JAMFILE) ] ] ; |
---|
180 | libraries = |
---|
181 | [ MATCH ^.*libs[/\\:]([^/\\:]*)[/\\:]build[/\\:]Jamfile$ : |
---|
182 | $(library-jamfiles) ] ; |
---|
183 | EXIT $(libraries) ; |
---|
184 | } |
---|
185 | |
---|
186 | # |
---|
187 | local version-tag = [ MATCH "^([^.]+)[.]([^.]+)[.]([^.]+)" : $(BOOST_VERSION) ] ; |
---|
188 | if $(version-tag[3]) = 0 |
---|
189 | { |
---|
190 | version-tag = $(version-tag[1-2]) ; |
---|
191 | } |
---|
192 | version-tag = $(version-tag:J="_") ; |
---|
193 | |
---|
194 | # |
---|
195 | install-subinclude |
---|
196 | [ MATCH ^(.*build[/\\:]$(JAMFILE))$ : [ glob-tree $(BOOST_ROOT)/libs : $(JAMFILE) ] ] |
---|
197 | : <exclude>$(without-libraries) <include>$(with-libraries) ; |
---|
198 | |
---|
199 | local lib-sources = [ install-sources lib ] ; |
---|
200 | |
---|
201 | if $(lib-sources) |
---|
202 | { |
---|
203 | local gNOWARN_INCOMPATIBLE_BUILDS = TRUE ; |
---|
204 | local gUNVERSIONED_VARIANT_TAG = [ cond $(layout-system) : TRUE ] ; |
---|
205 | |
---|
206 | local lib-build = |
---|
207 | debug release |
---|
208 | [ cond $(with-debug-python) : debug-python ] |
---|
209 | [ cond $(NT) : <runtime-link>static/dynamic ] |
---|
210 | <threading>single/multi |
---|
211 | ; |
---|
212 | local lib-target = |
---|
213 | [ cond $(with-install) : install : all ] |
---|
214 | [ cond $(with-stage) : stage : all ] |
---|
215 | ; |
---|
216 | local lib-dest-files = [ |
---|
217 | stage $(lib-locate:D=) |
---|
218 | : |
---|
219 | $(lib-sources) |
---|
220 | : |
---|
221 | <locate>$(lib-locate:D) |
---|
222 | common-variant-tag |
---|
223 | <target>$(lib-target) |
---|
224 | : |
---|
225 | $(lib-build) |
---|
226 | [ unless $(with-install) $(with-stage) : <suppress>true ] |
---|
227 | ] ; |
---|
228 | if ! $(gIN_LIB_INCLUDE) && $(layout-versioned) |
---|
229 | { |
---|
230 | local unversioned-files ; |
---|
231 | if $(with-install) || $(with-stage) |
---|
232 | { |
---|
233 | if $(NT) |
---|
234 | { |
---|
235 | local version-files = [ MATCH "(.*[.]lib)" : $(lib-dest-files) ] ; |
---|
236 | local noversion-files ; |
---|
237 | for local version-file in $(version-files) |
---|
238 | { |
---|
239 | local noversion-file = |
---|
240 | [ MATCH "(.*)-[0-9_]+([.]lib)" : $(version-file) ] ; |
---|
241 | noversion-file = $(noversion-file[1])$(noversion-file[2]) ; |
---|
242 | MakeLocate $(noversion-file) : [ FDirName [ split-path $(lib-locate) ] ] ; |
---|
243 | HardLink $(noversion-file) : $(version-file) ; |
---|
244 | noversion-files += $(noversion-file) ; |
---|
245 | } |
---|
246 | declare-fake-targets $(lib-target) : $(noversion-files) ; |
---|
247 | } |
---|
248 | else if $(UNIX) |
---|
249 | { |
---|
250 | local so-version-files = [ MATCH "(.*[.]so[.0-9]+)" : $(lib-dest-files) ] ; |
---|
251 | so-version-files ?= [ MATCH "(.*[.]so)" : $(lib-dest-files) ] ; |
---|
252 | local version-files = $(so-version-files) [ MATCH "(.*[.]a)" : $(lib-dest-files) ] ; |
---|
253 | local noversion-files ; |
---|
254 | for local version-file in $(version-files) |
---|
255 | { |
---|
256 | local noversion-file = |
---|
257 | [ MATCH "(.*)-[0-9_]+([.]so)[.0-9]*" : $(version-file) ] |
---|
258 | [ MATCH "(.*)-[0-9_]+([.]a)" : $(version-file) ] ; |
---|
259 | noversion-file = $(noversion-file[1])$(noversion-file[2]) ; |
---|
260 | MakeLocate $(noversion-file) : [ FDirName [ split-path $(lib-locate) ] ] ; |
---|
261 | HardLink $(noversion-file) : $(version-file) ; |
---|
262 | noversion-files += $(noversion-file) ; |
---|
263 | } |
---|
264 | declare-fake-targets $(lib-target) : $(noversion-files) ; |
---|
265 | } |
---|
266 | } |
---|
267 | } |
---|
268 | } |
---|
269 | |
---|
270 | stage [ cond $(layout-versioned) : $(include-locate:D=)/boost-$(version-tag) : $(include-locate:D=) ] |
---|
271 | : |
---|
272 | [ glob-tree $(BOOST_ROOT)/boost/compatibility/cpp_c_headers : c* ] |
---|
273 | [ glob-tree $(BOOST_ROOT)/boost : *.hpp *.ipp *.h *.inc ] |
---|
274 | : |
---|
275 | <locate>$(include-locate:D) |
---|
276 | <tree-subdirs>$(BOOST_ROOT) |
---|
277 | [ cond $(with-install) : <target>install : <target>all ] |
---|
278 | : |
---|
279 | [ unless $(with-install) : <suppress>true ] |
---|
280 | ; |
---|