-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbuild.sh
More file actions
executable file
·69 lines (56 loc) · 1.58 KB
/
build.sh
File metadata and controls
executable file
·69 lines (56 loc) · 1.58 KB
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
#!/bin/bash
set -eu
readonly ROOT_PATH=$(cd $(dirname $0) && pwd)
## Get OS environment parameters.
if [ "$(uname -s)" = 'Darwin' ]; then
# Mac OSX
readonly ID='macos'
readonly ARCH='x86_64'
readonly IS_LINUX='false'
elif [ -e /etc/os-release ]; then
. /etc/os-release
readonly ARCH=`uname -p`
readonly IS_LINUX='true'
else
echo "Thank you for useing. But sorry, this platform is not supported yet."
exit 1
fi
## Download libwebrtc (Compiled chromium WebRTC native APIs.)
readonly LOCAL_ENV_PATH=${ROOT_PATH}/local
readonly WEBRTC_VER=71
mkdir -p ${LOCAL_ENV_PATH}/include
mkdir -p ${LOCAL_ENV_PATH}/src
cd ${LOCAL_ENV_PATH}/src
# Filename
if [ "${ID}" = 'macos' ]; then
readonly WEBRTC_FILE="libwebrtc-osx-${WEBRTC_VER}.zip"
else
readonly WEBRTC_FILE="libwebrtc-ubuntu-x64-${WEBRTC_VER}.tar.gz"
fi
# Download and unarchive
if ! [ -e "${WEBRTC_FILE}" ]; then
if [ "${ID}" = 'macos' ]; then
curl -OL https://github.com/llamerada-jp/libwebrtc/releases/download/v${WEBRTC_VER}/${WEBRTC_FILE}
cd ${LOCAL_ENV_PATH}
unzip -o src/${WEBRTC_FILE}
else
wget https://github.com/llamerada-jp/libwebrtc/releases/download/v${WEBRTC_VER}/${WEBRTC_FILE}
cd ${LOCAL_ENV_PATH}
tar zxf src/${WEBRTC_FILE}
fi
fi
## Build
# Change compiler to clang on linux
if [ "${IS_LINUX}" = 'true' ]; then
export CC=/usr/bin/clang
export CXX=/usr/bin/clang++
fi
readonly BUILD_PATH=${ROOT_PATH}/build
mkdir -p ${BUILD_PATH}
cd ${ROOT_PATH}
git submodule init
git submodule update
cd ${BUILD_PATH}
cmake -DLIBWEBRTC_PATH=${LOCAL_ENV_PATH} ..
make
cp sample ${ROOT_PATH}