[tor-commits] [tor-browser-bundle/hardened-builds] Build webrtc-linux with GN instead of GYP.

gk at torproject.org gk at torproject.org
Fri Mar 31 19:04:25 UTC 2017


commit 58801dcbb5d927d6eb35a328cb63d1912434a397
Author: David Fifield <david at bamsoftware.com>
Date:   Mon Mar 20 16:20:37 2017 -0400

    Build webrtc-linux with GN instead of GYP.
    
     * Bump webrtc to branch-heads/58
    
     * Also, bumps go-webrtc and snowflake to the latest.
    
     * Removes the need to re-run ninja for FakeAudioCaptureModule since
       "pc_test_utils" includes it.
    
     * Update to the new default bridge
---
 Bundle-Data/PTConfigs/bridge_prefs.js              |  2 +-
 .../linux/gitian-pluggable-transports.yml          |  5 +-
 gitian/descriptors/linux/gitian-webrtc.yml         | 54 +++++++++++-----------
 gitian/fetch-inputs.sh                             |  3 --
 gitian/patches/webrtc-linux.patch                  | 25 ++++++++++
 gitian/versions                                    |  6 +--
 gitian/versions.alpha                              |  6 +--
 gitian/versions.beta                               |  6 +--
 gitian/versions.nightly                            |  2 +-
 9 files changed, 68 insertions(+), 41 deletions(-)

diff --git a/Bundle-Data/PTConfigs/bridge_prefs.js b/Bundle-Data/PTConfigs/bridge_prefs.js
index 61e2a9e..64b7f23 100644
--- a/Bundle-Data/PTConfigs/bridge_prefs.js
+++ b/Bundle-Data/PTConfigs/bridge_prefs.js
@@ -37,4 +37,4 @@ pref("extensions.torlauncher.default_bridge.obfs4.20", "obfs4 85.17.30.79:443 FC
 pref("extensions.torlauncher.default_bridge.meek-amazon.1", "meek 0.0.2.0:2 B9E7141C594AF25699E0079C1F0146F409495296 url=https://d2zfqthxsdq309.cloudfront.net/ front=a0.awsstatic.com");
 pref("extensions.torlauncher.default_bridge.meek-azure.1", "meek 0.0.2.0:3 97700DFE9F483596DDA6264C4D7DF7641E1E39CE url=https://meek.azureedge.net/ front=ajax.aspnetcdn.com");
 
-pref("extensions.torlauncher.default_bridge.snowflake.1", "snowflake 0.0.3.0:1 B05EC36590AC0374F0E4D36DDA77908FD59D97F3");
+pref("extensions.torlauncher.default_bridge.snowflake.1", "snowflake 0.0.3.0:1 2B280B23E1107BB62ABFC40DDCC8824814F80A72");
diff --git a/gitian/descriptors/linux/gitian-pluggable-transports.yml b/gitian/descriptors/linux/gitian-pluggable-transports.yml
index 9b4a278..65b9e33 100644
--- a/gitian/descriptors/linux/gitian-pluggable-transports.yml
+++ b/gitian/descriptors/linux/gitian-pluggable-transports.yml
@@ -105,6 +105,8 @@ script: |
   ln -sf hardened-cc c++
   cd ~/build
   export PATH=$INSTDIR/gcc/bin:$INSTDIR/binutils/bin:$PATH
+  # GN needs libatomic.so.1 here.
+  export LD_LIBRARY_PATH=$INSTDIR/gcc/lib
   ARCH=""
   if [ $GBUILD_BITS == "64" ];
   then
@@ -321,7 +323,8 @@ script: |
   # the prebuilt libwebrtc-magic.a libraries. Since we build our own
   # libwebrtc-magic.a with the C++11 ABI, we have to undo that setting here,
   # using CGO_CXXFLAGS.
-  CGO_CXXFLAGS=-D_GLIBCXX_USE_CXX11_ABI=1 go install github.com/keroserene/go-webrtc
+  # __STDC_FORMAT_MACROS is needed for a definition of PRIxPTR from inttypes.h.
+  CGO_CXXFLAGS="-D_GLIBCXX_USE_CXX11_ABI=1 -D__STDC_FORMAT_MACROS=1" CGO_LDFLAGS=-latomic go install github.com/keroserene/go-webrtc
   cd ..
 
   # Building snowflake
diff --git a/gitian/descriptors/linux/gitian-webrtc.yml b/gitian/descriptors/linux/gitian-webrtc.yml
index 85da679..b5226e3 100644
--- a/gitian/descriptors/linux/gitian-webrtc.yml
+++ b/gitian/descriptors/linux/gitian-webrtc.yml
@@ -11,12 +11,13 @@ packages:
 - "hardening-wrapper"
 - "libasound2-dev"
 - "libexpat1-dev"
+- "libglib2.0-dev"
+- "libgtk2.0-dev"
 - "libudev-dev"
 - "libx11-dev"
 - "libxext-dev"
 - "libxrandr-dev"
-- "default-jre-headless"
-- "default-jdk"
+- "pkg-config"
 reference_datetime: "2000-01-01 00:00:00"
 remotes:
 - "url": "https://chromium.googlesource.com/chromium/tools/depot_tools.git"
@@ -26,6 +27,7 @@ files:
 - "binutils-linux64-utils.zip"
 - "gcc-linux64-utils.zip"
 - "webrtc.tar.gz"
+- "webrtc-linux.patch"
 script: |
   INSTDIR="$HOME/install"
   export REFERENCE_DATETIME
@@ -82,6 +84,7 @@ script: |
   # Building webrtc
   tar xaf webrtc.tar.gz
   cd webrtc/src
+  patch -p1 < ../../webrtc-linux.patch
 
   # First, build a copy of GN, rather than use the prebuilt copy in buildtools/linux64.
   cd tools/gn
@@ -91,32 +94,31 @@ script: |
   # This is where bootstrap.py stashes the built gn.
   GN="$PWD/out_bootstrap/gn"
 
-  export GYP_CROSSCOMPILE=1
-  export GYP_DEFINES="OS=linux target_arch=$(if [ $GBUILD_BITS = 32 ]; then echo ia32; else echo x64; fi)"
+  export GN_ARGS=""
+  # For a list of all possible GN args, do "gn gen out/Release; gn args --list out/Release".
+  # https://chromium.googlesource.com/chromium/src/+/master/tools/gn/docs/cross_compiles.md
+  GN_ARGS+=" target_os=\"linux\" target_cpu=\"$(if [ $GBUILD_BITS = 32 ]; then echo x86; else echo x64; fi)\""
+  # Not debug.
+  GN_ARGS+=" is_debug=false"
+  # There are warnings from unused returns.
+  GN_ARGS+=" treat_warnings_as_errors=false"
+  # Build static libraries.
+  GN_ARGS+=" is_component_build=false"
   # Do not use bundled utilities.
-  GYP_DEFINES+=" clang=0 host_clang=0 use_sysroot=0"
-  GYP_DEFINES+=" linux_use_bundled_gold=0 linux_use_gold_flags=0 linux_use_bundled_binutils=0"
-  # Avoid some dependencies. Some of these don't seem to work fully; for
-  # example even with use_alsa=0 we need libasound2-dev.
-  GYP_DEFINES+=" use_x11=0 use_gtk=0 use_gconf=0 use_alsa=0 use_pulseaudio=0 use_libpci=0 include_internal_audio_device=0 enabled_libjingle_device_manager=0"
-  # examples and tests also bring in dependencies.
-  GYP_DEFINES+=" include_examples=0 include_tests=0"
-  # embedded=1 is supposed to turn of various features; see
-  # https://bugs.chromium.org/p/chromium/issues/detail?id=318413.
-  GYP_DEFINES+=" embedded=1"
-  GYP_DEFINES+=" werror="
-  JAVA_HOME=/usr/lib/jvm/default-java webrtc/build/gyp_webrtc.py
-  ninja -C out/Release
-  # Run ninja once more, without include_tests=0, in order to build just the
-  # FakeAudioCaptureModule that go-webrtc uses.
-  GYP_DEFINES="$(echo "$GYP_DEFINES" | sed -e 's/include_tests=0//g')"
-  JAVA_HOME=/usr/lib/jvm/default-java webrtc/build/gyp_webrtc.py
-  ninja -C out/Release obj/webrtc/api/test/peerconnection_unittests.fakeaudiocapturemodule.o
+  GN_ARGS+=" is_clang=false use_sysroot=false"
+  GN_ARGS+=" gold_path=\"$INSTDIR/binutils/bin\""
+  # Make extra sure we don't use bundled binutils.
+  rm -rf third_party/binutils/Linux_*
+  # Avoid some dependencies.
+  GN_ARGS+=" use_ozone=true use_gconf=false"
+  GN_ARGS+=" rtc_include_opus=false rtc_include_ilbc=false rtc_include_internal_audio_device=false rtc_include_pulse_audio=false"
+  # Included for "field_trial" below.  Maybe "fieldtrial_testing_like_official_build" could help here?
+  #GN_ARGS+=" rtc_include_tests=false"
+  rm -rf out/Release
+  "$GN" gen out/Release --args="$GN_ARGS"
+  ninja -C out/Release webrtc field_trial metrics_default pc_test_utils
   # https://github.com/keroserene/go-webrtc/issues/23#issuecomment-175312648
-  # dump_syms_regtest.o is actually an executable, not an object file. If not
-  # excluded, it results in the error:
-  # libwebrtc-linux-386-magic.a(dump_syms_regtest.o): unsupported ELF file type 2
-  ar crs libwebrtc-magic.a $(find . -name '*.o' -not -name '*.main.o' -not -name 'dump_syms_regtest.o' | sort)
+  ar crs libwebrtc-magic.a $(find . -name '*.o' -not -name '*.main.o' | sort)
   cd ../..
 
   # Grabbing the result
diff --git a/gitian/fetch-inputs.sh b/gitian/fetch-inputs.sh
index 9059336..e70eb4c 100755
--- a/gitian/fetch-inputs.sh
+++ b/gitian/fetch-inputs.sh
@@ -309,10 +309,7 @@ cd ..
 # 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"
 # 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.
 export JAVA_HOME=/usr/lib/jvm/default-java
diff --git a/gitian/patches/webrtc-linux.patch b/gitian/patches/webrtc-linux.patch
new file mode 100644
index 0000000..b1efb7a
--- /dev/null
+++ b/gitian/patches/webrtc-linux.patch
@@ -0,0 +1,25 @@
+From ebc1773a92884bec7d93274b2d729ccf76050197 Mon Sep 17 00:00:00 2001
+From: David Fifield <fifield at eecs.berkeley.edu>
+Date: Wed, 22 Mar 2017 09:53:07 -0400
+Subject: [PATCH] Disable some settings in build_overrides.
+
+---
+ build_overrides/build.gni | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/build_overrides/build.gni b/build_overrides/build.gni
+index af4924d4c..ffaafdebc 100644
+--- a/build_overrides/build.gni
++++ b/build_overrides/build.gni
+@@ -14,7 +14,7 @@ mac_sdk_min_build_override = "10.11"
+ enable_java_templates = true
+ 
+ # Some non-Chromium builds don't use Chromium's third_party/binutils.
+-linux_use_bundled_binutils_override = true
++linux_use_bundled_binutils_override = false
+ 
+ # Variable that can be used to support multiple build scenarios, like having
+ # Chromium specific targets in a client project's GN file etc.
+-- 
+2.12.1
+
diff --git a/gitian/versions b/gitian/versions
index 1b88910..a1f8bff 100755
--- a/gitian/versions
+++ b/gitian/versions
@@ -42,9 +42,9 @@ GO_X_NET_TAG=7dbad50ab5b31073856416cdcfeb2796d682f844
 OBFS4_TAG=obfs4proxy-0.0.5
 NOTOFONTS_TAG=720e34851382ee3c1ef024d8dffb68ffbfb234c2
 DEPOT_TOOLS_TAG=28216cd14b44716db5c83634afbdc6e90492652b
-WEBRTC_TAG=f33698296719f956497d2dbff81b5080864a8804 # https://chromium.googlesource.com/external/webrtc.git/+/refs/branch-heads/52
-GO_WEBRTC_TAG=69c5ca70533142494d145b43ef2f46ca94715557
-SNOWFLAKE_TAG=6cecd31fd896eb26e64ad8bab8a9ea510ec3b21d
+WEBRTC_TAG=c279861207c5b15fc51069e96595782350e0ac12 # https://chromium.googlesource.com/external/webrtc.git/+/refs/branch-heads/58
+GO_WEBRTC_TAG=ab1b64862e0c4b4182010699911c2c5818f0a101
+SNOWFLAKE_TAG=9f2e9a6ecb696149708716ca06ce842df03cf492
 UNIURI_TAG=8902c56451e9b58ff940bbe5fec35d5f9c04584a
 
 GITIAN_TAG=tor-browser-builder-3.x-8
diff --git a/gitian/versions.alpha b/gitian/versions.alpha
index e3352c4..145c9f9 100755
--- a/gitian/versions.alpha
+++ b/gitian/versions.alpha
@@ -48,9 +48,9 @@ OBFS4_TAG=obfs4proxy-0.0.5
 NOTOFONTS_TAG=720e34851382ee3c1ef024d8dffb68ffbfb234c2
 SELFRANDO_TAG=44ac0df8c0e8eb291f2d913e2dd147000bf54863
 DEPOT_TOOLS_TAG=28216cd14b44716db5c83634afbdc6e90492652b
-WEBRTC_TAG=f33698296719f956497d2dbff81b5080864a8804 # https://chromium.googlesource.com/external/webrtc.git/+/refs/branch-heads/52
-GO_WEBRTC_TAG=69c5ca70533142494d145b43ef2f46ca94715557
-SNOWFLAKE_TAG=6cecd31fd896eb26e64ad8bab8a9ea510ec3b21d
+WEBRTC_TAG=c279861207c5b15fc51069e96595782350e0ac12 # https://chromium.googlesource.com/external/webrtc.git/+/refs/branch-heads/58
+GO_WEBRTC_TAG=ab1b64862e0c4b4182010699911c2c5818f0a101
+SNOWFLAKE_TAG=9f2e9a6ecb696149708716ca06ce842df03cf492
 UNIURI_TAG=8902c56451e9b58ff940bbe5fec35d5f9c04584a
 
 GITIAN_TAG=tor-browser-builder-4-1
diff --git a/gitian/versions.beta b/gitian/versions.beta
index a9c988e..65b6546 100755
--- a/gitian/versions.beta
+++ b/gitian/versions.beta
@@ -31,9 +31,9 @@ GOPTLIB_TAG=0.2
 MEEK_TAG=0.25
 NOTOFONTS_TAG=720e34851382ee3c1ef024d8dffb68ffbfb234c2
 DEPOT_TOOLS_TAG=28216cd14b44716db5c83634afbdc6e90492652b
-WEBRTC_TAG=f33698296719f956497d2dbff81b5080864a8804 # https://chromium.googlesource.com/external/webrtc.git/+/refs/branch-heads/52
-GO_WEBRTC_TAG=69c5ca70533142494d145b43ef2f46ca94715557
-SNOWFLAKE_TAG=6cecd31fd896eb26e64ad8bab8a9ea510ec3b21d
+WEBRTC_TAG=c279861207c5b15fc51069e96595782350e0ac12 # https://chromium.googlesource.com/external/webrtc.git/+/refs/branch-heads/58
+GO_WEBRTC_TAG=ab1b64862e0c4b4182010699911c2c5818f0a101
+SNOWFLAKE_TAG=9f2e9a6ecb696149708716ca06ce842df03cf492
 UNIURI_TAG=8902c56451e9b58ff940bbe5fec35d5f9c04584a
 
 GITIAN_TAG=tor-browser-builder-3.x-6
diff --git a/gitian/versions.nightly b/gitian/versions.nightly
index 042095a..5fde922 100755
--- a/gitian/versions.nightly
+++ b/gitian/versions.nightly
@@ -51,7 +51,7 @@ OBFS4_TAG=master
 NOTOFONTS_TAG=720e34851382ee3c1ef024d8dffb68ffbfb234c2
 SELFRANDO_TAG=44ac0df8c0e8eb291f2d913e2dd147000bf54863
 DEPOT_TOOLS_TAG=master
-WEBRTC_TAG=f33698296719f956497d2dbff81b5080864a8804 # https://chromium.googlesource.com/external/webrtc.git/+/refs/branch-heads/52
+WEBRTC_TAG=c279861207c5b15fc51069e96595782350e0ac12 # https://chromium.googlesource.com/external/webrtc.git/+/refs/branch-heads/58
 GO_WEBRTC_TAG=master
 SNOWFLAKE_TAG=master
 UNIURI_TAG=master



More information about the tor-commits mailing list