fix: windows crashes & builds (#55)
- Doing jobs in parallels in GHA (Divide build time by 3).
- Now use custom webrtc builds for this repo
- Windows crashes when receiving video is now fixed (thanks @cloudwebrtc)
- Now reading defines from webrtc.ninja
- Added a small create_pc test to be sure libwebrtc is working/linked correctly
- Fix MacOS builds
- Fixed Linux duplicated main build error (due to nasm)
This commit is contained in:
@@ -2,7 +2,9 @@
|
||||
src
|
||||
.gclient_*
|
||||
depot_tools
|
||||
ninja
|
||||
|
||||
# builds
|
||||
macos
|
||||
linux
|
||||
win*
|
||||
macos*
|
||||
linux*
|
||||
|
||||
@@ -1,5 +1,42 @@
|
||||
#!/bin/bash
|
||||
|
||||
arch=""
|
||||
profile="release"
|
||||
|
||||
while [ "$#" -gt 0 ]; do
|
||||
case "$1" in
|
||||
--arch)
|
||||
arch="$2"
|
||||
if [ "$arch" != "x64" ] && [ "$arch" != "arm64" ]; then
|
||||
echo "Error: Invalid value for --arch. Must be 'x64' or 'arm64'."
|
||||
exit 1
|
||||
fi
|
||||
shift 2
|
||||
;;
|
||||
--profile)
|
||||
profile="$2"
|
||||
if [ "$profile" != "debug" ] && [ "$profile" != "release" ]; then
|
||||
echo "Error: Invalid value for --profile. Must be 'debug' or 'release'."
|
||||
exit 1
|
||||
fi
|
||||
shift 2
|
||||
;;
|
||||
*)
|
||||
echo "Error: Unknown argument '$1'"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [ -z "$arch" ]; then
|
||||
echo "Error: --arch must be set."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Building LiveKit WebRTC"
|
||||
echo "Arch: $arch"
|
||||
echo "Profile: $profile"
|
||||
|
||||
if [ ! -e "$(pwd)/depot_tools" ]
|
||||
then
|
||||
git clone --depth 1 https://chromium.googlesource.com/chromium/tools/depot_tools.git
|
||||
@@ -7,71 +44,70 @@ fi
|
||||
|
||||
export COMMAND_DIR=$(cd $(dirname $0); pwd)
|
||||
export PATH="$(pwd)/depot_tools:$PATH"
|
||||
export OUTPUT_DIR="$(pwd)/src/out"
|
||||
export ARTIFACTS_DIR="$(pwd)/linux"
|
||||
export OUTPUT_DIR="$(pwd)/src/out-$arch-$profile"
|
||||
export ARTIFACTS_DIR="$(pwd)/linux-$arch-$profile"
|
||||
|
||||
if [ ! -e "$(pwd)/src" ]
|
||||
then
|
||||
gclient sync
|
||||
gclient sync -D --no-history
|
||||
fi
|
||||
|
||||
cd src
|
||||
git apply "$COMMAND_DIR/patches/add_license_dav1d.patch" -v
|
||||
git apply "$COMMAND_DIR/patches/ssl_verify_callback_with_native_handle.patch" -v
|
||||
git apply "$COMMAND_DIR/patches/fix_mocks.patch" -v
|
||||
git apply "$COMMAND_DIR/patches/add_license_dav1d.patch" -v --ignore-space-change --ignore-whitespace --whitespace=nowarn
|
||||
git apply "$COMMAND_DIR/patches/ssl_verify_callback_with_native_handle.patch" -v --ignore-space-change --ignore-whitespace --whitespace=nowarn
|
||||
git apply "$COMMAND_DIR/patches/fix_mocks.patch" -v --ignore-space-change --ignore-whitespace --whitespace=nowarn
|
||||
cd ..
|
||||
|
||||
mkdir -p "$ARTIFACTS_DIR/lib"
|
||||
|
||||
for is_debug in "true" "false"
|
||||
do
|
||||
for target_cpu in "x64" "arm64"
|
||||
do
|
||||
args="is_debug=${is_debug} \
|
||||
target_os=\"linux\" \
|
||||
target_cpu=\"${target_cpu}\" \
|
||||
rtc_enable_protobuf=false \
|
||||
treat_warnings_as_errors=false \
|
||||
use_custom_libcxx=false \
|
||||
rtc_include_tests=false \
|
||||
rtc_build_tools=false \
|
||||
rtc_build_examples=false \
|
||||
rtc_libvpx_build_vp9=true \
|
||||
is_component_build=false \
|
||||
enable_stripping=true \
|
||||
use_goma=false \
|
||||
rtc_use_h264=false \
|
||||
rtc_use_pipewire=false \
|
||||
symbol_level=0 \
|
||||
enable_iterator_debugging=false \
|
||||
use_rtti=true \
|
||||
rtc_use_x11=false"
|
||||
python3 "./src/build/linux/sysroot_scripts/install-sysroot.py" --arch="$arch"
|
||||
|
||||
if [ $is_debug = "true" ]; then
|
||||
args="${args} is_asan=true is_lsan=true";
|
||||
fi
|
||||
debug="false"
|
||||
if [ "$profile" = "debug" ]; then
|
||||
debug="true"
|
||||
fi
|
||||
|
||||
# generate ninja files
|
||||
gn gen "$OUTPUT_DIR" --root="src" --args="${args}"
|
||||
args="is_debug=$debug \
|
||||
target_os=\"linux\" \
|
||||
target_cpu=\"$arch\" \
|
||||
rtc_enable_protobuf=false \
|
||||
treat_warnings_as_errors=false \
|
||||
use_custom_libcxx=false \
|
||||
rtc_include_tests=false \
|
||||
rtc_build_tools=false \
|
||||
rtc_build_examples=false \
|
||||
rtc_libvpx_build_vp9=true \
|
||||
is_component_build=false \
|
||||
enable_stripping=true \
|
||||
use_goma=false \
|
||||
rtc_use_h264=false \
|
||||
rtc_use_pipewire=false \
|
||||
symbol_level=0 \
|
||||
enable_iterator_debugging=false \
|
||||
use_rtti=true \
|
||||
rtc_use_x11=false"
|
||||
|
||||
# build static library
|
||||
ninja -C "$OUTPUT_DIR" webrtc
|
||||
if [ "$debug" = "true" ]; then
|
||||
args="${args} is_asan=true is_lsan=true";
|
||||
fi
|
||||
|
||||
filename="libwebrtc.a"
|
||||
if [ $is_debug = "true" ]; then
|
||||
filename="libwebrtcd.a"
|
||||
fi
|
||||
# generate ninja files
|
||||
gn gen "$OUTPUT_DIR" --root="src" --args="${args}"
|
||||
|
||||
# cppy static library
|
||||
mkdir -p "$ARTIFACTS_DIR/lib/${target_cpu}"
|
||||
cp "$OUTPUT_DIR/obj/libwebrtc.a" "$ARTIFACTS_DIR/lib/${target_cpu}/${filename}"
|
||||
done
|
||||
done
|
||||
# build static library
|
||||
ninja -C "$OUTPUT_DIR" :default
|
||||
|
||||
# make libwebrtc.a
|
||||
# don't include nasm
|
||||
ar -rc "$ARTIFACTS_DIR/lib/libwebrtc.a" `find "$OUTPUT_DIR/obj" -name '*.o' -not -path "*/third_party/nasm/*"`
|
||||
|
||||
python3 "./src/tools_webrtc/libs/generate_licenses.py" \
|
||||
--target :webrtc "$OUTPUT_DIR" "$OUTPUT_DIR"
|
||||
--target :default "$OUTPUT_DIR" "$OUTPUT_DIR"
|
||||
|
||||
cp "$OUTPUT_DIR/obj/webrtc.ninja" "$ARTIFACTS_DIR"
|
||||
cp "$OUTPUT_DIR/args.gn" "$ARTIFACTS_DIR"
|
||||
cp "$OUTPUT_DIR/LICENSE.md" "$ARTIFACTS_DIR"
|
||||
|
||||
cd src
|
||||
find . -name "*.h" -print | cpio -pd "$ARTIFACTS_DIR/include"
|
||||
|
||||
cp "$OUTPUT_DIR/LICENSE.md" "$ARTIFACTS_DIR"
|
||||
|
||||
@@ -1,4 +1,41 @@
|
||||
#!/bin/bash -eu
|
||||
#!/bin/bash
|
||||
|
||||
arch=""
|
||||
profile="release"
|
||||
|
||||
while [ "$#" -gt 0 ]; do
|
||||
case "$1" in
|
||||
--arch)
|
||||
arch="$2"
|
||||
if [ "$arch" != "x64" ] && [ "$arch" != "arm64" ]; then
|
||||
echo "Error: Invalid value for --arch. Must be 'x64' or 'arm64'."
|
||||
exit 1
|
||||
fi
|
||||
shift 2
|
||||
;;
|
||||
--profile)
|
||||
profile="$2"
|
||||
if [ "$profile" != "debug" ] && [ "$profile" != "release" ]; then
|
||||
echo "Error: Invalid value for --profile. Must be 'debug' or 'release'."
|
||||
exit 1
|
||||
fi
|
||||
shift 2
|
||||
;;
|
||||
*)
|
||||
echo "Error: Unknown argument '$1'"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [ -z "$arch" ]; then
|
||||
echo "Error: --arch must be set."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Building LiveKit WebRTC"
|
||||
echo "Arch: $arch"
|
||||
echo "Profile: $profile"
|
||||
|
||||
if [ ! -e "$(pwd)/depot_tools" ]
|
||||
then
|
||||
@@ -7,69 +44,71 @@ fi
|
||||
|
||||
export COMMAND_DIR=$(cd $(dirname $0); pwd)
|
||||
export PATH="$(pwd)/depot_tools:$PATH"
|
||||
export OUTPUT_DIR="$(pwd)/src/out"
|
||||
export ARTIFACTS_DIR="$(pwd)/macos"
|
||||
export OUTPUT_DIR="$(pwd)/src/out-$arch-$profile"
|
||||
export ARTIFACTS_DIR="$(pwd)/macos-$arch-$profile"
|
||||
|
||||
if [ ! -e "$(pwd)/src" ]
|
||||
then
|
||||
gclient sync
|
||||
gclient sync -D --no-history
|
||||
fi
|
||||
|
||||
cd src
|
||||
git apply "$COMMAND_DIR/patches/add_license_dav1d.patch" -v
|
||||
git apply "$COMMAND_DIR/patches/ssl_verify_callback_with_native_handle.patch" -v
|
||||
git apply "$COMMAND_DIR/patches/fix_mocks.patch" -v
|
||||
git apply "$COMMAND_DIR/patches/add_license_dav1d.patch" -v --ignore-space-change --ignore-whitespace --whitespace=nowarn
|
||||
git apply "$COMMAND_DIR/patches/ssl_verify_callback_with_native_handle.patch" -v --ignore-space-change --ignore-whitespace --whitespace=nowarn
|
||||
git apply "$COMMAND_DIR/patches/fix_mocks.patch" -v --ignore-space-change --ignore-whitespace --whitespace=nowarn
|
||||
cd ..
|
||||
|
||||
mkdir -p "$ARTIFACTS_DIR/lib"
|
||||
|
||||
for is_debug in "true" "false"
|
||||
do
|
||||
for target_cpu in "x64" "arm64"
|
||||
do
|
||||
debug="false"
|
||||
if [ "$profile" = "debug" ]; then
|
||||
debug="true"
|
||||
fi
|
||||
|
||||
# generate ninja files
|
||||
gn gen "$OUTPUT_DIR" --root="src" \
|
||||
--args="is_debug=${is_debug} \
|
||||
enable_dsyms=${is_debug} \
|
||||
target_os=\"mac\" \
|
||||
target_cpu=\"${target_cpu}\" \
|
||||
mac_deployment_target=\"10.11\" \
|
||||
treat_warnings_as_errors=false \
|
||||
rtc_enable_protobuf=false \
|
||||
rtc_include_tests=false \
|
||||
rtc_build_examples=false \
|
||||
rtc_build_tools=false \
|
||||
rtc_libvpx_build_vp9=true \
|
||||
is_component_build=false \
|
||||
enable_stripping=true \
|
||||
use_goma=false \
|
||||
rtc_use_h264=false \
|
||||
rtc_enable_symbol_export=true \
|
||||
rtc_enable_objc_symbol_export=false \
|
||||
clang_use_chrome_plugins=false \
|
||||
symbol_level=0 \
|
||||
enable_iterator_debugging=false \
|
||||
use_rtti=true"
|
||||
# generate ninja files
|
||||
gn gen "$OUTPUT_DIR" --root="src" \
|
||||
--args="is_debug=$debug \
|
||||
enable_dsyms=$debug \
|
||||
target_os=\"mac\" \
|
||||
target_cpu=\"$arch\" \
|
||||
mac_deployment_target=\"10.11\" \
|
||||
treat_warnings_as_errors=false \
|
||||
rtc_enable_protobuf=false \
|
||||
rtc_include_tests=false \
|
||||
rtc_build_examples=false \
|
||||
rtc_build_tools=false \
|
||||
rtc_libvpx_build_vp9=true \
|
||||
is_component_build=false \
|
||||
enable_stripping=true \
|
||||
rtc_enable_symbol_export=true \
|
||||
rtc_enable_objc_symbol_export=false \
|
||||
rtc_use_h264=false \
|
||||
use_custom_libcxx=false \
|
||||
clang_use_chrome_plugins=false \
|
||||
use_rtti=true \
|
||||
use_lld=false"
|
||||
|
||||
# build static library
|
||||
ninja -C "$OUTPUT_DIR" webrtc
|
||||
# build static library
|
||||
ninja -C "$OUTPUT_DIR" :default \
|
||||
api/audio_codecs:builtin_audio_decoder_factory \
|
||||
api/task_queue:default_task_queue_factory \
|
||||
sdk:native_api \
|
||||
sdk:default_codec_factory_objc \
|
||||
pc:peerconnection \
|
||||
sdk:videocapture_objc \
|
||||
sdk:mac_framework_objc
|
||||
|
||||
filename="libwebrtc.a"
|
||||
if [ $is_debug = "true" ]; then
|
||||
filename="libwebrtcd.a"
|
||||
fi
|
||||
|
||||
# cppy static library
|
||||
mkdir -p "$ARTIFACTS_DIR/lib/${target_cpu}"
|
||||
cp "$OUTPUT_DIR/obj/libwebrtc.a" "$ARTIFACTS_DIR/lib/${target_cpu}/${filename}"
|
||||
done
|
||||
done
|
||||
# make libwebrtc.a
|
||||
# don't include nasm
|
||||
ar -rc "$ARTIFACTS_DIR/lib/libwebrtc.a" `find "$OUTPUT_DIR/obj" -name '*.o' -not -path "*/third_party/nasm/*"`
|
||||
|
||||
python3 "./src/tools_webrtc/libs/generate_licenses.py" \
|
||||
--target :webrtc "$OUTPUT_DIR" "$OUTPUT_DIR"
|
||||
|
||||
cp "$OUTPUT_DIR/obj/webrtc.ninja" "$ARTIFACTS_DIR"
|
||||
cp "$OUTPUT_DIR/args.gn" "$ARTIFACTS_DIR"
|
||||
cp "$OUTPUT_DIR/LICENSE.md" "$ARTIFACTS_DIR"
|
||||
|
||||
cd src
|
||||
find . -name "*.h" -print | cpio -pd "$ARTIFACTS_DIR/include"
|
||||
|
||||
cp "$OUTPUT_DIR/LICENSE.md" "$ARTIFACTS_DIR"
|
||||
|
||||
@@ -1,5 +1,37 @@
|
||||
@echo off
|
||||
|
||||
setlocal enabledelayedexpansion
|
||||
|
||||
set arch=
|
||||
set profile=release
|
||||
|
||||
:arg_loop
|
||||
if "%1" == "" goto end_arg_loop
|
||||
if "%1" == "--arch" (
|
||||
set "arch=%2"
|
||||
shift & shift & goto arg_loop
|
||||
)
|
||||
if "%1" == "--profile" (
|
||||
set "profile=%2"
|
||||
shift & shift & goto arg_loop
|
||||
)
|
||||
echo Error: Unknown argument '%1'
|
||||
exit /b 1
|
||||
:end_arg_loop
|
||||
|
||||
if not "!arch!" == "x64" if not "!arch!" == "arm64" (
|
||||
echo Error: Invalid value for --arch. Must be 'x64' or 'arm64'.
|
||||
exit /b 1
|
||||
)
|
||||
if not "!profile!" == "debug" if not "!profile!" == "release" (
|
||||
echo Error: Invalid value for --profile. Must be 'debug' or 'release'.
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
echo "Building LiveKit WebRTC"
|
||||
echo "Arch: !arch!"
|
||||
echo "Profile: !profile!"
|
||||
|
||||
if not exist depot_tools (
|
||||
git clone --depth 1 https://chromium.googlesource.com/chromium/tools/depot_tools.git
|
||||
)
|
||||
@@ -9,55 +41,45 @@ set PATH=%cd%\depot_tools;%PATH%
|
||||
set DEPOT_TOOLS_WIN_TOOLCHAIN=0
|
||||
set GYP_GENERATORS=ninja,msvs-ninja
|
||||
set GYP_MSVS_VERSION=2019
|
||||
set OUTPUT_DIR=src/out
|
||||
set ARTIFACTS_DIR=%cd%\windows
|
||||
set OUTPUT_DIR=src\out-!arch!-!profile!
|
||||
set ARTIFACTS_DIR=%cd%\win-!arch!-!profile!
|
||||
set vs2019_install=C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional
|
||||
|
||||
if not exist src (
|
||||
call gclient.bat sync
|
||||
call gclient.bat sync -D --no-history
|
||||
)
|
||||
|
||||
cd src
|
||||
call git apply "%COMMAND_DIR%/patches/add_license_dav1d.patch" -v
|
||||
call git apply "%COMMAND_DIR%/patches/ssl_verify_callback_with_native_handle.patch" -v
|
||||
call git apply "%COMMAND_DIR%/patches/fix_mocks.patch" -v
|
||||
call git apply "%COMMAND_DIR%/patches/add_license_dav1d.patch" -v --ignore-space-change --ignore-whitespace --whitespace=nowarn
|
||||
call git apply "%COMMAND_DIR%/patches/ssl_verify_callback_with_native_handle.patch" -v --ignore-space-change --ignore-whitespace --whitespace=nowarn
|
||||
call git apply "%COMMAND_DIR%/patches/fix_mocks.patch" -v --ignore-space-change --ignore-whitespace --whitespace=nowarn
|
||||
cd ..
|
||||
|
||||
mkdir "%ARTIFACTS_DIR%\lib"
|
||||
|
||||
setlocal enabledelayedexpansion
|
||||
|
||||
for %%i in (x64 arm64) do (
|
||||
mkdir "%ARTIFACTS_DIR%/lib/%%i"
|
||||
for %%j in (true false) do (
|
||||
|
||||
rem generate ninja for release
|
||||
call gn.bat gen %OUTPUT_DIR% --root="src" ^
|
||||
--args="is_debug=%%j is_clang=true target_cpu=\"%%i\" use_custom_libcxx=false rtc_include_tests=false rtc_build_examples=false rtc_use_h264=false symbol_level=0 enable_iterator_debugging=false"
|
||||
|
||||
rem build
|
||||
ninja.exe -C %OUTPUT_DIR% webrtc
|
||||
|
||||
set filename=
|
||||
if true==%%j (
|
||||
set filename=webrtcd.lib
|
||||
) else (
|
||||
set filename=webrtc.lib
|
||||
)
|
||||
|
||||
rem copy static library for release build
|
||||
copy "%OUTPUT_DIR%\obj\webrtc.lib" "%ARTIFACTS_DIR%\lib\%%i\!filename!"
|
||||
)
|
||||
set "debug=false"
|
||||
if "!profile!" == "debug" (
|
||||
set "debug=true"
|
||||
)
|
||||
|
||||
endlocal
|
||||
rem generate ninja for release
|
||||
call gn.bat gen %OUTPUT_DIR% --root="src" ^
|
||||
--args="is_debug=!debug! is_clang=true target_cpu=\"!arch!\" use_custom_libcxx=false rtc_include_tests=false rtc_build_examples=false rtc_build_tools=false is_component_build=false rtc_enable_protobuf=false rtc_use_h264=false symbol_level=0 enable_iterator_debugging=false"
|
||||
|
||||
rem build
|
||||
ninja.exe -C %OUTPUT_DIR% :default
|
||||
|
||||
rem copy static library for release build
|
||||
copy "%OUTPUT_DIR%\obj\webrtc.lib" "%ARTIFACTS_DIR%\lib"
|
||||
|
||||
rem generate license
|
||||
call python3 "%cd%\src\tools_webrtc\libs\generate_licenses.py" ^
|
||||
--target :webrtc %OUTPUT_DIR% %OUTPUT_DIR%
|
||||
--target :default %OUTPUT_DIR% %OUTPUT_DIR%
|
||||
|
||||
copy "%OUTPUT_DIR%\obj\webrtc.ninja" "%ARTIFACTS_DIR%"
|
||||
copy "%OUTPUT_DIR%\args.gn" "%ARTIFACTS_DIR%"
|
||||
copy "%OUTPUT_DIR%\LICENSE.md" "%ARTIFACTS_DIR%"
|
||||
|
||||
rem copy header
|
||||
xcopy src\*.h "%ARTIFACTS_DIR%\include" /C /S /I /F /H
|
||||
|
||||
rem copy license
|
||||
copy "%OUTPUT_DIR%\LICENSE.md" "%ARTIFACTS_DIR%\LICENSE.md"
|
||||
|
||||
Reference in New Issue
Block a user