朋友跑 IPOP 在 pi 上, 整理一份更簡單的步驟.

首先, 準備 rootfs

$ sudo debootstrap --arch=armel --include=locales,sudo,vim,tmux,bash-completion,command-not-found --foreign jessie debian-arm http://httpredir.debian.org/debian
$ sudo cp /usr/bin/qemu-arm-static debian-arm/usr/bin
$ sudo chroot debian-arm /debootstrap/debootstrap --second-stage
$ sudo bash -c 'echo deb http://httpredir.debian.org/debian jessie main non-free contrib >debian-arm/etc/apt/sources.list'
$ sudo bash -c 'echo deb http://httpredir.debian.org/debian jessie-proposed-updates main non-free contrib >>debian-arm/etc/apt/sources.list'
$ sudo bash -c 'echo deb http://httpredir.debian.org/debian jessie-backports main non-free contrib >>debian-arm/etc/apt/sources.list'
$ sudo chroot debian-arm apt-get update
$ sudo chroot debian-arm apt-get clean

讓工作環境方便些, 可做可不做

$ for l in en_US zh_TW zh_CN; do sudo sed -e "[email protected]^# [email protected][email protected]" -i debian-arm/etc/locale.gen; done
$ sudo chroot debian-arm locale-gen
$ sudo chroot debian-arm update-command-not-found

切進 rootfs

$ sudo systemd-nspawn -D debian-arm

安裝 build IPOP 時的相依

$ sudo apt-get install --yes ninja-build default-jdk pkg-config git subversion make gcc g++ python libexpat1-dev libgtk2.0-dev libnss3-dev libssl-dev
$ sudo apt-get clean

接著按這頁 下載 source code.

進到 trunk 目錄中

$ cd libjingle/trunk

修正 pkg-config-wrapper 的路徑

$ for f in talk/ipop-project/ipop-tincan/build/libjingle.gyp talk/libjingle.gyp net/third_party/nss/ssl.gyp; do sed -e "[email protected]/../../build/linux/[email protected]$PWD/build/linux/[email protected]" -i "$f"; done

修正 compiler flags

$ sed -i "s/'arm_float_abi%': 'soft',/'arm_float_abi%': 'hard',/g" build/common.gypi 
$ sed -i "s/'arm_fpu%': '',/'arm_fpu%': 'vfp',/g" build/common.gypi

修正 linker path

$ ln -sf /usr/bin/gold third_party/gold/gold32

設定 environment variables

$ export GYP_DEFINES="use_openssl=1 target_arch=arm arm_version=6"
$ export PATH+=":$(readlink -f ../depot_tools)"
$ export JAVA_HOME="/usr/lib/jvm/default-java"
$ export GYP_GENERATORS=make
$ export C_INCLUDE_PATH=/usr/include:/usr/include/arm-linux-gnueabi
$ export CPLUS_INCLUDE_PATH=/usr/include:/usr/include/arm-linux-gnueabi:/usr/include/c++/4.9:/usr/include/arm-linux-gnueabi/c++/4.9

開始 build IPOP

$ gclient runhooks --force
$ make ipop-tincan BUILDTYPE=Release

完成!