code:
#!/bin/bash

# android-components
read -d '' p << 'EOF' || true
if (m/const\\s+val\\s+VERSION\\s+=\\s+"([^"]+)"/) {
  print $1;
  exit;
}
EOF
needed=$(cat buildSrc/src/main/java/AndroidComponents.kt | perl -ne "$p")
current='[% pc("android-components", "var/android_components_version") %]'
check_update_needed android-components "$needed" "$current"

# targetSdkVersion
read -d '' p << 'EOF' || true
if (m/const\\s+val\\s+targetSdkVersion\\s+=\\s+([^"]+)/) {
  print $1;
  exit;
}
EOF
needed=$(cat buildSrc/src/main/java/Config.kt | perl -ne "$p")
current=30
check_update_needed targetSdkVersion "$needed" "$current"

# compileSdkVersion
read -d '' p << 'EOF' || true
if (m/const\\s+val\\s+compileSdkVersion\\s+=\\s+([^"]+)/) {
  print $1;
  exit;
}
EOF
needed=$(cat buildSrc/src/main/java/Config.kt | perl -ne "$p")
current=31
check_update_needed compileSdkVersion "$needed" "$current"

# minSdkVersion
read -d '' p << 'EOF' || true
if (m/const\\s+val\\s+minSdkVersion\\s+=\\s+([^"]+)/) {
  print $1;
  exit;
}
EOF
needed=$(cat buildSrc/src/main/java/Config.kt | perl -ne "$p")
current=21
check_update_needed minSdkVersion "$needed" "$current"

# gradle
read -d '' p << 'EOF' || true
if (m|distributionUrl=https\\\\://services.gradle.org/distributions/gradle-(.*)-bin.zip|) {
  print $1;
  exit;
}
EOF
needed=$(cat gradle/wrapper/gradle-wrapper.properties | perl -ne "$p")
current='[% c("var/gradle_version") %]'
check_update_needed gradle "$needed" "$current"

# android-gradle-plugin
read -d '' p << 'EOF' || true
if (m/const\\s+val\\s+android_gradle_plugin\\s+=\\s+"([^"]+)"/) {
  print $1;
  exit;
}
EOF
needed=$(cat buildSrc/src/main/java/Dependencies.kt | perl -ne "$p")
current='7.0.0'
check_update_needed android-gradle-plugin "$needed" "$current"

repo_name: JeremyRand/tor

license: mit


code:
From 6ce1e079030b9191d2a9960b3fb266d7b723180c Mon Sep 17 00:00:00 2001
From: Georg Koppen <gk@torproject.org>
Date: Tue, 21 Apr 2020 11:03:13 +0000
Subject: [PATCH] Bug 33927: Use local maven repository for gradle dependencies

---
 build.gradle             | 2 ++
 buildSrc/build.gradle    | 1 +
 buildSrc/settings.gradle | 5 +++++
 settings.gradle          | 6 ++++++
 4 files changed, 14 insertions(+)
 create mode 100644 buildSrc/settings.gradle

diff --git a/build.gradle b/build.gradle
index 093a4fcd2..9b51c77d3 100644
--- a/build.gradle
+++ b/build.gradle
@@ -5,6 +5,7 @@ import org.mozilla.fenix.gradle.tasks.GithubDetailsTask
 buildscript {
     // This logic is duplicated in the allprojects block: I don't know how to fix that.
     repositories {
+        mavenLocal()
         maven {
             name "Mozilla Nightly"
             url "https://nightly.maven.mozilla.org/maven2"
@@ -80,6 +81,7 @@ plugins {
 allprojects {
     // This logic is duplicated in the buildscript block: I don't know how to fix that.
     repositories {
+        mavenLocal()
         maven {
             name "Mozilla Nightly"
             url "https://nightly.maven.mozilla.org/maven2"
diff --git a/buildSrc/build.gradle b/buildSrc/build.gradle
index c3d133e6a..2eb6e05c3 100644
--- a/buildSrc/build.gradle
+++ b/buildSrc/build.gradle
@@ -7,6 +7,7 @@ plugins {
 }

 repositories {
+    mavenLocal()
     if (project.hasProperty("centralRepo")) {
         maven {
             name "MavenCentral"
diff --git a/buildSrc/settings.gradle b/buildSrc/settings.gradle
new file mode 100644
index 000000000..a7066edcb
--- /dev/null
+++ b/buildSrc/settings.gradle
@@ -0,0 +1,5 @@
+pluginManagement {
+  repositories {
+    mavenLocal()
+  }
+}
diff --git a/settings.gradle b/settings.gradle
index 8440fc306..d2e8ba475 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -1,3 +1,9 @@
+pluginManagement {
+  repositories {
+    mavenLocal()
+  }
+}
+
 include ':app'

 include ':mozilla-detekt-rules'


code:
#!/bin/bash
[% c("var/set_default_env") -%]

[% FOREACH lang = c('var/locales') %]
  [% SET lang = tmpl(lang) %]
  [% SET filename = c("var/input_filename") _ '/' _ lang _ '.xpi'; %]
  shasum=$(grep '[% c("var/ff_arch") %]/xpi/[% lang %].xpi$' SHA512SUMS-[% c("version") %] | sed 's|  [% c("var/ff_arch") %]/xpi/[% lang %].xpi$||')
  echo "$shasum  [% filename %]" | sha512sum -c
[% END %]

mkdir -p [% dest_dir %]/[% c("filename") %]
[% FOREACH lang = c('var/locales') %]
  [% SET lang = tmpl(lang) %]
  [% SET filename = c("var/input_filename") _ '/' _ lang _ '.xpi'; %]
  cp -a [% filename %] [% dest_dir %]/[% c("filename") %]/
[% END %]

path: projects/firefox-langpacks/build


code:
# vim: filetype=yaml sw=2
version: '[% c("var/ff_version") %]-[% c("var/ff_build") %]'
filename: '[% project %]-[% c("version") %]-[% c("var/osname") %]-[% c("var/build_id") %]'

var:
  ff_version: '[% pc("firefox", "var/firefox_version") %]'
  ff_build: build1
  input_filename: 'dl-langpack-[% c("var/ff_arch") %]-[% c("version") %]'

targets:
  linux:
    var:
      ff_arch: 'linux-[% c("arch") %]'
  windows-i686:
    var:
      ff_arch: win32
  windows-x86_64:
    var:
      ff_arch: win64
  osx-x86_64:
    var:
      ff_arch: mac

input_files:
  - URL: 'https://ftp.mozilla.org/pub/firefox/candidates/[% c("var/ff_version") %]-candidates/[% c("var/ff_build") %]/SHA512SUMS'
    filename: 'SHA512SUMS-[% c("version") %]'
    gpg_keyring: firefox.gpg
    sig_ext: asc
    file_gpg_id: 1

  - filename: '[% c("var/input_filename") %]'
    refresh_input: 1
    exec: |
      #!/bin/bash
      set -e
      [% SET outdir = c("var/input_filename") %]
      mkdir -p [% dest_dir %]/[% outdir %]
      [% FOREACH lang = c('var/locales') %]
      [% SET lang = tmpl(lang) %]
      [% SET ffver = c("var/ff_version");
         SET ffbuild = c("var/ff_build");
         SET ffarch = c("var/ff_arch");
         SET URL = "https://ftp.mozilla.org/pub/mozilla.org/firefox/candidates/" _ ffver _ '-candidates/' _ ffbuild _ '/' _ ffarch _ '/xpi/' _ lang _ '.xpi';
         SET filename = outdir _ '/' _ lang _ '.xpi'; %]
      test -f [% dest_dir %]/[% filename %] || \
         [% GET c("urlget", { filename => filename _ '-tmp', URL => URL }); %]
      test -f [% dest_dir %]/[% filename %] || \
         mv -f [% dest_dir %]/[% filename %]-tmp [% dest_dir %]/[% filename %]
      [% END %]

path: projects/firefox-langpacks/config


code:
/*
 * Bug 34359: Update abicheck to require newer libstdc++.so.6
 * This program is useful in determining if the libstdc++.so.6 installed
 * on the system is recent enough. Specifically, this program requires
 * `GLIBCXX_3.4.28` which should be provided by libstdc++.so.6 from
 * GCC >= 9.3.0 (we are good here as well with GCC 10.2.0). If the program
 * executes successfully, that means we should use the system version of
 * libstdc++.so.6 and if not, that means we should use the bundled version.
 *
 * We use std::pmr::monotonic_buffer_resource in order to require
 * GLIBCXX_3.4.28:
 * https://github.com/gcc-mirror/gcc/blob/9e4ebad20a064d10df451cfb2cea9853d339a898/libstdc%2B%2B-v3/config/abi/pre/gnu.ver#L2303
 * The example below got inspired by
 * https://www.mail-archive.com/gcc-patches@gcc.gnu.org/msg227964.html.
 */

#include <memory_resource>

int main () {
  std::pmr::monotonic_buffer_resource res;
  void* a = res.allocate(1);
  res.release();
  return 0;
}


code:
#!/bin/bash
[% c("var/set_default_env") -%]
[% pc(c('var/compiler'), 'var/setup', { compiler_tarfile => c('input_files_by_name/' _ c('var/compiler')) }) %]
distdir=/var/tmp/dist/[% project %]
mkdir -p /var/tmp/build
mkdir -p [% dest_dir _ '/' _ c('filename') %]

[% IF c("var/windows") %]
  # Setting up fxc2
  tar -C /var/tmp/dist -xf [% c('input_files_by_name/fxc2') %]
  export PATH="/var/tmp/dist/fxc2/bin:$PATH"
  # Setting up stack protector support
  tar -C /var/tmp/dist -xf [% c('input_files_by_name/mingw-w64') %]
  cp /var/tmp/dist/mingw-w64/gcclibs/{libssp.a,libssp_nonshared.a} /var/tmp/dist/mingw-w64-clang/[% c("arch") %]-w64-mingw32/lib/
[% END -%]

tar -C /var/tmp/dist -xf [% c('input_files_by_name/rust') %]
tar -C /var/tmp/dist -xf [% c('input_files_by_name/cbindgen') %]
tar -C /var/tmp/dist -xf [% c('input_files_by_name/nasm') %]
tar -C /var/tmp/dist -xf [% c('input_files_by_name/node') %]
export PATH="/var/tmp/dist/rust/bin:/var/tmp/dist/cbindgen:/var/tmp/dist/nasm/bin:/var/tmp/dist/node/bin:$PATH"
tar -C /var/tmp/dist -xf [% c('input_files_by_name/clang') %]
export LLVM_CONFIG="/var/tmp/dist/clang/bin/llvm-config"

[% IF c("var/linux") %]
  tar -C /var/tmp/dist -xf [% c('input_files_by_name/python') %]
  export PATH="/var/tmp/dist/python/bin:$PATH"
  tar -C /var/tmp/dist -xf $rootdir/[% c('input_files_by_name/binutils') %]
  export PATH="/var/tmp/dist/binutils/bin:$PATH"
  # Use clang for everything on Linux now if we don't build with ASan.
  [% IF ! c("var/asan") -%]
    export PATH="/var/tmp/dist/clang/bin:$PATH"
  [% END -%]
  [% IF c("var/linux-i686") %]
    # Exporting `PKG_CONFIG_PATH` in the mozconfig file is causing build
    # breakage in Rust code. It seems that environment variable is not passed
    # down properly in that case. Thus, we set it here in the build script.
    export PKG_CONFIG_PATH="${PKG_CONFIG_PATH}:/usr/lib/i386-linux-gnu/pkgconfig"
  [% END -%]
[% END -%]

[% IF c("var/rlbox") -%]
  tar -C /var/tmp/dist -xf [% c('input_files_by_name/wasi-sysroot') %]
  # XXX: We need the libclang_rt.builtins-wasm32.a in our clang lib directory.
  # Copy it over.
  # https://searchfox.org/mozilla-central/source/build/build-clang/build-clang.py#890,
  # include it directly in our clang
  rtdir=/var/tmp/dist/clang/lib/clang/[% pc("clang", "version") %]/lib/wasi
  [% IF c("var/osx") -%]
    rtdir=/var/tmp/dist/macosx-toolchain/clang/lib/clang/[% pc("clang", "version") %]/lib/wasi
  [% END-%]
  mkdir -p $rtdir
  cp /var/tmp/dist/wasi-sysroot/lib/clang/11.0.0/lib/wasi/libclang_rt.builtins-wasm32.a $rtdir
  tar -C /var/tmp/dist -xf [% c('input_files_by_name/lucetc') %]
  export PATH="/var/tmp/dist/lucetc/bin:$PATH"
  export WASM_SANDBOXED_LIBRARIES=graphite,ogg
  export WASI_SYSROOT=/var/tmp/dist/wasi-sysroot/share/wasi-sysroot
[% END -%]

tar -C /var/tmp/build -xf [% project %]-[% c('version') %].tar.gz

mkdir -p $distdir/[% IF ! c("var/osx") %]Browser[% END %]

cd /var/tmp/build/[% project %]-[% c("version") %]
cat > .mozconfig << 'MOZCONFIG_EOF'
[% INCLUDE mozconfig %]
MOZCONFIG_EOF
[% IF c("var/asan") -%]
  # Without disabling LSan our build is blowing up:
  # https://bugs.torproject.org/10599#comment:52
  export ASAN_OPTIONS="detect_leaks=0"
[% END -%]

eval $(perl $rootdir/get-moz-build-date [% c("var/copyright_year") %] [% c("var/torbrowser_version") %])
if [ -z $MOZ_BUILD_DATE ]
then
    echo "MOZ_BUILD_DATE is not set"
    exit 1
fi

[% IF c("var/windows") %]
  # Make sure widl is not inserting random timestamps, see #21837.
  export WIDL_TIME_OVERRIDE="0"
  patch -p1 < $rootdir/nsis-uninstall.patch
  # mingw-w64 does not support SEH on 32bit systems. Be explicit about that.
  export LDFLAGS="[% c('var/flag_noSEH') %]"
[% END -%]

[% IF c("var/namecoin") %]
  patch -p1 < $rootdir/namecoin-etld.patch
[% END -%]

[% IF c("var/tor-browser") -%]
  # Place a copy of the Tor Launcher sources under browser/extensions
  tar -C browser/extensions -xf $rootdir/[% c('input_files_by_name/tor-launcher') %]
[% END -%]

[% IF c("var/namecoin") %]
  pushd toolkit/torproject/torbutton
  patch -p1 < $rootdir/namecoin-torbutton.patch
  popd
[% END %]

[% IF c("var/nightly") && c("var/tor-browser") -%]
  # Set update url for nightly (#33402 / #40033)
  sed -i 's|^URL=https://aus1\.torproject\.org/.*|URL=https://nightlies.tbb.torproject.org/nightly-updates/updates/nightly-[% c("var/osname") %]/%CHANNEL%/%BUILD_TARGET%/%VERSION%/%LOCALE%|' build/application.ini.in
[% END -%]

rm -f configure
rm -f js/src/configure

export MACH_USE_SYSTEM_PYTHON=1

./mach configure [% IF c("var/tor-browser") %]--with-tor-browser-version=[% c("var/torbrowser_version") %][% END %] --with-distribution-id=org.torproject --enable-update-channel=[% c("var/channel") %] --enable-bundled-fonts [% IF c("var/tor-browser") %]--with-branding=[% c("var/branding_directory") %][% END %]

./mach build --verbose
./mach build stage-package

[% IF c("var/osx") %]
  cp -a obj-*/dist/firefox/* $distdir
  [% IF c("var/base-browser") -%]
    mv "$distdir/Firefox.app" "$distdir/[% c('var/Project_Name') %].app"
  [% END -%]
  # Remove firefox-bin (we don't use it, see ticket #10126)
  rm -f "$distdir/[% c('var/Project_Name') %].app/Contents/MacOS/firefox-bin"

  # Adjust the Info.plist file
  INFO_PLIST="$distdir/[% c('var/Project_Name') %].app/Contents/Info.plist"
  mv "$INFO_PLIST" tmp.plist
  python3 $rootdir/fix-info-plist.py '[% c("var/torbrowser_version") %]' '[% c("var/copyright_year") %]' < tmp.plist > "$INFO_PLIST"
  rm -f tmp.plist
[% END %]

[% IF c("var/linux") %]
  [% IF c("var/linux-x86_64") && !c("var/asan") %]
    cp obj-*/testing/geckodriver/x86_64-unknown-linux-gnu/release/geckodriver $distdir
  [% END %]
  cp -a obj-*/dist/firefox/* $distdir/Browser/
  # Remove firefox-bin (we don't use it, see ticket #10126)
  rm -f $distdir/Browser/firefox-bin
  # TODO: There goes FIPS-140.. We could upload these somewhere unique and
  # subsequent builds could test to see if they've been uploaded before...
  # But let's find out if it actually matters first..
  rm -f $distdir/Browser/*.chk
  # Replace firefox by a wrapper script (#25485)
  mv $distdir/Browser/firefox $distdir/Browser/firefox.real
  mv $rootdir/start-firefox $distdir/Browser/firefox
  chmod 755 $distdir/Browser/firefox
[% END %]

[% IF c("var/windows") %]
  cp -a obj-*/dist/firefox/* $distdir/Browser/
  [% IF c("var/windows-i686") %]
    cp -a /var/tmp/dist/fxc2/bin/d3dcompiler_47_32.dll $distdir/Browser/d3dcompiler_47.dll
  [% ELSE %]
    cp -a /var/tmp/dist/fxc2/bin/d3dcompiler_47.dll $distdir/Browser
  [% END %]
[% END %]

# Make MAR-based update tools available for use during the bundle phase.
# Note that mar and mbsdiff are standalone tools, compiled for the build
# host's architecture.  We also include signmar, certutil, and the libraries
# they require; these utilities and libraries are built for the target
# architecture.
MARTOOLS=$distdir/mar-tools
mkdir -p $MARTOOLS
cp -p config/createprecomplete.py $MARTOOLS/
cp -p tools/update-packaging/*.sh $MARTOOLS/
cp -p obj-*/dist/host/bin/mar $MARTOOLS/
cp -p obj-*/dist/host/bin/mbsdiff $MARTOOLS/
[% IF c("var/linux") || c("var/osx") %]
  cp -p obj-*/dist/bin/signmar $MARTOOLS/
  cp -p obj-*/dist/bin/certutil $MARTOOLS/
  cp -p obj-*/dist/bin/modutil $MARTOOLS/
  cp -p obj-*/dist/bin/pk12util $MARTOOLS/
  cp -p obj-*/dist/bin/shlibsign $MARTOOLS/
  [% IF c("var/linux") %]
    NSS_LIBS="libfreeblpriv3.so libmozsqlite3.so libnss3.so libnssckbi.so libnssutil3.so libsmime3.so libsoftokn3.so libssl3.so"
    NSPR_LIBS="libnspr4.so libplc4.so libplds4.so"
  [% ELSE %]
    NSS_LIBS="libfreebl3.dylib libmozglue.dylib libnss3.dylib libnssckbi.dylib libsoftokn3.dylib"
    # No NSPR_LIBS for macOS
    NSPR_LIBS=""
  [% END %]
  for LIB in $NSS_LIBS $NSPR_LIBS; do
    cp -p obj-*/dist/bin/$LIB $MARTOOLS/
  done
[% END %]
[% IF c("var/windows") %]
  cp -p obj-*/dist/bin/signmar.exe $MARTOOLS/
  cp -p obj-*/dist/bin/certutil.exe $MARTOOLS/
  cp -p obj-*/dist/bin/modutil.exe $MARTOOLS/
  cp -p obj-*/dist/bin/pk12util.exe $MARTOOLS/
  cp -p obj-*/dist/bin/shlibsign.exe $MARTOOLS/
  NSS_LIBS="freebl3.dll mozglue.dll nss3.dll nssckbi.dll softokn3.dll"
  for LIB in $NSS_LIBS; do
      cp -p obj-*/dist/bin/$LIB $MARTOOLS/
  done
[% END %]

cd $distdir

[% IF c("var/linux-x86_64") %]
  [% IF !c("var/asan") %]
    # No need for an unstripped geckodriver
    strip geckodriver
  [% END %]
  mkdir -p $distdir/Debug/Browser
  # Strip and generate debuginfo for the firefox binary that we keep, all *.so
  # files, the plugin-container, and the updater (see ticket #10126)
  for LIB in Browser/*.so Browser/firefox.real Browser/plugin-container Browser/updater
  do
      objcopy --only-keep-debug $LIB Debug/$LIB
      strip $LIB
      objcopy --add-gnu-debuglink=./Debug/$LIB $LIB
  done
[% END %]

# Re-zipping the omni.ja files is not needed to make them reproductible,
# however if we don't re-zip them, the files become corrupt when we
# update them using 'zip' and firefox will silently fail to load some
# parts.
[% IF c("var/windows") || c("var/linux") %]
  [% c("var/rezip", { rezip_file => 'Browser/omni.ja' }) %]
  [% c("var/rezip", { rezip_file => 'Browser/browser/omni.ja' }) %]
[% ELSIF c("var/osx") %]
  [% c("var/rezip", { rezip_file => '"' _ c("var/Project_Name") _ '.app/Contents/Resources/omni.ja"' }) %]
  [% c("var/rezip", { rezip_file => '"' _ c("var/Project_Name") _ '.app/Contents/Resources/browser/omni.ja"' }) %]
[% END %]

[%
IF c("var/osx");
  SET browserdir='"' _ c("var/Project_Name") _ '.app/Contents"';
ELSE;
  SET browserdir='Browser';
END;
%]

[% IF c("var/linux") %]
  /var/tmp/dist/gcc/bin/g++ $rootdir/abicheck.cc -o Browser/abicheck -std=c++17
[% END %]

[% c('tar', {
        tar_src => [ browserdir ],
        tar_args => '-czf ' _ dest_dir _ '/' _ c('filename') _ '/browser.tar.gz',
    }) %]

[% IF c("var/linux-x86_64") %]
[% c('tar', {
        tar_src => [ 'Debug' ],
        tar_args => '-cJf ' _ dest_dir _ '/' _ c('filename') _ '/browser-debug.tar.xz',
    }) %]
  [% IF !c("var/asan") %]
    [% c('tar', {
            tar_src => [ 'geckodriver' ],
            tar_args => '-cJf ' _ dest_dir _ '/' _ c('filename') _ '/geckodriver-linux64.tar.xz',
        }) %]
  [% END %]
[% END %]

[% c('zip', {
        zip_src => [ 'mar-tools' ],
        zip_args => dest_dir _ '/' _ c('filename') _ '/' _ c('var/martools_filename'),
    }) %]

[% IF c("var/build_infos_json") -%]
  cat > "[% dest_dir _ '/' _ c('filename') _ '/build-infos.json' %]" << EOF_BUILDINFOS
  {
      "firefox_platform_version" : "[% c("var/firefox_platform_version") %]",
      "firefox_buildid" : "$MOZ_BUILD_DATE"
  }
EOF_BUILDINFOS
[% END -%]

path: projects/firefox/build


code:
# vim: filetype=yaml sw=2
version: '[% c("abbrev") %]'
filename: 'firefox-[% c("var/project-name") %]-[% c("version") %]-[% c("var/osname") %]-[% c("var/build_id") %]'
git_hash: '[% c("var/project-name") %]-[% c("var/firefox_version") %]-[% c("var/browser_branch") %]-build[% c("var/browser_build") %]'
tag_gpg_id: 1
git_url: https://git.torproject.org/tor-browser.git
git_submodule: 1
gpg_keyring: torbutton.gpg
container:
  use_container: 1

var:
  firefox_platform_version: 91.10.0
  firefox_version: '[% c("var/firefox_platform_version") %]esr'
  browser_branch: '11.5-1'
  browser_build: 2
  branding_directory: 'browser/branding/alpha'
  copyright_year: '[% exec("git show -s --format=%ci").remove("-.*") %]'
  deps:
    - build-essential
    - unzip
    - zip
    - autoconf2.13
    - yasm
    - pkg-config

  rezip: |
    rezip_tmpdir=$(mktemp -d)
    mkdir -p "$rezip_tmpdir/z"
    unzip -d "$rezip_tmpdir/z" -- [% c("rezip_file") %] || [ $? -lt 3 ]
    pushd "$rezip_tmpdir/z"
    [% c("zip", {
      zip_src => [ '.' ],
      zip_args => '$rezip_tmpdir/new.zip',
    }) %]
    popd
    mv -f -- "$rezip_tmpdir/new.zip" [% c("rezip_file") %]
    rm -Rf "$rezip_tmpdir"

steps:
  src-tarballs:
    filename: 'src-[% project %]-[% c("version") %].tar.xz'
    version: '[% c("git_hash") %]'
    input_files: []
    container:
      use_container: 0
    targets:
      nightly:
        version: '[% c("abbrev") %]'

  list_toolchain_updates:
    git_url: https://github.com/mozilla/gecko-dev.git
    git_hash: esr91
    tag_gpg_id: 0
    input_files: []
    container:
      use_container: 0

targets:
  release:
    var:
      branding_directory: 'browser/branding/official'

  nightly:
    git_hash: '[% c("var/project-name") %]-[% c("var/firefox_version") %]-[% c("var/browser_branch") %]'
    tag_gpg_id: 0
    var:
      branding_directory: 'browser/branding/nightly'

  linux-x86_64:
    var:
      martools_filename: mar-tools-linux64.zip
      arch_deps:
        - libgtk2.0-dev
        - libgtk-3-dev
        - libdbus-glib-1-dev
        - libxt-dev
        - hardening-wrapper
        # To pass configure since ESR 31.
        - libpulse-dev
        # To pass configure since ESR 52
        - libx11-xcb-dev
        # To support Wayland mode
        - libdrm-dev

  linux-i686:
    var:
      martools_filename: mar-tools-linux32.zip
      sort_deps: 0
      arch_deps:
        - libgtk2.0-dev:i386
        - libgtk-3-dev:i386
        - libdbus-glib-1-dev:i386
        - libxt-dev:i386
        - hardening-wrapper
        # To pass configure since ESR 31.
        - libpulse-dev:i386
        # To pass configure since ESR 52
        - libx11-xcb-dev:i386
        # To support Wayland mode
        - libdrm-dev:i386

  osx-x86_64:
    var:
      martools_filename: mar-tools-mac64.zip
      arch_deps:
        - python3
        - python3-distutils
        - rsync

  windows:
    var:
      arch_deps:
        - python3
        - python3-distutils
        - wine
      compiler: mingw-w64-clang

  windows-i686:
    var:
      martools_filename: mar-tools-win32.zip

  windows-x86_64:
    var:
      martools_filename: mar-tools-win64.zip

input_files:
  - project: container-image
  - name: '[% c("var/compiler") %]'
    project: '[% c("var/compiler") %]'
  - filename: get-moz-build-date
  - project: binutils
    name: binutils
    enable: '[% c("var/linux") %]'
  - filename: fix-info-plist.py
    enable: '[% c("var/osx") %]'
  - filename: nsis-uninstall.patch
    enable: '[% c("var/windows") %]'
  - project: rust
    name: rust
  - project: cbindgen
    name: cbindgen
  - project: wasi-sysroot
    name: wasi-sysroot
    enable: '[% c("var/rlbox") %]'
  - project: lucetc
    name: lucetc
    enable: '[% c("var/rlbox") %]'
  - project: node
    name: node
  - project: nasm
    name: nasm
  - project: python
    name: python
    enable: '[% c("var/linux") %]'
  - project: clang
    name: clang
  - project: fxc2
    name: fxc2
    enable: '[% c("var/windows") %]'
    target_prepend:
      - torbrowser-windows-x86_64
  - name: mingw-w64
    project: mingw-w64
    enable: '[% c("var/windows") %]'
  - filename: abicheck.cc
    enable: '[% c("var/linux") %]'
  - filename: start-firefox
    enable: '[% c("var/linux") %]'
  - project: tor-launcher
    name: tor-launcher
    enable: '[% c("var/tor-browser") %]'
  - filename: namecoin-torbutton.patch
    enable: '[% c("var/namecoin") %]'
    # TorButton patch authored by Arthur Edelstein, from https://github.com/arthuredelstein/torbutton/ branch 2.1.10-namecoin
  - filename: namecoin-etld.patch
    enable: '[% c("var/namecoin") %]'

path: projects/firefox/config


code:
#!/usr/bin/env python3

# Sets these keys in a property list file:
#   CFBundleGetInfoString
#   CFBundleShortVersionString
#   NSHumanReadableCopyright

import getopt
import plistlib
import sys

def usage():
    print("usage: %s TORBROWSER_VERSION YEAR < Info.plist > FixedInfo.plist" % sys.argv[0], file=sys.stderr)
    sys.exit(2)

_, args = getopt.gnu_getopt(sys.argv[1:], "")

if len(args) != 2:
    usage()

TORBROWSER_VERSION = args[0]
YEAR = args[1]

COPYRIGHT = "Tor Browser %s Copyright %s The Tor Project" % (TORBROWSER_VERSION, YEAR)

sys.stdin = open(sys.stdin.fileno(), 'rb')
plist = plistlib.load(sys.stdin)

plist["CFBundleGetInfoString"] = "Tor Browser %s" % TORBROWSER_VERSION
plist["CFBundleShortVersionString"] = TORBROWSER_VERSION
plist["NSHumanReadableCopyright"] = COPYRIGHT

sys.stdout = open(sys.stdout.fileno(), 'wb')
plistlib.dump(plist, sys.stdout)


code:
#!/usr/bin/perl -w
# Generate a MOZ_BUILD_DATE based on Tor Browser version number

use strict;

die "wrong number of arguments" unless @ARGV == 2;
my ($year, $version) = @ARGV;
my $date;
if ($version =~ m/^tbb-nightly\.([^\.]+)\.([^\.]+)\.([^\.]+)$/) {
  $date = sprintf("%d%02d%02d010101", $1, $2, $3);
} elsif ($version eq 'testbuild') {
  # There is no need for an increasing build date in test builds. Just hardcode
  # it.
  $date = 20010101010101;
} else {
  my @v = split(/[\.ab]/, $version);
  push @v, '0' if @v < 4;
  push @v, '0' if @v < 4;
  # When MOZ_BUILD_DATE was based on the firefox version, with
  # Tor Browser 8.0.6 and firefox 60.5.1 it was 20190204060201
  # We can remove 5 from the month, while keeping it increasing.
  my $month = $v[0] - 5;
  $date = 1010101 + $year * 10000000000 + $month * 100000000
             + $v[1] * 1000000 + $v[2] * 10000 + $v[3];
  $date += 1000000 unless $version =~ m/[ab]/;
}
print "export MOZ_BUILD_DATE=$date\n";

path: projects/firefox/get-moz-build-date


code:
#!/bin/bash

# rust
[% IF c("var/linux");
     SET toolchain_alias='linux64-rust';
   ELSIF c("var/windows");
     SET toolchain_alias='mingw32-rust';
   ELSIF c("var/osx");
     SET toolchain_alias='linux64-rust-macos';
   END; %]
read -d '' p << 'EOF' || true
my $d = YAML::XS::LoadFile('taskcluster/ci/toolchain/rust.yml');
foreach my $t (keys %$d) {
  if ($d->{$t}{run}{'toolchain-alias'} eq '[% toolchain_alias %]') {
    my $channel;
    foreach my $arg (@{$d->{$t}{run}{arguments}}) {
      if ($arg eq '--channel') {
        $channel = 1;
        next;
      }
      if ($channel) {
        print $arg;
        exit;
      }
    }
  }
}
EOF
needed=$(perl -MYAML::XS -e "$p")
current='[% pc("rust", "version") %]'
check_update_needed rust "$needed" "$current"

# cbindgen
read -d '' p << 'EOF' || true
if (m/^\\s*cbindgen_min_version\\s*=\\s*Version\\("([^"]+)"\\)/) {
  print $1;
  exit;
}
EOF
needed=$(cat build/moz.configure/bindgen.configure | perl -ne "$p")
current='[% pc("cbindgen", "version") %]'
check_update_needed cbindgen "$needed" "$current"

# nasm
read -d '' p << 'EOF' || true
if (m/^\\s*MODERN_NASM_VERSION\\s*=\\s*LooseVersion\\("([^"]+)"\\)/) {
  print $1;
  exit;
}
EOF
needed=$(cat python/mozboot/mozboot/base.py | perl -ne "$p")
current='2.14'
check_update_needed nasm "$needed" "$current"

# clang
[% IF c("var/linux");
     SET toolchain_alias='linux64-clang';
   ELSIF c("var/windows");
     SET toolchain_alias='linux64-clang-mingw-x64';
   ELSIF c("var/osx");
     SET toolchain_alias='macosx64-clang';
   END; %]
read -d '' p << 'EOF' || true
my $d = YAML::XS::LoadFile('taskcluster/ci/toolchain/clang.yml');
my $clang_toolchain;
foreach my $t (keys %$d) {
  if ($d->{$t}{run}{'toolchain-alias'} eq '[% toolchain_alias %]') {
    foreach my $fetch (@{$d->{$t}{fetches}{fetch}}) {
      $clang_toolchain = $fetch if $fetch =~ m/^clang-.*/;
    }
    last;
  }
}

if (!$clang_toolchain) {
  print STDERR "Error: could not find clang toolchain";
  exit 1;
}

my $fetch = YAML::XS::LoadFile('taskcluster/ci/fetch/toolchains.yml');
print $fetch->{$clang_toolchain}{fetch}{revision};
EOF
needed=$(perl -MYAML::XS -e "$p")
current='[% pc("llvm-project", "git_hash") %]'
check_update_needed clang "$needed" "$current"

# node
read -d '' p << 'EOF' || true
sub l {
  ref $_[0] eq 'ARRAY' ? $_[0] : [ $_[0] ];
}

my $d = YAML::XS::LoadFile('taskcluster/ci/toolchain/node.yml');
my $node_toolchain;
T: foreach my $t (keys %$d) {
  foreach my $alias (@{l($d->{$t}{run}{'toolchain-alias'})}) {
    if ($alias eq 'linux64-node') {
      foreach my $fetch (@{$d->{$t}{fetches}{fetch}}) {
        if ($fetch =~ m/^nodejs-.*/) {
          $node_toolchain = $fetch;
          last T;
        }
      }
    }
  }
}

exit 1 unless $node_toolchain;

my $fetch = YAML::XS::LoadFile('taskcluster/ci/fetch/toolchains.yml');
my ($version) = $fetch->{$node_toolchain}{fetch}{url} =~ m|^https://nodejs.org/dist/v([^/]+)/|;
print "$version\\n";
EOF
needed=$(perl -MYAML::XS -e "$p")
current='[% pc("node", "version") %]'
check_update_needed node "$needed" "$current"

# python
read -d '' p << 'EOF' || true
if (m/find_python3_executable\\(min_version\\s*=\\s*"([^"]+)"/) {
  print $1;
  exit;
}
EOF
needed=$(cat build/moz.configure/init.configure | perl -ne "$p")
current=3.6.0
check_update_needed python "$needed" "$current"

[% IF c("var/osx") %]
# macosx-sdk
read -d '' p << 'EOF' || true
my $d = YAML::XS::LoadFile('taskcluster/ci/toolchain/clang.yml');
my $clang_toolchain;
foreach my $t (keys %$d) {
  if ($d->{$t}{run}{'toolchain-alias'} eq 'macosx64-clang') {
    foreach my $toolchain (@{$d->{$t}{fetches}{toolchain}}) {
      if ($toolchain =~ m/^macosx64-sdk-(.+)$/) {
        print $1;
        exit;
      }
    }
    last;
  }
}
EOF
needed=$(perl -MYAML::XS -e "$p")
current='[% pc("macosx-toolchain", "version") %]'
check_update_needed macos-sdk "$needed" "$current"

# cctools
read -d '' p << 'EOF' || true
my $d = YAML::XS::LoadFile('taskcluster/ci/fetch/toolchains.yml');
print $d->{'cctools-port'}{fetch}{revision};
EOF
needed=$(perl -MYAML::XS -e "$p")
current='[% pc("cctools", "git_hash") %]'
check_update_needed cctools "$needed" "$current"

# libtapi
read -d '' p << 'EOF' || true
my $d = YAML::XS::LoadFile('taskcluster/ci/fetch/toolchains.yml');
print $d->{'libtapi'}{fetch}{revision};
EOF
needed=$(perl -MYAML::XS -e "$p")
current='[% pc("libtapi", "git_hash") %]'
check_update_needed libtapi "$needed" "$current"

# End of macOS checks
[% END -%]

[% IF c("var/windows") %]
# mingw-w64
read -d '' p << 'EOF' || true
my $d = YAML::XS::LoadFile('taskcluster/ci/fetch/toolchains.yml');
print $d->{'mingw-w64'}{fetch}{revision};
EOF
needed=$(perl -MYAML::XS -e "$p")
current='[% pc("mingw-w64", "git_hash") %]'
check_update_needed mingw-w64 "$needed" "$current"

# llvm-mingw
read -d '' p << 'EOF' || true
my $d = YAML::XS::LoadFile('taskcluster/ci/fetch/toolchains.yml');
print $d->{'llvm-mingw'}{fetch}{revision};
EOF
needed=$(perl -MYAML::XS -e "$p")
current='[% pc("llvm-mingw", "git_hash") %]'
check_update_needed llvm-mingw "$needed" "$current"

# fxc2
read -d '' p << 'EOF' || true
my $d = YAML::XS::LoadFile('taskcluster/ci/fetch/toolchains.yml');
print $d->{fxc2}{fetch}{revision};
EOF
needed=$(perl -MYAML::XS -e "$p")
current='[% pc("fxc2", "git_hash") %]'
check_update_needed fxc2 "$needed" "$current"

# End of Windows checks
[% END -%]

[% IF c("var/rlbox") %]
# wasi-sdk
read -d '' p << 'EOF' || true
my $d = YAML::XS::LoadFile('taskcluster/ci/fetch/toolchains.yml');
print $d->{'wasi-sdk'}{fetch}{revision};
EOF
needed=$(perl -MYAML::XS -e "$p")
current='[% pc("wasi-sysroot", "git_hash") %]'
check_update_needed wasi-sdk "$needed" "$current"

# lucetc
read -d '' p << 'EOF' || true
my $d = YAML::XS::LoadFile('taskcluster/ci/fetch/toolchains.yml');
print $d->{'lucetc-source'}{fetch}{revision};
EOF
needed=$(perl -MYAML::XS -e "$p")
current='[% pc("lucetc", "git_hash") %]'
check_update_needed lucetc "$needed" "$current"

# End RLBox
[% END -%]


code:
. $topsrcdir/mozconfig-[% IF c("var/osx"); GET 'macos-x86_64'; ELSE; GET c("var/osname"); END; %][% IF c("var/asan") %]-asan[% END %]

[% IF c("var/linux") -%]
  # We want to build with clang now and point to the GCC toolchain until #29041 is
  # fixed. We explicitly need to define the host compiler as well as for some
  # reason the gcc-toolchain argument does not get passed along otherwise.
  CC="clang --gcc-toolchain=/var/tmp/dist/gcc"
  CXX="clang++ --gcc-toolchain=/var/tmp/dist/gcc"
  HOST_CC=$CC
  HOST_CXX=$CXX

  export BINDGEN_CFLAGS='--gcc-toolchain=/var/tmp/dist/gcc'
[% END -%]

[% IF c("var/windows") -%]
  CROSS_COMPILE=1

  HOST_CC="clang"
  HOST_CXX="clang++"
  CC="[% c('arch') %]-w64-mingw32-clang"
  CXX="[% c('arch') %]-w64-mingw32-clang++"
  CXXFLAGS="-fms-extensions"
  AR=llvm-ar
  RANLIB=llvm-ranlib

  clang_path=/var/tmp/dist/mingw-w64-clang

  # For Stylo
  BINDGEN_CFLAGS="-I$clang_path/[% c('arch') %]-w64-mingw32/include/c++/v1 -I$clang_path/[% c('arch') %]-w64-mingw32/include"
[% END -%]

[% IF c("var/osx") -%]
  TOOLCHAIN_DIR=/var/tmp/dist/macosx-toolchain

  # ld needs libLTO.so from llvm
  mk_add_options "export LD_LIBRARY_PATH=$TOOLCHAIN_DIR/clang/lib"

  CROSS_CCTOOLS_PATH=$TOOLCHAIN_DIR/cctools
  CROSS_SYSROOT=$TOOLCHAIN_DIR/MacOSX10.12.sdk
  CROSS_PRIVATE_FRAMEWORKS=$CROSS_SYSROOT/System/Library/PrivateFrameworks
  HARDENING_FLAGS="-Werror=format -Werror=format-security -fstack-protector-strong -D_FORTIFY_SOURCE=2"
  FLAGS="-target x86_64-apple-darwin -B $CROSS_CCTOOLS_PATH/bin -isysroot $CROSS_SYSROOT $HARDENING_FLAGS"

  export CC="$TOOLCHAIN_DIR/clang/bin/clang $FLAGS"
  export CXX="$TOOLCHAIN_DIR/clang/bin/clang++ $FLAGS"
  export LLVMCONFIG=$TOOLCHAIN_DIR/clang/bin/llvm-config
  export LDFLAGS="-Wl,-syslibroot,$CROSS_SYSROOT -Wl,-pie"
  export BINDGEN_CFLAGS="$FLAGS"
  export TOOLCHAIN_PREFIX=$CROSS_CCTOOLS_PATH/bin/x86_64-apple-darwin-
  export DSYMUTIL="$TOOLCHAIN_DIR/clang/bin/dsymutil"

  export HOST_CFLAGS="-g"
  export HOST_CXXFLAGS="-g"
  export HOST_LDFLAGS="-g"

  ac_add_options --target=x86_64-apple-darwin
  export MACOS_SDK_DIR=$CROSS_SYSROOT
  export MACOS_PRIVATE_FRAMEWORKS_DIR=$CROSS_PRIVATE_FRAMEWORKS
[% END -%]

[% IF c("var/tor-browser") %]
  ac_add_options --enable-tor-browser-update
  ac_add_options --enable-verify-mar
[% END -%]

ac_add_options --with-relative-profile=[% c('var/ProjectName') %]/Data/Browser
mk_add_options MOZ_APP_DISPLAYNAME="[% c('var/Project_Name') %]"

path: projects/firefox/mozconfig


code:
diff --git a/netwerk/dns/effective_tld_names.dat b/netwerk/dns/effective_tld_names.dat
index 0c53819d860d..469fb3d53ba1 100644
--- a/netwerk/dns/effective_tld_names.dat
+++ b/netwerk/dns/effective_tld_names.dat
@@ -5499,6 +5499,7 @@ pro.om
 onion
 tor.onion
 securedrop.tor.onion
+bit.onion

 // org : https://en.wikipedia.org/wiki/.org
 org


code:
diff --git a/chrome/content/tor-circuit-display.js b/chrome/content/tor-circuit-display.js
index d6034384..120d32a0 100644
--- a/chrome/content/tor-circuit-display.js
+++ b/chrome/content/tor-circuit-display.js
@@ -48,7 +48,11 @@ let credentialsToNodeDataMap = new Map(),
     knownCircuitIDs = new Map(),
     // A mutable map that records the SOCKS credentials for the
     // latest channels for each browser + domain.
-    browserToCredentialsMap = new Map();
+    browserToCredentialsMap = new Map(),
+    // A mutable map from stream id to .bit[.onion] domains
+    bitTargets = {},
+    // A mutable map from .bit[.onion] domains to .onion domains.
+    bitToOnionMap = {};

 // __trimQuotes(s)__.
 // Removes quotation marks around a quoted string.
@@ -132,6 +136,28 @@ let getCircuitStatusByID = async function (aController, circuitID) {
   return null;
 };

+// __collectBitTargets(aContoller)__.
+// Watches for STREAM NEW events. When a NEW event occurs, we will see
+// the stream's target domain. If that target is a .bit domain, then
+// we want to be sure to record this so we can later record if it is
+// remapped to a .onion domain.
+let collectBitTargets = function (aController) {
+  return aController.watchEvent(
+    "STREAM",
+    streamEvent => streamEvent.StreamStatus === "NEW",
+    async (streamEvent) => {
+      logger.eclog(3, "new streamEvent:" + JSON.stringify(streamEvent));
+      if (streamEvent && streamEvent.StreamID && streamEvent.Target) {
+        let targetDomain = streamEvent.Target.split(":")[0];
+        if (targetDomain.endsWith(".bit") ||
+            targetDomain.endsWith(".bit.onion")) {
+          bitTargets[streamEvent.StreamID] = Services.eTLD.getBaseDomainFromHost(targetDomain);
+          logger.eclog(3, "stream on .bit domain: " + targetDomain);
+        }
+      }
+    });
+};
+
 // __collectIsolationData(aController, updateUI)__.
 // Watches for STREAM SENTCONNECT events. When a SENTCONNECT event occurs, then
 // we assume isolation settings (SOCKS username+password) are now fixed for the
@@ -145,6 +171,15 @@ let collectIsolationData = function (aController, updateUI) {
     "STREAM",
     streamEvent => streamEvent.StreamStatus === "SENTCONNECT",
     async (streamEvent) => {
+      logger.eclog(3, "sentconnect streamEvent:" + JSON.stringify(streamEvent));
+      // Collect any stream target that might be an onion.
+      if (streamEvent && streamEvent.StreamID && streamEvent.Target) {
+        let targetDomain = streamEvent.Target.split(":")[0];
+        if (targetDomain.endsWith(".onion")) {
+          bitToOnionMap[bitTargets[streamEvent.StreamID]] = targetDomain;
+          logger.eclog(3, "mapped " + bitTargets[streamEvent.StreamID] + " to " + targetDomain);
+        }
+      }
       if (!knownCircuitIDs.get(streamEvent.CircuitID)) {
         logger.eclog(3, "streamEvent.CircuitID: " + streamEvent.CircuitID);
         knownCircuitIDs.set(streamEvent.CircuitID, true);
@@ -312,7 +347,9 @@ let updateCircuitDisplay = function () {
     }

     let domainParts = [];
-    if (domain.endsWith(".onion")) {
+    logger.eclog(3, "bit to onion map:" + JSON.stringify(bitToOnionMap) + ", domain: " + domain);
+    let mappedOnion = bitToOnionMap[domain];
+    if (domain.endsWith(".onion") || mappedOnion) {
       for (let i = 0; i < 3; ++i) {
         li(uiString("relay"));
       }
@@ -325,24 +362,28 @@ let updateCircuitDisplay = function () {
       domainParts.push(domain);
     }

-    // We use a XUL html:span element so that the tooltiptext is displayed.
-    li([
-      "html:span",
-      {
-        class: "circuit-onion",
-        onclick: `
-          this.classList.add("circuit-onion-copied");
-          Cc[
-            "@mozilla.org/widget/clipboardhelper;1"
-          ].getService(Ci.nsIClipboardHelper).copyString(this.getAttribute("data-onion"))
-        `,
-        "data-onion": domain,
-        "data-text-clicktocopy": torbutton_get_property_string("torbutton.circuit_display.click_to_copy"),
-        "data-text-copied": torbutton_get_property_string("torbutton.circuit_display.copied"),
-        tooltiptext: domain,
-      },
-      ...domainParts,
-    ]);
+    if (mappedOnion) {
+      li(domain, " ", ["span", { class: "circuit-ip-address" }, mappedOnion]);
+    } else {
+      // We use a XUL html:span element so that the tooltiptext is displayed.
+      li([
+        "html:span",
+        {
+          class: "circuit-onion",
+          onclick: `
+            this.classList.add("circuit-onion-copied");
+            Cc[
+              "@mozilla.org/widget/clipboardhelper;1"
+            ].getService(Ci.nsIClipboardHelper).copyString(this.getAttribute("data-onion"))
+          `,
+          "data-onion": domain,
+          "data-text-clicktocopy": torbutton_get_property_string("torbutton.circuit_display.click_to_copy"),
+          "data-text-copied": torbutton_get_property_string("torbutton.circuit_display.copied"),
+          tooltiptext: domain,
+        },
+        ...domainParts,
+      ]);
+    }

     // Hide the note about guards if we are using a bridge.
     document.getElementById("circuit-guard-note-container").style.display =
@@ -454,6 +495,7 @@ let setupDisplay = function (enablePrefName) {
       stopCollectingIsolationData = null,
       stopCollectingBrowserCredentials = null,
       stopEnsuringCorrectPopupDimensions = null,
+      stopCollectingBitTargets = null,
       stop = function() {
         syncDisplayWithSelectedTab(false);
         if (myController) {
@@ -466,6 +508,9 @@ let setupDisplay = function (enablePrefName) {
           if (stopEnsuringCorrectPopupDimensions) {
             stopEnsuringCorrectPopupDimensions();
           }
+          if (stopCollectingBitTargets) {
+            stopCollectingBitTargets();
+          }
           myController = null;
         }
       },
@@ -474,6 +519,7 @@ let setupDisplay = function (enablePrefName) {
           try {
             myController = await wait_for_controller();
             syncDisplayWithSelectedTab(true);
+            stopCollectingBitTargets = collectBitTargets(myController);
             stopCollectingIsolationData = collectIsolationData(myController, updateCircuitDisplay);
             stopCollectingBrowserCredentials = collectBrowserCredentials();
             stopEnsuringCorrectPopupDimensions = ensureCorrectPopupDimensions();


code:
From 67c1d7d66d99494102832e12059a84fa439c88e0 Mon Sep 17 00:00:00 2001
From: Sukhbir Singh <sukhbir@torproject.org>
Date: Tue, 12 Jun 2018 21:58:24 -0400
Subject: [PATCH] Bug 26205: Don't build the uninstaller for Windows during
 Firefox compilation

diff --git a/browser/Makefile.in b/browser/Makefile.in
index 2eb9e708f68e..0c9442183942 100644
--- a/browser/Makefile.in
+++ b/browser/Makefile.in
@@ -6,10 +6,6 @@ include $(topsrcdir)/config/rules.mk

 ifdef MAKENSISU

-# For Windows build the uninstaller during the application build since the
-# uninstaller is included with the application for mar file generation.
-libs::
-	$(MAKE) -C installer/windows uninstaller
 ifdef MOZ_MAINTENANCE_SERVICE
 	$(MAKE) -C installer/windows maintenanceservice_installer
 endif
diff --git a/browser/installer/Makefile.in b/browser/installer/Makefile.in
index 0325f0ffab9a..a5a9488623a3 100644
--- a/browser/installer/Makefile.in
+++ b/browser/installer/Makefile.in
@@ -98,10 +98,6 @@ ifdef NECKO_WIFI
 DEFINES += -DNECKO_WIFI
 endif

-ifdef MAKENSISU
-DEFINES += -DHAVE_MAKENSISU=1
-endif
-
 ifdef MOZ_DEFAULT_BROWSER_AGENT
 DEFINES += -DMOZ_DEFAULT_BROWSER_AGENT=1
 endif
--
2.27.0


code:
#!/bin/sh

basedir=$(dirname "$0")

add_LD_LIBRARY_PATH() {
  if test -z "$LD_LIBRARY_PATH"
  then
    LD_LIBRARY_PATH="$1"
  else
    LD_LIBRARY_PATH="$1:$LD_LIBRARY_PATH"
  fi
}

# Check if the system has a more recent version of libstdc++.so.6; if yes, use
# that instead of the bundled version.
"$basedir/abicheck" >/dev/null 2>&1
if [ $? -ne 0 ]; then
  add_LD_LIBRARY_PATH "$basedir/TorBrowser/Tor/libstdc++/"
fi
add_LD_LIBRARY_PATH "$basedir/TorBrowser/Tor/"
export LD_LIBRARY_PATH

exec "$basedir/firefox.real" "$@"

path: projects/firefox/start-firefox


code:
#!/bin/bash
[% c("var/set_default_env") -%]
distdir=/var/tmp/dist/fonts
mkdir -p $distdir

mv noto-fonts-* noto-fonts

[% FOREACH fontfile = c("var/noto_fonts_common");
    GET 'cp noto-fonts/' _ fontfile _ ' $distdir/' _ "\n";
  END; %]

[% IF c("var/linux") %]
  [% FOREACH fontfile = c("var/noto_fonts_linux");
      GET 'cp noto-fonts/' _ fontfile _ ' $distdir/' _ "\n";
    END; %]
[% END %]
[% IF c("var/osx") %]
  [% FOREACH fontfile = c("var/noto_fonts_mac");
      GET 'cp noto-fonts/' _ fontfile _ ' $distdir/' _ "\n";
    END; %]
[% END %]
[% IF c("var/windows") %]
  [% FOREACH fontfile = c("var/noto_fonts_windows");
      GET 'cp noto-fonts/' _ fontfile _ ' $distdir/' _ "\n";
    END; %]
[% END %]

[% IF c("var/linux") || c("var/osx") %]
  unzip -o 2.0.0.zip -d STIX
  cp "STIX/stixfonts-2.0.0/archive/STIXv1.1.1/Fonts/STIX-Word/STIXMath-Regular.otf" $distdir/
[% END %]
[% IF c("var/linux") %]
  cp {NotoSansJP-Regular.otf,NotoSansKR-Regular.otf,NotoSansSC-Regular.otf,NotoSansTC-Regular.otf} $distdir/
[% END %]
cd /var/tmp/dist
[% c('tar', {
        tar_src => [ 'fonts' ],
        tar_args => '-czf ' _ dest_dir _ '/' _ c('filename'),
    }) %]

path: projects/fonts/build


code:
# vim: filetype=yaml sw=2
version: '2'
filename: "[% project %]-[% c('version') %]-[% c('var/build_id') %].tar.gz"
container:
  use_container: 1
var:
  noto_git_hash: 20bc5918912503bc1537a407a694738c33c048aa
  # Use this way so that the script that downloads the fonts can access the
  # lists of all the targets.
  noto_fonts_common:
    - NotoSansAdlam-Regular.ttf
    - NotoSansBalinese-Regular.ttf
    - NotoSansBamum-Regular.ttf
    - NotoSansBassaVah-Regular.ttf
    - NotoSansBatak-Regular.ttf
    - NotoSansBengali-Regular.ttf
    - NotoSansBuginese-Regular.ttf
    - NotoSansBuhid-Regular.ttf
    - NotoSansCanadianAboriginal-Regular.ttf
    - NotoSansChakma-Regular.ttf
    - NotoSansCham-Regular.ttf
    - NotoSansCherokee-Regular.ttf
    - NotoSansCoptic-Regular.ttf
    - NotoSansDeseret-Regular.ttf
    - NotoSansDevanagari-Regular.ttf
    - NotoSansElbasan-Regular.ttf
    - NotoSansEthiopic-Regular.ttf
    - NotoSansGeorgian-Regular.ttf
    - NotoSansGrantha-Regular.ttf
    - NotoSansGujarati-Regular.ttf
    - NotoSansGunjalaGondi-Regular.ttf
    - NotoSansGurmukhi-Regular.ttf
    - NotoSansHanifiRohingya-Regular.ttf
    - NotoSansHanunoo-Regular.ttf
    - NotoSansKannada-Regular.ttf
    - NotoSansKhmer-Regular.ttf
    - NotoSansJavanese-Regular.ttf
    - NotoSansKayahLi-Regular.ttf
    - NotoSansKhojki-Regular.ttf
    - NotoSansKhudawadi-Regular.ttf
    - NotoSansLao-Regular.ttf
    - NotoSansLepcha-Regular.ttf
    - NotoSansLimbu-Regular.ttf
    - NotoSansLisu-Regular.ttf
    - NotoSansMahajani-Regular.ttf
    - NotoSansMalayalam-Regular.ttf
    - NotoSansMandaic-Regular.ttf
    - NotoSansMasaramGondi-Regular.ttf
    - NotoSansMedefaidrin-Regular.ttf
    - NotoSansMeeteiMayek-Regular.ttf
    - NotoSansMendeKikakui-Regular.ttf
    - NotoSansMiao-Regular.ttf
    - NotoSansModi-Regular.ttf
    - NotoSansMongolian-Regular.ttf
    - NotoSansMro-Regular.ttf
    - NotoSansMyanmar-Regular.ttf
    - NotoSansMultani-Regular.ttf
    - NotoSansNewa-Regular.ttf
    - NotoSansNewTaiLue-Regular.ttf
    - NotoSansNKo-Regular.ttf
    - NotoSansOlChiki-Regular.ttf
    - NotoSansOriya-Regular.ttf
    - NotoSansOsage-Regular.ttf
    - NotoSansOsmanya-Regular.ttf
    - NotoSansPahawhHmong-Regular.ttf
    - NotoSansPauCinHau-Regular.ttf
    - NotoSansRejang-Regular.ttf
    - NotoSansRunic-Regular.ttf
    - NotoSansSamaritan-Regular.ttf
    - NotoSansSaurashtra-Regular.ttf
    - NotoSansSharada-Regular.ttf
    - NotoSansShavian-Regular.ttf
    - NotoSansSinhala-Regular.ttf
    - NotoSansSoraSompeng-Regular.ttf
    - NotoSansSoyombo-Regular.ttf
    - NotoSansSundanese-Regular.ttf
    - NotoSansSylotiNagri-Regular.ttf
    - NotoSansSymbols2-Regular.ttf
    - NotoSansSymbols-Regular.ttf
    - NotoSansSyriac-Regular.ttf
    - NotoSansTagalog-Regular.ttf
    - NotoSansTagbanwa-Regular.ttf
    - NotoSansTaiLe-Regular.ttf
    - NotoSansTaiTham-Regular.ttf
    - NotoSansTaiViet-Regular.ttf
    - NotoSansTakri-Regular.ttf
    - NotoSansTamil-Regular.ttf
    - NotoSansTelugu-Regular.ttf
    - NotoSansThaana-Regular.ttf
    - NotoSansTifinaghAdrar-Regular.ttf
    - NotoSansTifinaghAgrawImazighen-Regular.ttf
    - NotoSansTifinaghAhaggar-Regular.ttf
    - NotoSansTifinaghAir-Regular.ttf
    - NotoSansTifinaghAPT-Regular.ttf
    - NotoSansTifinaghAzawagh-Regular.ttf
    - NotoSansTifinaghGhat-Regular.ttf
    - NotoSansTifinaghHawad-Regular.ttf
    - NotoSansTifinagh-Regular.ttf
    - NotoSansTifinaghRhissaIxa-Regular.ttf
    - NotoSansTifinaghSIL-Regular.ttf
    - NotoSansTifinaghTawellemmet-Regular.ttf
    - NotoSansTirhuta-Regular.ttf
    - NotoSansVai-Regular.ttf
    - NotoSansWancho-Regular.ttf
    - NotoSansWarangCiti-Regular.ttf
    - NotoSansYi-Regular.ttf
    - NotoSansZanabazarSquare-Regular.ttf
    - NotoSerifBalinese-Regular.ttf
    - NotoSerifBengali-Regular.ttf
    - NotoSerifDevanagari-Regular.ttf
    - NotoSerifDogra-Regular.ttf
    - NotoSerifEthiopic-Regular.ttf
    - NotoSerifGeorgian-Regular.ttf
    - NotoSerifGrantha-Regular.ttf
    - NotoSerifGujarati-Regular.ttf
    - NotoSerifGurmukhi-Regular.ttf
    - NotoSerifKannada-Regular.ttf
    - NotoSerifKhmer-Regular.ttf
    - NotoSerifKhojki-Regular.ttf
    - NotoSerifLao-Regular.ttf
    - NotoSerifMalayalam-Regular.ttf
    - NotoSerifMyanmar-Regular.ttf
    - NotoSerifNyiakengPuachueHmong-Regular.ttf
    - NotoSerifSinhala-Regular.ttf
    - NotoSerifTamil-Regular.ttf
    - NotoSerifTelugu-Regular.ttf
    - NotoSerifTibetan-Regular.ttf
    - NotoSerifYezidi-Regular.ttf

  noto_fonts_linux:
    - Arimo-Regular.ttf
    - Arimo-Bold.ttf
    - Arimo-Italic.ttf
    - Arimo-BoldItalic.ttf
    - Cousine-Regular.ttf
    - Tinos-Regular.ttf
    - Tinos-Bold.ttf
    - Tinos-Italic.ttf
    - Tinos-BoldItalic.ttf
    - NotoNaskhArabic-Regular.ttf
    - NotoSansArmenian-Regular.ttf
    - NotoSansHebrew-Regular.ttf
    - NotoSansSymbols-Regular.ttf
    - NotoSansSymbols2-Regular.ttf
    - NotoSansThaana-Regular.ttf
    - NotoSansThai-Regular.ttf
    - NotoSerifArmenian-Regular.ttf
    - NotoSerifHebrew-Regular.ttf
    - NotoSerifThai-Regular.ttf
  noto_fonts_mac:
    - NotoSansArmenian-Regular.ttf
    - NotoSansHebrew-Regular.ttf
    - NotoSansThaana-Regular.ttf
    - NotoSerifArmenian-Regular.ttf
    - NotoSerifHebrew-Regular.ttf

  noto_fonts_windows:
    - NotoNaskhArabic-Regular.ttf
    - NotoSans-Regular.ttf
    - NotoSerif-Regular.ttf

input_files:
  - project: container-image
  - filename: 'noto-fonts-[% c("var/noto_git_hash") %]-[% c("version") %]'
    name: noto-fonts
    exec: '[% INCLUDE "fetch-noto-fonts" %]'
  # Noto Sans CJK Version 2.004
  - URL: https://github.com/googlefonts/noto-cjk/raw/523d033d6cb47f4a80c58a35753646f5c3608a78/Sans/SubsetOTF/JP/NotoSansJP-Regular.otf
    sha256sum: dff723ba59d57d136764a04b9b2d03205544f7cd785a711442d6d2d085ac5073
    enable: '[% c("var/linux") %]'
  - URL: https://github.com/googlefonts/noto-cjk/raw/523d033d6cb47f4a80c58a35753646f5c3608a78/Sans/SubsetOTF/KR/NotoSansKR-Regular.otf
    sha256sum: 69975a0ac8472717870aefeab0a4d52739308d90856b9955313b2ad5e0148d68
    enable: '[% c("var/linux") %]'
  - URL: https://github.com/googlefonts/noto-cjk/raw/523d033d6cb47f4a80c58a35753646f5c3608a78/Sans/SubsetOTF/SC/NotoSansSC-Regular.otf
    sha256sum: faa6c9df652116dde789d351359f3d7e5d2285a2b2a1f04a2d7244df706d5ea9
    enable: '[% c("var/linux") %]'
  - URL: https://github.com/googlefonts/noto-cjk/raw/523d033d6cb47f4a80c58a35753646f5c3608a78/Sans/SubsetOTF/TC/NotoSansTC-Regular.otf
    sha256sum: 5bab0cb3c1cf89dde07c4a95a4054b195afbcfe784d69d75c340780712237537
    enable: '[% c("var/linux") %]'
  - URL: https://github.com/stipub/stixfonts/archive/2.0.0.zip
    sha256sum: 4327a16797dabebedce28a9075671730e22c7f74831b24b1fb91e27faec5a235
    enable: '[% c("var/linux") || c("var/osx") %]'

path: projects/fonts/config


code:
#!/bin/bash
set -e

REPO_DIR="$(mktemp -d)"
OUT_DIR="[% dest_dir %]/noto-fonts-[% c("var/noto_git_hash") %]-[% c("version") %]"

pushd "$REPO_DIR"
git init
git remote add origin https://github.com/googlefonts/noto-fonts.git
git fetch --depth 1 origin "[% c('var/noto_git_hash') %]"
git checkout "[% c('var/noto_git_hash') %]"

rm -rf "$OUT_DIR"
mkdir "$OUT_DIR"
[%
  platforms = [c("var/noto_fonts_common"), c("var/noto_fonts_linux"), c("var/noto_fonts_mac"), c("var/noto_fonts_windows")];
  FOREACH platform = platforms;
    FOREACH fontfile = platform;
      GET 'font=$(find hinted -name ' _ fontfile _ ' -print | head -1)' _ "\n";
      # Do not use find -exec, because if the file does not exist, we have an
      # error only in the following phases. In this way, we try to fail earlier.
      GET 'cp -u $font "$OUT_DIR/"' _ "\n";
    END;
  END; %]

popd
rm -rf "$REPO_DIR"

echo "Finished downloading the needed Noto fonts"

path: projects/fonts/fetch-noto-fonts


code:
#!/bin/bash
[% c("var/set_default_env") -%]
distdir="/var/tmp/dist/[% project %]"

[% pc(c('var/compiler'), 'var/setup', { compiler_tarfile => c('input_files_by_name/' _ c('var/compiler')) }) %]

mkdir -p /var/tmp/build
tar -C /var/tmp/build -xf [% project %]-[% c("version") %].tar.gz
cd /var/tmp/build/[% project %]-[% c("version") %]

make x64

mkdir -p $distdir/bin/
cp fxc2.exe $distdir/bin/
cp dll/d3dcompiler_47_32.dll $distdir/bin/d3dcompiler_47_32.dll
cp dll/d3dcompiler_47.dll $distdir/bin/

cd /var/tmp/dist

[% c('tar', {
        tar_src => [ project ],
        tar_args => '-czf ' _ dest_dir _ '/' _ c('filename'),
    }) %]


code:
# vim: filetype=yaml sw=2
version: '[% c("abbrev") %]'
git_url: https://github.com/mozilla/fxc2.git
git_hash: 5ace4c25b63cb5a83b58a3eae3d36256a6022cde
filename: '[% project %]-[% c("version") %]-[% c("var/build_id") %].tar.gz'
container:
  use_container: 1

var:
  compiler: mingw-w64-clang

input_files:
  - project: container-image
  - name: '[% c("var/compiler") %]'
    project: '[% c("var/compiler") %]'


code:
#!/bin/sh
[% c("var/set_default_env") -%]
[% IF c("var/linux") -%]
  # Config options for hardening-wrapper
  export DEB_BUILD_HARDENING=1
  export DEB_BUILD_HARDENING_STACKPROTECTOR=1
  export DEB_BUILD_HARDENING_FORTIFY=1
  # Since r223796 landed on GCC master enforcing PIE breaks GCC compilation.
  # The compiler gets built with `-fno-PIE` and linked with `-no-pie` as not
  # doing so would make precompiled headers (PCH) fail.
  # It is okay for us to omit this right now as it does not change any hardening
  # flags in the resulting bundles.
  export DEB_BUILD_HARDENING_PIE=0
  # We need to disable `-Werror=format-security` as GCC does not build with it
  # anymore. It seems it got audited for those problems already:
  # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=48817.
  export DEB_BUILD_HARDENING_FORMAT=0
[% END -%]
distdir=/var/tmp/dist/[% project %]
mkdir /var/tmp/build
tar -C /var/tmp/build -xf [% project %]-[% c("version") %].tar.xz
cd /var/tmp/build/[% project %]-[% c("version") %]
./configure --prefix=$distdir [% c("var/configure_opt") %]
make -j[% c("num_procs") %]
make install
cd /var/tmp/dist
[% c('tar', {
        tar_src => [ project ],
        tar_args => '-czf ' _ dest_dir _ '/' _ c('filename'),
        }) %]

path: projects/gcc/build


code:
# vim: filetype=yaml sw=2
filename: '[% project %]-[% c("version") %]-[% c("var/build_id") %].tar.gz'
# Note: When updating the gcc version, if this includes a libstdc++
# ABI change we should also update projects/firefox/abicheck.cc to
# require the new version.
version: 10.3.0
container:
  use_container: 1
var:
  deps:
    - build-essential
    - libmpc-dev
  setup: |
    mkdir -p /var/tmp/dist
    tar -C /var/tmp/dist -xf $rootdir/[% c("compiler_tarfile") %]
    export PATH="/var/tmp/dist/gcc/bin:$PATH"
    export LD_LIBRARY_PATH=/var/tmp/dist/gcc/lib64:/var/tmp/dist/gcc/lib32

    [% IF c("hardened_gcc") -%]
      # Config options for hardening-wrapper
      export DEB_BUILD_HARDENING=1
      export DEB_BUILD_HARDENING_STACKPROTECTOR=1
      export DEB_BUILD_HARDENING_FORTIFY=1
      export DEB_BUILD_HARDENING_FORMAT=1
      export DEB_BUILD_HARDENING_PIE=1

      # Make sure we use the hardening wrapper
      pushd /var/tmp/dist/gcc/bin
      cp /usr/bin/hardened-cc ./
      mv gcc gcc.real
      mv c++ c++.real
      mv g++ g++.real
      ln -sf hardened-cc gcc
      ln -sf hardened-cc c++
      ln -sf hardened-cc g++
      popd
    [% END -%]

targets:
  windows:
    var:
      configure_opt: --disable-multilib --enable-languages=c,c++
      arch_deps:
        - libc6-dev
        - zlib1g-dev
  linux:
    hardened_gcc: 1
    var:
      configure_opt: --enable-multilib --enable-languages=c,c++ --with-arch_32=i686
      arch_deps:
        - hardening-wrapper
        - libc6-dev-i386

input_files:
  - project: container-image
  - URL: 'https://ftp.gnu.org/gnu/gcc/gcc-[% c("version") %]/gcc-[% c("version") %].tar.xz'
    sha256sum: 64f404c1a650f27fc33da242e1f2df54952e3963a49e06e73f6940f3223ac344

path: projects/gcc/config


code:
#!/bin/bash
[% c("var/set_default_env") -%]
[% pc(c('var/compiler'), 'var/setup', { compiler_tarfile => c('input_files_by_name/' _ c('var/compiler')) }) %]
distdir=/var/tmp/dist
mkdir -p /var/tmp/build
mkdir -p $distdir/[% project %]

tar -C $GRADLE_HOME -xf $rootdir/[% c('input_files_by_name/gradle') %]

# We need to have the get-moz-build-date script available in the container
# but we can't include it via input_files as it is a script shared between
# projects.
cat > get-moz-build-date << "EOF"
[% INCLUDE "get-moz-build-date" %]
EOF

tar -C /var/tmp/dist -xf [% c('input_files_by_name/rust') %]
tar -C /var/tmp/dist -xf [% c('input_files_by_name/cbindgen') %]
tar -C /var/tmp/dist -xf [% c('input_files_by_name/nasm') %]
tar -C /var/tmp/dist -xf [% c('input_files_by_name/node') %]
tar -C /var/tmp/dist -xf [% c('input_files_by_name/clang') %]
export LLVM_CONFIG="/var/tmp/dist/clang/bin/llvm-config"
tar -C /var/tmp/dist -xf [% c('input_files_by_name/binutils') %]
export PATH="/var/tmp/dist/rust/bin:/var/tmp/dist/cbindgen:/var/tmp/dist/nasm/bin:/var/tmp/dist/node/bin:/var/tmp/dist/clang/bin:/var/tmp/dist/binutils/bin:$PATH"

tar -C /var/tmp/build -xf [% project %]-[% c('version') %].tar.gz

cd /var/tmp/build/[% project %]-[% c("version") %]
mv -f $rootdir/[% c('input_files_by_name/mozconfig') %] .mozconfig

eval $(perl $rootdir/get-moz-build-date [% c("var/copyright_year") %] [% c("var/torbrowser_version") %])
if [ -z $MOZ_BUILD_DATE ]
then
    echo "MOZ_BUILD_DATE is not set"
    exit 1
fi

export JAVA_HOME=/usr/lib/jvm/java-1.11.0-openjdk-amd64
gradle_repo=/var/tmp/dist/gradle-dependencies
export GRADLE_MAVEN_REPOSITORIES="file://$gradle_repo","file://$gradle_repo/maven2"
export GRADLE_FLAGS="--no-daemon --offline"
# Move the Gradle repo to a hard-coded location. The location is embedded in
# the file chrome/toolkit/content/global/buildconfig.html so it needs to be
# standardized for reproducibility.
mv $rootdir/[% c('input_files_by_name/gradle-dependencies') %] $gradle_repo
cp -r $gradle_repo/m2/* $gradle_repo

rm -f configure
rm -f js/src/configure

# We unbreak mach, see: https://bugzilla.mozilla.org/show_bug.cgi?id=1656993.
export MACH_USE_SYSTEM_PYTHON=1
# Create .mozbuild to avoid interactive prompt in configure
mkdir "$HOME/.mozbuild"
./mach configure --with-tor-browser-version=[% c("var/torbrowser_version") %] --with-java-bin-path="$JAVA_HOME/bin" --without-wasm-sandboxed-libraries
./mach build --verbose

# We don't want the debug or "exoplayer" .aars, but the .aar that has `omni` in its name.
find obj-* -type f -name geckoview*omni*.aar -exec cp {} $distdir/[% project %] \;

cd $distdir
[% c('tar', {
        tar_src => [ project ],
        tar_args => '-czf ' _ dest_dir _ '/' _ c('filename'),
    }) %]

path: projects/geckoview/build


code:
# vim: filetype=yaml sw=2
version: '[% c("abbrev") %]'
filename: 'geckoview-[% c("version") %]-[% c("var/osname") %]-[% c("var/build_id") %].tar.gz'
git_hash: 'geckoview-[% c("var/geckoview_version") %]-[% c("var/torbrowser_branch") %]-2-build4'
tag_gpg_id: 1
git_url: https://git.torproject.org/tor-browser.git
git_submodule: 1
gpg_keyring: torbutton.gpg
container:
  use_container: 1

var:
  geckoview_version: 99.0b3
  torbrowser_branch: 11.5
  copyright_year: '[% exec("git show -s --format=%ci").remove("-.*") %]'
  deps:
    - build-essential
    - unzip
    - zip
    - autoconf2.13
    - yasm
    - python3
    - python3-distutils
    - pkg-config
    - openjdk-11-jdk-headless
  # this should be updated when the list of gradle dependencies is changed
  # see doc/how-to-create-gradle-dependencies-list.txt
  gradle_dependencies_version: 10
  gradle_version: 7.3

steps:
  merge_aars:
    filename: 'geckoview-[% c("version") %]-[% c("var/build_id") %].tar.gz'
    version: '[% c("abbrev") %]'
    merge_aars: |
      #!/bin/bash
      [% c("var/set_default_env") -%]
      [% pc(c('var/compiler'), 'var/setup', { compiler_tarfile => c('input_files_by_name/' _ c('var/compiler')) }) %]
      distdir=/var/tmp/dist
      builddir=/var/tmp/build
      mkdir -p /var/tmp/build
      mkdir -p $distdir/[% project %]

      tar -C $GRADLE_HOME -xf $rootdir/[% c('input_files_by_name/gradle') %]

      cat > get-moz-build-date << "EOF"
      [% INCLUDE "get-moz-build-date" %]
      EOF

      tar -C $distdir -xf [% c('input_files_by_name/node') %]
      export PATH="/var/tmp/dist/node/bin:$PATH"

      tar -C $builddir -xf [% c('input_files_by_name/geckoview_armv7') %]
      tar -C $builddir -xf [% c('input_files_by_name/geckoview_aarch64') %]
      tar -C $builddir -xf [% c('input_files_by_name/geckoview_x86') %]
      tar -C $builddir -xf [% c('input_files_by_name/geckoview_x86_64') %]
      tar -C $builddir -xf [% project %]-[% c('version') %].tar.gz

      # Specify the architectures we want to merge
      export MOZ_ANDROID_FAT_AAR_ARCHITECTURES=armeabi-v7a,arm64-v8a,x86,x86_64
      export MOZ_ANDROID_FAT_AAR_ARMEABI_V7A=$builddir/geckoview/*armeabi-v7a*.aar
      export MOZ_ANDROID_FAT_AAR_ARM64_V8A=$builddir/geckoview/*arm64-v8a*.aar
      # Specifying just "x86" is not differentiating enough
      export MOZ_ANDROID_FAT_AAR_X86=$builddir/geckoview/*x86-*.aar
      export MOZ_ANDROID_FAT_AAR_X86_64=$builddir/geckoview/*x86_64*.aar

      cd $builddir/[% project %]-[% c("version") %]
      mv -f $rootdir/[% c('input_files_by_name/mozconfig') %] .mozconfig

      eval $(perl $rootdir/get-moz-build-date [% c("var/copyright_year") %] [% c("var/torbrowser_version") %])
      if [ -z $MOZ_BUILD_DATE ]
      then
          echo "MOZ_BUILD_DATE is not set"
          exit 1
      fi

      export JAVA_HOME=/usr/lib/jvm/java-1.11.0-openjdk-amd64
      gradle_repo=/var/tmp/dist/gradle-dependencies
      export GRADLE_MAVEN_REPOSITORIES="file://$gradle_repo","file://$gradle_repo/maven2"
      export GRADLE_FLAGS="--no-daemon --offline"
      mv $rootdir/[% c('input_files_by_name/gradle-dependencies') %] $gradle_repo
      cp -r $gradle_repo/m2/* $gradle_repo

      # We unbreak mach, see: https://bugzilla.mozilla.org/show_bug.cgi?id=1656993.
      export MACH_USE_SYSTEM_PYTHON=1
      # Create .mozbuild to avoid interactive prompt in configure
      mkdir "$HOME/.mozbuild"
      # We still need to specify --tor-browser-version due to bug 34005.
      ./mach configure --with-tor-browser-version=[% c("var/torbrowser_version") %] --with-java-bin-path="$JAVA_HOME/bin" --without-wasm-sandboxed-libraries
      ./mach build --verbose
      find obj-* -regex '.*geckoview.*omni.*\(aar\|pom\)' -exec cp {} $distdir/[% project %] \;

      cd $distdir/
      [% c('tar', {
              tar_src => [ project ],
              tar_args => '-czf ' _ dest_dir _ '/' _ c('filename'),
         }) %]

    input_files:
      - project: container-image
        pkg_type: build
      - name: '[% c("var/compiler") %]'
        project: '[% c("var/compiler") %]'
        pkg_type: build
      - project: gradle
        name: gradle
        pkg_type: build
      - project: node
        name: node
        pkg_type: build
      - filename: mozconfig-android-all
        name: mozconfig
      - filename: 'gradle-dependencies-[% c("var/gradle_dependencies_version") %]'
        name: gradle-dependencies
        exec: '[% INCLUDE "fetch-gradle-dependencies" %]'
      - name: geckoview_armv7
        project: geckoview
        pkg_type: build
        target_prepend:
          - torbrowser-android-armv7
      - name: geckoview_aarch64
        project: geckoview
        pkg_type: build
        target_prepend:
          - torbrowser-android-aarch64
      - name: geckoview_x86
        project: geckoview
        pkg_type: build
        target_prepend:
          - torbrowser-android-x86
      - name: geckoview_x86_64
        project: geckoview
        pkg_type: build
        target_prepend:
          - torbrowser-android-x86_64

  list_toolchain_updates:
    git_url: https://github.com/mozilla/gecko-dev.git
    git_hash: beta
    tag_gpg_id: 0
    input_files: []
    container:
      use_container: 0

targets:
  nightly:
    git_hash: 'geckoview-[% c("var/geckoview_version") %]-[% c("var/torbrowser_branch") %]-2'
    tag_gpg_id: 0

input_files:
  - project: container-image
  - name: '[% c("var/compiler") %]'
    project: '[% c("var/compiler") %]'
  - project: gradle
    name: gradle
  - filename: 'mozconfig-[% c("var/osname") %]'
    name: mozconfig
  - project: binutils
    name: binutils
  - project: rust
    name: rust
  - project: cbindgen
    name: cbindgen
  - project: node
    name: node
  - project: nasm
    name: nasm
  - project: clang
    name: clang
  - filename: 'gradle-dependencies-[% c("var/gradle_dependencies_version") %]'
    name: gradle-dependencies
    exec: '[% INCLUDE "fetch-gradle-dependencies" %]'

path: projects/geckoview/config