-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Adding logic to the configuration help script to take default values into account #130125
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
Closed
Closed
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,45 +21,47 @@ def __init__(self, name, rustbuild, desc, value): | |
|
||
|
||
options = [] | ||
option_defaults = {} | ||
|
||
|
||
def o(*args): | ||
def o(*args, default): | ||
option_defaults[args[0]] = default | ||
options.append(Option(*args, value=False)) | ||
|
||
|
||
def v(*args): | ||
options.append(Option(*args, value=True)) | ||
|
||
|
||
o("debug", "rust.debug", "enables debugging environment; does not affect optimization of bootstrapped code") | ||
o("docs", "build.docs", "build standard library documentation") | ||
o("compiler-docs", "build.compiler-docs", "build compiler documentation") | ||
o("optimize-tests", "rust.optimize-tests", "build tests with optimizations") | ||
o("verbose-tests", "rust.verbose-tests", "enable verbose output when running tests") | ||
o("ccache", "llvm.ccache", "invoke gcc/clang via ccache to reuse object files between builds") | ||
o("sccache", None, "invoke gcc/clang via sccache to reuse object files between builds") | ||
o("local-rust", None, "use an installed rustc rather than downloading a snapshot") | ||
o("debug", "rust.debug", "enables debugging environment; does not affect optimization of bootstrapped code", default=False) | ||
o("docs", "build.docs", "build standard library documentation", default=True) | ||
o("compiler-docs", "build.compiler-docs", "build compiler documentation", default=False) | ||
o("optimize-tests", "rust.optimize-tests", "build tests with optimizations", default=True) | ||
o("verbose-tests", "rust.verbose-tests", "enable verbose output when running tests", default=False) | ||
o("ccache", "llvm.ccache", "invoke gcc/clang via ccache to reuse object files between builds", default=False) | ||
o("sccache", None, "invoke gcc/clang via sccache to reuse object files between builds", default=False) | ||
o("local-rust", None, "use an installed rustc rather than downloading a snapshot", default=False) | ||
v("local-rust-root", None, "set prefix for local rust binary") | ||
o("local-rebuild", "build.local-rebuild", "assume local-rust matches the current version, for rebuilds; implies local-rust, and is implied if local-rust already matches the current version") | ||
o("llvm-static-stdcpp", "llvm.static-libstdcpp", "statically link to libstdc++ for LLVM") | ||
o("llvm-link-shared", "llvm.link-shared", "prefer shared linking to LLVM (llvm-config --link-shared)") | ||
o("rpath", "rust.rpath", "build rpaths into rustc itself") | ||
o("codegen-tests", "rust.codegen-tests", "run the tests/codegen tests") | ||
o("ninja", "llvm.ninja", "build LLVM using the Ninja generator (for MSVC, requires building in the correct environment)") | ||
o("locked-deps", "build.locked-deps", "force Cargo.lock to be up to date") | ||
o("vendor", "build.vendor", "enable usage of vendored Rust crates") | ||
o("sanitizers", "build.sanitizers", "build the sanitizer runtimes (asan, dfsan, lsan, msan, tsan, hwasan)") | ||
o("dist-src", "rust.dist-src", "when building tarballs enables building a source tarball") | ||
o("cargo-native-static", "build.cargo-native-static", "static native libraries in cargo") | ||
o("profiler", "build.profiler", "build the profiler runtime") | ||
o("full-tools", None, "enable all tools") | ||
o("lld", "rust.lld", "build lld") | ||
o("llvm-bitcode-linker", "rust.llvm-bitcode-linker", "build llvm bitcode linker") | ||
o("clang", "llvm.clang", "build clang") | ||
o("use-libcxx", "llvm.use-libcxx", "build LLVM with libc++") | ||
o("control-flow-guard", "rust.control-flow-guard", "Enable Control Flow Guard") | ||
o("patch-binaries-for-nix", "build.patch-binaries-for-nix", "whether patch binaries for usage with Nix toolchains") | ||
o("new-symbol-mangling", "rust.new-symbol-mangling", "use symbol-mangling-version v0") | ||
o("local-rebuild", "build.local-rebuild", "assume local-rust matches the current version, for rebuilds; implies local-rust, and is implied if local-rust already matches the current version", default=False) | ||
o("llvm-static-stdcpp", "llvm.static-libstdcpp", "statically link to libstdc++ for LLVM", default=False) | ||
o("llvm-link-shared", "llvm.link-shared", "prefer shared linking to LLVM (llvm-config --link-shared)", default=False) | ||
o("rpath", "rust.rpath", "build rpaths into rustc itself", default=False) | ||
o("codegen-tests", "rust.codegen-tests", "run the tests/codegen tests", default=False) | ||
o("ninja", "llvm.ninja", "build LLVM using the Ninja generator (for MSVC, requires building in the correct environment)", default=False) | ||
Comment on lines
+45
to
+50
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is so unmaintainable approach. We can't track these default values unfortunately. |
||
o("locked-deps", "build.locked-deps", "force Cargo.lock to be up to date", default=False) | ||
o("vendor", "build.vendor", "enable usage of vendored Rust crates", default=False) | ||
o("sanitizers", "build.sanitizers", "build the sanitizer runtimes (asan, dfsan, lsan, msan, tsan, hwasan)", default=False) | ||
o("dist-src", "rust.dist-src", "when building tarballs enables building a source tarball", default=False) | ||
o("cargo-native-static", "build.cargo-native-static", "static native libraries in cargo", default=False) | ||
o("profiler", "build.profiler", "build the profiler runtime", default=False) | ||
o("full-tools", None, "enable all tools", default=False) | ||
o("lld", "rust.lld", "build lld", default=False) | ||
o("llvm-bitcode-linker", "rust.llvm-bitcode-linker", "build llvm bitcode linker", default=False) | ||
o("clang", "llvm.clang", "build clang", default=False) | ||
o("use-libcxx", "llvm.use-libcxx", "build LLVM with libc++", default=False) | ||
o("control-flow-guard", "rust.control-flow-guard", "Enable Control Flow Guard", default=False) | ||
o("patch-binaries-for-nix", "build.patch-binaries-for-nix", "whether patch binaries for usage with Nix toolchains", default=False) | ||
o("new-symbol-mangling", "rust.new-symbol-mangling", "use symbol-mangling-version v0", default=False) | ||
|
||
v("llvm-cflags", "llvm.cflags", "build LLVM with these extra compiler flags") | ||
v("llvm-cxxflags", "llvm.cxxflags", "build LLVM with these extra compiler flags") | ||
|
@@ -69,15 +71,15 @@ def v(*args): | |
|
||
# Optimization and debugging options. These may be overridden by the release | ||
# channel, etc. | ||
o("optimize-llvm", "llvm.optimize", "build optimized LLVM") | ||
o("llvm-assertions", "llvm.assertions", "build LLVM with assertions") | ||
o("llvm-enzyme", "llvm.enzyme", "build LLVM with enzyme") | ||
o("llvm-plugins", "llvm.plugins", "build LLVM with plugin interface") | ||
o("debug-assertions", "rust.debug-assertions", "build with debugging assertions") | ||
o("debug-assertions-std", "rust.debug-assertions-std", "build the standard library with debugging assertions") | ||
o("overflow-checks", "rust.overflow-checks", "build with overflow checks") | ||
o("overflow-checks-std", "rust.overflow-checks-std", "build the standard library with overflow checks") | ||
o("llvm-release-debuginfo", "llvm.release-debuginfo", "build LLVM with debugger metadata") | ||
o("optimize-llvm", "llvm.optimize", "build optimized LLVM", default=True) | ||
o("llvm-assertions", "llvm.assertions", "build LLVM with assertions", default=False) | ||
o("llvm-enzyme", "llvm.enzyme", "build LLVM with enzyme", default=False) | ||
o("llvm-plugins", "llvm.plugins", "build LLVM with plugin interface", default=False) | ||
o("debug-assertions", "rust.debug-assertions", "build with debugging assertions", default=False) | ||
o("debug-assertions-std", "rust.debug-assertions-std", "build the standard library with debugging assertions", default=False) | ||
o("overflow-checks", "rust.overflow-checks", "build with overflow checks", default=True) | ||
o("overflow-checks-std", "rust.overflow-checks-std", "build the standard library with overflow checks", default=False) | ||
o("llvm-release-debuginfo", "llvm.release-debuginfo", "build LLVM with debugger metadata", default=False) | ||
v("debuginfo-level", "rust.debuginfo-level", "debuginfo level for Rust code") | ||
v("debuginfo-level-rustc", "rust.debuginfo-level-rustc", "debuginfo level for the compiler") | ||
v("debuginfo-level-std", "rust.debuginfo-level-std", "debuginfo level for the standard library") | ||
|
@@ -151,9 +153,9 @@ def v(*args): | |
|
||
# Many of these are saved below during the "writing configuration" step | ||
# (others are conditionally saved). | ||
o("manage-submodules", "build.submodules", "let the build manage the git submodules") | ||
o("full-bootstrap", "build.full-bootstrap", "build three compilers instead of two (not recommended except for testing reproducible builds)") | ||
o("extended", "build.extended", "build an extended rust tool set") | ||
o("manage-submodules", "build.submodules", "let the build manage the git submodules", default=False) | ||
o("full-bootstrap", "build.full-bootstrap", "build three compilers instead of two (not recommended except for testing reproducible builds)", default=False) | ||
o("extended", "build.extended", "build an extended rust tool set", default=False) | ||
|
||
v("bootstrap-cache-path", None, "use provided path for the bootstrap cache") | ||
v("tools", None, "List of extended tools will be installed") | ||
|
@@ -163,8 +165,8 @@ def v(*args): | |
v("target", None, "List of GNUs ./configure syntax LLVM target triples") | ||
|
||
# Options specific to this configure script | ||
o("option-checking", None, "complain about unrecognized options in this configure script") | ||
o("verbose-configure", None, "don't truncate options when printing them in this configure script") | ||
o("option-checking", None, "complain about unrecognized options in this configure script", default=False) | ||
o("verbose-configure", None, "don't truncate options when printing them in this configure script", default=False) | ||
v("set", None, "set arbitrary key/value pairs in TOML configuration") | ||
|
||
|
||
|
@@ -193,7 +195,10 @@ def is_value_list(key): | |
if option.value: | ||
print('\t{:30} {}'.format('--{}=VAL'.format(option.name), option.desc)) | ||
else: | ||
print('\t{:30} {}'.format('--enable-{}'.format(option.name), option.desc)) | ||
if option_defaults[option.name]: | ||
print('\t{:30} {}'.format('--enable-{}'.format(option.name), option.desc)) | ||
else: | ||
print('\t{:30} {}'.format('--disable-{}'.format(option.name), option.desc)) | ||
print('') | ||
print('This configure script is a thin configuration shim over the true') | ||
print('configuration system, `config.toml`. You can explore the comments') | ||
|
@@ -203,7 +208,7 @@ def is_value_list(key): | |
print('in the TOML configuration if desired') | ||
print('') | ||
print('Also note that all options which take `--enable` can similarly') | ||
print('be passed with `--disable-foo` to forcibly disable the option') | ||
print('be passed with `--disable-foo` to forcibly disable the option and vice versa.') | ||
sys.exit(0) | ||
|
||
VERBOSE = False | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this prints
--disable-docs
, then the current description afterwards must be negated. E.g. to "skip building compiler documentation".