cargo-wix
cargo-wix copied to clipboard
Fix rustc-cfg usage
The rustc-cfg crate uses the rustc --target <triple> --print cfg
command, which works for determining toolchain/target information but it will not work for determining Cargo-based compiler configurations, such as features enabled or disabled via the RUSTFLAGS
environment variable. The cargo rustc -- --print cfg
and optionally the cargo rustc --target <triple> -- --print cfg
commands should be used instead. The rustc-cfg crate does not appear to support the cargo rustc
command. I am in the process of creating a new cargo-rustc-cfg
crate inspired by the rustc-cfg crate that does use the cargo rustc
commands. The rustc-cfg crate should then be replaced with this new one.
I have created and published the cargo-rustc-cfg crate. The rustc-cfg
crate will eventually be replaced with this one to address this issue.
There are a couple of issues popping up with the cargo-rustc-cfg crate. Cargo is building the project every time for every target because it does not abort the build process or "dry run" when the -- --print cfg
arguments are used. There is also issues with Cargo targets and needing to add cargo-metadata as a dependency to select a single target. All of these can be worked around, but it is not great.
Really the Cargo Rust Compiler (rustc) configuration is just needed to detect the CRT feature (#115), and the rest might be obtained from just the rustc configuration (rustc-cfg crate) using the --target <TRIPLE>
option. So, I think this is on-hold until the issues with the cargo rustc
command are resolved.
A mechanism for obtaining the Cargo-based compiler configurations. It will take a while for it to reach stable for Cargo, but this will greatly unify resolution of this issue along with resolving #115. The cargo-rustc-cfg crate will also need to be updated, but that will eventually replace usage of the rustc-cfg crate here.
Once this issue is resolved and the crt-static
issue is properly addressed, a new release seems appropriate.