Skip to content

Commit

Permalink
feat: allow load pam library dynamic
Browse files Browse the repository at this point in the history
  • Loading branch information
honsunrise committed Aug 19, 2024
1 parent cddb66f commit e241905
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
7 changes: 5 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,19 @@ repository = "https://github.com/1wilkens/pam-sys.git"
documentation = "https://docs.rs/pam-sys/"
readme = "README.md"
include = [ "LICENSE-*", "README.md", "CHANGELOG.md", "src/lib.rs", "build.rs", "wrapper.h"]

edition = "2018"

build = "build.rs"
links = "pam"

[badges]
azure-devops = { project = "1wilkens/ci", pipeline = "pam-sys" }

[dependencies]
libc = "^0.2.65"
libloading = { version = "0.8", optional = true }

[build-dependencies]
bindgen = { version = "0.69", default-features = false }

[features]
dylib = ["dep:libloading"]
9 changes: 8 additions & 1 deletion build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,14 @@ fn main() {
println!("cargo:rerun-if-changed=wrapper.h");

// Prepare bindgen builder
let mut builder = bindgen::Builder::default()
let mut builder = bindgen::Builder::default();

#[cfg(feature = "dylib")]
{
builder = builder.dynamic_library_name("pam");
}

builder = builder
// Our header
.header("wrapper.h")
// Use libc for c-types
Expand Down

0 comments on commit e241905

Please sign in to comment.