Skip to content

Commit 501b467

Browse files
author
oech3
committed
build-gnu.sh: Use MULTICALL=y and build few utils for faster build
1 parent dd08296 commit 501b467

File tree

1 file changed

+19
-16
lines changed

1 file changed

+19
-16
lines changed

util/build-gnu.sh

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -87,18 +87,19 @@ else
8787
fi
8888
cd -
8989

90-
# Pass the feature flags to make, which will pass them to cargo
91-
"${MAKE}" PROFILE="${PROFILE}" SKIP_UTILS=more CARGOFLAGS="${CARGO_FEATURE_FLAGS}"
92-
# min test for SELinux
93-
[ "${SELINUX_ENABLED}" = 1 ] && touch g && "${PROFILE}"/stat -c%C g && rm g
94-
95-
cp "${UU_BUILD_DIR}/install" "${UU_BUILD_DIR}/ginstall" # The GNU tests rename this script before running, to avoid confusion with the make target
96-
# Create *sum binaries
97-
for sum in b2sum md5sum sha1sum sha224sum sha256sum sha384sum sha512sum; do
98-
sum_path="${UU_BUILD_DIR}/${sum}"
99-
test -f "${sum_path}" || (cd ${UU_BUILD_DIR} && ln -s "hashsum" "${sum}")
100-
done
101-
test -f "${UU_BUILD_DIR}/[" || (cd ${UU_BUILD_DIR} && ln -s "test" "[")
90+
# bug: seq with MULTICALL=y breaks env-signal-handler.sh
91+
"${MAKE}" UTILS="install seq" PROFILE="${PROFILE}" CARGOFLAGS="${CARGO_FEATURE_FLAGS}"
92+
ln -vf "${UU_BUILD_DIR}/install" "${UU_BUILD_DIR}/ginstall" # The GNU tests use renamed install to ginstall
93+
if [ "${SELINUX_ENABLED}" = 1 ];then
94+
# Build few utils for SELinux for faster build. MULTICALL=y fails...
95+
"${MAKE}" UTILS="cat chcon cp cut echo env groups id ln ls mkdir mkfifo mknod mktemp mv printf rm rmdir runcon stat test touch tr true uname wc whoami" PROFILE="${PROFILE}" CARGOFLAGS="${CARGO_FEATURE_FLAGS}"
96+
else
97+
# Use MULTICALL=y for faster build
98+
"${MAKE}" MULTICALL=y SKIP_UTILS="install more seq" PROFILE="${PROFILE}" CARGOFLAGS="${CARGO_FEATURE_FLAGS}"
99+
for binary in $("${UU_BUILD_DIR}"/coreutils --list)
100+
do ln -vf "${UU_BUILD_DIR}/coreutils" "${UU_BUILD_DIR}/${binary}"
101+
done
102+
fi
102103

103104
##
104105

@@ -109,8 +110,7 @@ cd "${path_GNU}" && echo "[ pwd:'${PWD}' ]"
109110
for binary in $(./build-aux/gen-lists-of-programs.sh --list-progs); do
110111
bin_path="${UU_BUILD_DIR}/${binary}"
111112
test -f "${bin_path}" || {
112-
echo "'${binary}' was not built with uutils, using the 'false' program"
113-
cp "${UU_BUILD_DIR}/false" "${bin_path}"
113+
cp -v /usr/bin/false "${bin_path}"
114114
}
115115
done
116116

@@ -134,9 +134,12 @@ else
134134
# Use a better diff
135135
"${SED}" -i 's|diff -c|diff -u|g' tests/Coreutils.pm
136136

137-
# Skip make if possible
137+
138138
# Use our nproc for *BSD and macOS
139-
test -f src/getlimits || "${MAKE}" -j "$("${UU_BUILD_DIR}/nproc")"
139+
NPROC=$(command -v "${UU_BUILD_DIR}/nproc" || command -v nproc)
140+
NPROC_NUM=$("${NPROC}")
141+
# Skip make if possible
142+
test -f src/getlimits || "${MAKE}" -j "${NPROC_NUM}"
140143
cp -f src/getlimits "${UU_BUILD_DIR}"
141144

142145
# Handle generated factor tests

0 commit comments

Comments
 (0)