Skip to content

Instantly share code, notes, and snippets.

@cyberrob-zz
Last active August 29, 2015 14:05
Show Gist options
  • Save cyberrob-zz/ee48fd847c75e33ebca9 to your computer and use it in GitHub Desktop.
Save cyberrob-zz/ee48fd847c75e33ebca9 to your computer and use it in GitHub Desktop.
WebRTC Build Steps
## building webrtc
# install dependencies:
sudo apt-get install git git-svn subversion g++ python libnss3-dev libasound2-dev libpulse-dev libjpeg62-dev libxv-dev libgtk2.0-dev libexpat1-dev lib32asound2-dev ia32-libs
# for those want to install ia32-libs on x64 linux please refer to this thread
# http://stackoverflow.com/questions/23182765/how-to-install-ia32-libs-in-ubuntu-14-04-lts
# get the depottools:
cd ~
git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
# Add depot_tools to your PATH (I'm using zsh with ohmyzsh):
echo export PATH="$PATH":`pwd`/depot_tools >> ~/.zshrc
# Or
echo export PATH="$PATH":`pwd`/depot_tools >> ~/.bash_rc
# create a working directory:
cd ~
mkdir libjingle
cd libjingle
# get the WebRTC source:
gclient config http://webrtc.googlecode.com/svn/trunk/
# configure for android:
echo "target_os = ['android', 'unix']" >> .gclient
# start a large sync of the liblibjingle source code, which will likely take some time.
gclient sync --nohooks
# set up env variables:
source ~/libjingle/trunk/build/android/envsetup.sh
# Install JDK 6u45 for compiling
# Download old jdk from http://ghaffarian.net/downloads/Java/JDK/
# Move jdk to home dir
mv ~/Downloads/jdk-6u45-linux-x64.bin ~/
# Extract jdk6u45 to jvm/
cd /usr/lib/jvm && /bin/sh ~/jdk-6u45-linux-x64.bin -noregister
# Choose jdk6 from list
sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/jdk1.6.0_45/bin/javac 50000
sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk1.6.0_45/bin/java 50000
sudo update-alternatives --config javac
sudo update-alternatives --config java
# Setup JAVA_HOME for later compiling
echo "JAVA_HOME=/usr/lib/jvm/jdk1.6.0_45" >> ~/.zshrc
# or manually add JAVA_HOME at the end of PATH
echo export PATH="$PATH":$JAVA_HOME >> ~/.zshrc
# remember to make new path validate
source ~/.zshrc
# Overcome a small bug in the libjingle gwp compile scripts
cd /usr/lib
ln -s jdk1.6.0_45 java-6-sun
# make sure the java version is jdk6
java -version
# install new dependencies:
sudo ~/libjingle/trunk/build/./install-build-deps-android.sh
sudo ~/libjingle/trunk/build/./install-build-deps.sh
# Set up webrtc-related GYP variables:
export GYP_DEFINES="build_with_libjingle=1 build_with_chromium=0 libjingle_java=1 OS=android $GYP_DEFINES"
# To cause WEBRTC_LOGGING to emit to Android's logcat, add enable_tracing=1 to the $GYP_DEFINES above like:
export GYP_DEFINES="build_with_libjingle=1 build_with_chromium=0 libjingle_java=1 OS=android enable_tracing=1 $GYP_DEFINES"
# Set up building env
sudo ~/libjingle/trunk/build/android/envsetup.sh
source ~/libjingle/trunk/build/android/envsetup.sh
# generate the build scripts:
# make sure JAVA_HOME setup correctly or this step will fail
gclient runhooks
# (Check if jdk is modified. If it's modified, go change it back to jdk6)
java -version
# build the Debug version of the AppRTCDemo(it takes about 5 mins depending on your machine):
ninja -C out/Debug -j 10 AppRTCDemo
# run this again if the target AppRTCDemo is unknown
source ./build/android/envsetup.sh
export GYP_DEFINES="$GYP_DEFINES OS=android"
gclient runhooks
# install apk into device
adb install -r out/Debug/AppRTCDemo-debug.apk
# open up the app on the device to connect with chat room number opened in your browser
adb shell am start -n org.appspot.apprtc/.AppRTCDemoActivity -a android.intent.action.VIEW -d '"https://apprtc.appspot.com/?r=XXXXXX"'
# If app crashed, it's normal. Let me find out why.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment