diff options
author | Tavian Barnes <tavianator@tavianator.com> | 2024-04-10 10:03:15 -0400 |
---|---|---|
committer | Tavian Barnes <tavianator@tavianator.com> | 2024-04-10 13:15:49 -0400 |
commit | 9f90d09fcf58269dc09bad90b360d46c374e56e9 (patch) | |
tree | a461f3475386bbe34d88e67db1d5bf099245cb88 | |
parent | 170fd017a1e7d87d0d53502b8f407c9163aa2957 (diff) | |
download | bfs-9f90d09fcf58269dc09bad90b360d46c374e56e9.tar.xz |
build: Add optional libselinux dependency
-rw-r--r-- | Makefile | 6 | ||||
-rw-r--r-- | config/libselinux.c | 6 | ||||
-rwxr-xr-x | config/pkgconf.sh | 3 | ||||
-rw-r--r-- | docs/BUILDING.md | 14 |
4 files changed, 22 insertions, 7 deletions
@@ -143,6 +143,7 @@ export RELEASE_CFLAGS= -O3 -flto=auto # $ make config USE_LIBURING=n USE_ONIGURUMA=y USE_LIBACL ?= USE_LIBCAP ?= +USE_LIBSELINUX ?= USE_LIBURING ?= USE_ONIGURUMA ?= @@ -167,6 +168,7 @@ _XLDLIBS := ${LDLIBS} _XUSE_LIBACL := ${USE_LIBACL} _XUSE_LIBCAP := ${USE_LIBCAP} +_XUSE_LIBSELINUX := ${USE_LIBSELINUX} _XUSE_LIBURING := ${USE_LIBURING} _XUSE_ONIGURUMA := ${USE_ONIGURUMA} @@ -197,6 +199,7 @@ export XLDLIBS=${_XLDLIBS} export XUSE_LIBACL=${_XUSE_LIBACL} export XUSE_LIBCAP=${_XUSE_LIBCAP} +export XUSE_LIBSELINUX=${_XUSE_LIBSELINUX} export XUSE_LIBURING=${_XUSE_LIBURING} export XUSE_ONIGURUMA=${_XUSE_ONIGURUMA} @@ -210,6 +213,7 @@ CONFIG := ${GEN}/config.mk PKGS := \ ${GEN}/libacl.mk \ ${GEN}/libcap.mk \ + ${GEN}/libselinux.mk \ ${GEN}/liburing.mk \ ${GEN}/oniguruma.mk @@ -478,7 +482,7 @@ distcheck: ${DISTCHECKS} DISTCHECK_CONFIG_asan := ASAN=y UBSAN=y DISTCHECK_CONFIG_msan := MSAN=y UBSAN=y CC=clang DISTCHECK_CONFIG_tsan := TSAN=y UBSAN=y CC=clang -DISTCHECK_CONFIG_m32 := EXTRA_CFLAGS="-m32" PKG_CONFIG_PATH=/usr/lib32/pkgconfig USE_LIBURING=n +DISTCHECK_CONFIG_m32 := EXTRA_CFLAGS="-m32" PKG_CONFIG_LIBDIR=/usr/lib32/pkgconfig USE_LIBURING=n DISTCHECK_CONFIG_release := RELEASE=y ${DISTCHECKS}:: diff --git a/config/libselinux.c b/config/libselinux.c new file mode 100644 index 0000000..72f5d33 --- /dev/null +++ b/config/libselinux.c @@ -0,0 +1,6 @@ +#include <selinux/selinux.h> + +int main(void) { + freecon(0); + return 0; +} diff --git a/config/pkgconf.sh b/config/pkgconf.sh index 070fad6..286c19c 100755 --- a/config/pkgconf.sh +++ b/config/pkgconf.sh @@ -37,6 +37,9 @@ else libcap) LDLIB=-lcap ;; + libselinux) + LDLIB=-lselinux + ;; liburing) LDLIB=-luring ;; diff --git a/docs/BUILDING.md b/docs/BUILDING.md index 072da92..4ed139c 100644 --- a/docs/BUILDING.md +++ b/docs/BUILDING.md @@ -74,15 +74,17 @@ Here are some of the common ones; check the [`Makefile`](/Makefile) for more. `bfs` depends on some system libraries for some of its features. These dependencies are optional, and can be turned off in `make config` if necessary by setting the appropriate variable to `n` (e.g. `make config USE_ONIGURUMA=n`). -| Dependency | Platforms | `make config` flag | -|-------------|------------|--------------------| -| [libacl] | Linux only | `USE_LIBACL` | -| [libcap] | Linux only | `USE_LIBCAP` | -| [liburing] | Linux only | `USE_LIBURING` | -| [Oniguruma] | All | `USE_ONIGURUMA` | +| Dependency | Platforms | `make config` flag | +|--------------|------------|--------------------| +| [libacl] | Linux only | `USE_LIBACL` | +| [libcap] | Linux only | `USE_LIBCAP` | +| [liburing] | Linux only | `USE_LIBURING` | +| [libselinux] | Linux only | `USE_LIBSELINUX` | +| [Oniguruma] | All | `USE_ONIGURUMA` | [libacl]: https://savannah.nongnu.org/projects/acl [libcap]: https://sites.google.com/site/fullycapable/ +[libselinux]: https://github.com/SELinuxProject/selinux [liburing]: https://github.com/axboe/liburing [Oniguruma]: https://github.com/kkos/oniguruma |