forked from bazelbuild/rules_rust
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge cc toolchain flags into build script env (bazelbuild#1675)
Right now, setting build_script_env will _overwrite_ the values from the cc_toolchain, which is almost certainly ~always wrong. Instead, allow _appending_ values, which means that if overrides are necessary people can add them (e.g. disabling specific warnings). Note: This is technically a breaking change, but one which should improve faithfulness of the build.
- Loading branch information
1 parent
b7c36c0
commit 025bf7d
Showing
3 changed files
with
33 additions
and
2 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
fn main() { | ||
let cflags = std::env::var("CFLAGS").unwrap(); | ||
assert!(cflags.contains("-target aarch64-linux-gnu.2.28"), "Expected CFLAGS to contain `-target aarch64-linux-gnu.2.28` because of zig toolchain but was `{}`", cflags); | ||
assert!(cflags.contains(" cbeep"), "Expected CFLAGS to contain ` cbeep` because of build_script_env but was `{}`", cflags); | ||
|
||
let cxxflags = std::env::var("CXXFLAGS").unwrap(); | ||
assert!(cxxflags.contains("-target aarch64-linux-gnu.2.28"), "Expected CXXFLAGS to contain `-target aarch64-linux-gnu.2.28` because of zig toolchain but was `{}`", cxxflags); | ||
assert!(cxxflags.contains(" cxxbeep"), "Expected CXXFLAGS to contain ` cxxbeep` because of build_script_env but was `{}`", cxxflags); | ||
|
||
let ldflags = std::env::var("LDFLAGS").unwrap(); | ||
assert!(ldflags.contains("-target aarch64-linux-gnu.2.28"), "Expected LDFLAGS to contain `-target aarch64-linux-gnu.2.28` because of zig toolchain but was `{}`", ldflags); | ||
assert!(ldflags.contains(" ldbeep"), "Expected LDFLAGS to contain ` ldbeep` because of build_script_env but was `{}`", ldflags); | ||
} |