Comments (5)
Hm I'm not sure I quite follow unfortunately? Is the idea that you want something like include paths from pkg-config but lib paths from a custom location?
from pkg-config-rs.
In first place I want to write build.rs
using pkg-config
crate API with support of 2 additional cases:
- for systems which has no
pkg-config
binary (e.g. MacOSX and Windows); - for libs which have no
lib<name>.pc
.
So build.rs
will be something like
fn main() {
let lib = pkg_config::Config::new()
.probe("smbclient")
.expect("libsmbclient not found");
// bindgen staff
let header = find_header(&lib).unwrap().to_str().unwrap().to_string();
let bindings = bindgen::Builer::default().header(header)
// bindgen config
.generate()
.expect("failed to generate bindings");
// write bindings to file
}
instead of
fn main() {
let inc_path_name = "SMBCLIENT_INCLUDE_PATH";
let lib_path_name = "SMBCLIENT_LIBRARY_PATH";
let header = match (env::var(inc_path_name), env::var(lib_path_name)) {
(Ok(inc_path), Ok(lib_path)) => {
println!("cargo:rustc-link-lib=smbclient");
println!("cargo:rustc-link-search=native={}", lib_path);
let mut path = PathBuf::from(inc_path);
path.push("libsmbclient.h");
path.to_str().unwrap().to_string()
}
(Ok(_), Err(_)) | (Err(_), Ok(_)) =>
panic!("Either both {} and {} should be set or none of them", inc_path_name, lib_path_name),
(Err(_), Err(_)) => {
let lib = pkg_config::Config::new()
.probe("smbclient")
.expect("libsmbclient not found");
find_header(&lib).unwrap().to_str().unwrap().to_string()
}
};
// bindgen staff
let bindings = bindgen::Builer::default().header(header)
// bindgen config
.generate()
.expect("failed to generate bindings");
// write bindings to file
}
from pkg-config-rs.
Ah ok I see, but I think that's beyond the scope of the pkg-config crate? That sounds like an external helper crate, though, which may internally use pkg-config.
from pkg-config-rs.
I thought it but it seems to me as duplication. It will still have something like Library
struct with almost same fields, it will have overlapping env vars (in functional sence) for static linking, similar logic for emitting cargo:rustc-*
etc.
Of course, if it seems out of scope for pkg-build
to you, I could write a wrapper.
from pkg-config-rs.
Sure yeah there may be some duplication, but not too much in theory, right? The wrapper like you're indicating may also not want to have all the fields that pkg-config returns.
from pkg-config-rs.
Related Issues (20)
- Add readme = "README.md" in cargo.toml to have the readme displayed on crates.io HOT 2
- Dependency being constantly rebuilt due to 'env_metadata' being set to 'true' HOT 8
- Should we parse -isystem Cflags? HOT 2
- customized pkg-config is incomplete? HOT 1
- Bug: Missing support for `pkgconf` for Fedora HOT 3
- v0.3.21 raised MSRV to 1.47.0 HOT 4
- Placing pkg-config.exe file to this git if possible HOT 3
- Libraries linked in incorrect order HOT 3
- Incorrect parse result for raw archive path HOT 3
- [Feature Request] Add configurable linking modifiers HOT 6
- `PKG_CONFIG_PATH_FOR_BUILD` env var HOT 4
- Allow disabling pkg-config altogether HOT 7
- static-nobundle option
- Unable to correctly identify a type of Windows static library name, such as `foo.lib` HOT 7
- Cargo build say "library name must not be empty" while using statik(true) HOT 4
- fails with pkgconf 2.0.0 breaking changes HOT 1
- Cannot link static libraries on Windows MinGW because the Libs.private flags are ignored
- Reduce -L flag pollution by resolving -L -l flags to on-disk files
- Rustdoc docs are missing information about environment variables present in README HOT 2
- Cannot link statically against `alsa` library HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pkg-config-rs.