aboutsummaryrefslogtreecommitdiffstats
path: root/configure.py
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2017-12-02 06:08:09 -0500
committerJack Lloyd <[email protected]>2017-12-02 08:24:59 -0500
commit1891809fd886ef15aa8935f48dcc7d829003d4be (patch)
tree33a7b00cf825790d6cee3114d4eb3f3416fe3c1a /configure.py
parent3415a93a774f631e156ee8a187e376ff2789f27d (diff)
Build simplifications
Diffstat (limited to 'configure.py')
-rwxr-xr-xconfigure.py75
1 files changed, 37 insertions, 38 deletions
diff --git a/configure.py b/configure.py
index 74c4e78bc..22d246f06 100755
--- a/configure.py
+++ b/configure.py
@@ -1331,6 +1331,9 @@ class OsInfo(InfoObject): # pylint: disable=too-many-instance-attributes
'doc_dir': 'share/doc',
'building_shared_supported': 'yes',
'so_post_link_command': '',
+ 'cli_exe_name': 'botan',
+ 'lib_prefix': 'lib',
+ 'library_name': 'botan-{major}',
})
if lex.ar_command == 'ar' and lex.ar_options == '':
@@ -1363,17 +1366,20 @@ class OsInfo(InfoObject): # pylint: disable=too-many-instance-attributes
self.ar_command = lex.ar_command
self.ar_options = lex.ar_options
self.bin_dir = lex.bin_dir
- self.building_shared_supported = (True if lex.building_shared_supported == 'yes' else False)
+ self.building_shared_supported = (lex.building_shared_supported == 'yes')
+ self.cli_exe_name = lex.cli_exe_name
self.doc_dir = lex.doc_dir
self.header_dir = lex.header_dir
self.install_root = lex.install_root
self.lib_dir = lex.lib_dir
- self.os_type = lex.os_type
+ self.lib_prefix = lex.lib_prefix
+ self.library_name = lex.library_name
self.obj_suffix = lex.obj_suffix
+ self.os_type = lex.os_type
self.program_suffix = lex.program_suffix
+ self.so_post_link_command = lex.so_post_link_command
self.static_suffix = lex.static_suffix
self.target_features = lex.target_features
- self.so_post_link_command = lex.so_post_link_command
def defines(self, options):
r = []
@@ -2026,6 +2032,9 @@ def create_template_vars(source_paths, build_config, options, modules, cc, arch,
main_executable = os.path.basename(sys.argv[0])
return ' '.join([main_executable] + sys.argv[1:])
+ build_dir = options.with_build_dir or os.path.curdir
+ program_suffix = options.program_suffix or osinfo.program_suffix
+
variables = {
'version_major': Version.major(),
'version_minor': Version.minor(),
@@ -2046,12 +2055,19 @@ def create_template_vars(source_paths, build_config, options, modules, cc, arch,
'src_dir': source_paths.src_dir,
'doc_dir': source_paths.doc_dir,
+ 'cli_exe': os.path.join(build_dir, osinfo.cli_exe_name + program_suffix),
+ 'test_exe': os.path.join(build_dir, 'botan-test' + program_suffix),
+
+ 'lib_prefix': osinfo.lib_prefix,
+ 'static_suffix': osinfo.static_suffix,
+ 'libname': osinfo.library_name.format(major=Version.major(), minor=Version.minor()),
+
'command_line': configure_command_line(),
'local_config': read_textfile(options.local_config),
'makefile_path': os.path.join(build_config.build_dir, '..', 'Makefile'),
- 'program_suffix': options.program_suffix or osinfo.program_suffix,
+ 'program_suffix': program_suffix,
'prefix': options.prefix or osinfo.install_root,
'bindir': options.bindir or osinfo.bin_dir,
@@ -2108,6 +2124,7 @@ def create_template_vars(source_paths, build_config, options, modules, cc, arch,
'lib_link_cmd': cc.so_link_command_for(osinfo.basename, options) + external_link_cmd(),
'exe_link_cmd': cc.binary_link_command_for(osinfo.basename, options) + external_link_cmd(),
+ 'post_link_cmd': '',
'link_to': ' '.join(
[cc.add_lib_option + lib for lib in link_to('libs')] +
@@ -2134,36 +2151,20 @@ def create_template_vars(source_paths, build_config, options, modules, cc, arch,
'ar_options': cc.ar_options or osinfo.ar_options,
'ar_output_to': cc.ar_output_to,
- 'lib_prefix': 'lib' if options.os != 'windows' else '',
-
- 'static_suffix': osinfo.static_suffix,
-
'mod_list': '\n'.join(sorted([m.basename for m in modules])),
'python_version': options.python_version,
'with_sphinx': options.with_sphinx,
'house_ecc_curve_defines': make_cpp_macros(HouseEccCurve(options.house_curve).defines()) \
- if options.house_curve else ''
+ if options.house_curve else '',
}
- variables['test_exe'] = os.path.join(variables['out_dir'],
- 'botan-test' + variables['program_suffix'])
-
- variables['post_link_cmd'] = osinfo.so_post_link_command.format(**variables) if options.build_shared_lib else ''
-
- if options.os == 'windows':
- # For historical reasons? the library does not have the major number on Windows
- # This should probably be fixed in a future major release.
- variables['libname'] = 'botan'
- variables['lib_basename'] = variables['libname']
- variables['cli_exe'] = os.path.join(variables['out_dir'], 'botan-cli' + variables['program_suffix'])
- else:
- variables['libname'] = 'botan-%d' % (Version.major())
- variables['lib_basename'] = 'lib' + variables['libname']
- variables['cli_exe'] = os.path.join(variables['out_dir'], 'botan' + variables['program_suffix'])
+ if options.os != 'windows':
variables['botan_pkgconfig'] = os.path.join(build_config.build_dir, PKG_CONFIG_FILENAME)
- variables['static_lib_name'] = variables['lib_basename'] + '.' + variables['static_suffix']
+ # 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'])
if options.build_shared_lib:
if osinfo.soname_pattern_base != None:
@@ -2178,24 +2179,22 @@ def create_template_vars(source_paths, build_config, options, modules, cc, arch,
variables['soname_patch'] = osinfo.soname_pattern_patch.format(**variables)
variables['lib_link_cmd'] = variables['lib_link_cmd'].format(**variables)
- else:
- variables['lib_link_cmd'] = ''
-
- if options.os == 'llvm' or options.compiler == 'msvc':
- # llvm-link and msvc require just naming the file directly
- variables['link_to_botan'] = os.path.join(variables['out_dir'], variables['static_lib_name'])
- else:
- variables['link_to_botan'] = '%s%s %s%s' % (
- cc.add_lib_dir_option, variables['out_dir'],
- cc.add_lib_option, variables['libname'])
+ variables['post_link_cmd'] = osinfo.so_post_link_command.format(**variables) if options.build_shared_lib else ''
lib_targets = []
- if options.build_shared_lib:
- lib_targets.append('shared_lib_name')
if options.build_static_lib:
lib_targets.append('static_lib_name')
+ if options.build_shared_lib:
+ lib_targets.append('shared_lib_name')
+
+ variables['library_targets'] = ' '.join([os.path.join(build_dir, variables[t]) for t in lib_targets])
- variables['library_targets'] = ' '.join([os.path.join(variables['out_dir'], variables[t]) for t in lib_targets])
+ if options.os == 'llvm' or options.compiler == 'msvc':
+ # llvm-link and msvc require just naming the file directly
+ variables['link_to_botan'] = os.path.join(build_dir, variables['static_lib_name'])
+ else:
+ variables['link_to_botan'] = '%s%s %s%s' % (cc.add_lib_dir_option, build_dir,
+ cc.add_lib_option, variables['libname'])
variables.update(MakefileListsGenerator(build_config, options, modules, cc, arch, osinfo).generate())