Skip to content

Conversation

@deg4uss3r
Copy link

@deg4uss3r deg4uss3r commented Jan 19, 2025

This PR adds the ability to use modifiers in Cargo.toml and Environment variable overrides.

resolves: #118

Copy link
Owner

@gdesmott gdesmott left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your contribution.

I have no objection adding such feature but would like a bit more context as I never used those kinds of modifiers.

Adding @xclaesse and @nirbheek in case they know more about modifiers and have some input.

Once we agree on the API we'll need it properly documented in the general documentation at the top of lib.rs.

@codecov
Copy link

codecov bot commented Jan 20, 2025

Codecov Report

❌ Patch coverage is 98.17352% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 91.62%. Comparing base (8013f88) to head (d653f7e).
⚠️ Report is 6 commits behind head on main.

Files with missing lines Patch % Lines
src/lib.rs 95.65% 3 Missing ⚠️
src/test.rs 99.26% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #117      +/-   ##
==========================================
+ Coverage   91.00%   91.62%   +0.62%     
==========================================
  Files           3        3              
  Lines        2089     2270     +181     
==========================================
+ Hits         1901     2080     +179     
- Misses        188      190       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Owner

@gdesmott gdesmott left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks generally ok.

Can you please rebase your branch on top of main? Feel free to squash commits while doing so.

//! - `SYSTEM_DEPS_$NAME_SEARCH_NATIVE` to override the [`cargo:rustc-link-search=native`](https://doc.rust-lang.org/cargo/reference/build-scripts.html#cargorustc-link-searchkindpath) flag;
//! - `SYSTEM_DEPS_$NAME_SEARCH_FRAMEWORK` to override the [`cargo:rustc-link-search=framework`](https://doc.rust-lang.org/cargo/reference/build-scripts.html#cargorustc-link-searchkindpath) flag;
//! - `SYSTEM_DEPS_$NAME_LIB` to override the [`cargo:rustc-link-lib`](https://doc.rust-lang.org/cargo/reference/build-scripts.html#rustc-link-lib) flag;
//! - `SYSTEM_DEPS_$NAME_MOD` to add a link modifier to the [`cargo:rustc-link-mod`](https://doc.rust-lang.org/cargo/reference/build-scripts.html#rustc-link-lib) flag;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
//! - `SYSTEM_DEPS_$NAME_MOD` to add a link modifier to the [`cargo:rustc-link-mod`](https://doc.rust-lang.org/cargo/reference/build-scripts.html#rustc-link-lib) flag;
//! - `SYSTEM_DEPS_$NAME_MODIFIERS` to add a link modifier to the [`cargo:rustc-link-mod`](https://doc.rust-lang.org/cargo/reference/build-scripts.html#rustc-link-lib) flag;

As that's the name used in https://doc.rust-lang.org/cargo/reference/build-scripts.html#rustc-link-lib.
And mod as its own meaning in Rust.

/// frameworks the linker should link on
pub frameworks: Vec<String>,
/// frameworks the linker should link on and their modifiers
pub frameworks: Vec<(String, String)>,
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think having a struct instead of a tuple here would make things clearer.

pub(crate) name: Option<String>,
pub(crate) fallback_names: Option<Vec<String>>,
pub(crate) optional: Option<bool>,
pub(crate) modifier: Option<String>,
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
pub(crate) modifier: Option<String>,
pub(crate) modifiers: Option<String>,

No?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow Modifiers For Statically Linked Libraries

2 participants