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