1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-27 11:07:44 +00:00

gnu: fix the build with selinux

This commit is contained in:
Sylvestre Ledru 2025-05-04 19:20:07 +02:00
parent bcc02e9cea
commit b778fa7baf
2 changed files with 23 additions and 5 deletions

View file

@ -267,8 +267,8 @@ TEST_NO_FAIL_FAST :=--no-fail-fast
TEST_SPEC_FEATURE := test_unimplemented TEST_SPEC_FEATURE := test_unimplemented
else ifeq ($(SELINUX_ENABLED),1) else ifeq ($(SELINUX_ENABLED),1)
TEST_NO_FAIL_FAST := TEST_NO_FAIL_FAST :=
TEST_SPEC_FEATURE := feat_selinux TEST_SPEC_FEATURE := selinux
BUILD_SPEC_FEATURE := feat_selinux BUILD_SPEC_FEATURE := selinux
endif endif
define TEST_BUSYBOX define TEST_BUSYBOX

View file

@ -2,7 +2,8 @@
# `build-gnu.bash` ~ builds GNU coreutils (from supplied sources) # `build-gnu.bash` ~ builds GNU coreutils (from supplied sources)
# #
# spell-checker:ignore (paths) abmon deref discrim eacces getlimits getopt ginstall inacc infloop inotify reflink ; (misc) INT_OFLOW OFLOW baddecode submodules xstrtol distros ; (vars/env) SRCDIR vdir rcexp xpart dired OSTYPE ; (utils) gnproc greadlink gsed multihardlink texinfo # spell-checker:ignore (paths) abmon deref discrim eacces getlimits getopt ginstall inacc infloop inotify reflink ; (misc) INT_OFLOW OFLOW
# spell-checker:ignore baddecode submodules xstrtol distros ; (vars/env) SRCDIR vdir rcexp xpart dired OSTYPE ; (utils) gnproc greadlink gsed multihardlink texinfo CARGOFLAGS
set -e set -e
@ -28,6 +29,7 @@ REPO_main_dir="$(dirname -- "${ME_dir}")"
# Default profile is 'debug' # Default profile is 'debug'
UU_MAKE_PROFILE='debug' UU_MAKE_PROFILE='debug'
CARGO_FEATURE_FLAGS=""
for arg in "$@" for arg in "$@"
do do
@ -93,9 +95,20 @@ echo "UU_BUILD_DIR='${UU_BUILD_DIR}'"
cd "${path_UUTILS}" && echo "[ pwd:'${PWD}' ]" cd "${path_UUTILS}" && echo "[ pwd:'${PWD}' ]"
# Check for SELinux support
if [ "$(uname)" == "Linux" ]; then if [ "$(uname)" == "Linux" ]; then
# only set on linux # Only attempt to enable SELinux features on Linux
export SELINUX_ENABLED=1 export SELINUX_ENABLED=1
CARGO_FEATURE_FLAGS="${CARGO_FEATURE_FLAGS} selinux"
fi
# Trim leading whitespace from feature flags
CARGO_FEATURE_FLAGS="$(echo "${CARGO_FEATURE_FLAGS}" | sed -e 's/^[[:space:]]*//')"
# If we have feature flags, format them correctly for cargo
if [ ! -z "${CARGO_FEATURE_FLAGS}" ]; then
CARGO_FEATURE_FLAGS="--features ${CARGO_FEATURE_FLAGS}"
echo "Building with cargo flags: ${CARGO_FEATURE_FLAGS}"
fi fi
# Set up quilt for patch management # Set up quilt for patch management
@ -111,7 +124,12 @@ else
fi fi
cd - cd -
"${MAKE}" PROFILE="${UU_MAKE_PROFILE}" # Pass the feature flags to make, which will pass them to cargo
"${MAKE}" PROFILE="${UU_MAKE_PROFILE}" CARGOFLAGS="${CARGO_FEATURE_FLAGS}"
touch g
echo "stat with selinux support"
./target/debug/stat -c%C g || true
cp "${UU_BUILD_DIR}/install" "${UU_BUILD_DIR}/ginstall" # The GNU tests rename this script before running, to avoid confusion with the make target cp "${UU_BUILD_DIR}/install" "${UU_BUILD_DIR}/ginstall" # The GNU tests rename this script before running, to avoid confusion with the make target
# Create *sum binaries # Create *sum binaries