Commit 4ff2be0b authored by David Fifield's avatar David Fifield Committed by Georg Koppen
Browse files

Bug 25483: Use snowflake from the cohosh/pion branch.

Switched to using the pion/webrtc library and modified the targets
to build snowflake on all platforms.
parent 273e0979
Loading
Loading
Loading
Loading
+2 −29
Original line number Diff line number Diff line
#!/bin/bash
[% c("var/set_default_env") -%]
[% pc('go', 'var/setup', { go_tarfile => c('input_files_by_name/go') }) %]
[% pc(c('var/compiler'), 'var/setup', { compiler_tarfile => c('input_files_by_name/' _ c('var/compiler')) }) %]
[% IF c("var/linux") %]
  tar -C /var/tmp/dist -xf $rootdir/[% c('input_files_by_name/binutils') %]
  export PATH="/var/tmp/dist/binutils/bin:$PATH"
  # The go-webrtc package sets _GLIBCXX_USE_CXX11_ABI=0 for compatibility with
  # 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.
  export CGO_CXXFLAGS="-D_GLIBCXX_USE_CXX11_ABI=1"
[% END -%]
distdir=/var/tmp/dist/[% project %]
[% c("var/set_PTDIR_DOCSDIR") -%]
mkdir -p $PTDIR $DOCSDIR
[% IF c("var/osx") %]
  export CGO_ENABLED=1
  export CGO_CFLAGS="[% c("var/FLAGS") %] -mmacosx-version-min=[% c("var/macosx_deployment_target") %]"
  export CGO_CXXFLAGS="[% c("var/FLAGS") %] -stdlib=libc++ -mmacosx-version-min=[% c("var/macosx_deployment_target") %]"
  export CGO_LDFLAGS="[% c("var/FLAGS") %] -stdlib=libc++ -mmacosx-version-min=[% c("var/macosx_deployment_target") %]"
  export CC="$clangdir/bin/clang"
  export CXX="$clangdir/bin/clang++"
[% END %]

tar -C /var/tmp/dist -xf [% c('input_files_by_name/go-webrtc') %]
tar -C /var/tmp/dist -xf [% c('input_files_by_name/uniuri') %]
tar -C /var/tmp/dist -xf [% c('input_files_by_name/goptlib') %]
tar -C /var/tmp/dist -xf [% c('input_files_by_name/pion-webrtc') %]

mkdir -p /var/tmp/build
tar -C /var/tmp/build -xf [% project %]-[% c('version') %].tar.gz
@@ -35,16 +17,7 @@ mkdir -p "$GOPATH/src/git.torproject.org/pluggable-transports"
ln -sf "$PWD" "$GOPATH/src/git.torproject.org/pluggable-transports/snowflake.git"

cd client
[% IF c("var/osx") -%]
  # Without faketime, snowflake-client would contain the timestamp of the
  # temporary client.a file created during "go build".
  # The -tmpdir flag overrides what would otherwise be a randomly generated
  # path, /tmp/go-link-RANDOMNUM/go.o.
  mkdir -p /var/tmp/go-link.tmpdir
  [% c("var/faketime") %] go build -ldflags '-s -tmpdir /var/tmp/go-link.tmpdir'
[% ELSE -%]
go build -ldflags '-s'
[% END -%]
cp -a client[% IF c("var/windows") %].exe[% END %] $PTDIR/snowflake-client[% IF c("var/windows") %].exe[% END %]

cd ..
+4 −26
Original line number Diff line number Diff line
# vim: filetype=yaml sw=2
version: '[% c("abbrev") %]'
git_url: https://git.torproject.org/pluggable-transports/snowflake.git
git_hash: cd650fa0097f948b15dddd889ad2e6908b58bd66
git_url: https://github.com/cohosh/snowflake
git_hash: 49a899be452a58db27ecc94223b0c527bf8d4927
filename: '[% project %]-[% c("version") %]-[% c("var/osname") %]-[% c("var/build_id") %].tar.gz'

var:
  container:
    use_container: 1

targets:
  linux-i686:
    var:
      arch_deps:
        - pkg-config
        - libx11-dev:i386
  linux-x86_64:
    var:
      arch_deps:
        - pkg-config
        - libx11-dev
  osx-x86_64:
    var:
      arch_deps:
        - pkg-config
        - faketime

input_files:
  - project: container-image
  - name: go
    project: go
  - name: '[% c("var/compiler") %]'
    project: '[% c("var/compiler") %]'
  - name: binutils
    project: binutils
    enable: '[% c("var/linux") %]'
  - name: go-webrtc
    project: go-webrtc
  - name: uniuri
    project: uniuri
  - name: goptlib
    project: goptlib
  - name: pion-webrtc
    project: pion-webrtc
+3 −0
Original line number Diff line number Diff line
## obfs4proxy configuration
ClientTransportPlugin meek_lite,obfs2,obfs3,obfs4,scramblesuit exec TorBrowser\Tor\PluggableTransports\obfs4proxy.exe

## snowflake configuration
ClientTransportPlugin snowflake exec TorBrowser\Tor\PluggableTransports\snowflake-client.exe -url https://snowflake-broker.azureedge.net/ -front ajax.aspnetcdn.com -ice stun:stun.l.google.com:19302
+4 −11
Original line number Diff line number Diff line
@@ -108,19 +108,12 @@ cp -a Bundle-Data/Docs/* "$TBDIR/$DOCSPATH"
tar -C Bundle-Data/[% bundledata_osname %] -c . | tar -C "$TBDIR[% IF ! c("var/osx") %]/TorBrowser[% END %]" -x

cat Bundle-Data/PTConfigs/[% bundledata_osname %]/torrc-defaults-appendix >> "$TBDIR/$TORCONFIGPATH/torrc-defaults"
[% IF c("var/linux") || c("var/osx") -%]
[% IF ! c("var/snowflake") %]
  grep -v 'default_bridge\.snowflake' Bundle-Data/PTConfigs/bridge_prefs.js \
    >> "$GENERATEDPREFSPATH"
[% ELSE %]
  cat Bundle-Data/PTConfigs/bridge_prefs.js >> "$GENERATEDPREFSPATH"
[% END %]
[% END -%]
[% IF c("var/windows") -%]
  # We don't have snowflake available on Windows (yet).
  grep -v 'default_bridge\.snowflake' Bundle-Data/PTConfigs/bridge_prefs.js \
    >> "$GENERATEDPREFSPATH"
[% END -%]

[% IF ! c("var/multi_lingual") %]
  echo 'pref("extensions.torlauncher.prompt_for_locale", false);' >> "$GENERATEDPREFSPATH"
+5 −2
Original line number Diff line number Diff line
@@ -247,7 +247,7 @@ targets:
    var:
      linux: 1
      compiler: gcc
      # We only build snowflake for linux and macOS on the alpha and nightly
      # We only build snowflake on the alpha and nightly
      # channels for now.
      snowflake: '[% c("var/alpha") || c("var/nightly") %]'
      container:
@@ -299,6 +299,9 @@ targets:
      flag_mwindows: '-mwindows'
      compiler: mingw-w64
      faketime_path: /usr/lib/x86_64-linux-gnu/faketime/libfaketime.so.1
      # We only build snowflake on the alpha and nightly
      # channels for now.
      snowflake: '[% c("var/alpha") || c("var/nightly") %]'
      deps:
        - build-essential
        - python
@@ -324,7 +327,7 @@ targets:
      LDFLAGS: "-Wl,-syslibroot,$sysrootdir -Wl,-dead_strip -Wl,-pie"
      macosx_deployment_target: '10.9'
      locale_ja: ja-JP-mac
      # We only build snowflake for linux and macOS on the alpha and nightly
      # We only build snowflake on the alpha and nightly
      # channels for now.
      snowflake: '[% c("var/alpha") || c("var/nightly") %]'
      deps: