Bug 1410475: Add support for detecting whether c-c is topdir in mozconfigs; r=mshal
authorTom Prince <mozilla@hocat.ca>
Thu, 19 Oct 2017 13:56:13 -0600
changeset 389099 c7ae1c6f2a4914e863f7530b2c37469041d2d847
parent 389098 7f574eb1f99cc0561b58c045a8cba0552e7ee930
child 389100 ab9b6d55ac11d7b473a72eea26d197a7bbd5f567
push id54363
push usermozilla@hocat.ca
push dateMon, 30 Oct 2017 19:07:10 +0000
treeherderautoland@c7ae1c6f2a49 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmshal
bugs1410475
milestone58.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 1410475: Add support for detecting whether c-c is topdir in mozconfigs; r=mshal MozReview-Commit-ID: DYveJX8J3lr
build/mozconfig.comm-support
new file mode 100644
--- /dev/null
+++ b/build/mozconfig.comm-support
@@ -0,0 +1,49 @@
+# This file exists to support comm-central from building with mozilla-central
+# as a subdirectory to building as a subdirectory of mozilla-central.
+
+# In order to have mozconfig files that support building in either
+# configuration during the transition, without duplicating the logic
+# in every mozconfig file, there needs to exist a file that exists at the
+# same path in mozilla-central and comm-central.
+
+# This file gets included under two circumstances.
+# 1. comm-central is being built as a subdirectory of mozilla-central.
+# 2. comm-central is being built as a parent directory of mozilla-central,
+#    but `mach` was invoked from the objdir and thinks that $topsrcdir is
+#    the mozilla-central directory. If we detect this is the case, we fix
+#    $topsrcdir before proceeding.
+# In either case, we then invoke the identically named file that lives in
+# comm-central, which sets some variables that can be used by the rest of the
+# mozconfig.
+
+
+# Note that the top-level mozconfig file is in $2.
+
+if [ "$(dirname "$2")" = "$topsrcdir" ]; then
+  # No weirdness
+  if [ -d "$topsrcdir/mail" ]; then
+    # Building with comm-central as top-level directory.
+    echo "ERROR: Should not include mozilla/build/mozconfig.comm when building"
+    echo "       with comm-central as top-level directory."
+    exit 1
+  elif [ -d "$topsrcdir/comm/mail" ]; then
+    # Building with mozila-central as top-level directory.
+    . "$topsrcdir/comm/build/mozconfig.comm-support"
+  else
+    echo "ERROR: Unknown build directory layout."
+    exit 1
+  fi
+elif [ "$(dirname "$2")" = "$(dirname "$topsrcdir")" ]; then
+  if [ -d "$topsrcdir/../mail" ]; then
+    # Building with comm-central as top-level directory;
+    # but invoked with $topsrcdir as "mozilla/".
+    topsrcdir=$(dirname "$topsrcdir")
+    . "$topsrcdir/build/mozconfig.comm-support"
+  else
+    echo "ERROR: Unknown build directory layout."
+    exit 1
+  fi
+else
+  echo "ERROR: Unknown build directory layout."
+  exit 1
+fi