|
|
|
|
@ -20,7 +20,7 @@ printf '[INFO] Temporary directory: %s\n' "$probe_dir"
|
|
|
|
|
probe_step() { |
|
|
|
|
local step="$1" result |
|
|
|
|
shift |
|
|
|
|
printf '\n[INFO] %s\n[INFO] Command:' "$step" |
|
|
|
|
printf '\n[INFO] %s\n[INFO] Directory: %s\n[INFO] Command:' "$step" "$PWD" |
|
|
|
|
printf ' %q' "$@" |
|
|
|
|
printf '\n' |
|
|
|
|
"$@" |
|
|
|
|
@ -102,6 +102,42 @@ if [ "${MSYSTEM:-}" = UCRT64 ]; then
|
|
|
|
|
} |
|
|
|
|
probe_cmd=$(cygpath -u "${COMSPEC:-C:/Windows/System32/cmd.exe}") || exit $? |
|
|
|
|
probe_replay=$(cygpath -w "$probe_dir/replay.cmd") || exit $? |
|
|
|
|
|
|
|
|
|
# CMD сохраняет полный Windows-код завершения cc1; Bash оставляет только младший байт. |
|
|
|
|
probe_cc1=$("$probe_cc" -print-prog-name=cc1) || { printf '[ERROR] Cannot locate cc1.\n'; exit 1; } |
|
|
|
|
probe_cc1=${probe_cc1%$'\r'} |
|
|
|
|
probe_cc1=$(cygpath -u "$probe_cc1") || { printf '[ERROR] Cannot resolve the cc1 path.\n'; exit 1; } |
|
|
|
|
probe_cc1_native=$(cygpath -w "$probe_cc1") || { printf '[ERROR] Cannot resolve the native cc1 path.\n'; exit 1; } |
|
|
|
|
printf '@echo off\r\n"%s" --version\r\nset "UTUN_CC1_RESULT=%%errorlevel%%"\r\n' "$probe_cc1_native" \ |
|
|
|
|
> "$probe_dir/cc1.cmd" || { printf '[ERROR] Cannot write the cc1 probe script.\n'; exit 1; } |
|
|
|
|
printf 'echo [INFO] cc1 Windows exit code: %%UTUN_CC1_RESULT%%\r\nexit /b %%UTUN_CC1_RESULT%%\r\n' \ |
|
|
|
|
>> "$probe_dir/cc1.cmd" || { printf '[ERROR] Cannot finish the cc1 probe script.\n'; exit 1; } |
|
|
|
|
probe_cc1_script=$(cygpath -w "$probe_dir/cc1.cmd") || { printf '[ERROR] Cannot resolve the cc1 script path.\n'; exit 1; } |
|
|
|
|
for probe_cwd in "$probe_root" "$probe_build"; do |
|
|
|
|
cd -- "$probe_cwd" || { printf '[ERROR] Cannot open probe directory: %s\n' "$probe_cwd"; exit 1; } |
|
|
|
|
MSYS2_ARG_CONV_EXCL='*' probe_step 'Launch cc1 directly' "$probe_cmd" /d /c call "$probe_cc1_script" |
|
|
|
|
# При ошибке продолжаем сравнение каталогов и DLL, затем повторяем исходный сбой. |
|
|
|
|
done |
|
|
|
|
cd -- "$probe_root" || { printf '[ERROR] Cannot open the repository directory.\n'; exit 1; } |
|
|
|
|
probe_objdump="${probe_cc%/*}/objdump.exe" |
|
|
|
|
"$probe_objdump" -p "$probe_cc1" > "$probe_dir/cc1-imports.txt" || { |
|
|
|
|
printf '[ERROR] Cannot inspect cc1 imports.\n'; exit 1; |
|
|
|
|
} |
|
|
|
|
printf '\n[INFO] cc1 DLL imports:\n' |
|
|
|
|
sed -n '/DLL Name:/p' "$probe_dir/cc1-imports.txt" || { printf '[ERROR] Cannot read cc1 imports.\n'; exit 1; } |
|
|
|
|
for probe_dll in "$probe_build/"*.dll; do |
|
|
|
|
[ -f "$probe_dll" ] || continue |
|
|
|
|
probe_system_dll="${probe_cc%/*}/${probe_dll##*/}" |
|
|
|
|
[ -f "$probe_system_dll" ] || continue |
|
|
|
|
cmp -s "$probe_dll" "$probe_system_dll" |
|
|
|
|
probe_result=$? |
|
|
|
|
case "$probe_result" in |
|
|
|
|
0) printf '[INFO] DLL matches UCRT64: %s\n' "${probe_dll##*/}" ;; |
|
|
|
|
1) printf '[WARN] DLL differs from UCRT64: %s\n' "${probe_dll##*/}" |
|
|
|
|
probe_step 'DLL hashes' sha256sum "$probe_dll" "$probe_system_dll" || exit $? ;; |
|
|
|
|
*) printf '[ERROR] Cannot compare DLL: %s, exit code: %d\n' "$probe_dll" "$probe_result"; exit "$probe_result" ;; |
|
|
|
|
esac |
|
|
|
|
done |
|
|
|
|
cd -- "$probe_build" || { printf '[ERROR] Cannot open the ChatGUI build directory.\n'; exit 1; } |
|
|
|
|
MSYS2_ARG_CONV_EXCL='*' probe_step 'Replay Ninja bands.c command with GCC verbose output' \ |
|
|
|
|
"$probe_cmd" /d /c call "$probe_replay" || exit $? |
|
|
|
|
|