Skip to content

Commit a5ebe59

Browse files
oech3oech3
authored andcommitted
build-gnu.sh: Refactor and use multicall for faster build
1 parent bed7012 commit a5ebe59

File tree

1 file changed

+15
-13
lines changed

1 file changed

+15
-13
lines changed

util/build-gnu.sh

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -94,29 +94,31 @@ else
9494
fi
9595
cd -
9696

97-
# Pass the feature flags to make, which will pass them to cargo
98-
"${MAKE}" PROFILE="${PROFILE}" CARGOFLAGS="${CARGO_FEATURE_FLAGS}"
97+
# Build with MULTICALL=y for faster build time
98+
if [ "${SELINUX_ENABLED}" != 1 ];then
99+
"${MAKE}" MULTICALL=y PROFILE="${PROFILE}" CARGOFLAGS="${CARGO_FEATURE_FLAGS}"
100+
else
101+
# But it fails with SELinux by unknown reason
102+
MULTICALL_UTILS="test hashsum true factor false yes"
103+
"${MAKE}" MULTICALL=y UTILS="${MULTICALL_UTILS}" PROFILE="${PROFILE}" CARGOFLAGS="${CARGO_FEATURE_FLAGS}"
104+
"${MAKE}" SKIP_UTILS="${MULTICALL_UTILS}" PROFILE="${PROFILE}" CARGOFLAGS="${CARGO_FEATURE_FLAGS}"
105+
fi
106+
for binary in $("${UU_BUILD_DIR}"/coreutils --list)
107+
do ln -vf "${UU_BUILD_DIR}/coreutils" "${UU_BUILD_DIR}/${binary}"
108+
done
109+
ln -vf "${UU_BUILD_DIR}/install" "${UU_BUILD_DIR}/ginstall" # The GNU tests use renamed install to ginstall
99110
# min test for SELinux
100111
[ "${SELINUX_ENABLED}" = 1 ] && touch g && "${PROFILE}"/stat -c%C g && rm g
101112

102-
cp "${UU_BUILD_DIR}/install" "${UU_BUILD_DIR}/ginstall" # The GNU tests rename this script before running, to avoid confusion with the make target
103-
# Create *sum binaries
104-
for sum in b2sum b3sum md5sum sha1sum sha224sum sha256sum sha384sum sha512sum; do
105-
sum_path="${UU_BUILD_DIR}/${sum}"
106-
test -f "${sum_path}" || (cd ${UU_BUILD_DIR} && ln -s "hashsum" "${sum}")
107-
done
108-
test -f "${UU_BUILD_DIR}/[" || (cd ${UU_BUILD_DIR} && ln -s "test" "[")
109-
110113
##
111114

112115
cd "${path_GNU}" && echo "[ pwd:'${PWD}' ]"
113116

114-
# Any binaries that aren't built become `false` so their tests fail
117+
echo "Symlinking binaries that aren't built become `false` so their tests fail"
115118
for binary in $(./build-aux/gen-lists-of-programs.sh --list-progs); do
116119
bin_path="${UU_BUILD_DIR}/${binary}"
117120
test -f "${bin_path}" || {
118-
echo "'${binary}' was not built with uutils, using the 'false' program"
119-
cp "${UU_BUILD_DIR}/false" "${bin_path}"
121+
ln -svf /usr/bin/false "${bin_path}"
120122
}
121123
done
122124

0 commit comments

Comments
 (0)