Bug 1235738 - Move MOZ_DEBUG_DEFINES to build frontend. r=gps

MOZ_DEBUG_DEFINES are essentially defines used everywhere. So treat them as
feeding the initial value for DEFINES in each moz.build sandbox. This allows
the kind overrides that was done in the past by resetting MOZ_DEBUG_DEFINES
in Makefiles.
This commit is contained in:
Mike Hommey 2015-12-29 16:00:21 +09:00
Родитель 147df9c988
Коммит e0c501a1c1
11 изменённых файлов: 30 добавлений и 52 удалений

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

@ -57,7 +57,7 @@ $(DIST)/branding:
libs::
@if test -f '$(LOCALE_SRCDIR)/existing-profile-defaults.js'; then \
$(PYTHON) -m mozbuild.action.preprocessor $(PREF_PPFLAGS) $(DEFINES) $(ACDEFINES) $(MOZ_DEBUG_DEFINES) \
$(PYTHON) -m mozbuild.action.preprocessor $(PREF_PPFLAGS) $(DEFINES) $(ACDEFINES) \
$(LOCALE_SRCDIR)/existing-profile-defaults.js -o $(FINAL_TARGET)/defaults/existing-profile-defaults.js; \
fi

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

@ -159,8 +159,6 @@ _DEBUG_ASFLAGS :=
_DEBUG_CFLAGS :=
_DEBUG_LDFLAGS :=
_DEBUG_CFLAGS += $(MOZ_DEBUG_DEFINES)
ifneq (,$(MOZ_DEBUG)$(MOZ_DEBUG_SYMBOLS))
ifeq ($(AS),yasm)
ifeq ($(OS_ARCH)_$(GNU_CC),WINNT_)

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

@ -107,7 +107,6 @@ $(addprefix install-,$(INSTALL_MANIFESTS)): install-%: $(TOPOBJDIR)/config/build
-DAB_CD=en-US \
-DMOZ_APP_BUILDID=$(shell cat $(TOPOBJDIR)/config/buildid) \
$(ACDEFINES) \
$(MOZ_DEBUG_DEFINES) \
install_$(subst /,_,$*)
# ============================================================================

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

@ -1217,7 +1217,7 @@ endif
libs realchrome:: $(FINAL_TARGET)/chrome
$(call py_action,jar_maker,\
$(QUIET) -d $(FINAL_TARGET) \
$(MAKE_JARS_FLAGS) $(DEFINES) $(ACDEFINES) $(MOZ_DEBUG_DEFINES) \
$(MAKE_JARS_FLAGS) $(DEFINES) $(ACDEFINES) \
$(JAR_MANIFEST))
endif
@ -1459,7 +1459,7 @@ PP_TARGETS_ALL_RESULTS := $(sort $(foreach tier,$(PP_TARGETS_TIERS),$(PP_TARGETS
$(PP_TARGETS_ALL_RESULTS):
$(if $(filter-out $(notdir $@),$(notdir $(<:.in=))),$(error Looks like $@ has an unexpected dependency on $< which breaks PP_TARGETS))
$(RM) '$@'
$(call py_action,preprocessor,--depend $(MDDEPDIR)/$(@F).pp $(PP_TARGET_FLAGS) $(DEFINES) $(ACDEFINES) $(MOZ_DEBUG_DEFINES) '$<' -o '$@')
$(call py_action,preprocessor,--depend $(MDDEPDIR)/$(@F).pp $(PP_TARGET_FLAGS) $(DEFINES) $(ACDEFINES) '$<' -o '$@')
$(filter %.css,$(PP_TARGETS_ALL_RESULTS)): PP_TARGET_FLAGS+=--marker %

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

@ -1,31 +0,0 @@
#
# Copyright (C) 2010 Mozilla Foundation
#
# This is used to integrate the HarfBuzz library with the Mozilla build.
#
# Permission is hereby granted, without written agreement and without
# license or royalty fees, to use, copy, modify, and distribute this
# software and its documentation for any purpose, provided that the
# above copyright notice and the following two paragraphs appear in
# all copies of this software.
#
# IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
# DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
# ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
# IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
# DAMAGE.
#
# THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
# BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
# FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
# ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
# PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
#
# Mozilla author(s): Jonathan Kew
#
include $(topsrcdir)/config/rules.mk
# Cancel the effect of the -DDEBUG macro if present,
# because harfbuzz uses that name for its own purposes
COMPILE_CXXFLAGS += -UDEBUG

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

@ -69,3 +69,6 @@ DEFINES['PACKAGE_BUGREPORT'] = '"http://bugzilla.mozilla.org/"'
DEFINES['HAVE_OT'] = 1
DEFINES['HB_NO_MT'] = True
DEFINES['HB_NO_UNICODE_FUNCS'] = True
# Cancel the effect of the -DDEBUG macro if present,
# because harfbuzz uses that name for its own purposes
DEFINES['DEBUG'] = False

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

@ -1,6 +0,0 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
# Avoid Lock_impl code depending on mozilla::Logger
MOZ_DEBUG_DEFINES=

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

@ -16,6 +16,7 @@ USE_STATIC_LIBS = True
DEFINES['MOZ_NO_MOZALLOC'] = True
# Avoid Lock_impl code depending on mozilla::Logger.
DEFINES['NDEBUG'] = True
DEFINES['DEBUG'] = False
# Use locking code from the chromium stack.
if CONFIG['OS_TARGET'] == 'WINNT':

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

@ -456,6 +456,9 @@ class RecursiveMakeBackend(CommonBackend):
if consumed:
return True
if not isinstance(obj, Defines):
self.consume_object(obj.defines)
if isinstance(obj, DirectoryTraversal):
self._process_directory_traversal(obj, backend_file)
elif isinstance(obj, ConfigFileSubstitution):
@ -924,10 +927,8 @@ class RecursiveMakeBackend(CommonBackend):
"""Output the DEFINES rules to the given backend file."""
defines = list(obj.get_defines())
if defines:
backend_file.write(which + ' +=')
for define in defines:
backend_file.write(' %s' % define)
backend_file.write('\n')
defines = ' '.join(defines)
backend_file.write_once('%s += %s\n' % (which, defines))
def _process_test_harness_files(self, obj, backend_file):
for path, files in obj.srcdir_files.iteritems():
@ -1449,7 +1450,7 @@ INSTALL_TARGETS += %(prefix)s
# which would modify content in the source directory.
'$(RM) $@',
'$(call py_action,preprocessor,$(DEFINES) $(ACDEFINES) '
'$(MOZ_DEBUG_DEFINES) $< -o $@)'
'$< -o $@)'
])
self._add_unified_build_rules(mk,

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

@ -281,6 +281,19 @@ class SubContext(Context, ContextDerivedValue):
self._sandbox().pop_subcontext(self)
class InitializedDefines(ContextDerivedValue, OrderedDict):
def __init__(self, context, value=None):
OrderedDict.__init__(self)
for define in context.config.substs.get('MOZ_DEBUG_DEFINES', '').split():
assert define[:2] == "-D"
pair = define[2:].split('=', 1)
if len(pair) == 1:
pair.append(1)
self[pair[0]] = pair[1]
if value:
self.update(value)
class FinalTargetValue(ContextDerivedValue, unicode):
def __new__(cls, context, value=""):
if not value:
@ -957,7 +970,7 @@ VARIABLES = {
indicating extra files the output depends on.
""", 'export'),
'DEFINES': (OrderedDict, dict,
'DEFINES': (InitializedDefines, dict,
"""Dictionary of compiler defines to declare.
These are passed in to the compiler as ``-Dkey='value'`` for string
@ -1598,7 +1611,7 @@ VARIABLES = {
appear in the moz.build file.
""", None),
'HOST_DEFINES': (OrderedDict, dict,
'HOST_DEFINES': (InitializedDefines, dict,
"""Dictionary of compiler defines to declare for host compilation.
See ``DEFINES`` for specifics.
""", None),

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

@ -79,7 +79,7 @@ class ContextDerived(TreeMetadata):
@property
def defines(self):
defines = self._context.get('DEFINES')
defines = self._context['DEFINES']
return Defines(self._context, defines) if defines else None
@property
@ -90,7 +90,7 @@ class ContextDerived(TreeMetadata):
class HostMixin(object):
@property
def defines(self):
defines = self._context.get('HOST_DEFINES')
defines = self._context['HOST_DEFINES']
return HostDefines(self._context, defines) if defines else None