Debian Codegraph @

debian/rust-vendor/selinux-sys/README.md

raw
1 [![crates.io](https://img.shields.io/crates/v/selinux-sys.svg)](https://crates.io/crates/selinux-sys)
2 [![docs.rs](https://docs.rs/selinux-sys/badge.svg)](https://docs.rs/selinux-sys)
3 [![license](https://img.shields.io/github/license/koutheir/selinux-sys?color=black)](https://raw.githubusercontent.com/koutheir/selinux-sys/master/LICENSE.txt)
4
5 # `selinux-sys`: Unsafe Rust bindings for `libselinux`
6
7 SELinux is a flexible Mandatory Access Control (MAC) for Linux.
8
9 This crate exposes neither *deprecated* nor *undocumented* SELinux API functions
10 and types.
11
12 This crate is specific to Android and some Linux distributions. Building it for
13 other platforms, or for the Linux kernel, results in an empty crate.
14
15 ## Supported environment variables
16
17 This crate depends on some environment variables, and *variants* of those.
18 For each environment variable (e.g., `CC`), the following are the accepted
19 variants of it:
20 - `<var>_<target>`, *e.g.,* `CC_aarch64-unknown-linux-gnu`.
21 - `<var>_<target-with-underscores>`, *e.g.,* `CC_aarch64_unknown_linux_gnu`.
22 - `TARGET_<var>`, *e.g.,* `TARGET_CC`.
23 - `<var>`, *e.g.,* `CC`.
24
25 The following environment variables (and their variants) affect how this crate
26 is built:
27 - `SELINUX_STATIC`
28 - `SELINUX_PATH`
29 - `SELINUX_INCLUDE_DIR`
30 - `SELINUX_LIB_DIR`
31 - `SYSROOT`
32 - `CC`
33 - `CFLAGS`
34
35 ## Dynamic or static linking
36
37 This crate links to `libselinux` dynamically if possible, except when targeting
38 platforms based on the `musl` C library.
39
40 This behavior can be changed either by setting the environment variable
41 `SELINUX_STATIC` to `1`, or by enabling the crate feature `static`.
42 If both are defined, then the value of `SELINUX_STATIC` takes precedence.
43
44 Setting `SELINUX_STATIC` to `0` mandates dynamic linking.
45
46 ## Finding SELinux library and headers
47
48 By default, this crate finds SELinux headers and library based on the default
49 target C compiler.
50
51 This behavior can be changed by:
52 - Either defining the environment variable `SELINUX_PATH` to the path of
53 a directory containing the sub-directories `include` and `lib` where
54 the headers and library are installed.
55 - Or by defining one or both of the environment variables `SELINUX_INCLUDE_DIR`
56 and `SELINUX_LIB_DIR` to paths to the directories where headers and library
57 are present. If `SELINUX_PATH` is also defined, then `SELINUX_INCLUDE_DIR`
58 and `SELINUX_LIB_DIR` take precedence.
59
60 ## Depending on this crate
61
62 This crate provides the following variables to other crates that depend on it:
63 - `DEP_SELINUX_INCLUDE`: Path of the directory where library C header files reside.
64 - `DEP_SELINUX_LIB`: Path of the directory where the library binary resides.
65
66 ## Versioning
67
68 This project adheres to [Semantic Versioning].
69 The `CHANGELOG.md` file details notable changes over time.
70
71 [Semantic Versioning]: https://semver.org/spec/v2.0.0.html