-
Notifications
You must be signed in to change notification settings - Fork 76
/
build.sh
executable file
·73 lines (61 loc) · 1.53 KB
/
build.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
#!/usr/bin/env bash
PROJECT_DIR=$(pwd)
THIRD_PARTY_DIR="$PROJECT_DIR/third_party"
WEBRTC_REPO="https://chromium.googlesource.com/external/webrtc"
WEBRTC_DIR="$THIRD_PARTY_DIR/webrtc"
WEBRTC_SRC="$WEBRTC_DIR/src"
OS=$(go env GOOS)
ARCH=$(go env GOARCH)
CONFIG="Debug"
COMMIT="bd7d8f7e2b824a887aa12236cb6185d446d7da61"
INCLUDE_DIR="$PROJECT_DIR/include"
LIB_DIR="$PROJECT_DIR/lib"
# TODO(arlolra): depot_tools
GYP_DEFINES="include_tests=0"
mkdir -p $THIRD_PARTY_DIR
mkdir -p $INCLUDE_DIR
mkdir -p $LIB_DIR
if [[ -d $WEBRTC_DIR ]]; then
echo "Sync'ing webrtc ..."
pushd $WEBRTC_DIR
gclient sync
popd
else
echo "Getting webrtc ..."
mkdir -p $WEBRTC_DIR
pushd $WEBRTC_DIR
gclient config --name src $WEBRTC_REPO
gclient sync
popd
fi
echo "Checking out latest tested / compatible version of webrtc ..."
pushd $WEBRTC_SRC
git checkout $COMMIT
popd
echo "Generating build scripts ..."
pushd $WEBRTC_SRC
python webrtc/build/gyp_webrtc
popd
echo "Building webrtc ..."
pushd $WEBRTC_SRC
ninja -C out/$CONFIG
popd
echo "Copying headers ..."
pushd $WEBRTC_SRC
for h in $(find talk/ webrtc/ -type f -name '*.h')
do
mkdir -p "$INCLUDE_DIR/$(dirname $h)"
cp $h "$INCLUDE_DIR/$h"
done
popd
echo "Concatenating libraries ..."
pushd $WEBRTC_SRC/out/$CONFIG
# on osx:
# ls *.a > filelist
# libtool -static -o libwebrtc-magic.a -filelist filelist
# strip -S -x -o libwebrtc-magic.a libwebrtc-magic.a
# on linux:
# ar crs libwebrtc-magic.a $(find . -name '*.o' -not -name '*.main.o')
mv libwebrtc-magic.a $LIB_DIR/libwebrtc-$OS-$ARCH-magic.a
popd
echo "Build complete."