]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/python/SConstruct
update sources to v12.2.3
[ceph.git] / ceph / src / boost / libs / python / SConstruct
CommitLineData
7c673cae
FG
1# -*- python -*-
2#
3# Copyright (c) 2016 Stefan Seefeld
4# All rights reserved.
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
10import SCons.Script.Main
11import config
12import config.ui
13import platform
14import os
15import subprocess
16import re
17
18#
19# We try to mimic the typical autotools-workflow.
20#
21# * In a 'configure' step all the essential build parameters are established
22# (either by explicit command-line arguments or from configure checks)
23# * A subsequent build step can then simply read the cached variables, so
24# users don't have to memorize and re-issue the arguments on each subsequent
25# invocation, and neither do the config checks need to be re-run.
26#
27# The essential part here is to define a 'config' target, which removes any
28# caches that may still be lingering around, then runs the checks.
29
30if 'config' in COMMAND_LINE_TARGETS:
31 # Clear the cache
32 try: os.remove('bin.SCons/config.py')
33 except: pass
34if not os.path.exists('bin.SCons/'):
35 os.mkdir('bin.SCons/')
36vars = Variables('bin.SCons/config.py', ARGUMENTS)
37config.add_options(vars)
38arch = ARGUMENTS.get('arch', platform.machine())
39env_vars = {}
40if 'CXX' in os.environ: env_vars['CXX'] = os.environ['CXX']
41if 'CXXFLAGS' in os.environ: env_vars['CXXFLAGS'] = os.environ['CXXFLAGS'].split()
b32b8144 42env_vars['ENV'] = os.environ #{'PATH': os.environ['PATH'], 'TMP' : os.environ['TMP']}
7c673cae
FG
43env = Environment(toolpath=['config/tools'],
44 tools=['default', 'libs', 'tests', 'doc', 'sphinx4scons'],
45 variables=vars,
46 TARGET_ARCH=arch,
47 **env_vars)
48if 'gcc' in env['TOOLS']:
49 # Earlier SCons versions (~ 2.3.0) can't handle CXX=clang++.
50 version = subprocess.check_output([env['CXX'], '--version'])
51 match = re.search(r'[0-9]+(\.[0-9]+)+', version)
52 if match:
53 version = match.group(0)
54 else:
55 version = 'unknown'
56 env['CXXVERSION'] = version
57
58Help(config.ui.help(vars, env) + """
59Variables are saved in bin.SCons/config.py and persist between scons invocations.
60""")
61
62if GetOption('help'):
63 Return()
64
65build_dir = config.prepare_build_dir(env)
66config_log = '{}/config.log'.format(build_dir)
67
68# configure
69SConsignFile('{}/.sconsign'.format(build_dir))
70#env.Decider('MD5-timestamp')
71env.Decider('timestamp-newer')
72checks = config.get_checks(env)
73if 'config' in COMMAND_LINE_TARGETS:
74 conf=env.Configure(custom_tests=checks, log_file=config_log, conf_dir=build_dir)
75 if False in (getattr(conf, c)() for c in checks):
76 Exit(1)
77 env = conf.Finish()
78 vars.Save('bin.SCons/config.py', env)
79
80if not os.path.exists(config_log):
81 print('Please run `scons config` first. (See `scons -h` for available options.)')
82 Exit(1)
83
84if not GetOption('verbose'):
85 config.ui.pretty_output(env)
86
87# build
b32b8144 88env['BPL_VERSION'] = '1.65'
7c673cae
FG
89for e in config.variants(env):
90 variant_dir=e.subst("$BOOST_CURRENT_VARIANT_DIR")
91 e.SConscript('src/SConscript', variant_dir=variant_dir + '/src',
92 exports = { 'env' : e.Clone(BOOST_LIB = 'python') })
93 if 'test' in COMMAND_LINE_TARGETS:
94 test_env = e.Clone(BOOST_LIB = 'python', BOOST_TEST = True)
95 test_env.BoostUseLib('python')
96 e.SConscript('test/SConscript', variant_dir=variant_dir + '/test',
97 exports = { 'env' : test_env })
98
99if 'doc' in COMMAND_LINE_TARGETS:
100 env.SConscript('doc/SConscript', variant_dir='bin.SCons/doc',
101 exports = { 'env' : e.Clone(BOOST_LIB = 'python') })