aboutsummaryrefslogtreecommitdiffstats
path: root/configure.py
diff options
context:
space:
mode:
authorRenĂ© Meusel <[email protected]>2019-09-09 12:51:16 +0200
committerRenĂ© Meusel <[email protected]>2019-09-09 15:54:04 +0200
commit7315c3c26d505111831c791eab7a58babea4fbc3 (patch)
tree6af6ab948dd69c9b78fbcc1cd07cc6778aea8ca6 /configure.py
parent3f748f3cee478cd3d4c0ce8a0c1e2ee2ecd1129f (diff)
--build-targets= sanity checks and target selection
Diffstat (limited to 'configure.py')
-rwxr-xr-xconfigure.py46
1 files changed, 43 insertions, 3 deletions
diff --git a/configure.py b/configure.py
index 523a6ec39..9b9cd30b1 100755
--- a/configure.py
+++ b/configure.py
@@ -276,6 +276,15 @@ class BuildPaths(object): # pylint: disable=too-many-instance-attributes
else:
raise InternalError("Unknown src info type '%s'" % (typ))
+__acceptable_build_targets = ["static", "shared", "cli", "tests", "bogo_shim", "docs"]
+
+def read_build_targets(options):
+ if options.build_targets == None: # not set => no list
+ return None
+ if not options.build_targets: # empty string => empty list
+ return []
+ return [t.strip().lower() for t in options.build_targets.split(',')]
+
def process_command_line(args): # pylint: disable=too-many-locals,too-many-statements
"""
Handle command line options
@@ -490,8 +499,8 @@ def process_command_line(args): # pylint: disable=too-many-locals,too-many-state
build_group.add_option('--build-bogo-shim', action='store_true', default=False,
help=optparse.SUPPRESS_HELP)
- build_group.add_option('--build-targets', default='cli,tests', dest="build_targets",
- help="build additional targets and tools (cli, tests, bogo_shim, docs)")
+ build_group.add_option('--build-targets', default=None, dest="build_targets",
+ help="build specific targets and tools (%s)" % ', '.join(__acceptable_build_targets))
build_group.add_option('--with-pkg-config', action='store_true', default=None,
help=optparse.SUPPRESS_HELP)
@@ -1961,7 +1970,7 @@ def create_template_vars(source_paths, build_paths, options, modules, cc, arch,
return os.path.join(build_dir, path)
def all_targets(options):
- targets = [t.strip().lower() for t in options.build_targets.split(',')]
+ targets = read_build_targets(options)
yield 'libs'
if 'cli' in targets:
yield 'cli'
@@ -2989,6 +2998,37 @@ def canonicalize_options(options, info_os, info_arch):
if options.cpu != options.arch:
logging.info('Canonicalized CPU target %s to %s', options.cpu, options.arch)
+ # select and sanity check build targets
+ def canonicalize_build_targets(options):
+ build_targets = read_build_targets(options)
+
+ # --build-targets was not provided: build default targets
+ if build_targets == None:
+ options.build_targets = "cli,tests"
+ return
+
+ # --build-targets was set to empty string: invalid input
+ if not build_targets:
+ raise UserError("select at least one --build-targets")
+
+ for build_target in build_targets:
+ if build_target not in __acceptable_build_targets:
+ raise UserError("unknown build target: %s" % build_target)
+
+ # building the shared lib desired and without contradiction?
+ if options.build_shared_lib == None:
+ options.build_shared_lib = "shared" in build_targets
+ elif bool(options.build_shared_lib) != bool("shared" in build_targets):
+ raise UserError("inconsistent usage of --enable/disable-shared-library and --build-targets")
+
+ # building the static lib desired and without contradiction?
+ if options.build_static_lib == None:
+ options.build_static_lib = "static" in build_targets
+ elif bool(options.build_static_lib) != bool("static" in build_targets):
+ raise UserError("inconsistent usage of --enable/disable-static-library and --build-targets")
+
+ canonicalize_build_targets(options)
+
shared_libs_supported = options.os in info_os and info_os[options.os].building_shared_supported()
if not shared_libs_supported: