Mercurial > crates > nonstick
diff libpam-sys/src/lib.rs @ 190:995aca290452
Restructure the way libpam-sys-impls works to fix cross-compilation.
The previous structure of libpam-sys-impls meant that things got
confusing (including for me) between what constants were build-time
and what constants were run-time. This broke cross-compilation.
This simplifies the way that works so that `libpam-sys-impls` has
*no* build script itself and is intended mostly as a library to be
included in other libraries' build scripts (while also exporting
the PamImpl enum).
author | Paul Fisher <paul@pfish.zone> |
---|---|
date | Sat, 02 Aug 2025 18:47:46 -0400 |
parents | b2456d274576 |
children | e915c54097d6 |
line wrap: on
line diff
--- a/libpam-sys/src/lib.rs Thu Jul 31 15:42:12 2025 -0400 +++ b/libpam-sys/src/lib.rs Sat Aug 02 18:47:46 2025 -0400 @@ -9,12 +9,12 @@ //! for callback types used in libpam, so you don't have to type //! `unsafe extern "C" fn(this is so long)` all the time. #![doc = ""] -#![doc = concat!("This documentation was built for the **", pam_impl_name!(), "** implementation.")] +#![doc = concat!("This documentation was built for the **", env!("LIBPAMSYS_IMPL"), "** implementation.")] //! //! You can override this **at build time** by setting the `LIBPAMSYS_IMPL` //! environment variable to one of the values of the [`pam_impl::PamImpl`] enum. -//! For more information about configuration, see the documentation of -//! [`libpam-sys-impls`](https://crates.io/crates/libpam-sys-impls). +//! For more information about configuration, see [the documentation of +//! libpam-sys-impls](libpam_sys_impls::build_target_impl). #![allow(non_camel_case_types)] #![allow(unused_imports)] @@ -23,7 +23,12 @@ mod ffi; #[doc(inline)] pub use crate::{constants::*, ffi::*}; -#[doc(inline)] -pub use libpam_sys_impls as pam_impl; -#[doc(inline)] -pub use libpam_sys_impls::pam_impl_name; + +/// Information about the current PAM implementation (or the implementation +/// that is being built for). +pub mod pam_impl { + #[doc(inline)] + pub use libpam_sys_impls::{PamImpl, enable_pam_impl_cfg, pam_impl_cfg_string}; + + include!(concat!(env!("OUT_DIR"), "/pam_impl_consts.rs")); +}