Bug 1417309 - Add the necessary bits to support a --enable-project=memory option. r?build
The option allows to iterate on the allocator code without requiring a
complete setup to build Firefox.
--- a/build/moz.configure/memory.configure
+++ b/build/moz.configure/memory.configure
@@ -59,15 +59,17 @@ option('--enable-replace-malloc',
@depends('--enable-replace-malloc', jemalloc, milestone, build_project)
def replace_malloc(value, jemalloc, milestone, build_project):
# Enable on central for the debugging opportunities it adds.
if value and not jemalloc:
die('--enable-replace-malloc requires --enable-jemalloc')
if value.origin != 'default':
return bool(value) or None
+ if build_project == 'memory':
+ return True
if milestone.is_nightly and jemalloc and build_project != 'js':
return True
set_config('MOZ_REPLACE_MALLOC', replace_malloc)
set_define('MOZ_REPLACE_MALLOC', replace_malloc)
add_old_configure_assignment('MOZ_REPLACE_MALLOC', replace_malloc)
new file mode 100644
--- /dev/null
+++ b/memory/app.mozbuild
@@ -0,0 +1,15 @@
+# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
+# vim: set filetype=python:
+# 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/.
+
+# Indirectly necessary for chromium's lock.h, included from LogAlloc.cpp
+EXPORTS.mozilla += [
+ '/mozglue/misc/Printf.h',
+ '/xpcom/base/Logging.h',
+]
+
+DIRS += [
+ '/memory',
+]
--- a/memory/build/moz.build
+++ b/memory/build/moz.build
@@ -38,14 +38,15 @@ if CONFIG['OS_TARGET'] == 'Darwin' and (
Library('memory')
if CONFIG['OS_TARGET'] == 'Android' and CONFIG['CC_TYPE'] == 'clang':
CXXFLAGS += [
'-Wno-tautological-pointer-compare',
]
-FINAL_LIBRARY = 'mozglue'
+if CONFIG['MOZ_BUILD_APP'] != 'memory':
+ FINAL_LIBRARY = 'mozglue'
if CONFIG['_MSC_VER']:
CXXFLAGS += ['-wd4273'] # inconsistent dll linkage (bug 558163)
DisableStlWrapping()
--- a/memory/moz.build
+++ b/memory/moz.build
@@ -4,20 +4,25 @@
# 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/.
with Files("**"):
BUG_COMPONENT = ("Core", "Memory Allocator")
DIRS += [
'build',
- 'mozalloc',
'fallible',
]
+# For now, don't build mozalloc when building with --enable-project=memory
+if CONFIG['MOZ_BUILD_APP'] != 'memory':
+ DIRS += [
+ 'mozalloc',
+ ]
+
if CONFIG['MOZ_WIDGET_TOOLKIT']:
DIRS += ['volatile']
# NB: gtest dir is included in toolkit/toolkit.build due to its dependency
# on libxul.
if CONFIG['MOZ_REPLACE_MALLOC']:
DIRS += ['replace']
new file mode 100644
--- /dev/null
+++ b/memory/moz.configure
@@ -0,0 +1,7 @@
+# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
+# vim: set filetype=python:
+# 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/.
+
+imply_option('--enable-jemalloc', True)
--- a/moz.build
+++ b/moz.build
@@ -78,17 +78,17 @@ if CONFIG['ENABLE_CLANG_PLUGIN']:
DIRS += [
'config',
'python',
'taskcluster',
'testing/mozbase',
'third_party/python',
]
-if CONFIG['MOZ_WIDGET_TOOLKIT'] or not CONFIG['MOZ_BUILD_APP']:
+if not CONFIG['JS_STANDALONE'] or not CONFIG['MOZ_BUILD_APP']:
CONFIGURE_DEFINE_FILES += [
'mozilla-config.h',
]
EXPORTS += [
'!buildid.h',
'!mozilla-config.h',
'!source-repo.h',
]