diff options
author | lloyd <[email protected]> | 2011-03-08 22:18:37 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2011-03-08 22:18:37 +0000 |
commit | e8ae96510f3d87e3b142df81b51c3b15e30e77f9 (patch) | |
tree | 4f61ddba33a8e06b85ba2edc1b74d1a02e7c4739 /configure.py | |
parent | 5f4aafe005d1031b955718fbb94d6beec3e6ea48 (diff) | |
parent | 41da07c02a36add833965be5ddc60ef1cf089beb (diff) |
propagate from branch 'net.randombit.botan' (head dd068808e5bf87c982765a8bcc314996053a5bdd)
to branch 'net.randombit.botan.c++0x' (head 34696d52a8148d64f7021b3e193fc56f051b9dd2)
Diffstat (limited to 'configure.py')
-rwxr-xr-x | configure.py | 64 |
1 files changed, 53 insertions, 11 deletions
diff --git a/configure.py b/configure.py index f86da5709..fee244592 100755 --- a/configure.py +++ b/configure.py @@ -2,7 +2,7 @@ """ Configuration program for botan (http://botan.randombit.net/) - (C) 2009-2010 Jack Lloyd + (C) 2009-2011 Jack Lloyd Distributed under the terms of the Botan license Tested with @@ -43,9 +43,9 @@ class BuildConfigurationInformation(object): """ version_major = 1 version_minor = 9 - version_patch = 14 - version_so_patch = 14 - version_suffix = '-dev' + version_patch = 15 + version_so_patch = 15 + version_suffix = '' version_datestamp = 0 @@ -221,6 +221,10 @@ def process_command_line(args): action='store_false', default=True, help=SUPPRESS_HELP) + build_group.add_option('--link-method', + default=None, + help=SUPPRESS_HELP) + build_group.add_option('--distribution-info', metavar='STRING', help='set distribution specific versioning', default='unspecified') @@ -1043,6 +1047,14 @@ def choose_modules_to_use(modules, archinfo, options): def cannot_use_because(mod, reason): not_using_because.setdefault(reason, []).append(mod) + for modname in options.enabled_modules: + if modname not in modules: + logging.warning("Unknown enabled module %s" % (modname)) + + for modname in options.disabled_modules: + if modname not in modules: + logging.warning("Unknown disabled module %s" % (modname)) + for (modname, module) in modules.items(): if modname in options.disabled_modules: cannot_use_because(modname, 'disabled by user') @@ -1177,15 +1189,34 @@ Perform the filesystem operations needed to setup the build def setup_build(build_config, options, template_vars): """ + Choose the link method based on system availablity and user request + """ + def choose_link_method(req_method): + + def useable_methods(): + if 'symlink' in os.__dict__: + yield 'symlink' + if 'link' in os.__dict__: + yield 'hardlink' + yield 'copy' + + for method in useable_methods(): + if req_method is None or req_method == method: + return method + + logging.info('Could not use requested link method %s' % (req_method)) + return 'copy' + + """ Copy or link the file, depending on what the platform offers """ - def portable_symlink(filename, target_dir): + def portable_symlink(filename, target_dir, method): if not os.access(filename, os.R_OK): logging.warning('Missing file %s' % (filename)) return - if 'symlink' in os.__dict__: + if method == 'symlink': def count_dirs(dir, accum = 0): if dir in ['', '/', os.path.curdir]: return accum @@ -1201,13 +1232,16 @@ def setup_build(build_config, options, template_vars): os.symlink(source, target) - elif 'link' in os.__dict__: + elif method == 'hardlink': os.link(filename, os.path.join(target_dir, os.path.basename(filename))) - else: + elif method == 'copy': shutil.copy(filename, target_dir) + else: + raise Exception('Unknown link method %s' % (method)) + def choose_makefile_template(style): if style == 'nmake': return 'nmake.in' @@ -1268,13 +1302,16 @@ def setup_build(build_config, options, template_vars): finally: f.close() + link_method = choose_link_method(options.link_method) + logging.info('Using %s to link files into build directory' % (link_method)) + def link_headers(header_list, type, dir): logging.debug('Linking %d %s header files in %s' % ( len(header_list), type, dir)) for header_file in header_list: try: - portable_symlink(header_file, dir) + portable_symlink(header_file, dir, link_method) except OSError, e: if e.errno != errno.EEXIST: logging.error('Error linking %s into %s: %s' % ( @@ -1371,7 +1408,7 @@ def generate_amalgamation(build_config): amalg_header = """/* * Botan %s Amalgamation -* (C) 1999-2009 Jack Lloyd and others +* (C) 1999-2011 Jack Lloyd and others * * Distributed under the terms of the Botan license */ @@ -1473,7 +1510,12 @@ def main(argv = None): if options.os is None: options.os = platform.system().lower() - logging.info('Guessing taget OS is %s (--os to set)' % (options.os)) + + if re.match('^cygwin_.*', options.os): + logging.debug("Converting '%s' to 'cygwin'", options.os) + options.os = 'cygwin' + + logging.info('Guessing target OS is %s (--os to set)' % (options.os)) if options.compiler is None: if options.os == 'windows': |