Skip to content

configure.py: fix --disable-option-checking and extra config paths #45566

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Oct 28, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions config.toml.example
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,16 @@
# Where to install man pages in `prefix` above
#mandir = "share/man"

# Where to install data in `prefix` above (currently unused)
#datadir = "share"

# Where to install additional info in `prefix` above (currently unused)
#infodir = "share/info"

# Where to install local state (currently unused)
# If this is a relative path, it will get installed in `prefix` above
#localstatedir = "/var/lib"

# =============================================================================
# Options for compiling Rust code itself
# =============================================================================
Expand Down
5 changes: 5 additions & 0 deletions src/bootstrap/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,11 @@ struct Install {
bindir: Option<String>,
libdir: Option<String>,
mandir: Option<String>,

// standard paths, currently unused
datadir: Option<String>,
infodir: Option<String>,
localstatedir: Option<String>,
}

/// TOML representation of how the LLVM build is configured.
Expand Down
13 changes: 9 additions & 4 deletions src/bootstrap/configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,12 @@ def err(msg):
unknown_args.append(arg)
p("")

if 'option-checking' not in known_args or known_args['option-checking'][1]:
# Note: here and a few other places, we use [-1] to apply the *last* value
# passed. But if option-checking is enabled, then the known_args loop will
# also assert that options are only passed once.
option_checking = ('option-checking' not in known_args
or known_args['option-checking'][-1][1])
if option_checking:
if len(unknown_args) > 0:
err("Option '" + unknown_args[0] + "' is not recognized")
if len(need_value_args) > 0:
Expand All @@ -238,7 +243,7 @@ def err(msg):

def build():
if 'build' in known_args:
return known_args['build'][0][1]
return known_args['build'][-1][1]
return bootstrap.default_build_triple()


Expand Down Expand Up @@ -276,9 +281,9 @@ def set(key, value):

# Ensure each option is only passed once
arr = known_args[key]
if len(arr) > 1:
if option_checking and len(arr) > 1:
err("Option '{}' provided more than once".format(key))
option, value = arr[0]
option, value = arr[-1]

# If we have a clear avenue to set our value in rustbuild, do so
if option.rustbuild is not None:
Expand Down