Mercurial > crates > nonstick
comparison libpam-sys/libpam-sys-test/build.rs @ 176:0730f5f2ee2a
Turn `libpam-sys-consts` back into `libpam-sys-impls`.
This moves the constants into `libpam-sys` and makes `libpam-sys-impls`
responsible solely for detecting the current PAM implementation.
author | Paul Fisher <paul@pfish.zone> |
---|---|
date | Wed, 30 Jul 2025 17:53:31 -0400 |
parents | 3a7cf05d2b5f |
children |
comparison
equal
deleted
inserted
replaced
175:e30775c80b49 | 176:0730f5f2ee2a |
---|---|
1 use bindgen::MacroTypeVariation; | 1 use bindgen::MacroTypeVariation; |
2 use libpam_sys_consts::pam_impl::PamImpl; | 2 use libpam_sys_impls::pam_impl_name; |
3 use libpam_sys_consts::{pam_impl, pam_impl_name}; | 3 use libpam_sys_impls::PamImpl; |
4 use proc_macro2::{Group, Ident, TokenStream, TokenTree}; | 4 use proc_macro2::{Group, Ident, TokenStream, TokenTree}; |
5 use quote::{format_ident, ToTokens}; | 5 use quote::{format_ident, ToTokens}; |
6 use std::path::Path; | 6 use std::path::Path; |
7 use std::process::Command; | 7 use std::process::Command; |
8 use std::str::FromStr; | 8 use std::str::FromStr; |
10 use syn::{Item, ItemConst}; | 10 use syn::{Item, ItemConst}; |
11 | 11 |
12 const REDIR_FD: &str = "pam_modutil_redirect_fd"; | 12 const REDIR_FD: &str = "pam_modutil_redirect_fd"; |
13 | 13 |
14 fn main() { | 14 fn main() { |
15 pam_impl::enable_pam_impl_cfg(); | 15 libpam_sys_impls::enable_pam_impl_cfg(); |
16 let config = match PamImpl::CURRENT { | 16 let config = match PamImpl::CURRENT { |
17 PamImpl::LinuxPam => TestConfig { | 17 PamImpl::LinuxPam => TestConfig { |
18 headers: vec![ | 18 headers: vec![ |
19 "<security/_pam_types.h>", | 19 "<security/_pam_types.h>", |
20 "<security/pam_appl.h>", | 20 "<security/pam_appl.h>", |
149 // Define away constness because the various PAM implementations | 149 // Define away constness because the various PAM implementations |
150 // have different const annotations and this will surely drive you crazy. | 150 // have different const annotations and this will surely drive you crazy. |
151 test.define("const", Some("")); | 151 test.define("const", Some("")); |
152 | 152 |
153 // Also replace all the `const`s with `mut`s in the ffi.rs file. | 153 // Also replace all the `const`s with `mut`s in the ffi.rs file. |
154 let file_contents = include_str!("../src/lib.rs"); | 154 let file_contents = include_str!("../src/ffi.rs"); |
155 let deconsted_file = test_file("ffi.rs"); | 155 let deconsted_file = test_file("ffi.rs"); |
156 remove_consts(file_contents, &deconsted_file); | 156 remove_consts(file_contents, &deconsted_file); |
157 | 157 |
158 test.generate(&deconsted_file, "ctest.rs"); | 158 test.generate(&deconsted_file, "ctest.rs"); |
159 } | 159 } |