2
2
# `build-gnu.bash` ~ builds GNU coreutils (from supplied sources)
3
3
#
4
4
5
- # 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
5
+ # spell-checker:ignore (paths) abmon deref discrim eacces getlimits getopt ginstall inacc infloop inotify reflink ; (misc) INT_OFLOW OFLOW
6
+ # spell-checker:ignore baddecode submodules xstrtol distros ; (vars/env) SRCDIR vdir rcexp xpart dired OSTYPE ; (utils) gnproc greadlink gsed multihardlink texinfo CARGOFLAGS
6
7
7
8
set -e
8
9
@@ -28,6 +29,7 @@ REPO_main_dir="$(dirname -- "${ME_dir}")"
28
29
29
30
# Default profile is 'debug'
30
31
UU_MAKE_PROFILE=' debug'
32
+ CARGO_FEATURE_FLAGS=" "
31
33
32
34
for arg in " $@ "
33
35
do
@@ -93,9 +95,20 @@ echo "UU_BUILD_DIR='${UU_BUILD_DIR}'"
93
95
94
96
cd " ${path_UUTILS} " && echo " [ pwd:'${PWD} ' ]"
95
97
98
+ # Check for SELinux support
96
99
if [" $( uname) " == " Linux" ]; then
97
- # only set onlinux
100
+ # Only attempt to enable SELinux features onLinux
98
101
export SELINUX_ENABLED=1
102
+ CARGO_FEATURE_FLAGS=" ${CARGO_FEATURE_FLAGS} selinux"
103
+ fi
104
+
105
+ # Trim leading whitespace from feature flags
106
+ CARGO_FEATURE_FLAGS=" $( echo" ${CARGO_FEATURE_FLAGS} " | sed -e' s/^[[:space:]]*//' ) "
107
+
108
+ # If we have feature flags, format them correctly for cargo
109
+ if [! -z " ${CARGO_FEATURE_FLAGS} " ]; then
110
+ CARGO_FEATURE_FLAGS=" --features${CARGO_FEATURE_FLAGS} "
111
+ echo " Building with cargo flags:${CARGO_FEATURE_FLAGS} "
99
112
fi
100
113
101
114
# Set up quilt for patch management
@@ -111,7 +124,12 @@ else
111
124
fi
112
125
cd -
113
126
114
- " ${MAKE} " PROFILE=" ${UU_MAKE_PROFILE} "
127
+ # Pass the feature flags to make, which will pass them to cargo
128
+ " ${MAKE} " PROFILE=" ${UU_MAKE_PROFILE} " CARGOFLAGS=" ${CARGO_FEATURE_FLAGS} "
129
+ touch g
130
+ echo " stat with selinux support"
131
+ ./target/debug/stat -c%C g|| true
132
+
115
133
116
134
cp" ${UU_BUILD_DIR} /install" " ${UU_BUILD_DIR} /ginstall" # The GNU tests rename this script before running, to avoid confusion with the make target
117
135
# Create *sum binaries