comparison 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
comparison
equal deleted inserted replaced
189:b2456d274576 190:995aca290452
7 //! which can be used to detect the current PAM implementation. 7 //! which can be used to detect the current PAM implementation.
8 //! - The [`aliases`] submodule, which contains convenient aliases 8 //! - The [`aliases`] submodule, which contains convenient aliases
9 //! for callback types used in libpam, so you don't have to type 9 //! for callback types used in libpam, so you don't have to type
10 //! `unsafe extern "C" fn(this is so long)` all the time. 10 //! `unsafe extern "C" fn(this is so long)` all the time.
11 #![doc = ""] 11 #![doc = ""]
12 #![doc = concat!("This documentation was built for the **", pam_impl_name!(), "** implementation.")] 12 #![doc = concat!("This documentation was built for the **", env!("LIBPAMSYS_IMPL"), "** implementation.")]
13 //! 13 //!
14 //! You can override this **at build time** by setting the `LIBPAMSYS_IMPL` 14 //! You can override this **at build time** by setting the `LIBPAMSYS_IMPL`
15 //! environment variable to one of the values of the [`pam_impl::PamImpl`] enum. 15 //! environment variable to one of the values of the [`pam_impl::PamImpl`] enum.
16 //! For more information about configuration, see the documentation of 16 //! For more information about configuration, see [the documentation of
17 //! [`libpam-sys-impls`](https://crates.io/crates/libpam-sys-impls). 17 //! libpam-sys-impls](libpam_sys_impls::build_target_impl).
18 #![allow(non_camel_case_types)] 18 #![allow(non_camel_case_types)]
19 #![allow(unused_imports)] 19 #![allow(unused_imports)]
20 20
21 pub mod aliases; 21 pub mod aliases;
22 mod constants; 22 mod constants;
23 mod ffi; 23 mod ffi;
24 #[doc(inline)] 24 #[doc(inline)]
25 pub use crate::{constants::*, ffi::*}; 25 pub use crate::{constants::*, ffi::*};
26 #[doc(inline)] 26
27 pub use libpam_sys_impls as pam_impl; 27 /// Information about the current PAM implementation (or the implementation
28 #[doc(inline)] 28 /// that is being built for).
29 pub use libpam_sys_impls::pam_impl_name; 29 pub mod pam_impl {
30 #[doc(inline)]
31 pub use libpam_sys_impls::{PamImpl, enable_pam_impl_cfg, pam_impl_cfg_string};
32
33 include!(concat!(env!("OUT_DIR"), "/pam_impl_consts.rs"));
34 }