|
|
|
|
@ -51,8 +51,11 @@ probe_includes=()
|
|
|
|
|
for probe_include in '' include celt silk silk/float silk/fixed src; do |
|
|
|
|
probe_includes+=("-I$probe_opus/$probe_include") |
|
|
|
|
done |
|
|
|
|
probe_step 'Compile Opus laplace.c' "$probe_cc" -v -DOPUS_BUILD -DUSE_ALLOCA -DVAR_ARRAYS "${probe_includes[@]}" \ |
|
|
|
|
-O3 -DNDEBUG -std=gnu99 -MD -MF "$probe_dir/laplace.d" -c "$probe_opus/celt/laplace.c" -o "$probe_dir/laplace.o" || exit $? |
|
|
|
|
for probe_source in laplace bands; do |
|
|
|
|
probe_step "Compile Opus $probe_source.c" "$probe_cc" -v -DOPUS_BUILD -DUSE_ALLOCA -DVAR_ARRAYS "${probe_includes[@]}" \ |
|
|
|
|
-O3 -DNDEBUG -std=gnu99 -MD -MF "$probe_dir/$probe_source.d" \ |
|
|
|
|
-c "$probe_opus/celt/$probe_source.c" -o "$probe_dir/$probe_source.o" || exit $? |
|
|
|
|
done |
|
|
|
|
|
|
|
|
|
probe_build="$probe_root/tools/chatgui/build" |
|
|
|
|
if [ ! -f "$probe_build/CMakeCache.txt" ]; then |
|
|
|
|
@ -66,5 +69,42 @@ fi
|
|
|
|
|
probe_step 'CMake cache settings' sed -n -E \ |
|
|
|
|
'/^CMAKE_(C_COMPILER|C_COMPILER_LAUNCHER|C_FLAGS(_(DEBUG|RELEASE|MINSIZEREL|RELWITHDEBINFO))?|MAKE_PROGRAM|GENERATOR|BUILD_TYPE):/p' \ |
|
|
|
|
"$probe_build/CMakeCache.txt" || exit $? |
|
|
|
|
|
|
|
|
|
# Повторяем Windows-команду без преобразования аргументов MSYS2; добавляем только GCC -v. |
|
|
|
|
if [ "${MSYSTEM:-}" = UCRT64 ]; then |
|
|
|
|
probe_ninja=$(sed -n 's/^CMAKE_MAKE_PROGRAM:[^=]*=//p' "$probe_build/CMakeCache.txt") |
|
|
|
|
probe_ninja=${probe_ninja%$'\r'} |
|
|
|
|
probe_ninja=$(cygpath -u "$probe_ninja") || exit $? |
|
|
|
|
"$probe_ninja" -C "$probe_build" -t commands opus_internal > "$probe_dir/ninja-commands.txt" |
|
|
|
|
probe_result=$? |
|
|
|
|
if [ "$probe_result" -ne 0 ]; then |
|
|
|
|
cat "$probe_dir/ninja-commands.txt" |
|
|
|
|
printf '[ERROR] Cannot read Ninja commands, exit code: %d\n' "$probe_result" |
|
|
|
|
exit "$probe_result" |
|
|
|
|
fi |
|
|
|
|
probe_command='' |
|
|
|
|
while IFS= read -r probe_line; do |
|
|
|
|
probe_line=${probe_line%$'\r'} |
|
|
|
|
case "$probe_line" in |
|
|
|
|
*' -DOPUS_BUILD '*' -c '*'/celt/bands.c'|*' -DOPUS_BUILD '*' -c '*'/celt/bands.c"') |
|
|
|
|
probe_command="$probe_line"; break ;; |
|
|
|
|
esac |
|
|
|
|
done < "$probe_dir/ninja-commands.txt" |
|
|
|
|
if [ -z "$probe_command" ]; then |
|
|
|
|
printf '[ERROR] Cannot find the Opus bands.c compile command in Ninja.\n' |
|
|
|
|
exit 1 |
|
|
|
|
fi |
|
|
|
|
probe_command=${probe_command/ -DOPUS_BUILD/ -v -DOPUS_BUILD} |
|
|
|
|
printf '[INFO] Native command: %s\n' "$probe_command" |
|
|
|
|
printf '@echo off\r\n%s\r\nexit /b %%errorlevel%%\r\n' "$probe_command" > "$probe_dir/replay.cmd" || { |
|
|
|
|
printf '[ERROR] Cannot write the native compiler replay script.\n' |
|
|
|
|
exit 1 |
|
|
|
|
} |
|
|
|
|
probe_cmd=$(cygpath -u "${COMSPEC:-C:/Windows/System32/cmd.exe}") || exit $? |
|
|
|
|
probe_replay=$(cygpath -w "$probe_dir/replay.cmd") || exit $? |
|
|
|
|
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 $? |
|
|
|
|
fi |
|
|
|
|
probe_step 'Build Opus with CMake' cmake --build "$probe_build" --target opus_internal --parallel 1 --verbose || exit $? |
|
|
|
|
printf '\n[SUCCESS] Standalone Opus compilation and CMake Opus build completed.\n' |
|
|
|
|
|