1 # This Source Code Form is subject to the terms of the Mozilla Public
2 # License, v. 2.0. If a copy of the MPL was not distributed with this
3 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
5 # Setup for build cache
7 # Avoid duplication if the file happens to be included twice.
8 if test -z "$bucket" -a -z "$NO_CACHE"; then
10 # buildbot (or builders that use buildprops.json):
11 if [ -f $topsrcdir/../buildprops.json ]; then
12 read branch platform master <<EOF
13 $(python2.7 -c 'import json; p = json.loads(open("'"$topsrcdir"'/../buildprops.json").read())["properties"]; print p["branch"], p["platform"], p["master"]' 2> /dev/null)
17 if test -z "$SCCACHE_DISABLE" -a -z "$no_sccache" -a -z "$MOZ_PGO_IS_SET" -a -z "$MOZ_PGO"; then
21 *scl1.mozilla.com*|*.scl3.mozilla.com*)
22 bucket=mozilla-releng-s3-cache-us-west-1-try
25 bucket=mozilla-releng-s3-cache-us-east-1-try
28 bucket=mozilla-releng-s3-cache-us-west-2-try
32 autoland|mozilla-inbound)
35 bucket=mozilla-releng-s3-cache-us-east-1-prod
38 bucket=mozilla-releng-s3-cache-us-west-2-prod
46 # builds where buildprops didn't have the data (eg: taskcluster or non-buildbot) and without sccache disabled:
47 if test -z "$bucket" -a -z "$SCCACHE_DISABLE" -a -z "$no_sccache" -a -z "$MOZ_PGO_IS_SET" -a -z "$MOZ_PGO"; then
49 # prevent rerun if az is set, or wget is not available
50 if test -z "$availability_zone" -a -x "$(command -v wget)"; then
51 if test -n "${TASKCLUSTER_WORKER_GROUP}"; then
52 # TASKCLUSTER_WORKER_GROUP is just the region now, so
53 # stick an extra character on to make the already-convoluted logic
55 availability_zone="${TASKCLUSTER_WORKER_GROUP}x"
57 # timeout after 1 second, and don't retry (failure indicates instance is not in ec2 or network issue)
58 # availability_zone is of the form <region><letter> where region is e.g. us-west-2, and az is us-west-2a
59 availability_zone=$(wget -T 1 -t 1 -q -O - http://169.254.169.254/latest/meta-data/placement/availability-zone || true)
61 if test -z "$availability_zone" -o "$availability_zone" = "not-ec2"; then
62 availability_zone=not-ec2
64 # region is az with last letter trimmed
65 region=${availability_zone%?}
66 # set S3 bucket according to tree (level)
67 case "${GECKO_HEAD_REPOSITORY}" in
69 bucket=taskcluster-level-1-sccache-${region}
71 *hg.mozilla.org/integration/autoland*|*hg.mozilla.org/integration/mozilla-inbound*)
72 bucket=taskcluster-level-3-sccache-${region}
79 master=dummy.euc1.mozilla.com
82 master=dummy.use1.mozilla.com
85 master=dummy.usw1.mozilla.com
88 master=dummy.usw2.mozilla.com
95 # if platform hasn't been determined from buildprops, and we're on windows,
96 # it must be set to prevent adding ac_add_options --with-ccache below
97 if test -z "$platform"; then
98 # set platform based on the SYSTEMROOT env var
99 case "${SYSTEMROOT}" in
107 if test -z "$bucket"; then
111 ac_add_options --with-ccache
114 mk_add_options "export SCCACHE_BUCKET=$bucket"
116 *us[ew][12].mozilla.com*|*euc1.mozilla.com*)
117 mk_add_options "export SCCACHE_NAMESERVER=169.254.169.253"
120 ac_add_options "--with-ccache=$topsrcdir/sccache2/sccache${suffix}"
121 export SCCACHE_VERBOSE_STATS=1
122 mk_add_options MOZ_PREFLIGHT_ALL+=build/sccache.mk
123 mk_add_options MOZ_POSTFLIGHT_ALL+=build/sccache.mk
124 mk_add_options "UPLOAD_EXTRA_FILES+=sccache.log.gz"
127 # sccache supports a special flag to create depfiles.
128 #TODO: bug 1318370 - move this all into toolchain.configure
129 export _DEPEND_CFLAGS='-deps$(MDDEPDIR)/$(@F).pp'
130 # Windows builds have a default wrapper that needs to be overridden
131 mk_add_options "export CC_WRAPPER="
132 mk_add_options "export CXX_WRAPPER="
133 # For now, sccache doesn't support separate PDBs so force debug info to be
135 mk_add_options "export COMPILE_PDB_FLAG="
136 mk_add_options "export HOST_PDB_FLAG="
137 mk_add_options "export MOZ_DEBUG_FLAGS=-Z7"