Bug 1417309 - Add the necessary bits to support a --enable-project=memory option. r=nalexander
authorMike Hommey <mh+mozilla@glandium.org>
Wed, 15 Nov 2017 14:21:15 +0900
changeset 698685 c995692a3c92e3fc2e31849c25eb8da49afa1326
parent 698684 1e648d0142777e06c6b4bddc51be0e918c93afe3
child 698686 a680c322255e5f290bf1a7ef8c72cffc2acc7190
child 698916 255f29fb55cebf239ad14360b368b48b5cfc81c4
push id89331
push userbmo:mh+mozilla@glandium.org
push dateWed, 15 Nov 2017 23:40:09 +0000
reviewersnalexander
bugs1417309
milestone59.0a1
Bug 1417309 - Add the necessary bits to support a --enable-project=memory option. r=nalexander The option allows to iterate on the allocator code without requiring a complete setup to build Firefox.
build/moz.configure/memory.configure
memory/app.mozbuild
memory/build/moz.build
memory/moz.build
memory/moz.configure
moz.build
--- 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
@@ -66,17 +66,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',
     ]