mozconfig.cache 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  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/.
  4. # Setup for build cache
  5. # Avoid duplication if the file happens to be included twice.
  6. if test -z "$bucket" -a -z "$NO_CACHE"; then
  7. # buildbot (or builders that use buildprops.json):
  8. if [ -f $topsrcdir/../buildprops.json ]; then
  9. read branch platform master <<EOF
  10. $(python2.7 -c 'import json; p = json.loads(open("'"$topsrcdir"'/../buildprops.json").read())["properties"]; print p["branch"], p["platform"], p["master"]' 2> /dev/null)
  11. EOF
  12. bucket=
  13. if test -z "$SCCACHE_DISABLE" -a -z "$no_sccache" -a -z "$MOZ_PGO_IS_SET" -a -z "$MOZ_PGO"; then
  14. case "${branch}" in
  15. try)
  16. case "${master}" in
  17. *scl1.mozilla.com*|*.scl3.mozilla.com*)
  18. bucket=mozilla-releng-s3-cache-us-west-1-try
  19. ;;
  20. *use1.mozilla.com*)
  21. bucket=mozilla-releng-s3-cache-us-east-1-try
  22. ;;
  23. *usw2.mozilla.com*)
  24. bucket=mozilla-releng-s3-cache-us-west-2-try
  25. ;;
  26. esac
  27. ;;
  28. autoland|mozilla-inbound)
  29. case "${master}" in
  30. *use1.mozilla.com*)
  31. bucket=mozilla-releng-s3-cache-us-east-1-prod
  32. ;;
  33. *usw2.mozilla.com*)
  34. bucket=mozilla-releng-s3-cache-us-west-2-prod
  35. ;;
  36. esac
  37. ;;
  38. esac
  39. fi
  40. # builds without buildprops (eg: taskcluster or non-buildbot) and without ccache env config and without sccache disabled:
  41. elif test -z "$CCACHE_DIR" -a -z "$SCCACHE_DISABLE" -a -z "$no_sccache" -a -z "$MOZ_PGO_IS_SET" -a -z "$MOZ_PGO"; then
  42. # prevent rerun if az is set, or wget is not available
  43. if test -z "$availability_zone" -a -x "$(command -v wget)"; then
  44. # timeout after 1 second, and don't retry (failure indicates instance is not in ec2 or network issue)
  45. # availability_zone is of the form <region><letter> where region is e.g. us-west-2, and az is us-west-2a
  46. availability_zone=$(wget -T 1 -t 1 -q -O - http://169.254.169.254/latest/meta-data/placement/availability-zone || true)
  47. if test -z "$availability_zone" -o "$availability_zone" = "not-ec2"; then
  48. availability_zone=not-ec2
  49. else
  50. # region is az with last letter trimmed
  51. region=${availability_zone%?}
  52. # set S3 bucket according to tree (level)
  53. case "${GECKO_HEAD_REPOSITORY}" in
  54. *hg.mozilla.org/try*)
  55. bucket=taskcluster-level-1-sccache-${region}
  56. ;;
  57. *hg.mozilla.org/integration/autoland*|*hg.mozilla.org/integration/mozilla-inbound*)
  58. bucket=taskcluster-level-3-sccache-${region}
  59. ;;
  60. esac
  61. # set a dummy master
  62. case "${region}" in
  63. eu-central-1)
  64. master=dummy.euc1.mozilla.com
  65. ;;
  66. us-east-1)
  67. master=dummy.use1.mozilla.com
  68. ;;
  69. us-west-1)
  70. master=dummy.usw1.mozilla.com
  71. ;;
  72. us-west-2)
  73. master=dummy.usw2.mozilla.com
  74. ;;
  75. esac
  76. fi
  77. fi
  78. fi
  79. # if platform hasn't been determined from buildprops, and we're on windows,
  80. # it must be set to prevent adding ac_add_options --with-ccache below
  81. if test -z "$platform"; then
  82. # set platform based on the SYSTEMROOT env var
  83. case "${SYSTEMROOT}" in
  84. *Windows)
  85. platform=windows
  86. ;;
  87. esac
  88. fi
  89. if test -z "$bucket"; then
  90. case "$platform" in
  91. win*) : ;;
  92. *)
  93. ac_add_options --with-ccache
  94. esac
  95. else
  96. if ! test -e $topsrcdir/sccache/sccache.py; then
  97. echo "Sccache missing in the tooltool manifest" >&2
  98. exit 1
  99. fi
  100. mk_add_options "export SCCACHE_BUCKET=$bucket"
  101. case "$master" in
  102. *us[ew][12].mozilla.com*|*euc1.mozilla.com*)
  103. mk_add_options "export SCCACHE_NAMESERVER=169.254.169.253"
  104. ;;
  105. esac
  106. ac_add_options "--with-compiler-wrapper=python2.7 $topsrcdir/sccache/sccache.py"
  107. mk_add_options MOZ_PREFLIGHT_ALL+=build/sccache.mk
  108. mk_add_options MOZ_POSTFLIGHT_ALL+=build/sccache.mk
  109. mk_add_options "UPLOAD_EXTRA_FILES+=sccache.log.gz"
  110. case "$platform" in
  111. win*)
  112. # sccache supports a special flag to create depfiles.
  113. export _DEPEND_CFLAGS='-deps$(MDDEPDIR)/$(@F).pp'
  114. # Windows builds have a default wrapper that needs to be overridden
  115. mk_add_options "export CC_WRAPPER="
  116. mk_add_options "export CXX_WRAPPER="
  117. # For now, sccache doesn't support separate PDBs so force debug info to be
  118. # in object files.
  119. mk_add_options "export COMPILE_PDB_FLAG="
  120. mk_add_options "export HOST_PDB_FLAG="
  121. mk_add_options "export MOZ_DEBUG_FLAGS=-Z7"
  122. ;;
  123. esac
  124. fi
  125. fi