Blame build/mozconfig.comm-support

Packit f0b94e
# This file exists to support comm-central from building with mozilla-central
Packit f0b94e
# as a subdirectory to building as a subdirectory of mozilla-central.
Packit f0b94e
Packit f0b94e
# In order to have mozconfig files that support building in either
Packit f0b94e
# configuration during the transition, without duplicating the logic
Packit f0b94e
# in every mozconfig file, there needs to exist a file that exists at the
Packit f0b94e
# same path in mozilla-central and comm-central.
Packit f0b94e
Packit f0b94e
# This file gets included under two circumstances.
Packit f0b94e
# 1. comm-central is being built as a subdirectory of mozilla-central.
Packit f0b94e
# 2. comm-central is being built as a parent directory of mozilla-central,
Packit f0b94e
#    but `mach` was invoked from the objdir and thinks that $topsrcdir is
Packit f0b94e
#    the mozilla-central directory. If we detect this is the case, we fix
Packit f0b94e
#    $topsrcdir before proceeding.
Packit f0b94e
# In either case, we then invoke the identically named file that lives in
Packit f0b94e
# comm-central, which sets some variables that can be used by the rest of the
Packit f0b94e
# mozconfig.
Packit f0b94e
Packit f0b94e
Packit f0b94e
# Note that the top-level mozconfig file is in $2.
Packit f0b94e
Packit f0b94e
if [ "$(dirname "$2")" = "$topsrcdir" ]; then
Packit f0b94e
  # No weirdness
Packit f0b94e
  if [ -d "$topsrcdir/mail" ]; then
Packit f0b94e
    # Building with comm-central as top-level directory.
Packit f0b94e
    echo "ERROR: Should not include mozilla/build/mozconfig.comm when building"
Packit f0b94e
    echo "       with comm-central as top-level directory."
Packit f0b94e
    exit 1
Packit f0b94e
  elif [ -d "$topsrcdir/comm/mail" ]; then
Packit f0b94e
    # Building with mozila-central as top-level directory.
Packit f0b94e
    . "$topsrcdir/comm/build/mozconfig.comm-support"
Packit f0b94e
  else
Packit f0b94e
    echo "ERROR: Unknown build directory layout."
Packit f0b94e
    exit 1
Packit f0b94e
  fi
Packit f0b94e
elif [ "$(dirname "$2")" = "$(dirname "$topsrcdir")" ]; then
Packit f0b94e
  if [ -d "$topsrcdir/../mail" ]; then
Packit f0b94e
    # Building with comm-central as top-level directory;
Packit f0b94e
    # but invoked with $topsrcdir as "mozilla/".
Packit f0b94e
    topsrcdir=$(dirname "$topsrcdir")
Packit f0b94e
    . "$topsrcdir/build/mozconfig.comm-support"
Packit f0b94e
  else
Packit f0b94e
    echo "ERROR: Unknown build directory layout."
Packit f0b94e
    exit 1
Packit f0b94e
  fi
Packit f0b94e
else
Packit f0b94e
  echo "ERROR: Unknown build directory layout."
Packit f0b94e
  exit 1
Packit f0b94e
fi