bug 1318370 - move _DEPEND_CFLAGS+CL_INCLUDES_PREFIX to toolchain.configure, ignore {CC,CXX}_WRAPPER when using sccache r=glandium

Currently mozconfig.cache overrides a few build options for sccache. This
patch moves them into toolchain.configure so that the build system will
set them properly when sccache is in use. Additionally, {CC,CXX}_WRAPPER
are set in config.mk, so just avoid setting them when sccache is in use.

MozReview-Commit-ID: FYlVKRI8OiN

--HG--
extra : rebase_source : cc7e4346869b98a52840c101824044abc236637f
This commit is contained in:
Ted Mielczarek 2017-01-10 16:52:27 -05:00
Родитель 5d759be63f
Коммит 0ba51f3683
5 изменённых файлов: 33 добавлений и 96 удалений

Просмотреть файл

@ -831,6 +831,7 @@ host_cxx_compiler = compiler('C++', host, c_compiler=host_c_compiler,
other_c_compiler=c_compiler)
# Generic compiler-based conditions.
building_with_msvc = depends(c_compiler)(lambda info: info.type == 'msvc')
non_msvc_compiler = depends(c_compiler)(lambda info: info.type != 'msvc')
building_with_gcc = depends(c_compiler)(lambda info: info.type == 'gcc')
@ -967,6 +968,36 @@ set_define('HAVE_VISIBILITY_ATTRIBUTE',
set_config('WRAP_SYSTEM_INCLUDES', wrap_system_includes)
set_config('VISIBILITY_FLAGS', visibility_flags)
@depends(c_compiler, using_sccache)
def depend_cflags(c_compiler, using_sccache):
if c_compiler.type != 'msvc':
return '-MD -MP -MF $(MDDEPDIR)/$(@F).pp'
elif using_sccache:
# sccache supports a special flag to create depfiles
# by parsing MSVC's -showIncludes output.
return '-deps$(MDDEPDIR)/$(@F).pp'
set_config('_DEPEND_CFLAGS', depend_cflags)
@depends(c_compiler, when=building_with_msvc)
@imports(_from='re', _import='compile', _as='re_compile')
def msvc_showincludes_prefix(c_compiler):
pattern = re_compile(r'^([^:]*:.*[ :] )(.*\\stdio.h)$')
output = try_invoke_compiler([c_compiler.compiler], 'C', '#include <stdio.h>\n',
['-nologo', '-c', '-Fonul', '-showIncludes'])
for line in output.splitlines():
if line.endswith('\\stdio.h'):
m = pattern.match(line)
if m:
if not m.group(2):
die("Unable to parse cl -showIncludes prefix. " +
"This compiler's locale has an unsupported formatting.")
return m.group(1)
# We should have found the prefix and returned earlier
die('Cannot find cl -showIncludes prefix.')
set_config('CL_INCLUDES_PREFIX', msvc_showincludes_prefix)
@depends(target)
def is_windows(target):
return target.kernel == 'WINNT'

Просмотреть файл

@ -123,16 +123,6 @@ else
mk_add_options MOZ_PREFLIGHT_ALL+=build/sccache.mk
mk_add_options MOZ_POSTFLIGHT_ALL+=build/sccache.mk
mk_add_options "UPLOAD_EXTRA_FILES+=sccache.log.gz"
case "$platform" in
win*)
# sccache supports a special flag to create depfiles.
#TODO: bug 1318370 - move this all into toolchain.configure
export _DEPEND_CFLAGS='-deps$(MDDEPDIR)/$(@F).pp'
# Windows builds have a default wrapper that needs to be overridden
mk_add_options "export CC_WRAPPER="
mk_add_options "export CXX_WRAPPER="
;;
esac
fi
fi

Просмотреть файл

@ -120,8 +120,10 @@ CONFIG_TOOLS = $(MOZ_BUILD_ROOT)/config
AUTOCONF_TOOLS = $(MOZILLA_DIR)/build/autoconf
ifdef _MSC_VER
ifndef MOZ_USING_SCCACHE
CC_WRAPPER ?= $(call py_action,cl)
CXX_WRAPPER ?= $(call py_action,cl)
endif
endif # _MSC_VER
CC := $(CC_WRAPPER) $(CC)
@ -623,7 +625,3 @@ endif
PLY_INCLUDE = -I$(MOZILLA_DIR)/other-licenses/ply
export CL_INCLUDES_PREFIX
# Make sure that the build system can handle non-ASCII characters
# in environment variables to prevent it from breking silently on
# non-English systems.
export NONASCII

Просмотреть файл

@ -1881,46 +1881,6 @@ AC_LANG_C
MOZ_EXPAND_LIBS
dnl ========================================================
dnl =
dnl = Build depencency options
dnl =
dnl ========================================================
MOZ_ARG_HEADER(Build dependencies)
if test "$GNU_CC" -a "$GNU_CXX"; then
_DEPEND_CFLAGS='-MD -MP -MF $(MDDEPDIR)/$(@F).pp'
else
dnl Don't override this for MSVC
if test -z "$_WIN32_MSVC"; then
_USE_CPP_INCLUDE_FLAG=
_DEFINES_CFLAGS='$(ACDEFINES) -D_JS_CONFDEFS_H_ -DMOZILLA_CLIENT'
_DEFINES_CXXFLAGS='$(ACDEFINES) -D_JS_CONFDEFS_H_ -DMOZILLA_CLIENT'
else
echo '#include <stdio.h>' > dummy-hello.c
changequote(,)
dnl This output is localized, split at the first double space or colon and space.
_CL_PREFIX_REGEX="^\([^:]*:.*[ :] \)\(.*\\\stdio.h\)$"
CL_INCLUDES_PREFIX=`${CC} -showIncludes -c -Fonul dummy-hello.c 2>&1 | sed -ne 's/'"$_CL_PREFIX_REGEX"'/\1/p'`
_CL_STDIO_PATH=`${CC} -showIncludes -c -Fonul dummy-hello.c 2>&1 | sed -ne 's/'"$_CL_PREFIX_REGEX"'/\2/p'`
changequote([,])
if ! test -e "$_CL_STDIO_PATH"; then
AC_MSG_ERROR([Unable to parse cl -showIncludes prefix. This compiler's locale has an unsupported formatting.])
fi
if test -z "$CL_INCLUDES_PREFIX"; then
AC_MSG_ERROR([Cannot find cl -showIncludes prefix.])
fi
AC_SUBST(CL_INCLUDES_PREFIX)
rm -f dummy-hello.c
dnl Make sure that the build system can handle non-ASCII characters
dnl in environment variables to prevent it from breaking silently on
dnl non-English systems.
NONASCII=$'\241\241'
AC_SUBST(NONASCII)
fi
fi
dnl ========================================================
dnl = Link js shell to system readline
dnl ========================================================
@ -2058,7 +2018,6 @@ HOST_CFLAGS=`echo \
HOST_CXXFLAGS=`echo \
$HOST_CXXFLAGS`
AC_SUBST(_DEPEND_CFLAGS)
AC_SUBST(MOZ_SYSTEM_NSPR)
OS_CFLAGS="$CFLAGS"

Просмотреть файл

@ -4692,46 +4692,6 @@ if test "$COMPILE_ENVIRONMENT"; then
MOZ_EXPAND_LIBS
fi # COMPILE_ENVIRONMENT
dnl ========================================================
dnl =
dnl = Build depencency options
dnl =
dnl ========================================================
MOZ_ARG_HEADER(Build dependencies)
if test "$GNU_CC" -a "$GNU_CXX"; then
_DEPEND_CFLAGS='-MD -MP -MF $(MDDEPDIR)/$(@F).pp'
else
dnl Don't override this for MSVC
if test -z "$_WIN32_MSVC"; then
_USE_CPP_INCLUDE_FLAG=
_DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
_DEFINES_CXXFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
else
echo '#include <stdio.h>' > dummy-hello.c
changequote(,)
dnl This output is localized, split at the first double space or colon and space.
_CL_PREFIX_REGEX="^\([^:]*:.*[ :] \)\(.*\\\stdio.h\)$"
CL_INCLUDES_PREFIX=`${CC} -showIncludes -c -Fonul dummy-hello.c 2>&1 | sed -ne 's/'"$_CL_PREFIX_REGEX"'/\1/p'`
_CL_STDIO_PATH=`${CC} -showIncludes -c -Fonul dummy-hello.c 2>&1 | sed -ne 's/'"$_CL_PREFIX_REGEX"'/\2/p'`
changequote([,])
if ! test -e "$_CL_STDIO_PATH"; then
AC_MSG_ERROR([Unable to parse cl -showIncludes prefix. This compiler's locale has an unsupported formatting.])
fi
if test -z "$CL_INCLUDES_PREFIX"; then
AC_MSG_ERROR([Cannot find cl -showIncludes prefix.])
fi
AC_SUBST(CL_INCLUDES_PREFIX)
rm -f dummy-hello.c
dnl Make sure that the build system can handle non-ASCII characters
dnl in environment variables to prevent it from breaking silently on
dnl non-English systems.
NONASCII=$'\241\241'
AC_SUBST(NONASCII)
fi
fi
dnl ========================================================
dnl =
dnl = Static Build Options
@ -5350,7 +5310,6 @@ HOST_CFLAGS=`echo \
HOST_CXXFLAGS=`echo \
$HOST_CXXFLAGS`
AC_SUBST(_DEPEND_CFLAGS)
AC_SUBST(MOZ_SYSTEM_JPEG)
AC_SUBST(MOZ_SYSTEM_PNG)
AC_SUBST(MOZ_SYSTEM_BZ2)