diff options
author | lloyd <[email protected]> | 2009-10-09 18:06:06 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2009-10-09 18:06:06 +0000 |
commit | 997e6c97b8ace857d00f9fd57f621ba9323c75df (patch) | |
tree | d5b65a4fc28a51a66a64fdf75055aab916c59db7 /configure.py | |
parent | c4264a0404cd9b0b9dcba66a2ca157174d934b09 (diff) |
Add more or less functional integration with Boost.Python. Use
--use-boost-python to enable creating a second makefile, Makefile.python,
which has targets for building and installing the Python module.
Diffstat (limited to 'configure.py')
-rwxr-xr-x | configure.py | 42 |
1 files changed, 38 insertions, 4 deletions
diff --git a/configure.py b/configure.py index 0f5e1502d..857cab7e7 100755 --- a/configure.py +++ b/configure.py @@ -55,6 +55,12 @@ class BuildConfigurationInformation(object): self.checkobj_dir = os.path.join(self.build_dir, 'checks') self.libobj_dir = os.path.join(self.build_dir, 'lib') + self.python_dir = os.path.join(options.src_dir, 'wrap', 'python') + + self.use_boost_python = options.boost_python + + self.pyobject_dir = os.path.join(self.build_dir, 'python') + self.include_dir = os.path.join(self.build_dir, 'include') self.full_include_dir = os.path.join(self.include_dir, 'botan') @@ -71,6 +77,10 @@ class BuildConfigurationInformation(object): [os.path.join(checks_dir, file) for file in os.listdir(checks_dir) if file.endswith('.cpp')]) + self.python_sources = sorted( + [os.path.join(self.python_dir, file) for file in os.listdir(self.python_dir) + if file.endswith('.cpp')]) + def doc_files(self): docs = ['readme.txt'] @@ -87,6 +97,14 @@ class BuildConfigurationInformation(object): return 'botan-%d.%d.pc' % (self.version_major, self.version_minor) + def build_dirs(self): + dirs = [self.checkobj_dir, + self.libobj_dir, + self.full_include_dir] + if self.use_boost_python: + dirs.append(self.pyobject_dir) + return dirs + def username(self): return getpass.getuser() @@ -146,6 +164,10 @@ def process_command_line(args): build_group.add_option('--disable-debug', dest='debug_build', action='store_false', help=SUPPRESS_HELP) + build_group.add_option('--use-boost-python', dest='boost_python', + default=False, action='store_true', + help='enable Boost.Python wrapper') + build_group.add_option('--with-tr1-implementation', metavar='WHICH', dest='with_tr1', default=None, help='enable TR1 (options: none, system, boost)') @@ -781,6 +803,14 @@ def create_template_vars(build_config, options, modules, cc, arch, osinfo): build_commands(build_config.check_sources, build_config.checkobj_dir, 'CHECK')), + 'python_objs': makefile_list( + objectfile_list(build_config.python_sources, + build_config.pyobject_dir)), + + 'python_build_cmds': '\n'.join( + build_commands(build_config.python_sources, + build_config.pyobject_dir, 'PYTHON')), + 'ar_command': cc.ar_command or osinfo.ar_command, 'ranlib_command': osinfo.ranlib_command(), 'install_cmd_exec': osinfo.install_cmd_exec, @@ -802,6 +832,8 @@ def create_template_vars(build_config, options, modules, cc, arch, osinfo): 'mod_list': '\n'.join(['%s (%s)' % (m.basename, m.realname) for m in sorted(modules)]), + + 'python_version': '.'.join(map(str, sys.version_info[0:2])) } """ @@ -988,10 +1020,8 @@ def setup_build(build_config, options, template_vars): except OSError, e: logging.debug('Error while removing build dir: %s' % (e)) - for dirs in [build_config.checkobj_dir, - build_config.libobj_dir, - build_config.full_include_dir]: - os.makedirs(dirs) + for dir in build_config.build_dirs(): + os.makedirs(dir) makefile_template = os.path.join( options.makefile_dir, @@ -1010,6 +1040,10 @@ def setup_build(build_config, options, template_vars): templates_to_proc[os.path.join(options.build_data, template)] = \ os.path.join(build_config.build_dir, sink) + if options.boost_python: + templates_to_proc[ + os.path.join(options.makefile_dir, 'python.in')] = 'Makefile.python' + for (template, sink) in templates_to_proc.items(): try: f = open(sink, 'w') |