Bug 1573435 - Use toolchain fetches for all remaining toolchain uses. r=nalexander
authorMike Hommey <mh+mozilla@glandium.org>
Fri, 09 Aug 2019 14:04:04 +0900
changeset 488149 73576d4b23de5f35476f4e3d439adf498b9ab5d1
parent 488148 3103e4be4bb4d63926e309af68ed23074207b064
child 488150 df54590321e85066cbd765a1be9e8216b38f9f5f
push id36435
push usercbrindusan@mozilla.com
push dateThu, 15 Aug 2019 09:46:49 +0000
treeherdermozilla-central@0db07ff50ab5 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnalexander
bugs1573435
milestone70.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1573435 - Use toolchain fetches for all remaining toolchain uses. r=nalexander The remaining uses all need adjustements to in-tree mozconfigs, so they all need to be done at once. However, to make things slightly more intelligible, we do this in two steps. This is step 1: we modify the use_toolchain transform to take care of the transformation, while keeping the task definitions intact, so that we only deal with mozconfig and build script adjustements here. Differential Revision: https://phabricator.services.mozilla.com/D41890
browser/config/mozconfigs/linux64/code-coverage
browser/config/mozconfigs/linux64/debug-searchfox-clang
browser/config/mozconfigs/linux64/debug-static-analysis-clang
browser/config/mozconfigs/linux64/plain-opt
browser/config/mozconfigs/linux64/tup
browser/config/mozconfigs/macosx64/code-coverage
browser/config/mozconfigs/macosx64/l10n-mozconfig
browser/config/mozconfigs/macosx64/l10n-mozconfig-devedition
browser/config/mozconfigs/macosx64/repack
browser/config/mozconfigs/win32/mingwclang
browser/config/mozconfigs/win64/code-coverage
browser/config/mozconfigs/win64/mingwclang
browser/config/mozconfigs/win64/plain-opt
build/macosx/cross-mozconfig.common
build/macosx/local-mozconfig.common
build/mozconfig.cache
build/mozconfig.clang-cl
build/mozconfig.lld-link
build/mozconfig.nasm
build/mozconfig.node
build/mozconfig.rust
build/mozconfig.stylo
build/unix/mozconfig.asan
build/unix/mozconfig.stdcxx
build/unix/mozconfig.tsan
build/unix/mozconfig.unix
build/win64/mozconfig.asan
mobile/android/config/mozconfigs/android-aarch64/beta
mobile/android/config/mozconfigs/android-aarch64/nightly
mobile/android/config/mozconfigs/android-api-16-gradle-dependencies/nightly
mobile/android/config/mozconfigs/android-api-16/beta
mobile/android/config/mozconfigs/android-api-16/nightly
mobile/android/config/mozconfigs/android-x86/beta
mobile/android/config/mozconfigs/android-x86/nightly
mobile/android/config/mozconfigs/android-x86_64/beta
mobile/android/config/mozconfigs/android-x86_64/nightly
mobile/android/config/mozconfigs/common
taskcluster/scripts/misc/build-mingw32-nsis.sh
taskcluster/taskgraph/transforms/build_fat_aar.py
taskcluster/taskgraph/transforms/use_toolchains.py
testing/mozharness/scripts/android_emulator_pgo.py
testing/parse_build_tests_ccov.py
toolkit/mozapps/installer/packager.mk
--- a/browser/config/mozconfigs/linux64/code-coverage
+++ b/browser/config/mozconfigs/linux64/code-coverage
@@ -7,11 +7,11 @@ TOOLTOOL_DIR=${TOOLTOOL_DIR:-$topsrcdir}
 ac_add_options --disable-install-strip
 ac_add_options --disable-elf-hack
 ac_add_options --disable-sandbox
 ac_add_options --disable-dmd
 ac_add_options --disable-profiling
 ac_add_options --disable-warnings-as-errors
 ac_add_options --enable-coverage
 
-export LDFLAGS="--coverage -L$topsrcdir/clang/lib/clang/8.0.0/lib/linux/"
+export LDFLAGS="--coverage -L$MOZ_FETCHES_DIR/clang/lib/clang/8.0.0/lib/linux/"
 export LIBS="-lclang_rt.profile-x86_64"
 export RUSTFLAGS="-Ccodegen-units=1 -Zprofile -Zno-landing-pads -Clink-dead-code -Coverflow-checks=off"
--- a/browser/config/mozconfigs/linux64/debug-searchfox-clang
+++ b/browser/config/mozconfigs/linux64/debug-searchfox-clang
@@ -4,18 +4,18 @@ MOZ_AUTOMATION_L10N_CHECK=0
 
 . "$topsrcdir/build/unix/mozconfig.unix"
 
 ac_add_options --enable-debug
 
 . $topsrcdir/build/mozconfig.stylo
 
 # Use Clang as specified in manifest
-export CC="$topsrcdir/clang/bin/clang"
-export CXX="$topsrcdir/clang/bin/clang++"
+export CC="$MOZ_FETCHES_DIR/clang/bin/clang"
+export CXX="$MOZ_FETCHES_DIR/clang/bin/clang++"
 
 # Save rust analysis (this requires unlocking the unstable features,
 # which is done in the taskcluster task definition via RUSTC_BOOTSTRAP)
 export RUSTFLAGS="-Zsave-analysis"
 
 # Add the static checker
 ac_add_options --enable-clang-plugin
 ac_add_options --enable-mozsearch-plugin
--- a/browser/config/mozconfigs/linux64/debug-static-analysis-clang
+++ b/browser/config/mozconfigs/linux64/debug-static-analysis-clang
@@ -4,17 +4,17 @@ MOZ_AUTOMATION_L10N_CHECK=0
 
 . "$topsrcdir/build/mozconfig.common"
 
 ac_add_options --enable-debug
 
 . $topsrcdir/build/mozconfig.stylo
 
 # Use Clang as specified in manifest
-export CC="$topsrcdir/clang/bin/clang"
-export CXX="$topsrcdir/clang/bin/clang++"
+export CC="$MOZ_FETCHES_DIR/clang/bin/clang"
+export CXX="$MOZ_FETCHES_DIR/clang/bin/clang++"
 
 # Add the static checker
 ac_add_options --enable-clang-plugin
 
 . "$topsrcdir/build/unix/mozconfig.stdcxx"
 
 . "$topsrcdir/build/mozconfig.common.override"
--- a/browser/config/mozconfigs/linux64/plain-opt
+++ b/browser/config/mozconfigs/linux64/plain-opt
@@ -1,14 +1,14 @@
 export TOOLTOOL_DIR="$topsrcdir"
-export LLVM_CONFIG="${TOOLTOOL_DIR}/clang/bin/llvm-config"
+export LLVM_CONFIG="${MOZ_FETCHES_DIR}/clang/bin/llvm-config"
 
-CARGO="${TOOLTOOL_DIR}/rustc/bin/cargo"
-RUSTC="${TOOLTOOL_DIR}/rustc/bin/rustc"
-RUSTDOC="${TOOLTOOL_DIR}/rustc/bin/rustdoc"
-RUSTFMT="${TOOLTOOL_DIR}/rustc/bin/rustfmt"
-CBINDGEN="${TOOLTOOL_DIR}/cbindgen/cbindgen"
+CARGO="${MOZ_FETCHES_DIR}/rustc/bin/cargo"
+RUSTC="${MOZ_FETCHES_DIR}/rustc/bin/rustc"
+RUSTDOC="${MOZ_FETCHES_DIR}/rustc/bin/rustdoc"
+RUSTFMT="${MOZ_FETCHES_DIR}/rustc/bin/rustfmt"
+CBINDGEN="${MOZ_FETCHES_DIR}/cbindgen/cbindgen"
 
-export NODEJS="${TOOLTOOL_DIR}/node/bin/node"
-NASM="${TOOLTOOL_DIR}/nasm/nasm"
+export NODEJS="${MOZ_FETCHES_DIR}/node/bin/node"
+NASM="${MOZ_FETCHES_DIR}/nasm/nasm"
 
-CC="${TOOLTOOL_DIR}/clang/bin/clang"
-CXX="${TOOLTOOL_DIR}/clang/bin/clang++"
+CC="${MOZ_FETCHES_DIR}/clang/bin/clang"
+CXX="${MOZ_FETCHES_DIR}/clang/bin/clang++"
--- a/browser/config/mozconfigs/linux64/tup
+++ b/browser/config/mozconfigs/linux64/tup
@@ -1,17 +1,17 @@
 MOZ_AUTOMATION_BUILD_SYMBOLS=0
 MOZ_AUTOMATION_L10N_CHECK=0
 MOZ_AUTOMATION_PACKAGE=0
 MOZ_AUTOMATION_PACKAGE_TESTS=0
 MOZ_AUTOMATION_UPLOAD=0
 MOZ_AUTOMATION_UPLOAD_SYMBOLS=0
 
 TOOLTOOL_DIR=${TOOLTOOL_DIR:-$topsrcdir}
-export TUP=${TOOLTOOL_DIR}/tup/tup
+export TUP=${MOZ_FETCHES_DIR}/tup/tup
 
 . "$topsrcdir/browser/config/mozconfigs/linux64/common-opt"
 . "$topsrcdir/build/mozconfig.common.override"
 
 ac_add_options --enable-build-backends=Tup
 unset ENABLE_CLANG_PLUGIN
 # To enable the option to upload the tup database, uncomment the line below
 # ac_add_options --upload-tup-db
--- a/browser/config/mozconfigs/macosx64/code-coverage
+++ b/browser/config/mozconfigs/macosx64/code-coverage
@@ -3,11 +3,11 @@
 unset MOZ_LTO
 
 TOOLTOOL_DIR=${TOOLTOOL_DIR:-$topsrcdir}
 
 ac_add_options --disable-sandbox
 ac_add_options --disable-warnings-as-errors
 ac_add_options --enable-coverage
 
-export LDFLAGS="-coverage -L$topsrcdir/clang/lib/clang/8.0.0/lib/darwin/"
+export LDFLAGS="-coverage -L$MOZ_FETCHES_DIR/clang/lib/clang/8.0.0/lib/darwin/"
 export LIBS="-lclang_rt.profile_osx"
 export RUSTFLAGS="-Ccodegen-units=1 -Zprofile -Zno-landing-pads -Clink-dead-code -Coverflow-checks=off"
--- a/browser/config/mozconfigs/macosx64/l10n-mozconfig
+++ b/browser/config/mozconfigs/macosx64/l10n-mozconfig
@@ -1,17 +1,17 @@
 . "$topsrcdir/browser/config/mozconfigs/common"
 . "$topsrcdir/build/mozconfig.no-compile"
 
 if test `uname -s` = "Linux"; then
   # We need to indicate the target for cross builds
   ac_add_options --target=x86_64-apple-darwin
-  export MKFSHFS=$topsrcdir/hfsplus-tools/newfs_hfs
-  export DMG_TOOL=$topsrcdir/dmg/dmg
-  export HFS_TOOL=$topsrcdir/dmg/hfsplus
+  export MKFSHFS=$MOZ_FETCHES_DIR/hfsplus-tools/newfs_hfs
+  export DMG_TOOL=$MOZ_FETCHES_DIR/dmg/dmg
+  export HFS_TOOL=$MOZ_FETCHES_DIR/dmg/hfsplus
 fi
 
 ac_add_options --with-l10n-base=../../l10n
 ac_add_options --enable-update-channel=${MOZ_UPDATE_CHANNEL}
 ac_add_options --with-branding=browser/branding/nightly
 
 ac_add_options --disable-nodejs
 unset NODEJS
--- a/browser/config/mozconfigs/macosx64/l10n-mozconfig-devedition
+++ b/browser/config/mozconfigs/macosx64/l10n-mozconfig-devedition
@@ -1,17 +1,17 @@
 . "$topsrcdir/browser/config/mozconfigs/common"
 . "$topsrcdir/build/mozconfig.no-compile"
 
 if test `uname -s` = "Linux"; then
   # We need to indicate the target for cross builds
   ac_add_options --target=x86_64-apple-darwin
-  export MKFSHFS=$topsrcdir/hfsplus-tools/newfs_hfs
-  export DMG_TOOL=$topsrcdir/dmg/dmg
-  export HFS_TOOL=$topsrcdir/dmg/hfsplus
+  export MKFSHFS=$MOZ_FETCHES_DIR/hfsplus-tools/newfs_hfs
+  export DMG_TOOL=$MOZ_FETCHES_DIR/dmg/dmg
+  export HFS_TOOL=$MOZ_FETCHES_DIR/dmg/hfsplus
 fi
 
 ac_add_options --with-l10n-base=../../l10n
 ac_add_options --enable-update-channel=${MOZ_UPDATE_CHANNEL}
 ac_add_options --with-branding=browser/branding/aurora
 
 ac_add_options --disable-nodejs
 unset NODEJS
--- a/browser/config/mozconfigs/macosx64/repack
+++ b/browser/config/mozconfigs/macosx64/repack
@@ -1,8 +1,8 @@
 # This mozconfig is responsible merely for getting the cross tools setup
 # for repacking a .tar into a .dmg as returned from signing.
 
-export MKFSHFS=$topsrcdir/hfsplus-tools/newfs_hfs
-export DMG_TOOL=$topsrcdir/dmg/dmg
-export HFS_TOOL=$topsrcdir/dmg/hfsplus
-export NODEJS=$topsrcdir/node/bin/node
+export MKFSHFS=$MOZ_FETCHES_DIR/hfsplus-tools/newfs_hfs
+export DMG_TOOL=$MOZ_FETCHES_DIR/dmg/dmg
+export HFS_TOOL=$MOZ_FETCHES_DIR/dmg/hfsplus
+export NODEJS=$MOZ_FETCHES_DIR/node/bin/node
 ac_add_options --disable-compile-environment
--- a/browser/config/mozconfigs/win32/mingwclang
+++ b/browser/config/mozconfigs/win32/mingwclang
@@ -41,34 +41,34 @@ ac_add_options --disable-jemalloc
 ac_add_options --enable-proxy-bypass-protection
 
 # These aren't supported on mingw at this time
 ac_add_options --disable-maintenance-service
 ac_add_options --disable-webrtc # Bug 1393901
 ac_add_options --disable-geckodriver # Bug 1489320
 
 # Find our toolchain
-HOST_CC="$TOOLTOOL_DIR/clang/bin/clang"
-HOST_CXX="$TOOLTOOL_DIR/clang/bin/clang++"
-CC="$TOOLTOOL_DIR/clang/bin/i686-w64-mingw32-clang"
-CXX="$TOOLTOOL_DIR/clang/bin/i686-w64-mingw32-clang++"
+HOST_CC="$MOZ_FETCHES_DIR/clang/bin/clang"
+HOST_CXX="$MOZ_FETCHES_DIR/clang/bin/clang++"
+CC="$MOZ_FETCHES_DIR/clang/bin/i686-w64-mingw32-clang"
+CXX="$MOZ_FETCHES_DIR/clang/bin/i686-w64-mingw32-clang++"
 ac_add_options --with-clang-path="$CC"
-ac_add_options --with-libclang-path="$TOOLTOOL_DIR/clang/lib"
+ac_add_options --with-libclang-path="$MOZ_FETCHES_DIR/clang/lib"
 CXXFLAGS="-fms-extensions"
 AR=llvm-ar
 RANLIB=llvm-ranlib
 
 # For Stylo
-BINDGEN_CFLAGS="-I$TOOLTOOL_DIR/clang/i686-w64-mingw32/include/c++/v1 -I$TOOLTOOL_DIR/clang/i686-w64-mingw32/include"
+BINDGEN_CFLAGS="-I$MOZ_FETCHES_DIR/clang/i686-w64-mingw32/include/c++/v1 -I$MOZ_FETCHES_DIR/clang/i686-w64-mingw32/include"
 
 # We want to make sure we use binutils and other binaries in the tooltool
 # package.
-mk_add_options "export PATH=$TOOLTOOL_DIR/clang/bin:$TOOLTOOL_DIR/mingw32/bin:$TOOLTOOL_DIR/wine/bin:$TOOLTOOL_DIR/upx/bin:$TOOLTOOL_DIR/fxc2/bin:$PATH"
+mk_add_options "export PATH=$MOZ_FETCHES_DIR/clang/bin:$MOZ_FETCHES_DIR/mingw32/bin:$MOZ_FETCHES_DIR/wine/bin:$MOZ_FETCHES_DIR/upx/bin:$MOZ_FETCHES_DIR/fxc2/bin:$PATH"
 
-LD_LIBRARY_PATH=${LD_LIBRARY_PATH:+$LD_LIBRARY_PATH:}$TOOLTOOL_DIR/mingw32/lib64:$TOOLTOOL_DIR/clang/lib
+LD_LIBRARY_PATH=${LD_LIBRARY_PATH:+$LD_LIBRARY_PATH:}$MOZ_FETCHES_DIR/mingw32/lib64:$MOZ_FETCHES_DIR/clang/lib
 mk_add_options "export LD_LIBRARY_PATH=$LD_LIBRARY_PATH"
 
 # Do not include the visual studio related mozconfigs of course
 
 ac_add_options --with-branding=browser/branding/nightly
 
 . "$topsrcdir/build/mozconfig.common.override"
 . "$topsrcdir/build/mozconfig.cache"
--- a/browser/config/mozconfigs/win64/code-coverage
+++ b/browser/config/mozconfigs/win64/code-coverage
@@ -13,18 +13,18 @@ ac_add_options --enable-rust-tests
 # Needed to enable breakpad in application.ini
 export MOZILLA_OFFICIAL=1
 
 . $topsrcdir/build/win64/mozconfig.vs-latest
 
 # Package js shell.
 export MOZ_PACKAGE_JSSHELL=1
 
-if [ -d "$topsrcdir/clang" ]; then
-    CLANG_LIB_DIR="$(cd $topsrcdir/clang/lib/clang/* && cd lib/windows && pwd)"
+if [ -d "$MOZ_FETCHES_DIR/clang" ]; then
+    CLANG_LIB_DIR="$(cd $MOZ_FETCHES_DIR/clang/lib/clang/* && cd lib/windows && pwd)"
 
     export LIB=$LIB:$CLANG_LIB_DIR
     export LDFLAGS="clang_rt.profile-x86_64.lib"
 fi
 
 export RUSTFLAGS="-Ccodegen-units=1 -Zprofile -Zno-landing-pads -Clink-dead-code -Coverflow-checks=off"
 
 . "$topsrcdir/build/mozconfig.common.override"
--- a/browser/config/mozconfigs/win64/mingwclang
+++ b/browser/config/mozconfigs/win64/mingwclang
@@ -41,34 +41,34 @@ ac_add_options --disable-jemalloc
 ac_add_options --enable-proxy-bypass-protection
 
 # These aren't supported on mingw at this time
 ac_add_options --disable-maintenance-service
 ac_add_options --disable-webrtc # Bug 1393901
 ac_add_options --disable-geckodriver # Bug 1489320
 
 # Find our toolchain
-HOST_CC="$TOOLTOOL_DIR/clang/bin/clang"
-HOST_CXX="$TOOLTOOL_DIR/clang/bin/clang++"
-CC="$TOOLTOOL_DIR/clang/bin/x86_64-w64-mingw32-clang"
-CXX="$TOOLTOOL_DIR/clang/bin/x86_64-w64-mingw32-clang++"
+HOST_CC="$MOZ_FETCHES_DIR/clang/bin/clang"
+HOST_CXX="$MOZ_FETCHES_DIR/clang/bin/clang++"
+CC="$MOZ_FETCHES_DIR/clang/bin/x86_64-w64-mingw32-clang"
+CXX="$MOZ_FETCHES_DIR/clang/bin/x86_64-w64-mingw32-clang++"
 ac_add_options --with-clang-path="$CC"
-ac_add_options --with-libclang-path="$TOOLTOOL_DIR/clang/lib"
+ac_add_options --with-libclang-path="$MOZ_FETCHES_DIR/clang/lib"
 CXXFLAGS="-fms-extensions"
 AR=llvm-ar
 RANLIB=llvm-ranlib
 
 # For Stylo
-BINDGEN_CFLAGS="-I$TOOLTOOL_DIR/clang/x86_64-w64-mingw32/include/c++/v1 -I$TOOLTOOL_DIR/clang/x86_64-w64-mingw32/include"
+BINDGEN_CFLAGS="-I$MOZ_FETCHES_DIR/clang/x86_64-w64-mingw32/include/c++/v1 -I$MOZ_FETCHES_DIR/clang/x86_64-w64-mingw32/include"
 
 # We want to make sure we use binutils and other binaries in the tooltool
 # package.
-mk_add_options "export PATH=$TOOLTOOL_DIR/clang/bin:$TOOLTOOL_DIR/mingw32/bin:$TOOLTOOL_DIR/wine/bin:$TOOLTOOL_DIR/upx/bin:$TOOLTOOL_DIR/fxc2/bin:$PATH"
+mk_add_options "export PATH=$MOZ_FETCHES_DIR/clang/bin:$MOZ_FETCHES_DIR/mingw32/bin:$MOZ_FETCHES_DIR/wine/bin:$MOZ_FETCHES_DIR/upx/bin:$MOZ_FETCHES_DIR/fxc2/bin:$PATH"
 
-LD_LIBRARY_PATH=${LD_LIBRARY_PATH:+$LD_LIBRARY_PATH:}$TOOLTOOL_DIR/mingw32/lib64:$TOOLTOOL_DIR/clang/lib
+LD_LIBRARY_PATH=${LD_LIBRARY_PATH:+$LD_LIBRARY_PATH:}$MOZ_FETCHES_DIR/mingw32/lib64:$MOZ_FETCHES_DIR/clang/lib
 mk_add_options "export LD_LIBRARY_PATH=$LD_LIBRARY_PATH"
 
 # Do not include the visual studio related mozconfigs of course
 
 ac_add_options --with-branding=browser/branding/nightly
 
 . "$topsrcdir/build/mozconfig.common.override"
 . "$topsrcdir/build/mozconfig.cache"
--- a/browser/config/mozconfigs/win64/plain-opt
+++ b/browser/config/mozconfigs/win64/plain-opt
@@ -1,16 +1,16 @@
 TOOLTOOL_DIR=${topsrcdir}
 export MAKECAB=$TOOLTOOL_DIR/makecab.exe
-export LLVM_CONFIG="${TOOLTOOL_DIR}/clang/bin/llvm-config"
+export LLVM_CONFIG="${MOZ_FETCHES_DIR}/clang/bin/llvm-config"
 
-RUSTC="${TOOLTOOL_DIR}/rustc/bin/rustc"
-CARGO="${TOOLTOOL_DIR}/rustc/bin/cargo"
-RUSTDOC="${TOOLTOOL_DIR}/rustc/bin/rustdoc"
-RUSTFMT="${TOOLTOOL_DIR}/rustc/bin/rustfmt"
-CBINDGEN="${TOOLTOOL_DIR}/cbindgen/cbindgen"
+RUSTC="${MOZ_FETCHES_DIR}/rustc/bin/rustc"
+CARGO="${MOZ_FETCHES_DIR}/rustc/bin/cargo"
+RUSTDOC="${MOZ_FETCHES_DIR}/rustc/bin/rustdoc"
+RUSTFMT="${MOZ_FETCHES_DIR}/rustc/bin/rustfmt"
+CBINDGEN="${MOZ_FETCHES_DIR}/cbindgen/cbindgen"
 
-NASM="${TOOLTOOL_DIR}/nasm/nasm.exe"
-NODEJS="${TOOLTOOL_DIR}/node/node.exe"
+NASM="${MOZ_FETCHES_DIR}/nasm/nasm.exe"
+NODEJS="${MOZ_FETCHES_DIR}/node/node.exe"
 
 ac_add_options --target=x86_64-pc-mingw32
 
 . $topsrcdir/build/win64/mozconfig.vs-latest
--- a/build/macosx/cross-mozconfig.common
+++ b/build/macosx/cross-mozconfig.common
@@ -2,41 +2,41 @@
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 MOZ_AUTOMATION_L10N_CHECK=0
 
 . "$topsrcdir/build/mozconfig.common"
 
 # cctools for ld, ar, and other related tools ; dsymutil for rust.
-mk_add_options "export PATH=$topsrcdir/cctools/bin:$topsrcdir/binutils/bin:$topsrcdir/llvm-dsymutil/bin:$PATH"
+mk_add_options "export PATH=$MOZ_FETCHES_DIR/cctools/bin:$MOZ_FETCHES_DIR/binutils/bin:$MOZ_FETCHES_DIR/llvm-dsymutil/bin:$PATH"
 
 # dsymutil needs a libstdc++ more recent than what's on the system.
-mk_add_options "export LD_LIBRARY_PATH=$topsrcdir/clang/lib"
+mk_add_options "export LD_LIBRARY_PATH=$MOZ_FETCHES_DIR/clang/lib"
 
 # This SDK was copied from a local XCode install and uploaded to tooltool.
 # Generate the tarball by running this command with the proper SDK version:
 #   sdk_path=$(xcrun --sdk macosx10.12 --show-sdk-path)
 #   tar -C $(dirname ${sdk_path}) -cHjf /tmp/$(basename ${sdk_path}).tar.bz2 $(basename ${sdk_path})
 # Upload the resulting tarball from /tmp to tooltool, and change the entry in
 # `browser/config/tooltool-manifests/macosx64/cross-releng.manifest`.
 CROSS_SYSROOT=$topsrcdir/MacOSX10.11.sdk
 CROSS_PRIVATE_FRAMEWORKS=$CROSS_SYSROOT/System/Library/PrivateFrameworks
 
-export CC="$topsrcdir/clang/bin/clang"
-export CXX="$topsrcdir/clang/bin/clang++"
+export CC="$MOZ_FETCHES_DIR/clang/bin/clang"
+export CXX="$MOZ_FETCHES_DIR/clang/bin/clang++"
 export CFLAGS="$CFLAGS -fcrash-diagnostics-dir=${UPLOAD_PATH}"
 export CXXFLAGS="$CXXFLAGS -fcrash-diagnostics-dir=${UPLOAD_PATH}"
-export LLVMCONFIG=$topsrcdir/clang/bin/llvm-config
+export LLVMCONFIG=$MOZ_FETCHES_DIR/clang/bin/llvm-config
 export BINDGEN_CFLAGS="-isysroot $CROSS_SYSROOT"
 export DSYMUTIL=$topsrcdir/build/macosx/llvm-dsymutil
-mk_add_options "export REAL_DSYMUTIL=$topsrcdir/llvm-dsymutil/bin/dsymutil"
-export MKFSHFS=$topsrcdir/hfsplus-tools/newfs_hfs
-export DMG_TOOL=$topsrcdir/dmg/dmg
-export HFS_TOOL=$topsrcdir/dmg/hfsplus
+mk_add_options "export REAL_DSYMUTIL=$MOZ_FETCHES_DIR/llvm-dsymutil/bin/dsymutil"
+export MKFSHFS=$MOZ_FETCHES_DIR/hfsplus-tools/newfs_hfs
+export DMG_TOOL=$MOZ_FETCHES_DIR/dmg/dmg
+export HFS_TOOL=$MOZ_FETCHES_DIR/dmg/hfsplus
 
 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
--- a/build/macosx/local-mozconfig.common
+++ b/build/macosx/local-mozconfig.common
@@ -1,34 +1,24 @@
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 . "$topsrcdir/build/mozconfig.common"
 
-if [ -d "$topsrcdir/clang" ]; then
+if [ -d "$MOZ_FETCHES_DIR/clang" ]; then
     # mozilla-central based build
-    export CC=$topsrcdir/clang/bin/clang
-    export CXX=$topsrcdir/clang/bin/clang++
-    export LLVMCONFIG=$topsrcdir/clang/bin/llvm-config
-    export DSYMUTIL=$topsrcdir/clang/bin/llvm-dsymutil
+    export CC=$MOZ_FETCHES_DIR/clang/bin/clang
+    export CXX=$MOZ_FETCHES_DIR/clang/bin/clang++
+    export LLVMCONFIG=$MOZ_FETCHES_DIR/clang/bin/llvm-config
+    export DSYMUTIL=$MOZ_FETCHES_DIR/clang/bin/llvm-dsymutil
     # Use an updated linker.
-    ldflags="-B$topsrcdir/cctools/bin"
-    export AR=$topsrcdir/cctools/bin/ar
-    export RANLIB=$topsrcdir/cctools/bin/ranlib
-elif [ -d "$topsrcdir/../clang" ]; then
-    # comm-central based build
-    export CC=$topsrcdir/../clang/bin/clang
-    export CXX=$topsrcdir/../clang/bin/clang++
-    export LLVMCONFIG=$topsrcdir/../clang/bin/llvm-config
-    export DSYMUTIL=$topsrcdir/../clang/bin/llvm-dsymutil
-    # Use an updated linker.
-    ldflags="-B$topsrcdir/../cctools/bin"
-    export AR=$topsrcdir/../cctools/bin/ar
-    export RANLIB=$topsrcdir/../cctools/bin/ranlib
+    ldflags="-B$MOZ_FETCHES_DIR/cctools/bin"
+    export AR=$MOZ_FETCHES_DIR/cctools/bin/ar
+    export RANLIB=$MOZ_FETCHES_DIR/cctools/bin/ranlib
 fi
 
 # Ensure the updated linker doesn't generate things our older build tools
 # don't understand.
 ldflags="$ldflags -Wl,-no_data_in_code_info"
 export LDFLAGS="$ldflags"
 
 # If not set use the system default clang
--- a/build/mozconfig.cache
+++ b/build/mozconfig.cache
@@ -53,12 +53,12 @@ if test -z "$bucket" -a -z "$SCCACHE_DIS
 fi
 
 if test -n "$bucket"; then
     if [ -n "${SCCACHE_GCS_KEY_PATH}" ]; then
         mk_add_options "export SCCACHE_GCS_BUCKET=$bucket"
     else
         mk_add_options "export SCCACHE_BUCKET=$bucket"
     fi
-    export CCACHE="$topsrcdir/sccache/sccache"
+    export CCACHE="$MOZ_FETCHES_DIR/sccache/sccache"
     export SCCACHE_VERBOSE_STATS=1
-    mk_add_options MOZBUILD_MANAGE_SCCACHE_DAEMON=${topsrcdir}/sccache/sccache
+    mk_add_options MOZBUILD_MANAGE_SCCACHE_DAEMON=${MOZ_FETCHES_DIR}/sccache/sccache
 fi
--- a/build/mozconfig.clang-cl
+++ b/build/mozconfig.clang-cl
@@ -1,14 +1,14 @@
-if test -d "$topsrcdir/clang/bin"; then
-    CLANG_DIR=`cd "$topsrcdir/clang/bin" ; pwd`
+if test -d "$MOZ_FETCHES_DIR/clang/bin"; then
+    CLANG_DIR=`cd "$MOZ_FETCHES_DIR/clang/bin" ; pwd`
     export PATH="${CLANG_DIR}:${PATH}"
 
-    if $(cd $topsrcdir/clang/lib/clang/* && test -d lib/windows); then
-        CLANG_LIB_DIR="$(cd $topsrcdir/clang/lib/clang/* && cd lib/windows && pwd)"
+    if $(cd $MOZ_FETCHES_DIR/clang/lib/clang/* && test -d lib/windows); then
+        CLANG_LIB_DIR="$(cd $MOZ_FETCHES_DIR/clang/lib/clang/* && cd lib/windows && pwd)"
         export LIB=$LIB:$CLANG_LIB_DIR
     fi
 fi
 
 export CC=clang-cl
 export CXX=clang-cl
 export ENABLE_CLANG_PLUGIN=1
 
--- a/build/mozconfig.lld-link
+++ b/build/mozconfig.lld-link
@@ -1,6 +1,6 @@
-if test -d "$topsrcdir/clang/bin"; then
-    CLANG_DIR=`cd "$topsrcdir/clang/bin" ; pwd`
+if test -d "$MOZ_FETCHES_DIR/clang/bin"; then
+    CLANG_DIR=`cd "$MOZ_FETCHES_DIR/clang/bin" ; pwd`
     export PATH="${CLANG_DIR}:${PATH}"
 fi
 
 export LINKER=lld-link
--- a/build/mozconfig.nasm
+++ b/build/mozconfig.nasm
@@ -1,12 +1,12 @@
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 case "$(uname -s)" in
 MINGW*)
-    export NASM=$topsrcdir/nasm/nasm.exe
+    export NASM=$MOZ_FETCHES_DIR/nasm/nasm.exe
     ;;
 *)
-    export NASM=$topsrcdir/nasm/nasm
+    export NASM=$MOZ_FETCHES_DIR/nasm/nasm
     ;;
 esac
--- a/build/mozconfig.node
+++ b/build/mozconfig.node
@@ -1,12 +1,12 @@
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 case "$(uname -s)" in
 MINGW*)
-    export NODEJS=$topsrcdir/node/node.exe
+    export NODEJS=$MOZ_FETCHES_DIR/node/node.exe
     ;;
 *)
-    export NODEJS=$topsrcdir/node/bin/node
+    export NODEJS=$MOZ_FETCHES_DIR/node/bin/node
     ;;
 esac
--- a/build/mozconfig.rust
+++ b/build/mozconfig.rust
@@ -1,12 +1,12 @@
 # Options to enable rust in automation builds.
 
 TOOLTOOL_DIR=${TOOLTOOL_DIR:-$topsrcdir}
 
 # Tell configure to use the tooltool rustc.
-RUSTC="$TOOLTOOL_DIR/rustc/bin/rustc"
-CARGO="$TOOLTOOL_DIR/rustc/bin/cargo"
-RUSTDOC="$TOOLTOOL_DIR/rustc/bin/rustdoc"
-RUSTFMT="$TOOLTOOL_DIR/rustc/bin/rustfmt"
-CBINDGEN="$TOOLTOOL_DIR/cbindgen/cbindgen"
+RUSTC="$MOZ_FETCHES_DIR/rustc/bin/rustc"
+CARGO="$MOZ_FETCHES_DIR/rustc/bin/cargo"
+RUSTDOC="$MOZ_FETCHES_DIR/rustc/bin/rustdoc"
+RUSTFMT="$MOZ_FETCHES_DIR/rustc/bin/rustfmt"
+CBINDGEN="$MOZ_FETCHES_DIR/cbindgen/cbindgen"
 
 ac_add_options --enable-rust-simd
--- a/build/mozconfig.stylo
+++ b/build/mozconfig.stylo
@@ -1,2 +1,2 @@
 # Tell the build system where to find llvm-config for builds on automation.
-export LLVM_CONFIG="${TOOLTOOL_DIR:-$topsrcdir}/clang/bin/llvm-config"
+export LLVM_CONFIG="${MOZ_FETCHES_DIR}/clang/bin/llvm-config"
--- a/build/unix/mozconfig.asan
+++ b/build/unix/mozconfig.asan
@@ -1,13 +1,13 @@
 MOZ_AUTOMATION_L10N_CHECK=0
 
 . "$topsrcdir/build/unix/mozconfig.unix"
 
-export LLVM_SYMBOLIZER="$topsrcdir/clang/bin/llvm-symbolizer"
+export LLVM_SYMBOLIZER="$MOZ_FETCHES_DIR/clang/bin/llvm-symbolizer"
 #
 # Enable ASan specific code and build workarounds
 ac_add_options --enable-address-sanitizer
 
 # Mandatory options required for ASan builds (both on Linux and Mac)
 export MOZ_DEBUG_SYMBOLS=1
 ac_add_options --enable-debug-symbols
 ac_add_options --disable-install-strip
--- a/build/unix/mozconfig.stdcxx
+++ b/build/unix/mozconfig.stdcxx
@@ -1,19 +1,19 @@
 # Avoid dependency on libstdc++ 4.7
 export MOZ_STDCXX_COMPAT=1
 
 TOOLTOOL_DIR=${TOOLTOOL_DIR:-$topsrcdir}
 
 # Depending whether GCC was built on a RedHat-based or a Debian-based system,
 # the directory containing 32-bits libraries can be either (respectively)
 # lib or lib32. The directory for 64-bits libraries is always lib64.
-if [ -f "$TOOLTOOL_DIR/gcc/lib64/libstdc++.so" ]; then
+if [ -f "$MOZ_FETCHES_DIR/gcc/lib64/libstdc++.so" ]; then
   # We put both 32-bits and 64-bits library path in LD_LIBRARY_PATH: ld.so
   # will prefer the files in the 32-bits path when loading 32-bits executables,
   # and the files in the 64-bits path when loading 64-bits executables.
   # We also put both possible 32-bits library paths.
-  LD_LIBRARY_PATH=${LD_LIBRARY_PATH:+$LD_LIBRARY_PATH:}$TOOLTOOL_DIR/gcc/lib64:$TOOLTOOL_DIR/gcc/lib32:$TOOLTOOL_DIR/gcc/lib
-elif [ -f "$TOOLTOOL_DIR/clang/lib/libstdc++.so" ]; then
-  LD_LIBRARY_PATH=${LD_LIBRARY_PATH:+$LD_LIBRARY_PATH:}$TOOLTOOL_DIR/clang/lib:$TOOLTOOL_DIR/clang/lib32
+  LD_LIBRARY_PATH=${LD_LIBRARY_PATH:+$LD_LIBRARY_PATH:}$MOZ_FETCHES_DIR/gcc/lib64:$MOZ_FETCHES_DIR/gcc/lib32:$MOZ_FETCHES_DIR/gcc/lib
+elif [ -f "$MOZ_FETCHES_DIR/clang/lib/libstdc++.so" ]; then
+  LD_LIBRARY_PATH=${LD_LIBRARY_PATH:+$LD_LIBRARY_PATH:}$MOZ_FETCHES_DIR/clang/lib:$MOZ_FETCHES_DIR/clang/lib32
 fi
 
 mk_add_options "export LD_LIBRARY_PATH=$LD_LIBRARY_PATH"
--- a/build/unix/mozconfig.tsan
+++ b/build/unix/mozconfig.tsan
@@ -1,13 +1,13 @@
 MOZ_AUTOMATION_L10N_CHECK=0
 
 . "$topsrcdir/build/unix/mozconfig.unix"
 
-export LLVM_SYMBOLIZER="$topsrcdir/clang/bin/llvm-symbolizer"
+export LLVM_SYMBOLIZER="$MOZ_FETCHES_DIR/clang/bin/llvm-symbolizer"
 
 # Enable TSan specific code and build workarounds
 ac_add_options --enable-thread-sanitizer
 
 # The ThreadSanitizer is not compatible with sandboxing
 # (see bug 1182565)
 ac_add_options --disable-sandbox
 
--- a/build/unix/mozconfig.unix
+++ b/build/unix/mozconfig.unix
@@ -1,23 +1,23 @@
 . "$topsrcdir/build/mozconfig.common"
 
 TOOLTOOL_DIR=${TOOLTOOL_DIR:-$topsrcdir}
 
 if [ -n "$FORCE_GCC" ]; then
-    CC="$TOOLTOOL_DIR/gcc/bin/gcc"
-    CXX="$TOOLTOOL_DIR/gcc/bin/g++"
+    CC="$MOZ_FETCHES_DIR/gcc/bin/gcc"
+    CXX="$MOZ_FETCHES_DIR/gcc/bin/g++"
 
     # We want to make sure we use binutils and other binaries in the tooltool
     # package.
-    mk_add_options "export PATH=$TOOLTOOL_DIR/gcc/bin:$PATH"
-    ac_add_options --with-clang-path=$TOOLTOOL_DIR/clang/bin/clang
+    mk_add_options "export PATH=$MOZ_FETCHES_DIR/gcc/bin:$PATH"
+    ac_add_options --with-clang-path=$MOZ_FETCHES_DIR/clang/bin/clang
 else
-    CC="$TOOLTOOL_DIR/clang/bin/clang"
-    CXX="$TOOLTOOL_DIR/clang/bin/clang++"
+    CC="$MOZ_FETCHES_DIR/clang/bin/clang"
+    CXX="$MOZ_FETCHES_DIR/clang/bin/clang++"
     export ENABLE_CLANG_PLUGIN=1
     case "$PERFHERDER_EXTRA_OPTIONS" in
     base-toolchains*)
       # Clang versions < 7.0 don't support the -fcrash-diagnostics-dir flag.
       ;;
     *)
       export CFLAGS="$CFLAGS -fcrash-diagnostics-dir=${UPLOAD_PATH}"
       export CXXFLAGS="$CXXFLAGS -fcrash-diagnostics-dir=${UPLOAD_PATH}"
@@ -28,18 +28,18 @@ else
         if [ -z "$USE_ARTIFACT" ]; then
             export MOZ_LTO=cross
             if [ -n "$MOZ_PGO_PROFILE_USE" ]; then
                 ac_add_options --enable-profile-use=cross
                 ac_add_options --with-pgo-jarlog=/builds/worker/fetches/en-US.log
                 ac_add_options --with-pgo-profile-path=/builds/worker/fetches
             fi
         fi
-        export LLVM_PROFDATA="$TOOLTOOL_DIR/clang/bin/llvm-profdata"
-        export AR="$topsrcdir/clang/bin/llvm-ar"
-        export NM="$topsrcdir/clang/bin/llvm-nm"
-        export RANLIB="$topsrcdir/clang/bin/llvm-ranlib"
+        export LLVM_PROFDATA="$MOZ_FETCHES_DIR/clang/bin/llvm-profdata"
+        export AR="$MOZ_FETCHES_DIR/clang/bin/llvm-ar"
+        export NM="$MOZ_FETCHES_DIR/clang/bin/llvm-nm"
+        export RANLIB="$MOZ_FETCHES_DIR/clang/bin/llvm-ranlib"
     fi
 
-    mk_add_options "export PATH=$TOOLTOOL_DIR/binutils/bin:$PATH"
+    mk_add_options "export PATH=$MOZ_FETCHES_DIR/binutils/bin:$PATH"
 fi
 
 . "$topsrcdir/build/unix/mozconfig.stdcxx"
--- a/build/win64/mozconfig.asan
+++ b/build/win64/mozconfig.asan
@@ -1,18 +1,18 @@
 . "$topsrcdir/browser/config/mozconfigs/win64/common-win64"
 
-if [ -d "$topsrcdir/clang" ]; then
-    CLANG_LIB_DIR="$(cd $topsrcdir/clang/lib/clang/* && cd lib/windows && pwd)"
+if [ -d "$MOZ_FETCHES_DIR/clang" ]; then
+    CLANG_LIB_DIR="$(cd $MOZ_FETCHES_DIR/clang/lib/clang/* && cd lib/windows && pwd)"
 
     export LIB=$LIB:$CLANG_LIB_DIR
     export LDFLAGS="clang_rt.asan_dynamic-x86_64.lib clang_rt.asan_dynamic_runtime_thunk-x86_64.lib"
 
     export MOZ_COPY_PDBS=1
-    export LLVM_SYMBOLIZER="$topsrcdir/clang/bin/llvm-symbolizer.exe"
+    export LLVM_SYMBOLIZER="$MOZ_FETCHES_DIR/clang/bin/llvm-symbolizer.exe"
     export MOZ_CLANG_RT_ASAN_LIB_PATH="${CLANG_LIB_DIR}/clang_rt.asan_dynamic-x86_64.dll"
 fi
 
 # Enable ASan specific code and build workarounds
 ac_add_options --enable-address-sanitizer
 
 # Mandatory options required for ASan builds
 ac_add_options --enable-debug-symbols
--- a/mobile/android/config/mozconfigs/android-aarch64/beta
+++ b/mobile/android/config/mozconfigs/android-aarch64/beta
@@ -1,18 +1,18 @@
 . "$topsrcdir/mobile/android/config/mozconfigs/common"
 
 # Android
 ac_add_options --with-android-min-sdk=21
 ac_add_options --target=aarch64-linux-android
 
 ac_add_options --with-branding=mobile/android/branding/beta
 
-export AR="$topsrcdir/clang/bin/llvm-ar"
-export NM="$topsrcdir/clang/bin/llvm-nm"
-export RANLIB="$topsrcdir/clang/bin/llvm-ranlib"
+export AR="$MOZ_FETCHES_DIR/clang/bin/llvm-ar"
+export NM="$MOZ_FETCHES_DIR/clang/bin/llvm-nm"
+export RANLIB="$MOZ_FETCHES_DIR/clang/bin/llvm-ranlib"
 
 export MOZ_LTO=cross
 
 export MOZILLA_OFFICIAL=1
 export MOZ_ANDROID_POCKET=1
 
 . "$topsrcdir/mobile/android/config/mozconfigs/common.override"
--- a/mobile/android/config/mozconfigs/android-aarch64/nightly
+++ b/mobile/android/config/mozconfigs/android-aarch64/nightly
@@ -3,18 +3,18 @@
 # Android
 ac_add_options --with-android-min-sdk=21
 ac_add_options --target=aarch64-linux-android
 
 ac_add_options --with-branding=mobile/android/branding/nightly
 
 export FENNEC_NIGHTLY=1
 
-export AR="$topsrcdir/clang/bin/llvm-ar"
-export NM="$topsrcdir/clang/bin/llvm-nm"
-export RANLIB="$topsrcdir/clang/bin/llvm-ranlib"
+export AR="$MOZ_FETCHES_DIR/clang/bin/llvm-ar"
+export NM="$MOZ_FETCHES_DIR/clang/bin/llvm-nm"
+export RANLIB="$MOZ_FETCHES_DIR/clang/bin/llvm-ranlib"
 
 export MOZ_LTO=cross
 
 export MOZILLA_OFFICIAL=1
 export MOZ_ANDROID_POCKET=1
 
 . "$topsrcdir/mobile/android/config/mozconfigs/common.override"
--- a/mobile/android/config/mozconfigs/android-api-16-gradle-dependencies/nightly
+++ b/mobile/android/config/mozconfigs/android-api-16-gradle-dependencies/nightly
@@ -6,20 +6,16 @@ MOZ_AUTOMATION_PACKAGE_TESTS=0
 MOZ_AUTOMATION_UPLOAD=0
 MOZ_AUTOMATION_PACKAGE_GENERATED_SOURCES=0
 
 NO_CACHE=1
 NO_NDK=1
 
 . "$topsrcdir/mobile/android/config/mozconfigs/common"
 
-# Until normal mozconfigs also use MOZ_FETCHES_DIR
-ac_add_options --with-android-sdk="$MOZ_FETCHES_DIR/android-sdk-linux"
-export NODEJS=$MOZ_FETCHES_DIR/node/bin/node
-
 # We want to download Gradle.
 ac_add_options --with-gradle
 # We want to use (and populate!) the local Nexus repositories.
 export GRADLE_MAVEN_REPOSITORIES="http://localhost:8081/nexus/content/repositories/google/","http://localhost:8081/nexus/content/repositories/jcenter/","http://localhost:8081/nexus/content/repositories/gradle-plugins/"
 
 # From here on, just like ../android-api-16-frontend/nightly.
 
 . "$topsrcdir/build/mozconfig.no-compile"
--- a/mobile/android/config/mozconfigs/android-api-16/beta
+++ b/mobile/android/config/mozconfigs/android-api-16/beta
@@ -10,15 +10,15 @@ ac_add_options --with-android-min-sdk=16
 ac_add_options --target=arm-linux-androideabi
 
 ac_add_options --with-branding=mobile/android/branding/beta
 
 export MOZILLA_OFFICIAL=1
 export MOZ_ANDROID_MMA=1
 export MOZ_ANDROID_POCKET=1
 
-export AR="$topsrcdir/clang/bin/llvm-ar"
-export NM="$topsrcdir/clang/bin/llvm-nm"
-export RANLIB="$topsrcdir/clang/bin/llvm-ranlib"
+export AR="$MOZ_FETCHES_DIR/clang/bin/llvm-ar"
+export NM="$MOZ_FETCHES_DIR/clang/bin/llvm-nm"
+export RANLIB="$MOZ_FETCHES_DIR/clang/bin/llvm-ranlib"
 
 export MOZ_LTO=cross
 
 . "$topsrcdir/mobile/android/config/mozconfigs/common.override"
--- a/mobile/android/config/mozconfigs/android-api-16/nightly
+++ b/mobile/android/config/mozconfigs/android-api-16/nightly
@@ -12,15 +12,15 @@ ac_add_options --target=arm-linux-androi
 ac_add_options --with-branding=mobile/android/branding/nightly
 
 export FENNEC_NIGHTLY=1
 
 export MOZILLA_OFFICIAL=1
 export MOZ_ANDROID_MMA=1
 export MOZ_ANDROID_POCKET=1
 
-export AR="$topsrcdir/clang/bin/llvm-ar"
-export NM="$topsrcdir/clang/bin/llvm-nm"
-export RANLIB="$topsrcdir/clang/bin/llvm-ranlib"
+export AR="$MOZ_FETCHES_DIR/clang/bin/llvm-ar"
+export NM="$MOZ_FETCHES_DIR/clang/bin/llvm-nm"
+export RANLIB="$MOZ_FETCHES_DIR/clang/bin/llvm-ranlib"
 
 export MOZ_LTO=cross
 
 . "$topsrcdir/mobile/android/config/mozconfigs/common.override"
--- a/mobile/android/config/mozconfigs/android-x86/beta
+++ b/mobile/android/config/mozconfigs/android-x86/beta
@@ -8,15 +8,15 @@
 ac_add_options --target=i686-linux-android
 ac_add_options --with-android-min-sdk=16
 
 ac_add_options --with-branding=mobile/android/branding/beta
 
 export MOZILLA_OFFICIAL=1
 export MOZ_ANDROID_POCKET=1
 
-export AR="$topsrcdir/clang/bin/llvm-ar"
-export NM="$topsrcdir/clang/bin/llvm-nm"
-export RANLIB="$topsrcdir/clang/bin/llvm-ranlib"
+export AR="$MOZ_FETCHES_DIR/clang/bin/llvm-ar"
+export NM="$MOZ_FETCHES_DIR/clang/bin/llvm-nm"
+export RANLIB="$MOZ_FETCHES_DIR/clang/bin/llvm-ranlib"
 
 export MOZ_LTO=cross
 
 . "$topsrcdir/mobile/android/config/mozconfigs/common.override"
--- a/mobile/android/config/mozconfigs/android-x86/nightly
+++ b/mobile/android/config/mozconfigs/android-x86/nightly
@@ -10,15 +10,15 @@ ac_add_options --with-android-min-sdk=16
 
 ac_add_options --with-branding=mobile/android/branding/nightly
 
 export FENNEC_NIGHTLY=1
 
 export MOZILLA_OFFICIAL=1
 export MOZ_ANDROID_POCKET=1
 
-export AR="$topsrcdir/clang/bin/llvm-ar"
-export NM="$topsrcdir/clang/bin/llvm-nm"
-export RANLIB="$topsrcdir/clang/bin/llvm-ranlib"
+export AR="$MOZ_FETCHES_DIR/clang/bin/llvm-ar"
+export NM="$MOZ_FETCHES_DIR/clang/bin/llvm-nm"
+export RANLIB="$MOZ_FETCHES_DIR/clang/bin/llvm-ranlib"
 
 export MOZ_LTO=cross
 
 . "$topsrcdir/mobile/android/config/mozconfigs/common.override"
--- a/mobile/android/config/mozconfigs/android-x86_64/beta
+++ b/mobile/android/config/mozconfigs/android-x86_64/beta
@@ -1,18 +1,18 @@
 . "$topsrcdir/mobile/android/config/mozconfigs/common"
 
 # Android
 ac_add_options --with-android-min-sdk=21
 ac_add_options --target=x86_64-linux-android
 
 ac_add_options --with-branding=mobile/android/branding/beta
 
-export AR="$topsrcdir/clang/bin/llvm-ar"
-export NM="$topsrcdir/clang/bin/llvm-nm"
-export RANLIB="$topsrcdir/clang/bin/llvm-ranlib"
+export AR="$MOZ_FETCHES_DIR/clang/bin/llvm-ar"
+export NM="$MOZ_FETCHES_DIR/clang/bin/llvm-nm"
+export RANLIB="$MOZ_FETCHES_DIR/clang/bin/llvm-ranlib"
 
 export MOZ_LTO=cross
 
 export MOZILLA_OFFICIAL=1
 export MOZ_ANDROID_POCKET=1
 
 . "$topsrcdir/mobile/android/config/mozconfigs/common.override"
--- a/mobile/android/config/mozconfigs/android-x86_64/nightly
+++ b/mobile/android/config/mozconfigs/android-x86_64/nightly
@@ -3,18 +3,18 @@
 # Android
 ac_add_options --with-android-min-sdk=21
 ac_add_options --target=x86_64-linux-android
 
 ac_add_options --with-branding=mobile/android/branding/nightly
 
 export FENNEC_NIGHTLY=1
 
-export AR="$topsrcdir/clang/bin/llvm-ar"
-export NM="$topsrcdir/clang/bin/llvm-nm"
-export RANLIB="$topsrcdir/clang/bin/llvm-ranlib"
+export AR="$MOZ_FETCHES_DIR/clang/bin/llvm-ar"
+export NM="$MOZ_FETCHES_DIR/clang/bin/llvm-nm"
+export RANLIB="$MOZ_FETCHES_DIR/clang/bin/llvm-ranlib"
 
 export MOZ_LTO=cross
 
 export MOZILLA_OFFICIAL=1
 export MOZ_ANDROID_POCKET=1
 
 . "$topsrcdir/mobile/android/config/mozconfigs/common.override"
--- a/mobile/android/config/mozconfigs/common
+++ b/mobile/android/config/mozconfigs/common
@@ -10,31 +10,31 @@ fi
 MOZ_AUTOMATION_L10N_CHECK=0
 . "$topsrcdir/build/mozconfig.common"
 
 # For Android builds in TaskCluster, the system image is Debian, and
 # we use the Java JRE/JDK from the system.  We use a custom clang for
 # the host compiler. Make sure clang uses the c++ headers included with
 # clang, rather than the system headers which leads to incompatibility
 # later (when linking against the clang-provided libstdc++).
-HOST_CC="$topsrcdir/clang/bin/clang --gcc-toolchain=$topsrcdir/clang"
-HOST_CXX="$topsrcdir/clang/bin/clang++ --gcc-toolchain=$topsrcdir/clang"
+HOST_CC="$MOZ_FETCHES_DIR/clang/bin/clang --gcc-toolchain=$MOZ_FETCHES_DIR/clang"
+HOST_CXX="$MOZ_FETCHES_DIR/clang/bin/clang++ --gcc-toolchain=$MOZ_FETCHES_DIR/clang"
 
 # Build Fennec
 ac_add_options --enable-application=mobile/android
-ac_add_options --with-android-sdk="$topsrcdir/android-sdk-linux"
+ac_add_options --with-android-sdk="$MOZ_FETCHES_DIR/android-sdk-linux"
 
-ac_add_options --with-gradle="$topsrcdir/android-gradle-dependencies/gradle-dist/bin/gradle"
-export GRADLE_MAVEN_REPOSITORIES="file://$topsrcdir/android-gradle-dependencies/google","file://$topsrcdir/android-gradle-dependencies/jcenter","file://$topsrcdir/android-gradle-dependencies/gradle-plugins"
+ac_add_options --with-gradle="$MOZ_FETCHES_DIR/android-gradle-dependencies/gradle-dist/bin/gradle"
+export GRADLE_MAVEN_REPOSITORIES="file://$MOZ_FETCHES_DIR/android-gradle-dependencies/google","file://$MOZ_FETCHES_DIR/android-gradle-dependencies/jcenter","file://$MOZ_FETCHES_DIR/android-gradle-dependencies/gradle-plugins"
 
 if [ -z "$NO_NDK" -a -z "$USE_ARTIFACT" ]; then
     # We use our own clang instead of the NDK's clang.
-    CC="$topsrcdir/clang/bin/clang"
-    CXX="$topsrcdir/clang/bin/clang++"
-    ac_add_options --with-android-ndk="$topsrcdir/android-ndk"
+    CC="$MOZ_FETCHES_DIR/clang/bin/clang"
+    CXX="$MOZ_FETCHES_DIR/clang/bin/clang++"
+    ac_add_options --with-android-ndk="$MOZ_FETCHES_DIR/android-ndk"
     # Enable static analysis plugin
     export ENABLE_CLANG_PLUGIN=1
 fi
 
 ac_add_options --enable-update-channel=${MOZ_UPDATE_CHANNEL}
 
 ac_add_options --with-google-safebrowsing-api-keyfile=/builds/sb-gapi.data
 ac_add_options --with-google-location-service-api-keyfile=/builds/gls-gapi.data
@@ -85,17 +85,17 @@ elif test "$MOZ_UPDATE_CHANNEL" = "beta"
     ac_add_options --with-pocket-api-keyfile=/builds/pocket-api-beta.token
 elif test "$MOZ_UPDATE_CHANNEL" = "nightly" ; then
     ac_add_options --with-pocket-api-keyfile=/builds/pocket-api-nightly.token
 else
     ac_add_options --with-pocket-api-keyfile="$topsrcdir/mobile/android/base/pocket-api-sandbox.token"
 fi
 
 if [ -n "$MOZ_PGO_PROFILE_USE" ]; then
-    export LLVM_PROFDATA="$topsrcdir/clang/bin/llvm-profdata"
+    export LLVM_PROFDATA="$MOZ_FETCHES_DIR/clang/bin/llvm-profdata"
 
     ac_add_options --enable-profile-use
 
     # This is disabled because jarlog re-ordering breaks apk publishing tasks,
     # see bug 1539933.
     # ac_add_options --with-pgo-jarlog=/builds/worker/fetches/en-US.log
     ac_add_options --with-pgo-profile-path=/builds/worker/fetches
 fi
--- a/taskcluster/scripts/misc/build-mingw32-nsis.sh
+++ b/taskcluster/scripts/misc/build-mingw32-nsis.sh
@@ -6,40 +6,41 @@ set -x -e -v
 #   checking for NSIS version...
 #   DEBUG: Executing: `/home/worker/workspace/build/src/mingw32/
 #   DEBUG: The command returned non-zero exit status 1.
 #   DEBUG: Its error output was:
 #   DEBUG: | Error: opening stub "/home/worker/workspace/mingw32/
 #   DEBUG: | Error initalizing CEXEBuild: error setting
 #   ERROR: Failed to get nsis version.
 
-INSTALL_DIR=$GECKO_PATH/mingw32
+INSTALL_DIR=$MOZ_FETCHES_DIR/mingw32
 
 mkdir -p $INSTALL_DIR
 
+cd $MOZ_FETCHES_DIR
+
 # As explained above, we have to build nsis to the directory it
 # will eventually be run from, which is the same place we just
 # installed our compiler. But at the end of the script we want
 # to package up what we just built. If we don't move the compiler,
 # we will package up the compiler we downloaded along with the
 # stuff we just built.
-mv $MOZ_FETCHES_DIR/mingw32 $GECKO_PATH/mingw32-gcc
-export PATH="$GECKO_PATH/mingw32-gcc/bin:$PATH"
-
-cd $MOZ_FETCHES_DIR
+mv mingw32 mingw32-gcc
+export PATH="$MOZ_FETCHES_DIR/mingw32-gcc/bin:$PATH"
 
 # --------------
 
 cd zlib-1.2.11
 make -f win32/Makefile.gcc PREFIX=i686-w64-mingw32-
 
 cd ../nsis-3.01-src
 # I don't know how to make the version work with the environment variables/config flags the way the author appears to
 sed -i "s/'VERSION', 'Version of NSIS', cvs_version/'VERSION', 'Version of NSIS', '3.01'/" SConstruct
 scons XGCC_W32_PREFIX=i686-w64-mingw32- ZLIB_W32=../zlib-1.2.11 SKIPUTILS="NSIS Menu" PREFIX=$INSTALL_DIR/ install
 
 # --------------
 
-cd $GECKO_PATH
+cd $MOZ_FETCHES_DIR
+
 tar caf nsis.tar.xz mingw32
 
 mkdir -p $UPLOAD_DIR
 cp nsis.tar.* $UPLOAD_DIR
--- a/taskcluster/taskgraph/transforms/build_fat_aar.py
+++ b/taskcluster/taskgraph/transforms/build_fat_aar.py
@@ -38,20 +38,20 @@ def set_fetches_and_locations(config, jo
 
             aar_location = _get_aar_location(config, job, platform)
             prefix = get_artifact_prefix(job)
             if not prefix.endswith('/'):
                 prefix = prefix + '/'
             if aar_location.startswith(prefix):
                 aar_location = aar_location[len(prefix):]
 
-            job['fetches'][platform] = [{
+            job.setdefault('fetches', {}).setdefault(platform, []).append({
                 'artifact': aar_location,
                 'extract': False,
-            }]
+            })
 
             aar_file_name = aar_location.split('/')[-1]
             env_var = MOZ_ANDROID_FAT_AAR_ENV_MAP[platform]
             job['worker']['env'][env_var] = aar_file_name
 
         job['dependencies'] = dependencies
 
         yield job
--- a/taskcluster/taskgraph/transforms/use_toolchains.py
+++ b/taskcluster/taskgraph/transforms/use_toolchains.py
@@ -1,124 +1,23 @@
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 from __future__ import absolute_import, print_function, unicode_literals
 
-import os
 from taskgraph.transforms.base import TransformSequence
 
 
 transforms = TransformSequence()
 
 
 @transforms.add
 def use_toolchains(config, jobs):
-    """Add dependencies corresponding to toolchains to use, and pass a list
-    of corresponding artifacts to jobs using toolchains.
+    """Transform toolchains definitions into the corresponding fetch
+    definitions.
     """
-    artifacts = {}
-    aliases_by_job = {}
-
-    def get_attribute(dict, key, attributes, attribute_name):
-        '''Get `attribute_name` from the given `attributes` dict, and if there
-        is a corresponding value, set `key` in `dict` to that value.'''
-        value = attributes.get(attribute_name)
-        if value:
-            dict[key] = value
-
-    # Toolchain jobs can depend on other toolchain jobs, but we don't have full
-    # tasks for them, since they're being transformed. So scan the jobs list in
-    # that case, otherwise, use the list of tasks for the kind dependencies.
-    if config.kind == 'toolchain':
-        jobs = list(jobs)
-        for job in jobs:
-            run = job.get('run', {})
-            get_attribute(artifacts, job['name'], run, 'toolchain-artifact')
-            get_attribute(aliases_by_job, job['name'], run, 'toolchain-alias')
-    else:
-        for task in config.kind_dependencies_tasks:
-            if task.kind != 'toolchain':
-                continue
-            name = task.label.replace('%s-' % task.kind, '')
-            get_attribute(artifacts, name, task.attributes, 'toolchain-artifact')
-            get_attribute(aliases_by_job, name, task.attributes, 'toolchain-alias')
-
-    aliases = {}
-    for job, alias in aliases_by_job.items():
-        if alias in aliases:
-            raise Exception(
-                "Cannot use the alias %s for %s, it's already used for %s"
-                % (alias, job, aliases[alias]))
-        if alias in artifacts:
-            raise Exception(
-                "Cannot use the alias %s for %s, it's already a toolchain job"
-                % (alias, job))
-        aliases[alias] = job
-
-    if config.kind == 'toolchain':
-        def get_alias(key):
-            if key in aliases:
-                raise Exception(
-                    "Toolchain job %s can't use the alias %s as dependency. "
-                    "Please use %s instead."
-                    % (job['name'], key, aliases[key])
-                )
-            return key
-    else:
-        def get_alias(key):
-            return aliases.get(key, key)
-
     for job in jobs:
-        scopes = job.setdefault('scopes', [])
-        env = job.setdefault('worker', {}).setdefault('env', {})
-
-        toolchains = [get_alias(t)
-                      for t in job.pop('toolchains', [])]
-
-        if config.kind == 'toolchain' and job['name'] in toolchains:
-            raise Exception("Toolchain job %s can't use itself as toolchain"
-                            % job['name'])
-
-        filenames = {}
-        for t in toolchains:
-            if t not in artifacts:
-                raise Exception('Missing toolchain job for %s-%s: %s'
-                                % (config.kind, job['name'], t))
-
-            dirname, f = os.path.split(artifacts[t])
-            if f in filenames:
-                # Build jobs don't support toolchain artifacts with the same
-                # name: they would overwrite one with the other.
-                raise Exception('%s-%s cannot use both %s and %s toolchains: '
-                                'they both have the same artifact name %s'
-                                % (config.kind, job['name'], filenames[f],
-                                   t, f))
-            filenames[f] = t
-
-            if not artifacts[t].startswith('public/'):
-                # Use taskcluster-proxy and request appropriate scope.
-                # For example, add 'scopes: [queue:get-artifact:path/to/*]'
-                # for 'path/to/artifact.tar.xz'.
-                job['worker']['taskcluster-proxy'] = True
-                scope = 'queue:get-artifact:{}/*'.format(dirname)
-                if scope not in scopes:
-                    scopes.append(scope)
-
-            if t.endswith('-sccache'):
-                job['needs-sccache'] = True
-
+        toolchains = job.pop('toolchains', None)
         if toolchains:
-            job.setdefault('dependencies', {}).update(
-                ('toolchain-%s' % t, 'toolchain-%s' % t)
-                for t in toolchains
-            )
-            # Pass a list of artifact-path@task-id to the job for all the
-            # toolchain artifacts it's going to need, where task-id is
-            # corresponding to the (possibly optimized) toolchain job, and
-            # artifact-path to the toolchain-artifact defined for that
-            # toolchain job.
-            env['MOZ_TOOLCHAINS'] = {'task-reference': ' '.join(
-                '%s@<toolchain-%s>' % (artifacts[t], t)
-                for t in toolchains
-            )}
-
+            job.setdefault('fetches', {}) \
+               .setdefault('toolchain', []) \
+               .extend(toolchains)
         yield job
--- a/testing/mozharness/scripts/android_emulator_pgo.py
+++ b/testing/mozharness/scripts/android_emulator_pgo.py
@@ -273,17 +273,17 @@ class AndroidProfileRun(TestingMixin, Ba
         # We normally merge as part of a GENERATED_FILES step in the profile-use
         # build, but Android runs sometimes result in a truncated profile. We do
         # a merge here to make sure the data isn't corrupt so we can retry the
         # 'run' task if necessary.
         profraw_files = glob.glob('/builds/worker/workspace/*.profraw')
         if not profraw_files:
             self.fatal('Could not find any profraw files in /builds/worker/workspace')
         merge_cmd = [
-            '/builds/worker/workspace/build/clang/bin/llvm-profdata',
+            os.path.join(os.environ['MOZ_FETCHES_DIR'], 'clang/bin/llvm-profdata'),
             'merge',
             '-o',
             '/builds/worker/workspace/merged.profraw',
         ] + profraw_files
         rc = subprocess.call(merge_cmd)
         if rc != 0:
             self.fatal('INFRA-ERROR: Failed to merge profile data. Corrupt profile?',
                        EXIT_STATUS_DICT[TBPL_RETRY])
--- a/testing/parse_build_tests_ccov.py
+++ b/testing/parse_build_tests_ccov.py
@@ -37,30 +37,28 @@ def main():
         for opt in config_opts:
             if opt.startswith('WINDOWSSDKDIR='):
                 windows_sdk_dir = opt[len('WINDOWSSDKDIR='):]
                 break
 
         assert windows_sdk_dir is not None, 'WINDOWSSDKDIR should be in MOZ_CONFIGURE_OPTIONS'
 
         ignore_dir_abs = os.path.dirname(windows_sdk_dir)
-    else:
-        gcc_dir = os.path.join(buildconfig.topsrcdir, 'gcc')
-        ignore_dir_abs = gcc_dir
 
-    # globs passed to grcov must exist and must be relative to the source directory.
-    # If it doesn't exist, maybe it has moved and we need to update the paths above.
-    # If it is no longer relative to the source directory, we no longer need to ignore it and
-    # this code can be removed.
-    assert os.path.isdir(ignore_dir_abs), '{} is not a directory'.format(ignore_dir_abs)
-    assert ignore_dir_abs.startswith(buildconfig.topsrcdir), '{} should start with {}'.format(ignore_dir_abs, buildconfig.topsrcdir)
+        # globs passed to grcov must exist and must be relative to the source directory.
+        # If it doesn't exist, maybe it has moved and we need to update the paths above.
+        # If it is no longer relative to the source directory, we no longer need to ignore it and
+        # this code can be removed.
+        assert os.path.isdir(ignore_dir_abs), '{} is not a directory'.format(ignore_dir_abs)
+        assert ignore_dir_abs.startswith(buildconfig.topsrcdir), '{} should start with {}'.format(ignore_dir_abs, buildconfig.topsrcdir)
 
-    grcov_command += ['--ignore-dir', os.path.relpath(ignore_dir_abs, buildconfig.topsrcdir) + '*']
+        grcov_command += ['--ignore-dir', os.path.relpath(ignore_dir_abs, buildconfig.topsrcdir) + '*']
 
     if buildconfig.substs['OS_TARGET'] == 'Linux':
+        gcc_dir = os.path.join(os.environ['MOZ_FETCHES_DIR'], 'gcc')
         if 'LD_LIBRARY_PATH' in os.environ:
             os.environ['LD_LIBRARY_PATH'] = '{}/lib64/:{}'.format(gcc_dir, os.environ['LD_LIBRARY_PATH'])
         else:
             os.environ['LD_LIBRARY_PATH'] = '{}/lib64/'.format(gcc_dir)
 
         os.environ['PATH'] = '{}/bin/:{}'.format(gcc_dir, os.environ['PATH'])
 
     grcov_output = subprocess.check_output(grcov_command)
--- a/toolkit/mozapps/installer/packager.mk
+++ b/toolkit/mozapps/installer/packager.mk
@@ -76,17 +76,17 @@ ifdef ENABLE_MOZSEARCH_PLUGIN
 	cd $(topobjdir)/mozsearch_index && \
           zip -r5D '$(ABS_DIST)/$(PKG_PATH)$(MOZSEARCH_ARCHIVE_BASENAME).zip' .
 	@echo 'Generating mozsearch rust-analysis tarball...'
 	$(RM) $(MOZSEARCH_RUST_ANALYSIS_BASENAME).zip
 	cd $(topobjdir)/ && \
           find . -type d -name save-analysis | xargs zip -r5D '$(ABS_DIST)/$(PKG_PATH)$(MOZSEARCH_RUST_ANALYSIS_BASENAME).zip'
 	@echo 'Generating mozsearch rust stdlib analysis tarball ($(RUST_TARGET))...'
 	$(RM) $(MOZSEARCH_RUST_STDLIB_BASENAME).zip
-	cd $(topsrcdir)/rustc/lib && \
+	cd $(MOZ_FETCHES_DIR)/rustc/lib && \
           zip -r5D '$(ABS_DIST)/$(PKG_PATH)$(MOZSEARCH_RUST_STDLIB_BASENAME).zip' \
           rustlib/$(RUST_TARGET)/analysis/ rustlib/src/
 	@echo 'Generating mozsearch distinclude map...'
 	cd $(topobjdir)/ && cp _build_manifests/install/dist_include '$(ABS_DIST)/$(PKG_PATH)$(MOZSEARCH_INCLUDEMAP_BASENAME).map'
 endif
 ifeq (Darwin, $(OS_ARCH))
 ifdef MOZ_ASAN
 	@echo "Rewriting ASan runtime dylib paths for all binaries in $(DIST)/$(MOZ_PKG_DIR)$(_BINPATH) ..."