diff options
author | Jack Lloyd <[email protected]> | 2018-10-18 13:11:44 -0400 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2018-10-18 13:16:30 -0400 |
commit | db877044836eaebd627398c6ef3e48c7b56a1395 (patch) | |
tree | b39de9f93382dd63850a66f6b539450237dc3bc7 /configure.py | |
parent | 8f19e97d6f735f8c4f2a191ef5463c7a5fe715c4 (diff) |
Canonicalize OS name first
We need the canonical OS name to be able to look up the relevant data
for defaults, but the defaults need to be set before the rest of the
canonicalization code runs.
Diffstat (limited to 'configure.py')
-rwxr-xr-x | configure.py | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/configure.py b/configure.py index b55efc91c..797514063 100755 --- a/configure.py +++ b/configure.py @@ -1987,11 +1987,12 @@ def create_template_vars(source_paths, build_paths, options, modules, cc, arch, 'test_mode': options.test_mode, 'optimize_for_size': options.optimize_for_size, - 'mod_list': sorted([m.basename for m in modules]), - - 'botan_pkgconfig': os.path.join(build_paths.build_dir, 'botan-%d.pc' % (Version.major())) + 'mod_list': sorted([m.basename for m in modules]) } + if options.with_pkg_config: + variables['botan_pkgconfig'] = os.path.join(build_paths.build_dir, 'botan-%d.pc' % (Version.major())) + # The name is always set because Windows build needs it variables['static_lib_name'] = '%s%s.%s' % (variables['lib_prefix'], variables['libname'], variables['static_suffix']) @@ -2751,6 +2752,14 @@ def set_defaults_for_unset_options(options, info_arch, info_cc, info_os): # pyli options.os = system_from_python logging.info('Guessing target OS is %s (use --os to set)' % (options.os)) + if options.os not in info_os: + def find_canonical_os_name(os_name_variant): + for (canonical_os_name, os_info) in info_os.items(): + if os_info.matches_name(os_name_variant): + return canonical_os_name + return os_name_variant # not found + options.os = find_canonical_os_name(options.os) + def deduce_compiler_type_from_cc_bin(cc_bin): if cc_bin.find('clang') != -1 or cc_bin in ['emcc', 'em++']: return 'clang' @@ -2799,13 +2808,6 @@ def set_defaults_for_unset_options(options, info_arch, info_cc, info_os): # pyli # Mutates `options` def canonicalize_options(options, info_os, info_arch): # pylint: disable=too-many-branches - if options.os not in info_os: - def find_canonical_os_name(os_name_variant): - for (canonical_os_name, os_info) in info_os.items(): - if os_info.matches_name(os_name_variant): - return canonical_os_name - return os_name_variant # not found - options.os = find_canonical_os_name(options.os) # canonical ARCH/CPU options.arch = canon_processor(info_arch, options.cpu) @@ -3028,7 +3030,7 @@ def do_io_for_build(cc, arch, osinfo, using_mods, build_paths, source_paths, tem write_template(in_build_dir('build.h'), in_build_data('buildh.in')) write_template(in_build_dir('botan.doxy'), in_build_data('botan.doxy.in')) - if options.with_pkg_config: + if 'botan_pkgconfig' in template_vars: write_template(template_vars['botan_pkgconfig'], in_build_data('botan.pc.in')) if options.os == 'windows': |