aboutsummaryrefslogtreecommitdiffstats
path: root/waflib/extras/bjam.py
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2019-04-21 22:56:13 +0200
committerDavid Robillard <d@drobilla.net>2019-04-21 22:56:13 +0200
commitbc596356af71d95eb2a341d0324a76e6b7e59a73 (patch)
treeb98fff0fffd6503acd8cb1cd452e055749ac94c0 /waflib/extras/bjam.py
parent683d47cb7fddf5447de76cdf80041b6b230de93c (diff)
downloadserd-bc596356af71d95eb2a341d0324a76e6b7e59a73.tar.gz
serd-bc596356af71d95eb2a341d0324a76e6b7e59a73.tar.bz2
serd-bc596356af71d95eb2a341d0324a76e6b7e59a73.zip
Switch to using a submodule for autowaf
Diffstat (limited to 'waflib/extras/bjam.py')
m---------waflib0
-rw-r--r--waflib/extras/bjam.py128
2 files changed, 0 insertions, 128 deletions
diff --git a/waflib b/waflib
new file mode 160000
+Subproject 2314e236ca6e7d94a26c3c17091da0f25f5867f
diff --git a/waflib/extras/bjam.py b/waflib/extras/bjam.py
deleted file mode 100644
index 8e04d3a6..00000000
--- a/waflib/extras/bjam.py
+++ /dev/null
@@ -1,128 +0,0 @@
-#! /usr/bin/env python
-# per rosengren 2011
-
-from os import sep, readlink
-from waflib import Logs
-from waflib.TaskGen import feature, after_method
-from waflib.Task import Task, always_run
-
-def options(opt):
- grp = opt.add_option_group('Bjam Options')
- grp.add_option('--bjam_src', default=None, help='You can find it in <boost root>/tools/jam/src')
- grp.add_option('--bjam_uname', default='linuxx86_64', help='bjam is built in <src>/bin.<uname>/bjam')
- grp.add_option('--bjam_config', default=None)
- grp.add_option('--bjam_toolset', default=None)
-
-def configure(cnf):
- if not cnf.env.BJAM_SRC:
- cnf.env.BJAM_SRC = cnf.options.bjam_src
- if not cnf.env.BJAM_UNAME:
- cnf.env.BJAM_UNAME = cnf.options.bjam_uname
- try:
- cnf.find_program('bjam', path_list=[
- cnf.env.BJAM_SRC + sep + 'bin.' + cnf.env.BJAM_UNAME
- ])
- except Exception:
- cnf.env.BJAM = None
- if not cnf.env.BJAM_CONFIG:
- cnf.env.BJAM_CONFIG = cnf.options.bjam_config
- if not cnf.env.BJAM_TOOLSET:
- cnf.env.BJAM_TOOLSET = cnf.options.bjam_toolset
-
-@feature('bjam')
-@after_method('process_rule')
-def process_bjam(self):
- if not self.bld.env.BJAM:
- self.create_task('bjam_creator')
- self.create_task('bjam_build')
- self.create_task('bjam_installer')
- if getattr(self, 'always', False):
- always_run(bjam_creator)
- always_run(bjam_build)
- always_run(bjam_installer)
-
-class bjam_creator(Task):
- ext_out = 'bjam_exe'
- vars=['BJAM_SRC', 'BJAM_UNAME']
- def run(self):
- env = self.env
- gen = self.generator
- bjam = gen.bld.root.find_dir(env.BJAM_SRC)
- if not bjam:
- Logs.error('Can not find bjam source')
- return -1
- bjam_exe_relpath = 'bin.' + env.BJAM_UNAME + '/bjam'
- bjam_exe = bjam.find_resource(bjam_exe_relpath)
- if bjam_exe:
- env.BJAM = bjam_exe.srcpath()
- return 0
- bjam_cmd = ['./build.sh']
- Logs.debug('runner: ' + bjam.srcpath() + '> ' + str(bjam_cmd))
- result = self.exec_command(bjam_cmd, cwd=bjam.srcpath())
- if not result == 0:
- Logs.error('bjam failed')
- return -1
- bjam_exe = bjam.find_resource(bjam_exe_relpath)
- if bjam_exe:
- env.BJAM = bjam_exe.srcpath()
- return 0
- Logs.error('bjam failed')
- return -1
-
-class bjam_build(Task):
- ext_in = 'bjam_exe'
- ext_out = 'install'
- vars = ['BJAM_TOOLSET']
- def run(self):
- env = self.env
- gen = self.generator
- path = gen.path
- bld = gen.bld
- if hasattr(gen, 'root'):
- build_root = path.find_node(gen.root)
- else:
- build_root = path
- jam = bld.srcnode.find_resource(env.BJAM_CONFIG)
- if jam:
- Logs.debug('bjam: Using jam configuration from ' + jam.srcpath())
- jam_rel = jam.relpath_gen(build_root)
- else:
- Logs.warn('No build configuration in build_config/user-config.jam. Using default')
- jam_rel = None
- bjam_exe = bld.srcnode.find_node(env.BJAM)
- if not bjam_exe:
- Logs.error('env.BJAM is not set')
- return -1
- bjam_exe_rel = bjam_exe.relpath_gen(build_root)
- cmd = ([bjam_exe_rel] +
- (['--user-config=' + jam_rel] if jam_rel else []) +
- ['--stagedir=' + path.get_bld().path_from(build_root)] +
- ['--debug-configuration'] +
- ['--with-' + lib for lib in self.generator.target] +
- (['toolset=' + env.BJAM_TOOLSET] if env.BJAM_TOOLSET else []) +
- ['link=' + 'shared'] +
- ['variant=' + 'release']
- )
- Logs.debug('runner: ' + build_root.srcpath() + '> ' + str(cmd))
- ret = self.exec_command(cmd, cwd=build_root.srcpath())
- if ret != 0:
- return ret
- self.set_outputs(path.get_bld().ant_glob('lib/*') + path.get_bld().ant_glob('bin/*'))
- return 0
-
-class bjam_installer(Task):
- ext_in = 'install'
- def run(self):
- gen = self.generator
- path = gen.path
- for idir, pat in (('${LIBDIR}', 'lib/*'), ('${BINDIR}', 'bin/*')):
- files = []
- for n in path.get_bld().ant_glob(pat):
- try:
- t = readlink(n.srcpath())
- gen.bld.symlink_as(sep.join([idir, n.name]), t, postpone=False)
- except OSError:
- files.append(n)
- gen.bld.install_files(idir, files, postpone=False)
- return 0
-