File tree 5 files changed +27
-7
lines changed
5 files changed +27
-7
lines changed Original file line number Diff line number Diff line change @@ -2,18 +2,23 @@ PAM_SRC_DIR = src/pam
2
2
3
3
BINDGEN_CMD = bindgen --allowlist-function '^pam_.*$$' --allowlist-var '^PAM_.*$$' --opaque-type pam_handle_t --blocklist-function pam_vsyslog --blocklist-function pam_vprompt --blocklist-function pam_vinfo --blocklist-function pam_verror --blocklist-type '.*va_list.*' --ctypes-prefix libc --no-layout-tests --sort-semantically
4
4
5
+ PAM_VARIANT = $$(./get-pam-variant.bash )
6
+
5
7
.PHONY : all clean pam-sys pam-sys-diff
6
8
7
9
pam-sys-diff :
8
- @$(BINDGEN_CMD ) $< | diff --color=auto $(PAM_SRC_DIR ) /sys.rs - || (echo run \' make -B pam-sys\' to apply these changes && false)
9
- @echo $(PAM_SRC_DIR ) /sys.rs does not need to be re-generated
10
+ @$(BINDGEN_CMD ) $(PAM_SRC_DIR ) /wrapper.h | \
11
+ sed ' s/rust-bindgen [0-9]*\.[0-9]*\.[0-9]*/&, minified by cargo-minify/' | \
12
+ diff --color=auto $(PAM_SRC_DIR ) /sys_$(PAM_VARIANT ) .rs - \
13
+ || (echo run \' make -B pam-sys\' to apply these changes && false)
14
+ @echo $(PAM_SRC_DIR ) /sys_$(PAM_VARIANT ) .rs does not need to be re-generated
10
15
11
16
# use 'make pam-sys' to re-generate the sys.rs file for your local platform
12
17
pam-sys :
13
- $(BINDGEN_CMD ) $(PAM_SRC_DIR ) /wrapper.h --output $(PAM_SRC_DIR ) /sys_$$( uname | tr 'A-Z' 'a-z' ) .rs
18
+ $(BINDGEN_CMD ) $(PAM_SRC_DIR ) /wrapper.h --output $(PAM_SRC_DIR ) /sys_$( PAM_VARIANT ) .rs
14
19
cargo minify --apply --allow-dirty
15
- sed -i.bak ' s/rust-bindgen [0-9]*\.[0-9]*\.[0-9]*/&, minified by cargo-minify/' $(PAM_SRC_DIR ) /sys_$$( uname | tr 'A-Z' 'a-z' ) .rs
16
- rm $(PAM_SRC_DIR ) /sys_$$( uname | tr 'A-Z' 'a-z' ) .rs.bak
20
+ sed -i.bak ' s/rust-bindgen [0-9]*\.[0-9]*\.[0-9]*/&, minified by cargo-minify/' $(PAM_SRC_DIR ) /sys_$( PAM_VARIANT ) .rs
21
+ rm $(PAM_SRC_DIR ) /sys_$( PAM_VARIANT ) .rs.bak
17
22
18
23
clean :
19
24
rm $(PAM_SRC_DIR ) /sys.rs
Original file line number Diff line number Diff line change
1
+ #! /usr/bin/env bash
2
+
3
+ # FIXME read headers to find the actually used variant
4
+ case $( uname) in
5
+ Linux)
6
+ echo linuxpam
7
+ ;;
8
+ FreeBSD)
9
+ echo openpam
10
+ ;;
11
+ * )
12
+ echo " Unsupported platform"
13
+ exit 1
14
+ ;;
15
+ esac
Original file line number Diff line number Diff line change @@ -16,8 +16,8 @@ mod error;
16
16
mod rpassword;
17
17
mod securemem;
18
18
19
- #[ cfg_attr( target_os = "linux" , path = "sys_linux .rs" ) ]
20
- #[ cfg_attr( target_os = "freebsd" , path = "sys_freebsd .rs" ) ]
19
+ #[ cfg_attr( target_os = "linux" , path = "sys_linuxpam .rs" ) ]
20
+ #[ cfg_attr( target_os = "freebsd" , path = "sys_openpam .rs" ) ]
21
21
#[ allow( nonstandard_style) ]
22
22
pub mod sys;
23
23
File renamed without changes.
File renamed without changes.
You can’t perform that action at this time.
0 commit comments