Skip to content

Commit

Permalink
Use cargo-ndk as a RUSTC_WRAPPER to pass --target to Clang
Browse files Browse the repository at this point in the history
This is an alternative workaround for bbqsrc#92 that's similar to the solution
used in ndk-build except that the `-Clink-arg rustflag` is injected via
a RUSTC_WRAPPER instead of trying to modify CARGO_ENCODED_RUSTFLAGS.

It turned out to be practically impossible to be able to reliably
set CARGO_ENCODED_RUSTFLAGS without risking trampling over rustflags
that might be configured via Cargo (for example `target.<cfg>.rustflags`
are especially difficult to read outside of cargo itself)

This approach avoids hitting the command line length limitations of the
current workaround and avoids needing temporary hard links or copying
the cargo-ndk binary to the target/ directory.

Even though we've only seen quoting issues with the Windows `.cmd`
wrappers this change to avoid using the wrapper scripts is being
applied consistently for all platforms. E.g. considering the upstream
recommendation to avoid the wrapper scripts if possible:

https://android-review.googlesource.com/c/platform/ndk/+/2134712

Fixes: bbqsrc#92
Fixes: bbqsrc#104
Addresses: android/ndk#1856
  • Loading branch information
rib committed May 18, 2023
1 parent 49a2ef3 commit dc5e927
Show file tree
Hide file tree
Showing 4 changed files with 103 additions and 261 deletions.
148 changes: 12 additions & 136 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 0 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,3 @@ pathos = "0.3.0"
serde = { version = "1.0.152", features = ["derive"] }
toml = "0.5.10"
version_check = "0.9.4"

[target.'cfg(windows)'.dependencies]
tempfile = "3.5.0"
wargs = "0.1.0"
Loading

0 comments on commit dc5e927

Please sign in to comment.