From 22dc854d8fd458d02aca328c211e37f3363bc650 Mon Sep 17 00:00:00 2001 From: E <79379754+oech3@users.noreply.github.com> Date: Wed, 12 Nov 2025 14:50:43 +0900 Subject: [PATCH 01/14] build-gnu.sh: Use MULTICALL=y for faster build time --- util/build-gnu.sh | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/util/build-gnu.sh b/util/build-gnu.sh index 75dfdb0358d..47ca93a87b4 100755 --- a/util/build-gnu.sh +++ b/util/build-gnu.sh @@ -131,19 +131,19 @@ fi cd - # Pass the feature flags to make, which will pass them to cargo -"${MAKE}" PROFILE="${UU_MAKE_PROFILE}" CARGOFLAGS="${CARGO_FEATURE_FLAGS}" +"${MAKE}" MULTICALL=y PROFILE="${UU_MAKE_PROFILE}" CARGOFLAGS="${CARGO_FEATURE_FLAGS}" +# Hardlink binaries +for binary in $(${UU_BUILD_DIR}/coreutils --list); do + (cd ${UU_BUILD_DIR} && ln -vf coreutils "$binary") +done +# The GNU tests rename this script before running, to avoid confusion with the make target +ln -vf "${UU_BUILD_DIR}/install" "${UU_BUILD_DIR}/ginstall" touch g echo "stat with selinux support" ./target/debug/stat -c%C g || true rm g -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 -for sum in b2sum b3sum md5sum sha1sum sha224sum sha256sum sha384sum sha512sum; do - sum_path="${UU_BUILD_DIR}/${sum}" - test -f "${sum_path}" || (cd ${UU_BUILD_DIR} && ln -s "hashsum" "${sum}") -done -test -f "${UU_BUILD_DIR}/[" || (cd ${UU_BUILD_DIR} && ln -s "test" "[") + ## From feb1954f52db8500584207aa345c51816eb15a5f Mon Sep 17 00:00:00 2001 From: E <79379754+oech3@users.noreply.github.com> Date: Wed, 12 Nov 2025 14:54:37 +0900 Subject: [PATCH 02/14] Reduce lines --- util/build-gnu.sh | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/util/build-gnu.sh b/util/build-gnu.sh index 47ca93a87b4..f0f47402a98 100755 --- a/util/build-gnu.sh +++ b/util/build-gnu.sh @@ -136,15 +136,12 @@ cd - for binary in $(${UU_BUILD_DIR}/coreutils --list); do (cd ${UU_BUILD_DIR} && ln -vf coreutils "$binary") done -# The GNU tests rename this script before running, to avoid confusion with the make target -ln -vf "${UU_BUILD_DIR}/install" "${UU_BUILD_DIR}/ginstall" +ln -vf "${UU_BUILD_DIR}/install" "${UU_BUILD_DIR}/ginstall" # The GNU tests rename this script before running, to avoid confusion with the make target touch g echo "stat with selinux support" ./target/debug/stat -c%C g || true rm g - - ## cd "${path_GNU}" && echo "[ pwd:'${PWD}' ]" From f23bd97eea62ca58054283403a4343c99de06c4e Mon Sep 17 00:00:00 2001 From: E <79379754+oech3@users.noreply.github.com> Date: Wed, 12 Nov 2025 16:17:04 +0900 Subject: [PATCH 03/14] Wrap ginstall --- util/build-gnu.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/util/build-gnu.sh b/util/build-gnu.sh index f0f47402a98..0cf476a0e05 100755 --- a/util/build-gnu.sh +++ b/util/build-gnu.sh @@ -136,7 +136,7 @@ cd - for binary in $(${UU_BUILD_DIR}/coreutils --list); do (cd ${UU_BUILD_DIR} && ln -vf coreutils "$binary") done -ln -vf "${UU_BUILD_DIR}/install" "${UU_BUILD_DIR}/ginstall" # The GNU tests rename this script before running, to avoid confusion with the make target +echo -e '#!/bin/sh\nexec $(dirname $0)/install "$@"' > "${UU_BUILD_DIR}/ginstall" && chmod +x "${UU_BUILD_DIR}/ginstall" # The GNU tests rename this script before running, to avoid confusion with the make target touch g echo "stat with selinux support" ./target/debug/stat -c%C g || true From 2e35a6ba31ffe86668e504a3e12a055cf0c3cd2c Mon Sep 17 00:00:00 2001 From: oech3 <79379754+oech3@users.noreply.github.com> Date: Wed, 12 Nov 2025 18:30:07 +0900 Subject: [PATCH 04/14] Use UU_BUILD_DIR --- util/build-gnu.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/util/build-gnu.sh b/util/build-gnu.sh index 0cf476a0e05..d06f60bd607 100755 --- a/util/build-gnu.sh +++ b/util/build-gnu.sh @@ -139,7 +139,7 @@ done echo -e '#!/bin/sh\nexec $(dirname $0)/install "$@"' > "${UU_BUILD_DIR}/ginstall" && chmod +x "${UU_BUILD_DIR}/ginstall" # The GNU tests rename this script before running, to avoid confusion with the make target touch g echo "stat with selinux support" -./target/debug/stat -c%C g || true +${UU_BUILD_DIR}/stat -c%C g || true rm g ## From a02310268b2f96bf58942f4e4dfcad1538375a02 Mon Sep 17 00:00:00 2001 From: oech3 <79379754+oech3@users.noreply.github.com> Date: Wed, 12 Nov 2025 20:04:26 +0900 Subject: [PATCH 05/14] copy --- util/build-gnu.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/util/build-gnu.sh b/util/build-gnu.sh index d06f60bd607..0275b938ebf 100755 --- a/util/build-gnu.sh +++ b/util/build-gnu.sh @@ -132,9 +132,9 @@ cd - # Pass the feature flags to make, which will pass them to cargo "${MAKE}" MULTICALL=y PROFILE="${UU_MAKE_PROFILE}" CARGOFLAGS="${CARGO_FEATURE_FLAGS}" -# Hardlink binaries +# copy binaries for binary in $(${UU_BUILD_DIR}/coreutils --list); do - (cd ${UU_BUILD_DIR} && ln -vf coreutils "$binary") + (cd ${UU_BUILD_DIR} && cp -vf coreutils "$binary") done echo -e '#!/bin/sh\nexec $(dirname $0)/install "$@"' > "${UU_BUILD_DIR}/ginstall" && chmod +x "${UU_BUILD_DIR}/ginstall" # The GNU tests rename this script before running, to avoid confusion with the make target touch g From 0826906ec7fe47407e83464b7bd0e6bc7335205d Mon Sep 17 00:00:00 2001 From: oech3 <79379754+oech3@users.noreply.github.com> Date: Wed, 12 Nov 2025 20:10:47 +0900 Subject: [PATCH 06/14] copy [ --- util/build-gnu.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/util/build-gnu.sh b/util/build-gnu.sh index 0275b938ebf..88739da68f6 100755 --- a/util/build-gnu.sh +++ b/util/build-gnu.sh @@ -134,7 +134,7 @@ cd - "${MAKE}" MULTICALL=y PROFILE="${UU_MAKE_PROFILE}" CARGOFLAGS="${CARGO_FEATURE_FLAGS}" # copy binaries for binary in $(${UU_BUILD_DIR}/coreutils --list); do - (cd ${UU_BUILD_DIR} && cp -vf coreutils "$binary") + (cd ${UU_BUILD_DIR} && cp -v --remove-destination coreutils "$binary") done echo -e '#!/bin/sh\nexec $(dirname $0)/install "$@"' > "${UU_BUILD_DIR}/ginstall" && chmod +x "${UU_BUILD_DIR}/ginstall" # The GNU tests rename this script before running, to avoid confusion with the make target touch g From 17a087565a4649efe054eac872be77d78f85043c Mon Sep 17 00:00:00 2001 From: oech3 <79379754+oech3@users.noreply.github.com> Date: Wed, 12 Nov 2025 23:30:01 +0900 Subject: [PATCH 07/14] Build install --- util/build-gnu.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/util/build-gnu.sh b/util/build-gnu.sh index 88739da68f6..3af6132931d 100755 --- a/util/build-gnu.sh +++ b/util/build-gnu.sh @@ -131,12 +131,13 @@ fi cd - # Pass the feature flags to make, which will pass them to cargo -"${MAKE}" MULTICALL=y PROFILE="${UU_MAKE_PROFILE}" CARGOFLAGS="${CARGO_FEATURE_FLAGS}" +# The GNU tests rename install to ginstall to avoid confusion with the make target +"${MAKE}" UTILS=install PROG_PREFIX=g PROFILE="${UU_MAKE_PROFILE}" CARGOFLAGS="${CARGO_FEATURE_FLAGS}" +"${MAKE}" SKIP_UTILS=install MULTICALL=y PROFILE="${UU_MAKE_PROFILE}" CARGOFLAGS="${CARGO_FEATURE_FLAGS}" # copy binaries for binary in $(${UU_BUILD_DIR}/coreutils --list); do (cd ${UU_BUILD_DIR} && cp -v --remove-destination coreutils "$binary") done -echo -e '#!/bin/sh\nexec $(dirname $0)/install "$@"' > "${UU_BUILD_DIR}/ginstall" && chmod +x "${UU_BUILD_DIR}/ginstall" # The GNU tests rename this script before running, to avoid confusion with the make target touch g echo "stat with selinux support" ${UU_BUILD_DIR}/stat -c%C g || true From 53445094772476cfb682bba6a8eef98df86b0dab Mon Sep 17 00:00:00 2001 From: oech3 <79379754+oech3@users.noreply.github.com> Date: Thu, 13 Nov 2025 01:52:16 +0900 Subject: [PATCH 08/14] Update build-gnu.sh --- util/build-gnu.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/util/build-gnu.sh b/util/build-gnu.sh index 3af6132931d..eaceb90d7be 100755 --- a/util/build-gnu.sh +++ b/util/build-gnu.sh @@ -132,7 +132,8 @@ cd - # Pass the feature flags to make, which will pass them to cargo # The GNU tests rename install to ginstall to avoid confusion with the make target -"${MAKE}" UTILS=install PROG_PREFIX=g PROFILE="${UU_MAKE_PROFILE}" CARGOFLAGS="${CARGO_FEATURE_FLAGS}" +"${MAKE}" UTILS=install PROFILE="${UU_MAKE_PROFILE}" CARGOFLAGS="${CARGO_FEATURE_FLAGS}" +cp ${UU_BUILD_DIR}/install ${UU_BUILD_DIR}/ginstall "${MAKE}" SKIP_UTILS=install MULTICALL=y PROFILE="${UU_MAKE_PROFILE}" CARGOFLAGS="${CARGO_FEATURE_FLAGS}" # copy binaries for binary in $(${UU_BUILD_DIR}/coreutils --list); do From e5be5b772d5b067c67eb298c4cced5f2217ec492 Mon Sep 17 00:00:00 2001 From: oech3 <79379754+oech3@users.noreply.github.com> Date: Thu, 13 Nov 2025 04:29:56 +0900 Subject: [PATCH 09/14] label coreutils --- util/build-gnu.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/util/build-gnu.sh b/util/build-gnu.sh index eaceb90d7be..5e002a1fb94 100755 --- a/util/build-gnu.sh +++ b/util/build-gnu.sh @@ -135,13 +135,14 @@ cd - "${MAKE}" UTILS=install PROFILE="${UU_MAKE_PROFILE}" CARGOFLAGS="${CARGO_FEATURE_FLAGS}" cp ${UU_BUILD_DIR}/install ${UU_BUILD_DIR}/ginstall "${MAKE}" SKIP_UTILS=install MULTICALL=y PROFILE="${UU_MAKE_PROFILE}" CARGOFLAGS="${CARGO_FEATURE_FLAGS}" -# copy binaries + +chcon -t bin_t "${UU_BUILD_DIR}/coreutils" || : for binary in $(${UU_BUILD_DIR}/coreutils --list); do - (cd ${UU_BUILD_DIR} && cp -v --remove-destination coreutils "$binary") + (cd ${UU_BUILD_DIR} && ln -vf coreutils "$binary") done touch g echo "stat with selinux support" -${UU_BUILD_DIR}/stat -c%C g || true +${UU_BUILD_DIR}/stat -c%C g || : rm g ## From c6f9dabdbb74e23596c3bf1ef3272d7bee675a7b Mon Sep 17 00:00:00 2001 From: oech3 <79379754+oech3@users.noreply.github.com> Date: Thu, 13 Nov 2025 06:16:18 +0900 Subject: [PATCH 10/14] Update util/build-gnu.sh MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Cả thế giới là Rust <90588855+naoNao89@users.noreply.github.com> --- util/build-gnu.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/util/build-gnu.sh b/util/build-gnu.sh index 5e002a1fb94..9deb9e923d9 100755 --- a/util/build-gnu.sh +++ b/util/build-gnu.sh @@ -139,6 +139,7 @@ cp ${UU_BUILD_DIR}/install ${UU_BUILD_DIR}/ginstall chcon -t bin_t "${UU_BUILD_DIR}/coreutils" || : for binary in $(${UU_BUILD_DIR}/coreutils --list); do (cd ${UU_BUILD_DIR} && ln -vf coreutils "$binary") + restorecon "${UU_BUILD_DIR}/${binary}" 2>/dev/null || true done touch g echo "stat with selinux support" From 8ddd9df1675ca7053edaa0ec94feb95304b158ea Mon Sep 17 00:00:00 2001 From: oech3 <79379754+oech3@users.noreply.github.com> Date: Thu, 13 Nov 2025 06:44:15 +0900 Subject: [PATCH 11/14] Update build-gnu.sh --- util/build-gnu.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/util/build-gnu.sh b/util/build-gnu.sh index 9deb9e923d9..3a306c1812a 100755 --- a/util/build-gnu.sh +++ b/util/build-gnu.sh @@ -133,12 +133,12 @@ cd - # Pass the feature flags to make, which will pass them to cargo # The GNU tests rename install to ginstall to avoid confusion with the make target "${MAKE}" UTILS=install PROFILE="${UU_MAKE_PROFILE}" CARGOFLAGS="${CARGO_FEATURE_FLAGS}" -cp ${UU_BUILD_DIR}/install ${UU_BUILD_DIR}/ginstall +ln ${UU_BUILD_DIR}/install ${UU_BUILD_DIR}/ginstall "${MAKE}" SKIP_UTILS=install MULTICALL=y PROFILE="${UU_MAKE_PROFILE}" CARGOFLAGS="${CARGO_FEATURE_FLAGS}" chcon -t bin_t "${UU_BUILD_DIR}/coreutils" || : for binary in $(${UU_BUILD_DIR}/coreutils --list); do - (cd ${UU_BUILD_DIR} && ln -vf coreutils "$binary") + (cd ${UU_BUILD_DIR} && cp -v --remove-destination coreutils "$binary") restorecon "${UU_BUILD_DIR}/${binary}" 2>/dev/null || true done touch g From b3997197e117cf6b9061e8eac58209871cfd6074 Mon Sep 17 00:00:00 2001 From: oech3 <79379754+oech3@users.noreply.github.com> Date: Thu, 13 Nov 2025 07:49:52 +0900 Subject: [PATCH 12/14] Update build-gnu.sh --- util/build-gnu.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/util/build-gnu.sh b/util/build-gnu.sh index 3a306c1812a..527165ed556 100755 --- a/util/build-gnu.sh +++ b/util/build-gnu.sh @@ -139,7 +139,7 @@ ln ${UU_BUILD_DIR}/install ${UU_BUILD_DIR}/ginstall chcon -t bin_t "${UU_BUILD_DIR}/coreutils" || : for binary in $(${UU_BUILD_DIR}/coreutils --list); do (cd ${UU_BUILD_DIR} && cp -v --remove-destination coreutils "$binary") - restorecon "${UU_BUILD_DIR}/${binary}" 2>/dev/null || true + chcon -t bin_t "${UU_BUILD_DIR}/${binary}" || : done touch g echo "stat with selinux support" From 13f0fa48b336ce2eb9766a75dc795fe5401767d4 Mon Sep 17 00:00:00 2001 From: oech3 <79379754+oech3@users.noreply.github.com> Date: Thu, 13 Nov 2025 17:30:42 +0900 Subject: [PATCH 13/14] Avoid ||: --- util/build-gnu.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/util/build-gnu.sh b/util/build-gnu.sh index 527165ed556..cfd2931c255 100755 --- a/util/build-gnu.sh +++ b/util/build-gnu.sh @@ -136,10 +136,10 @@ cd - ln ${UU_BUILD_DIR}/install ${UU_BUILD_DIR}/ginstall "${MAKE}" SKIP_UTILS=install MULTICALL=y PROFILE="${UU_MAKE_PROFILE}" CARGOFLAGS="${CARGO_FEATURE_FLAGS}" -chcon -t bin_t "${UU_BUILD_DIR}/coreutils" || : +[ SELINUX_ENABLED = 1 ] && chcon -t bin_t "${UU_BUILD_DIR}/coreutils" for binary in $(${UU_BUILD_DIR}/coreutils --list); do (cd ${UU_BUILD_DIR} && cp -v --remove-destination coreutils "$binary") - chcon -t bin_t "${UU_BUILD_DIR}/${binary}" || : + [ SELINUX_ENABLED = 1 ] && chcon -t bin_t "${UU_BUILD_DIR}/${binary}" done touch g echo "stat with selinux support" From f15dee8128eaefa9c66df20102169871b96c346a Mon Sep 17 00:00:00 2001 From: oech3 <79379754+oech3@users.noreply.github.com> Date: Thu, 13 Nov 2025 17:34:18 +0900 Subject: [PATCH 14/14] Update build-gnu.sh --- util/build-gnu.sh | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/util/build-gnu.sh b/util/build-gnu.sh index cfd2931c255..3563dfdb1ff 100755 --- a/util/build-gnu.sh +++ b/util/build-gnu.sh @@ -136,15 +136,12 @@ cd - ln ${UU_BUILD_DIR}/install ${UU_BUILD_DIR}/ginstall "${MAKE}" SKIP_UTILS=install MULTICALL=y PROFILE="${UU_MAKE_PROFILE}" CARGOFLAGS="${CARGO_FEATURE_FLAGS}" -[ SELINUX_ENABLED = 1 ] && chcon -t bin_t "${UU_BUILD_DIR}/coreutils" +[ ${SELINUX_ENABLED} = 1 ] && chcon -t bin_t "${UU_BUILD_DIR}/coreutils" for binary in $(${UU_BUILD_DIR}/coreutils --list); do (cd ${UU_BUILD_DIR} && cp -v --remove-destination coreutils "$binary") - [ SELINUX_ENABLED = 1 ] && chcon -t bin_t "${UU_BUILD_DIR}/${binary}" + [ ${SELINUX_ENABLED} = 1 ] && chcon -t bin_t "${UU_BUILD_DIR}/${binary}" done -touch g -echo "stat with selinux support" -${UU_BUILD_DIR}/stat -c%C g || : -rm g +[ ${SELINUX_ENABLED} = 1 ] && echo "stat with selinux support" && touch g && ${UU_BUILD_DIR}/stat -c%C g && rm g ##