Mercurial > crates > nonstick
comparison libpam-sys/build.rs @ 191:e915c54097d6
Clean up docs and link versions to the right place.
| author | Paul Fisher <paul@pfish.zone> |
|---|---|
| date | Sat, 02 Aug 2025 19:01:21 -0400 |
| parents | 995aca290452 |
| children |
comparison
equal
deleted
inserted
replaced
| 190:995aca290452 | 191:e915c54097d6 |
|---|---|
| 3 fn main() { | 3 fn main() { |
| 4 println!("cargo:rustc-link-lib=pam"); | 4 println!("cargo:rustc-link-lib=pam"); |
| 5 libpam_sys_impls::enable_pam_impl_cfg(); | 5 libpam_sys_impls::enable_pam_impl_cfg(); |
| 6 | 6 |
| 7 let pam_impl = libpam_sys_impls::build_target_impl(); | 7 let pam_impl = libpam_sys_impls::build_target_impl(); |
| 8 let impl_str = pam_impl.map(|i| format!("{i:?}")).unwrap_or("[undefined]".into()); | 8 let impl_str = pam_impl |
| 9 .map(|i| format!("{i:?}")) | |
| 10 .unwrap_or("[undefined]".into()); | |
| 9 println!("cargo:rustc-env=LIBPAMSYS_IMPL={impl_str}"); | 11 println!("cargo:rustc-env=LIBPAMSYS_IMPL={impl_str}"); |
| 10 let output = match pam_impl { | 12 let output = match pam_impl { |
| 11 None => "".into(), | 13 None => "".into(), |
| 12 Some(pam_impl) => { | 14 Some(pam_impl) => { |
| 13 format!("\ | 15 format!( |
| 16 "\ | |
| 14 /// The implementation of PAM this library was built against. | 17 /// The implementation of PAM this library was built against. |
| 15 pub const CURRENT: PamImpl = PamImpl::{pam_impl:?}; | 18 pub const CURRENT: PamImpl = PamImpl::{pam_impl:?}; |
| 16 /// The name of the PAM implementation this library was built | 19 /// The name of the PAM implementation this library was built |
| 17 /// against, as a string. | 20 /// against, as a string. |
| 18 #[macro_export] | 21 #[macro_export] |
| 19 macro_rules! pam_impl_name {{ () => {{ \"{pam_impl:?}\" }} }} | 22 macro_rules! pam_impl_name {{ () => {{ \"{pam_impl:?}\" }} }} |
| 20 pub(crate) use pam_impl_name; | 23 pub(crate) use pam_impl_name; |
| 21 ") | 24 " |
| 25 ) | |
| 22 } | 26 } |
| 23 }; | 27 }; |
| 24 let outfile = format!("{out}/pam_impl_consts.rs", out = env::var("OUT_DIR").expect("missing OUT_DIR env var")); | 28 let outfile = format!( |
| 29 "{out}/pam_impl_consts.rs", | |
| 30 out = env::var("OUT_DIR").expect("missing OUT_DIR env var") | |
| 31 ); | |
| 25 fs::write(outfile, output).expect("couldn't write output file"); | 32 fs::write(outfile, output).expect("couldn't write output file"); |
| 26 } | 33 } |
