2016-07-14 16:16:42 +00:00
|
|
|
# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
|
2016-03-08 04:49:35 +00:00
|
|
|
# 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/.
|
2016-03-09 06:27:42 +00:00
|
|
|
|
2016-03-09 06:59:39 +00:00
|
|
|
# /!\ Use js_option() instead of option() in this file. /!\
|
|
|
|
# =========================================================
|
|
|
|
|
|
|
|
@depends(build_project, '--help')
|
2016-03-18 10:03:09 +00:00
|
|
|
def building_js(build_project, help):
|
2016-03-09 06:59:39 +00:00
|
|
|
return build_project == 'js'
|
|
|
|
|
2016-03-18 10:03:09 +00:00
|
|
|
# Exception to the rule above: JS_STANDALONE is a special option that doesn't
|
|
|
|
# want the js_option treatment. When we're done merging js/src/configure and
|
|
|
|
# top-level configure, it can go away, although the JS_STANDALONE config
|
|
|
|
# will still need to be set depending on building_js above.
|
|
|
|
option(env='JS_STANDALONE', default=building_js,
|
|
|
|
help='Reserved for internal use')
|
|
|
|
|
|
|
|
@depends('JS_STANDALONE')
|
|
|
|
def js_standalone(value):
|
|
|
|
if value:
|
2016-03-22 05:21:32 +00:00
|
|
|
return True
|
2016-03-18 10:03:09 +00:00
|
|
|
|
2016-03-22 05:21:32 +00:00
|
|
|
set_config('JS_STANDALONE', js_standalone)
|
2016-03-23 07:34:59 +00:00
|
|
|
add_old_configure_assignment('JS_STANDALONE', js_standalone)
|
2016-03-18 10:03:09 +00:00
|
|
|
|
|
|
|
js_option('--disable-js-shell', default=building_js,
|
2016-03-09 06:59:39 +00:00
|
|
|
help='Do not build the JS shell')
|
2016-03-09 06:27:42 +00:00
|
|
|
|
|
|
|
@depends('--disable-js-shell')
|
2016-03-22 05:21:32 +00:00
|
|
|
def js_disable_shell(value):
|
2016-03-09 06:27:42 +00:00
|
|
|
if not value:
|
2016-03-22 05:21:32 +00:00
|
|
|
return True
|
|
|
|
|
|
|
|
set_config('JS_DISABLE_SHELL', js_disable_shell)
|
2016-03-09 08:41:40 +00:00
|
|
|
|
|
|
|
|
2016-03-09 07:09:25 +00:00
|
|
|
# Use SpiderMonkey Promise implementation if it's enabled
|
|
|
|
# =======================================================
|
2016-07-20 22:44:16 +00:00
|
|
|
js_option('--enable-sm-promise', default=True,
|
|
|
|
help='Enable SpiderMonkey promises')
|
2016-03-09 07:09:25 +00:00
|
|
|
|
|
|
|
@depends('--enable-sm-promise')
|
|
|
|
def sm_promise(value):
|
|
|
|
if value:
|
2016-03-22 05:21:32 +00:00
|
|
|
return True
|
2016-03-09 07:09:25 +00:00
|
|
|
|
2016-03-22 05:21:32 +00:00
|
|
|
set_config('SPIDERMONKEY_PROMISE', sm_promise)
|
2016-03-23 01:22:08 +00:00
|
|
|
set_define('SPIDERMONKEY_PROMISE', sm_promise)
|
2016-03-09 07:09:25 +00:00
|
|
|
|
2016-03-09 08:41:40 +00:00
|
|
|
# SpiderMonkey as a shared library, and how its symbols are exported
|
|
|
|
# ==================================================================
|
2016-03-18 10:03:09 +00:00
|
|
|
js_option('--disable-shared-js', default=building_js,
|
2016-03-09 08:41:40 +00:00
|
|
|
help='Do not create a shared library')
|
|
|
|
|
2016-03-18 10:03:09 +00:00
|
|
|
js_option('--disable-export-js', default=building_js,
|
2016-03-09 08:41:40 +00:00
|
|
|
help='Do not mark JS symbols as DLL exported/visible')
|
|
|
|
|
|
|
|
@depends('--disable-shared-js', '--disable-export-js')
|
2016-03-23 01:22:08 +00:00
|
|
|
def shared_js(shared_js, export_js):
|
2016-03-09 08:41:40 +00:00
|
|
|
if shared_js:
|
|
|
|
if not export_js:
|
2016-03-25 06:48:21 +00:00
|
|
|
die('Must export JS symbols when building a shared library.')
|
2016-03-23 01:22:08 +00:00
|
|
|
return True
|
|
|
|
|
|
|
|
set_config('JS_SHARED_LIBRARY', shared_js)
|
2016-03-23 07:34:59 +00:00
|
|
|
add_old_configure_assignment('JS_SHARED_LIBRARY', shared_js)
|
2016-03-23 01:22:08 +00:00
|
|
|
|
|
|
|
@depends('--disable-shared-js', '--disable-export-js')
|
|
|
|
def exportable_js_api(shared_js, export_js):
|
|
|
|
if not shared_js and export_js:
|
|
|
|
return True
|
|
|
|
|
|
|
|
set_define('STATIC_EXPORTABLE_JS_API', exportable_js_api)
|
|
|
|
|
|
|
|
@depends('--disable-shared-js', '--disable-export-js')
|
|
|
|
def static_js_api(shared_js, export_js):
|
|
|
|
if not shared_js and not export_js:
|
|
|
|
return True
|
|
|
|
|
|
|
|
set_define('STATIC_JS_API', static_js_api)
|
2016-03-09 08:41:40 +00:00
|
|
|
|
2016-03-22 05:21:32 +00:00
|
|
|
@depends('--disable-shared-js')
|
2016-03-23 01:22:08 +00:00
|
|
|
def static_js(value):
|
|
|
|
if not value:
|
2016-03-22 05:21:32 +00:00
|
|
|
return True
|
|
|
|
|
2016-03-23 01:22:08 +00:00
|
|
|
set_define('MOZ_STATIC_JS', static_js)
|
2016-03-09 08:41:40 +00:00
|
|
|
|
|
|
|
@deprecated_option(env='DISABLE_SHARED_JS', nargs='?')
|
|
|
|
def disable_shared_js(value):
|
|
|
|
# DISABLE_SHARED_JS=1 gets us an empty PositiveOptionValue
|
|
|
|
if value and not len(value):
|
|
|
|
suggestion = '--disable-shared-js'
|
|
|
|
else:
|
|
|
|
suggestion = '--enable-shared-js'
|
|
|
|
|
2016-03-25 06:48:21 +00:00
|
|
|
die('Setting %s is deprecated, use %s instead.',
|
|
|
|
value.format('DISABLE_SHARED_JS'), suggestion)
|
2016-03-09 08:41:40 +00:00
|
|
|
|
|
|
|
@deprecated_option(env='DISABLE_EXPORT_JS', nargs='?')
|
|
|
|
def disable_export_js(value):
|
|
|
|
# DISABLE_EXPORT_JS=1 gets us an empty PositiveOptionValue
|
|
|
|
if value and not len(value):
|
|
|
|
suggestion = '--disable-export-js'
|
|
|
|
else:
|
|
|
|
suggestion = '--enable-export-js'
|
|
|
|
|
2016-03-25 06:48:21 +00:00
|
|
|
die('Setting %s is deprecated, use %s instead.',
|
|
|
|
value.format('DISABLE_EXPORT_JS'), suggestion)
|
2016-03-17 07:12:44 +00:00
|
|
|
|
|
|
|
|
|
|
|
# Profiling
|
|
|
|
# =======================================================
|
|
|
|
js_option('--enable-instruments', env='MOZ_INSTRUMENTS',
|
|
|
|
help='Enable instruments remote profiling')
|
|
|
|
|
|
|
|
@depends('--enable-instruments', target)
|
|
|
|
def instruments(value, target):
|
|
|
|
if value and target.os != 'OSX':
|
2016-03-25 06:48:21 +00:00
|
|
|
die('--enable-instruments cannot be used when targeting %s',
|
|
|
|
target.os)
|
2016-03-17 07:12:44 +00:00
|
|
|
if value:
|
2016-03-22 05:21:32 +00:00
|
|
|
return True
|
2016-03-17 07:17:36 +00:00
|
|
|
|
2016-03-22 05:21:32 +00:00
|
|
|
set_config('MOZ_INSTRUMENTS', instruments)
|
2016-03-23 01:22:08 +00:00
|
|
|
set_define('MOZ_INSTRUMENTS', instruments)
|
2016-03-23 07:34:59 +00:00
|
|
|
add_old_configure_assignment('MOZ_INSTRUMENTS', instruments)
|
2016-03-23 05:18:57 +00:00
|
|
|
imply_option('--enable-profiling', instruments, reason='--enable-instruments')
|
2016-03-17 07:17:36 +00:00
|
|
|
|
|
|
|
js_option('--enable-callgrind', env='MOZ_CALLGRIND',
|
|
|
|
help='Enable callgrind profiling')
|
|
|
|
|
|
|
|
@depends('--enable-callgrind')
|
|
|
|
def callgrind(value):
|
|
|
|
if value:
|
2016-03-23 01:22:08 +00:00
|
|
|
return True
|
2016-03-17 07:24:30 +00:00
|
|
|
|
2016-03-23 01:22:08 +00:00
|
|
|
set_define('MOZ_CALLGRIND', callgrind)
|
2016-03-23 05:18:57 +00:00
|
|
|
imply_option('--enable-profiling', callgrind)
|
2016-03-17 07:24:30 +00:00
|
|
|
|
|
|
|
js_option('--enable-profiling', env='MOZ_PROFILING',
|
|
|
|
help='Set compile flags necessary for using sampling profilers '
|
|
|
|
'(e.g. shark, perf)')
|
|
|
|
|
2016-03-23 05:18:57 +00:00
|
|
|
@depends('--enable-profiling')
|
|
|
|
def profiling(value):
|
2016-03-17 07:24:30 +00:00
|
|
|
if value:
|
2016-03-23 05:18:57 +00:00
|
|
|
return True
|
2016-03-17 07:24:30 +00:00
|
|
|
|
2016-03-23 07:34:59 +00:00
|
|
|
add_old_configure_assignment('MOZ_PROFILING', profiling)
|
|
|
|
|
2016-03-23 05:18:57 +00:00
|
|
|
@depends(profiling, target)
|
|
|
|
def imply_vtune(value, target):
|
|
|
|
if value and (target.kernel == 'WINNT' or (target.kernel == 'Linux' and
|
|
|
|
target.os == 'GNU')):
|
2016-03-22 05:21:32 +00:00
|
|
|
return True
|
|
|
|
|
|
|
|
set_config('MOZ_PROFILING', profiling)
|
2016-03-23 01:22:08 +00:00
|
|
|
set_define('MOZ_PROFILING', profiling)
|
2016-03-23 05:18:57 +00:00
|
|
|
imply_option('--enable-vtune', imply_vtune, reason='--enable-profiling')
|
2016-03-17 07:24:30 +00:00
|
|
|
|
|
|
|
|
|
|
|
js_option('--enable-vtune', env='MOZ_VTUNE', help='Enable vtune profiling')
|
|
|
|
|
|
|
|
@depends('--enable-vtune')
|
|
|
|
def vtune(value):
|
|
|
|
if value:
|
2016-03-22 05:21:32 +00:00
|
|
|
return True
|
|
|
|
|
|
|
|
set_config('MOZ_VTUNE', vtune)
|
2016-03-23 01:22:08 +00:00
|
|
|
set_define('MOZ_VTUNE', vtune)
|
2016-08-10 11:06:40 +00:00
|
|
|
|
|
|
|
|
|
|
|
js_option('--enable-gc-trace', env='JS_GC_TRACE',
|
|
|
|
help='Enable tracing of allocation and finalization')
|
|
|
|
|
|
|
|
@depends('--enable-gc-trace')
|
|
|
|
def gc_trace(value):
|
|
|
|
if value:
|
|
|
|
return True
|
|
|
|
|
|
|
|
set_define('JS_GC_TRACE', gc_trace)
|