From ad65dfcc4e47086b14123327a51704179d4f0982 Mon Sep 17 00:00:00 2001 From: David Fifield Date: Sat, 30 Apr 2016 21:10:11 -0700 Subject: [PATCH] Build libwebrtc-magic.a for linux. https://github.com/keroserene/go-webrtc/issues/23 https://webrtc.org/native-code/development/ https://webrtc.org/native-code/development/prerequisite-sw/ --- .../linux/gitian-pluggable-transports.yml | 57 +++++++++++++++++++ gitian/fetch-inputs.sh | 22 +++++++ gitian/verify-tags.sh | 1 + gitian/versions | 1 + gitian/versions.alpha | 1 + gitian/versions.beta | 1 + gitian/versions.nightly | 1 + 7 files changed, 84 insertions(+) diff --git a/gitian/descriptors/linux/gitian-pluggable-transports.yml b/gitian/descriptors/linux/gitian-pluggable-transports.yml index 2a95700..19e9fa6 100644 --- a/gitian/descriptors/linux/gitian-pluggable-transports.yml +++ b/gitian/descriptors/linux/gitian-pluggable-transports.yml @@ -15,6 +15,19 @@ packages: - "swig" - "zip" - "hardening-wrapper" +- "pkg-config" +- "gtk2.0-dev" +- "libpci-dev" +- "libdbus-1-dev" +- "libgnome-keyring-dev" +- "libnss3-dev" +- "libffi-dev" +- "libasound2-dev" +- "libpulse-dev" +- "libudev-dev" +- "libgl1-mesa-dev" +- "default-jre-headless" +- "default-jdk" reference_datetime: "2000-01-01 00:00:00" remotes: - "url": "https://git.torproject.org/pluggable-transports/pyptlib.git" @@ -57,6 +70,11 @@ files: - "gmp-linux64-utils.zip" - "openssl-linux32-utils.zip" - "openssl-linux64-utils.zip" +- "binutils-linux32-utils.zip" +- "binutils-linux64-utils.zip" +- "gcc-linux32-utils.zip" +- "gcc-linux64-utils.zip" +- "webrtc" script: | INSTDIR="$HOME/install" PTDIR="$INSTDIR/Tor/PluggableTransports" @@ -79,6 +97,35 @@ script: | # FTE only needs libgmp.so.10 and no libgmpxx anymore. cp $INSTDIR/gmp/lib/libgmp.so.10 $INSTDIR/Tor + # Preparing Binutils and GCC for webrtc + unzip -d $INSTDIR binutils-linux$GBUILD_BITS-utils.zip + # Make sure gold is used with the hardening wrapper for full RELRO, see + # #13031. + cd $INSTDIR/binutils/bin + rm ld + cp /usr/bin/hardened-ld ./ + mv ld.gold ld.gold.real + ln -sf hardened-ld ld.gold + ln -sf ld.gold ld + cd ~/build + unzip -d $INSTDIR gcc-linux$GBUILD_BITS-utils.zip + # Make sure we use the hardening wrapper when compiling Tor Browser. + cd $INSTDIR/gcc/bin + cp /usr/bin/hardened-cc ./ + mv gcc gcc.real + mv c++ c++.real + ln -sf hardened-cc gcc + ln -sf hardened-cc c++ + cd ~/build + export PATH=$INSTDIR/gcc/bin:$INSTDIR/binutils/bin:$PATH + ARCH="" + if [ $GBUILD_BITS == "64" ]; + then + ARCH="64" + fi + # Make sure our GCC gets properly used. + export LD_LIBRARY_PATH=$INSTDIR/gcc/lib$ARCH + # Building go 1.4.x # This is needed to bootstrap the go that we actually use # https://golang.org/doc/install/source#go14 @@ -271,6 +318,16 @@ script: | # Disable automatic updating. export DEPOT_TOOLS_UPDATE=0 + # Building webrtc + export GYP_CROSSCOMPILE=1 + export GYP_DEFINES="OS=linux target_arch=$(if [ $GBUILD_BITS = 32 ]; then echo ia32; else echo x64; fi) use_sysroot=0 linux_use_bundled_gold=0 linux_use_gold_flags=0 linux_use_bundled_binutils=0 use_gconf=0 clang=0 host_clang=0 use_x11=0 werror=" + cd webrtc/src + JAVA_HOME=/usr/lib/jvm/default-java webrtc/build/gyp_webrtc + # "ninja" is part of depot_tools. + ninja -C out/Release + ar crs libwebrtc-magic.a $(find . -name '*.o' -not -name '*.main.o') + cd ../.. + # Grabbing the results and making sure timestamps don't spoil them export LD_PRELOAD=/usr/lib/faketime/libfaketime.so.1 cd $INSTDIR diff --git a/gitian/fetch-inputs.sh b/gitian/fetch-inputs.sh index d66f6d2..b519653 100755 --- a/gitian/fetch-inputs.sh +++ b/gitian/fetch-inputs.sh @@ -297,5 +297,27 @@ git submodule init git submodule update cd .. +# WebRTC is special, having its own build system that brings in lots of Chromium dependencies. +# https://webrtc.org/native-code/development/ +# depot_tools must have been downloaded before running this code. +dir=webrtc +PATH="$PATH:$PWD/depot_tools" +# GYP_CROSSCOMPILE=1 and GYP_DEFINES="use_x11=0" prevent probing for certain dependencies. +# Use --no-history because the whole checkout with history is about 12 GB. +export GYP_CROSSCOMPILE=1 +export GYP_DEFINES="use_x11=0" +mkdir -p "$dir" +cd "$dir" +if [ ! -d "src" ]; +then + # "fetch" is part of depot_tools. + fetch --nohooks --no-history webrtc +fi +# "gclient" is part of depot_tools. This download takes a long time the first time. +# JAVA_HOME is needed in a hook for libjingle. The readlink line tries to find the current JRE. +# default-java comes from the package default-jdk-headless. +JAVA_HOME=/usr/lib/jvm/default-java gclient sync --with_branch_heads --no-history -r $WEBRTC_TAG +cd .. + exit 0 diff --git a/gitian/verify-tags.sh b/gitian/verify-tags.sh index 9a08b26..cf36f7c 100755 --- a/gitian/verify-tags.sh +++ b/gitian/verify-tags.sh @@ -154,6 +154,7 @@ do fi done +# webrtc? Its fetch brings in sources from many repos. cd "$INPUTS_DIR" verify_git "." "$WRAPPER_DIR/gpg/torbutton.gpg" "$GITIAN_TAG" diff --git a/gitian/versions b/gitian/versions index e9fe9a8..35a2f4f 100755 --- a/gitian/versions +++ b/gitian/versions @@ -36,6 +36,7 @@ GO_X_NET_TAG=7dbad50ab5b31073856416cdcfeb2796d682f844 OBFS4_TAG=obfs4proxy-0.0.5 NOTOFONTS_TAG=720e34851382ee3c1ef024d8dffb68ffbfb234c2 DEPOT_TOOLS_TAG=28216cd14b44716db5c83634afbdc6e90492652b +WEBRTC_TAG=8ccf77319e08b86330c0e5b195697fd738c80931 # https://chromium.googlesource.com/external/webrtc.git/+/refs/branch-heads/49 GITIAN_TAG=tor-browser-builder-3.x-8-gpgsux diff --git a/gitian/versions.alpha b/gitian/versions.alpha index 3a43e1e..b5c6a35 100755 --- a/gitian/versions.alpha +++ b/gitian/versions.alpha @@ -42,6 +42,7 @@ GO_X_NET_TAG=7dbad50ab5b31073856416cdcfeb2796d682f844 OBFS4_TAG=obfs4proxy-0.0.5 NOTOFONTS_TAG=720e34851382ee3c1ef024d8dffb68ffbfb234c2 DEPOT_TOOLS_TAG=28216cd14b44716db5c83634afbdc6e90492652b +WEBRTC_TAG=8ccf77319e08b86330c0e5b195697fd738c80931 # https://chromium.googlesource.com/external/webrtc.git/+/refs/branch-heads/49 GITIAN_TAG=tor-browser-builder-4-1 diff --git a/gitian/versions.beta b/gitian/versions.beta index 8be19d8..5d1a647 100755 --- a/gitian/versions.beta +++ b/gitian/versions.beta @@ -31,6 +31,7 @@ GOPTLIB_TAG=0.2 MEEK_TAG=0.18 NOTOFONTS_TAG=720e34851382ee3c1ef024d8dffb68ffbfb234c2 DEPOT_TOOLS_TAG=28216cd14b44716db5c83634afbdc6e90492652b +WEBRTC_TAG=8ccf77319e08b86330c0e5b195697fd738c80931 # https://chromium.googlesource.com/external/webrtc.git/+/refs/branch-heads/49 GITIAN_TAG=tor-browser-builder-3.x-6 diff --git a/gitian/versions.nightly b/gitian/versions.nightly index b05bb15..5a051f1 100755 --- a/gitian/versions.nightly +++ b/gitian/versions.nightly @@ -49,6 +49,7 @@ GO_X_NET_TAG=master OBFS4_TAG=master NOTOFONTS_TAG=720e34851382ee3c1ef024d8dffb68ffbfb234c2 DEPOT_TOOLS_TAG=28216cd14b44716db5c83634afbdc6e90492652b +WEBRTC_TAG=8ccf77319e08b86330c0e5b195697fd738c80931 # https://chromium.googlesource.com/external/webrtc.git/+/refs/branch-heads/49 GITIAN_TAG=tor-browser-builder-4