Remove duplicate dependencies by patching, and add back links field #40
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.
We don't want duplicate ctru-sys crates in the dependency graph. Same for libc. We can patch them here to avoid any issues.
Now that we don't have duplicate ctru-sys crates, we can add back the links field. This field is important because it warns us when there are two crates linking to the same library (ex. duplicate ctru-sys crates). I think there's some misconceptions about how the
links
field works, so here's its docs and some clarifications:https://doc.rust-lang.org/cargo/reference/build-scripts.html#the-links-manifest-key
The
links
field does not automatically link the crate to the library. Instead it's more of a hint to Cargo that this crate should link to that native library. Cargo then enforces some things, like having a build script and only having one crate which links to this library in the dependency graph. These are useful things to enforce.Downstream crates don't need the ctru-sys patch, so it's only an issue here (they could add the patch for libc, but it's not required). I verified this with my project: AzureMarker/n3ds-controller@e16453c