diff options
author | lloyd <[email protected]> | 2011-06-01 12:50:25 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2011-06-01 12:50:25 +0000 |
commit | eb12046134962918725570394d1925252adfb45a (patch) | |
tree | 93b1e724dcfa7e6375163c6d6a2fcf49b6b4be2a | |
parent | 5f902124596c8fad246481cd6682ace766f04c08 (diff) |
Add --via-amalgamation option that builds everything from a single
source file.
-rwxr-xr-x | configure.py | 47 | ||||
-rw-r--r-- | doc/log.txt | 5 |
2 files changed, 36 insertions, 16 deletions
diff --git a/configure.py b/configure.py index d32b32d79..c55902905 100755 --- a/configure.py +++ b/configure.py @@ -76,9 +76,14 @@ class BuildConfigurationInformation(object): self.botan_include_dir = os.path.join(self.include_dir, 'botan') self.internal_include_dir = os.path.join(self.botan_include_dir, 'internal') - self.sources = sorted(flatten([mod.sources() for mod in modules])) + if options.via_amalgamation: + self.sources = ['botan_all.cpp'] + self.internal_headers = [] + else: + self.sources = sorted(flatten([mod.sources() for mod in modules])) + self.internal_headers = sorted(flatten([m.internal_headers() for m in modules])) + self.public_headers = sorted(flatten([m.public_headers() for m in modules])) - self.internal_headers = sorted(flatten([m.internal_headers() for m in modules])) checks_dir = os.path.join(options.base_dir, 'checks') @@ -224,6 +229,10 @@ def process_command_line(args): default=False, action='store_true', help='generate amalgamation files') + build_group.add_option('--via-amalgamation', dest='via_amalgamation', + default=False, action='store_true', + help='build via amalgamation') + build_group.add_option('--with-tr1-implementation', metavar='WHICH', dest='with_tr1', default=None, help='enable TR1 (choices: none, system, boost)') @@ -1520,12 +1529,16 @@ def generate_amalgamation(build_config): else: match = std_include.search(line) - if match: + if match and match.group(1) != 'functional': self.all_std_includes.add(match.group(1)) else: yield line - botan_all_h = open('botan_all.h', 'w') + amalg_basename = 'botan_all' + + header_name = '%s.h' % (amalg_basename) + + botan_h = open(header_name, 'w') pub_header_amalag = Amalgamation_Generator(build_config.public_headers) @@ -1537,31 +1550,30 @@ def generate_amalgamation(build_config): */ """ % (build_config.version_string) - botan_all_h.write(amalg_header) + botan_h.write(amalg_header) - botan_all_h.write(""" + botan_h.write(""" #ifndef BOTAN_AMALGAMATION_H__ #define BOTAN_AMALGAMATION_H__ """) - botan_all_h.write(pub_header_amalag.header_includes) - botan_all_h.write(pub_header_amalag.contents) - botan_all_h.write("\n#endif\n") + botan_h.write(pub_header_amalag.header_includes) + botan_h.write(pub_header_amalag.contents) + botan_h.write("\n#endif\n") internal_header_amalag = Amalgamation_Generator( [s for s in build_config.internal_headers if s.find('asm_macr_') == -1]) - botan_all_cpp = open('botan_all.cpp', 'w') + botan_cpp = open('%s.cpp' % (amalg_basename), 'w') - botan_all_cpp.write(amalg_header) + botan_cpp.write(amalg_header) - botan_all_cpp.write('#include "botan_all.h"\n') - - botan_all_cpp.write(internal_header_amalag.header_includes) - botan_all_cpp.write(internal_header_amalag.contents) + botan_cpp.write('\n#include "%s"\n' % (header_name)) + botan_cpp.write(internal_header_amalag.header_includes) + botan_cpp.write(internal_header_amalag.contents) for src in build_config.sources: if src.endswith('.S'): @@ -1572,7 +1584,7 @@ def generate_amalgamation(build_config): if botan_include.search(line): continue else: - botan_all_cpp.write(line) + botan_cpp.write(line) """ Test for the existence of a program @@ -1752,6 +1764,9 @@ def main(argv = None): '(use --without-sphinx to disable)') options.with_sphinx = True + if options.via_amalgamation: + options.generate_amalgamation = True + if options.gen_amalgamation: if options.asm_ok: logging.info('Disabling assembly code, cannot use in amalgamation') diff --git a/doc/log.txt b/doc/log.txt index a86c28e59..759f5fc5e 100644 --- a/doc/log.txt +++ b/doc/log.txt @@ -40,6 +40,11 @@ Version 1.9.18, Not Yet Released * Fix a bug under Visual C++ 2010 which would cause ``hex_encode`` to crash if given a zero-sized input to encode. +* A new build option ``--via-amalgamation`` will first generate the + single-file amalgamation, then build the library from that single + file. This option requires a lot of memory and does not parallelize, + but the resulting library is smaller and may be faster. + * On Unix, the library and header paths have been changed to allow parallel installation of different versions of the library. Headers are installed into ``<prefix>/include/botan-1.9/botan``, libraries |