forked from shiguredo-webrtc-build/webrtc-build
-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.macos_x86_64.sh
executable file
·102 lines (85 loc) · 3.09 KB
/
build.macos_x86_64.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
#!/bin/bash
cd `dirname $0`
source VERSION
SCRIPT_DIR="`pwd`"
PACKAGE_NAME=macos_x86_64
SOURCE_DIR="`pwd`/_source/$PACKAGE_NAME"
BUILD_DIR="`pwd`/_build/$PACKAGE_NAME"
PACKAGE_DIR="`pwd`/_package/$PACKAGE_NAME"
set -ex
# ======= ここまでは全ての build.*.sh で共通(PACKAGE_NAME だけ変える)
TARGET_ARCH=x64
TARGET_BUILD_CONFIGS="debug release"
MAC_DEPLOYMENT_TARGET=10.10
./scripts/get_depot_tools.sh $SOURCE_DIR
export PATH="$SOURCE_DIR/depot_tools:$PATH"
./scripts/prepare_webrtc.sh $SOURCE_DIR $WEBRTC_COMMIT
pushd $SOURCE_DIR/webrtc/src
patch -p2 < $SCRIPT_DIR/patches/4k.patch
patch -p2 < $SCRIPT_DIR/patches/macos_h264_encoder.patch
patch -p2 < $SCRIPT_DIR/patches/macos_av1.patch
patch -p2 < $SCRIPT_DIR/patches/macos_screen_capture.patch
patch -p1 < $SCRIPT_DIR/patches/macos_simulcast.patch
patch -p1 < $SCRIPT_DIR/patches/ios_simulcast.patch
popd
pushd $SOURCE_DIR/webrtc/src
for _build_config in $TARGET_BUILD_CONFIGS; do
_libs_dir=$BUILD_DIR/webrtc/$_build_config
mkdir -p $_libs_dir
if [ $_build_config = "release" ]; then
_is_debug="false"
_enable_dsyms="false"
else
_is_debug="true"
_enable_dsyms="true"
fi
gn gen $_libs_dir --args="
target_os=\"mac\"
target_cpu=\"$TARGET_ARCH\"
mac_deployment_target=\"$MAC_DEPLOYMENT_TARGET\"
enable_stripping=true
enable_dsyms=$_enable_dsyms
is_debug=$_is_debug
rtc_include_tests=false
rtc_build_examples=false
rtc_use_h264=false
rtc_libvpx_build_vp9=true
rtc_enable_symbol_export=true
is_component_build=false
use_rtti=true
libcxx_abi_unstable=false
"
ninja -C $_libs_dir
ninja -C $_libs_dir \
builtin_audio_decoder_factory \
default_task_queue_factory \
native_api \
default_codec_factory_objc \
peerconnection \
videocapture_objc \
mac_framework_objc
_branch="M`echo $WEBRTC_VERSION | cut -d'.' -f1`"
_commit="`echo $WEBRTC_VERSION | cut -d'.' -f3`"
_revision=$WEBRTC_COMMIT
_maint="`echo $WEBRTC_BUILD_VERSION | cut -d'.' -f4`"
cat <<EOF > $_libs_dir/WebRTC.framework/Resources/build_info.json
{
"webrtc_version": "$_branch",
"webrtc_commit": "$_commit",
"webrtc_maint": "$_maint",
"webrtc_revision": "$_revision"
}
EOF
# info.plistの編集(tools_wertc/ios/build_ios_libs.py内の処理を踏襲)
_info_plist_path=$_libs_dir/WebRTC.framework/Resources/Info.plist
_major_minor=(echo -n `/usr/libexec/PlistBuddy -c "Print :CFBundleShortVersionString" $_info_plist_path`)
_version_number="$_major_minor.0"
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $_version_number" $_info_plist_path
plutil -convert binary1 $_info_plist_path
pushd $_libs_dir/obj
/usr/bin/ar -rc $_libs_dir/libwebrtc.a `find . -name '*.o'`
popd
python2 tools_webrtc/libs/generate_licenses.py --target //sdk:mac_framework_objc $_libs_dir/WebRTC.framework/Resources $_libs_dir
done
popd
./scripts/package_webrtc_macos.sh $SCRIPT_DIR/static $SOURCE_DIR $BUILD_DIR $PACKAGE_DIR $SCRIPT_DIR/VERSION "$TARGET_BUILD_CONFIGS"