view 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 source

//! `libpam-sys` provides low-level access to LibPAM.
//!
//! Everything in here is directly as exported from the LibPAM library or
//! its header files, with two exceptions:
//!
//! - The [`pam_impl`] submodule (and the associated [`pam_impl_name!`] macro),
//!   which can be used to detect the current PAM implementation.
//! - The [`aliases`] submodule, which contains convenient aliases
//!   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 **", 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](libpam_sys_impls::build_target_impl).
#![allow(non_camel_case_types)]
#![allow(unused_imports)]

pub mod aliases;
mod constants;
mod ffi;
#[doc(inline)]
pub use crate::{constants::*, ffi::*};

/// 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"));
}