2016-03-08 04:49:35 +00:00
|
|
|
# -*- 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/.
|
2016-03-09 06:59:39 +00:00
|
|
|
|
2016-03-17 06:56:23 +00:00
|
|
|
|
|
|
|
# Profiling
|
|
|
|
# ==============================================================
|
|
|
|
# Some of the options here imply an option from js/moz.configure,
|
|
|
|
# so, need to be declared before the include.
|
|
|
|
option('--enable-systrace', env='MOZ_USE_SYSTRACE',
|
|
|
|
help='Turn on systrace for the Gecko profiler on android/b2g')
|
|
|
|
|
|
|
|
@depends('--enable-systrace', target)
|
|
|
|
def systrace(value, target):
|
|
|
|
if value and target.os != 'Android':
|
|
|
|
error('--enable-systrace cannot be used when targetting %s'
|
|
|
|
% target.os)
|
|
|
|
if value:
|
2016-03-22 04:44:00 +00:00
|
|
|
set_define('MOZ_USE_SYSTRACE', True)
|
2016-03-17 06:56:23 +00:00
|
|
|
|
|
|
|
|
2016-03-17 07:05:10 +00:00
|
|
|
option('--enable-jprof', env='MOZ_JPROF',
|
|
|
|
help='Enable jprof profiling tool (needs mozilla/tools/jprof)')
|
|
|
|
|
|
|
|
@depends('--enable-jprof')
|
|
|
|
def jprof(value):
|
|
|
|
if value:
|
2016-03-22 04:44:00 +00:00
|
|
|
set_define('MOZ_JPROF', True)
|
2016-03-17 07:24:30 +00:00
|
|
|
imply_option('--enable-profiling')
|
2016-03-22 05:21:32 +00:00
|
|
|
return True
|
2016-03-17 07:05:10 +00:00
|
|
|
|
2016-03-22 05:21:32 +00:00
|
|
|
set_config('MOZ_JPROF', jprof)
|
2016-03-17 07:05:10 +00:00
|
|
|
|
2016-03-17 07:08:53 +00:00
|
|
|
@depends(target)
|
|
|
|
def sps_profiler(target):
|
|
|
|
if target.os == 'Android':
|
|
|
|
return target.cpu in ('arm', 'x86')
|
|
|
|
elif target.kernel == 'Linux':
|
|
|
|
return target.cpu in ('x86', 'x86_64')
|
|
|
|
return target.os in ('OSX', 'WINNT')
|
|
|
|
|
|
|
|
@depends(sps_profiler)
|
|
|
|
def sps_profiler_define(value):
|
|
|
|
if value:
|
2016-03-22 04:44:00 +00:00
|
|
|
set_define('MOZ_ENABLE_PROFILER_SPS', True)
|
2016-03-22 05:21:32 +00:00
|
|
|
return True
|
|
|
|
|
|
|
|
set_config('MOZ_ENABLE_PROFILER_SPS', sps_profiler_define)
|
2016-03-17 07:08:53 +00:00
|
|
|
|
|
|
|
|
2016-03-17 07:22:18 +00:00
|
|
|
option('--enable-dmd', env='MOZ_DMD',
|
|
|
|
help='Enable Dark Matter Detector (heap profiler). '
|
|
|
|
'Also enables jemalloc, replace-malloc and profiling')
|
|
|
|
|
|
|
|
@depends('--enable-dmd')
|
|
|
|
def dmd(value):
|
|
|
|
if value:
|
2016-03-22 04:44:00 +00:00
|
|
|
set_define('MOZ_DMD', True)
|
2016-03-22 05:12:29 +00:00
|
|
|
add_old_configure_assignment('MOZ_DMD', True)
|
2016-03-17 07:24:30 +00:00
|
|
|
imply_option('--enable-profiling')
|
2016-03-22 05:21:32 +00:00
|
|
|
return True
|
2016-03-17 07:22:18 +00:00
|
|
|
|
2016-03-22 05:21:32 +00:00
|
|
|
set_config('MOZ_DMD', dmd)
|
2016-03-17 07:22:18 +00:00
|
|
|
|
2016-03-17 06:56:23 +00:00
|
|
|
# Javascript engine
|
|
|
|
# ==============================================================
|
2016-03-09 06:59:39 +00:00
|
|
|
include('../js/moz.configure')
|
2016-03-16 04:10:54 +00:00
|
|
|
|
|
|
|
|
2016-03-16 23:38:52 +00:00
|
|
|
# L10N
|
|
|
|
# ==============================================================
|
|
|
|
option('--with-l10n-base', nargs=1, env='L10NBASEDIR',
|
|
|
|
help='Path to l10n repositories')
|
|
|
|
|
|
|
|
@depends('--with-l10n-base')
|
|
|
|
def l10n_base(value):
|
|
|
|
if value:
|
|
|
|
path = value[0]
|
|
|
|
if not os.path.isdir(path):
|
|
|
|
error("Invalid value --with-l10n-base, %s doesn't exist" % path)
|
2016-03-22 05:21:32 +00:00
|
|
|
return os.path.realpath(os.path.abspath(path))
|
2016-03-16 23:38:52 +00:00
|
|
|
|
2016-03-22 05:21:32 +00:00
|
|
|
set_config('L10NBASEDIR', l10n_base)
|
2016-03-16 23:38:52 +00:00
|
|
|
|
|
|
|
|
2016-03-16 04:10:54 +00:00
|
|
|
# Default toolkit
|
|
|
|
# ==============================================================
|
|
|
|
# Normally, we'd want to use the `default` field on the option, but that
|
|
|
|
# requires --target to be resolved at --help time, which requires to run
|
|
|
|
# config.guess, which we want to avoid. Even better, we could actually set
|
|
|
|
# `choices` depending on the target, but that doesn't pan out for the same
|
|
|
|
# reason.
|
|
|
|
option('--enable-default-toolkit', nargs=1,
|
|
|
|
choices=('cairo-windows', 'cairo-gtk2', 'cairo-gtk2-x11', 'cairo-gtk3',
|
|
|
|
'cairo-qt', 'cairo-cocoa', 'cairo-uikit', 'cairo-android',
|
|
|
|
'cairo-gonk'),
|
|
|
|
help='Select default toolkit')
|
|
|
|
|
|
|
|
@depends('--enable-default-toolkit', target, gonkdir)
|
|
|
|
def toolkit(value, target, gonkdir):
|
|
|
|
# Define possible choices for each platform. The default is the first one
|
|
|
|
# listed when there are several.
|
|
|
|
os = target.os
|
|
|
|
if target.os == 'WINNT':
|
|
|
|
platform_choices = ('cairo-windows',)
|
|
|
|
elif target.os == 'OSX':
|
|
|
|
platform_choices = ('cairo-cocoa',)
|
|
|
|
elif target.os == 'iOS':
|
|
|
|
platform_choices = ('cairo-uikit',)
|
|
|
|
elif target.os == 'Android':
|
|
|
|
if gonkdir:
|
|
|
|
platform_choices = ('cairo-gonk',)
|
|
|
|
os = 'B2G'
|
|
|
|
else:
|
|
|
|
platform_choices = ('cairo-android',)
|
|
|
|
else:
|
|
|
|
platform_choices = ('cairo-gtk3', 'cairo-gtk2', 'cairo-gtk2-x11',
|
|
|
|
'cairo-qt')
|
|
|
|
|
|
|
|
if value:
|
|
|
|
if value[0] not in platform_choices:
|
|
|
|
error(
|
|
|
|
'`%s` is not a valid value for --enable-default-toolkit on %s\n'
|
|
|
|
'Valid values: %s'
|
|
|
|
% (value[0], os, ', '.join(platform_choices)))
|
|
|
|
return value[0]
|
|
|
|
|
|
|
|
return platform_choices[0]
|
|
|
|
|
|
|
|
|
|
|
|
@depends(toolkit)
|
|
|
|
def toolkit(toolkit):
|
|
|
|
if toolkit == 'cairo-gtk2-x11':
|
|
|
|
widget_toolkit = 'gtk2'
|
|
|
|
else:
|
|
|
|
widget_toolkit = toolkit.replace('cairo-', '')
|
|
|
|
add_old_configure_assignment('MOZ_WIDGET_TOOLKIT', widget_toolkit)
|
|
|
|
|
2016-03-16 05:14:25 +00:00
|
|
|
if widget_toolkit == 'gtk2':
|
|
|
|
set_define('MOZ_WIDGET_GTK', '2')
|
|
|
|
elif widget_toolkit == 'gtk3':
|
|
|
|
set_define('MOZ_WIDGET_GTK', '3')
|
|
|
|
elif widget_toolkit != 'windows':
|
2016-03-22 04:44:00 +00:00
|
|
|
set_define('MOZ_WIDGET_%s' % widget_toolkit.upper(), True)
|
2016-03-16 05:14:25 +00:00
|
|
|
|
2016-03-16 04:10:54 +00:00
|
|
|
return widget_toolkit
|
2016-03-16 05:56:24 +00:00
|
|
|
|
2016-03-22 05:21:32 +00:00
|
|
|
set_config('MOZ_WIDGET_TOOLKIT', toolkit)
|
|
|
|
|
2016-03-16 05:56:24 +00:00
|
|
|
|
|
|
|
option('--without-x', env='WITHOUT_X', help='Disable X11 support')
|
|
|
|
|
|
|
|
@depends('--without-x', toolkit)
|
|
|
|
def x11(value, toolkit):
|
|
|
|
if not value and toolkit != 'qt':
|
|
|
|
error('--without-x is only valid with --enable-default-toolkit=qt')
|
|
|
|
|
|
|
|
x11_toolkits = ('gtk2', 'gtk3', 'qt')
|
|
|
|
if value and value.origin != 'default' and toolkit not in x11_toolkits:
|
|
|
|
error('--with-x is only valid with --enable-default-toolkit={%s}'
|
|
|
|
% ','.join(x11_toolkits))
|
|
|
|
|
|
|
|
if value and toolkit in x11_toolkits:
|
2016-03-22 04:44:00 +00:00
|
|
|
set_define('MOZ_ENABLE_XREMOTE', True)
|
|
|
|
set_define('MOZ_X11', True)
|
2016-03-22 05:12:29 +00:00
|
|
|
add_old_configure_assignment('MOZ_X11', True)
|
2016-03-16 05:56:24 +00:00
|
|
|
|
2016-03-22 05:21:32 +00:00
|
|
|
return True if value and toolkit in x11_toolkits else None
|
2016-03-16 06:14:20 +00:00
|
|
|
|
2016-03-22 05:21:32 +00:00
|
|
|
set_config('MOZ_ENABLE_XREMOTE', x11)
|
|
|
|
set_config('MOZ_X11', x11)
|
2016-03-16 06:14:20 +00:00
|
|
|
|
|
|
|
# GL Provider
|
|
|
|
# ==============================================================
|
|
|
|
option('--with-gl-provider', nargs=1, help='Set GL provider backend type')
|
|
|
|
|
2016-03-22 05:21:32 +00:00
|
|
|
@depends('--with-gl-provider')
|
|
|
|
def gl_provider(value):
|
2016-03-16 06:14:20 +00:00
|
|
|
if value:
|
|
|
|
provider = value[0]
|
|
|
|
set_define('MOZ_GL_PROVIDER', 'GLContextProvider%s' % provider)
|
2016-03-22 04:44:00 +00:00
|
|
|
set_define('GL_PROVIDER_%s' % provider, True)
|
2016-03-22 05:21:32 +00:00
|
|
|
return provider
|
|
|
|
|
|
|
|
@depends(gl_provider, x11)
|
|
|
|
def gl_default_provider(value, x11):
|
|
|
|
if value:
|
|
|
|
return value
|
2016-03-16 06:14:20 +00:00
|
|
|
elif x11:
|
2016-03-22 04:44:00 +00:00
|
|
|
set_define('GL_PROVIDER_GLX', True)
|
2016-03-22 05:21:32 +00:00
|
|
|
return 'GLX'
|
2016-03-16 07:10:40 +00:00
|
|
|
|
2016-03-22 05:21:32 +00:00
|
|
|
set_config('MOZ_GL_PROVIDER', gl_provider)
|
|
|
|
set_config('MOZ_GL_DEFAULT_PROVIDER', gl_default_provider)
|
2016-03-16 07:10:40 +00:00
|
|
|
|
|
|
|
# PDF printing
|
|
|
|
# ==============================================================
|
|
|
|
@depends(toolkit)
|
|
|
|
def pdf_printing(toolkit):
|
|
|
|
if toolkit in ('windows', 'gtk2', 'gtk3', 'qt', 'android', 'gonk'):
|
2016-03-22 05:21:32 +00:00
|
|
|
return True
|
|
|
|
|
|
|
|
@depends(pdf_printing)
|
|
|
|
def pdf_surface_feature(pdf_printing):
|
|
|
|
if pdf_printing:
|
|
|
|
return '#define CAIRO_HAS_PDF_SURFACE 1'
|
2016-03-16 07:10:40 +00:00
|
|
|
else:
|
|
|
|
# CONFIGURE_SUBST_FILES need explicit empty values.
|
2016-03-22 05:21:32 +00:00
|
|
|
return ''
|
|
|
|
|
|
|
|
set_config('MOZ_PDF_PRINTING', pdf_printing)
|
|
|
|
set_config('PDF_SURFACE_FEATURE', pdf_surface_feature)
|
2016-03-16 07:19:03 +00:00
|
|
|
|
|
|
|
|
|
|
|
# Event loop instrumentation
|
|
|
|
# ==============================================================
|
|
|
|
option(env='MOZ_INSTRUMENT_EVENT_LOOP',
|
|
|
|
help='Force-enable event loop instrumentation')
|
|
|
|
|
|
|
|
@depends('MOZ_INSTRUMENT_EVENT_LOOP', toolkit)
|
|
|
|
def instrument_event_loop(value, toolkit):
|
|
|
|
if value or (toolkit in ('windows', 'gtk2', 'gtk3', 'cocoa', 'android',
|
|
|
|
'gonk') and value.origin == 'default'):
|
2016-03-22 04:44:00 +00:00
|
|
|
set_define('MOZ_INSTRUMENT_EVENT_LOOP', True)
|
2016-03-22 05:21:32 +00:00
|
|
|
return True
|
|
|
|
|
|
|
|
set_config('MOZ_INSTRUMENT_EVENT_LOOP', instrument_event_loop)
|
2016-03-16 07:23:30 +00:00
|
|
|
|
|
|
|
|
|
|
|
# Fontconfig Freetype
|
|
|
|
# ==============================================================
|
|
|
|
option(env='USE_FC_FREETYPE',
|
|
|
|
help='Force-enable the use of fontconfig freetype')
|
|
|
|
|
|
|
|
@depends('USE_FC_FREETYPE', toolkit)
|
|
|
|
def fc_freetype(value, toolkit):
|
|
|
|
if value or (toolkit in ('gtk2', 'gtk3', 'qt') and
|
|
|
|
value.origin == 'default'):
|
2016-03-22 05:12:29 +00:00
|
|
|
add_old_configure_assignment('USE_FC_FREETYPE', True)
|
2016-03-16 08:37:42 +00:00
|
|
|
|
|
|
|
|
|
|
|
# Apple platform decoder support
|
|
|
|
# ==============================================================
|
|
|
|
@depends(toolkit)
|
|
|
|
def applemedia(toolkit):
|
|
|
|
if toolkit in ('cocoa', 'uikit'):
|
2016-03-22 04:44:00 +00:00
|
|
|
set_define('MOZ_APPLEMEDIA', True)
|
2016-03-22 05:12:29 +00:00
|
|
|
add_old_configure_assignment('MOZ_APPLEMEDIA', True)
|
2016-03-16 08:37:42 +00:00
|
|
|
return True
|
2016-03-16 08:42:57 +00:00
|
|
|
|
2016-03-22 05:21:32 +00:00
|
|
|
set_config('MOZ_APPLEMEDIA', applemedia)
|
2016-03-16 08:42:57 +00:00
|
|
|
|
|
|
|
# Windows Media Foundation support
|
|
|
|
# ==============================================================
|
|
|
|
option('--disable-wmf',
|
|
|
|
help='Disable support for Windows Media Foundation')
|
|
|
|
|
|
|
|
@depends('--disable-wmf', target)
|
|
|
|
def wmf(value, target):
|
|
|
|
enabled = bool(value)
|
|
|
|
if value.origin == 'default':
|
|
|
|
# Enable Windows Media Foundation support by default.
|
|
|
|
# Note our minimum SDK version is Windows 7 SDK, so we are (currently)
|
|
|
|
# guaranteed to have a recent-enough SDK to build WMF.
|
|
|
|
enabled = target.os == 'WINNT'
|
|
|
|
if enabled and target.os != 'WINNT':
|
|
|
|
error('Cannot enable Windows Media Foundation support on %s'
|
|
|
|
% target.os)
|
|
|
|
if enabled:
|
2016-03-22 04:44:00 +00:00
|
|
|
set_define('MOZ_WMF', True)
|
2016-03-22 05:21:32 +00:00
|
|
|
return True
|
2016-03-16 08:46:13 +00:00
|
|
|
|
2016-03-22 05:21:32 +00:00
|
|
|
set_config('MOZ_WMF', wmf)
|
2016-03-16 08:46:13 +00:00
|
|
|
|
|
|
|
# FFmpeg H264/AAC Decoding Support
|
|
|
|
# ==============================================================
|
|
|
|
option('--disable-ffmpeg',
|
|
|
|
help='Disable FFmpeg for fragmented H264/AAC decoding')
|
|
|
|
|
|
|
|
@depends('--disable-ffmpeg', target)
|
|
|
|
def ffmpeg(value, target):
|
|
|
|
enabled = bool(value)
|
|
|
|
if value.origin == 'default':
|
|
|
|
enabled = target.os not in ('Android', 'WINNT')
|
|
|
|
if enabled:
|
2016-03-22 04:44:00 +00:00
|
|
|
set_define('MOZ_FFMPEG', True)
|
2016-03-16 08:50:42 +00:00
|
|
|
imply_option('--enable-fmp4', '--enable-ffmpeg')
|
2016-03-22 05:21:32 +00:00
|
|
|
return True
|
2016-03-16 08:50:42 +00:00
|
|
|
|
2016-03-22 05:21:32 +00:00
|
|
|
set_config('MOZ_FFMPEG', ffmpeg)
|
2016-03-16 08:50:42 +00:00
|
|
|
|
|
|
|
# Built-in fragmented MP4 support.
|
|
|
|
# ==============================================================
|
|
|
|
option('--disable-fmp4', env='MOZ_FMP4',
|
|
|
|
help='Disable support for in built Fragmented MP4 parsing')
|
|
|
|
|
|
|
|
@depends('--disable-fmp4', target, wmf, applemedia)
|
|
|
|
def fmp4(value, target, wmf, applemedia):
|
|
|
|
enabled = bool(value)
|
|
|
|
if value.origin == 'default':
|
|
|
|
# target.os == 'Android' includes all B2G versions
|
|
|
|
enabled = wmf or applemedia or target.os == 'Android'
|
|
|
|
if enabled:
|
2016-03-22 04:44:00 +00:00
|
|
|
set_define('MOZ_FMP4', True)
|
2016-03-22 05:12:29 +00:00
|
|
|
add_old_configure_assignment('MOZ_FMP4', True)
|
2016-03-22 05:21:32 +00:00
|
|
|
return True
|
2016-03-16 08:52:20 +00:00
|
|
|
|
2016-03-22 05:21:32 +00:00
|
|
|
set_config('MOZ_FMP4', fmp4)
|
2016-03-16 08:52:20 +00:00
|
|
|
|
|
|
|
# EME Support
|
|
|
|
# ==============================================================
|
|
|
|
option('--enable-eme', nargs='*', choices=('adobe',),
|
|
|
|
help='Enable support for Encrypted Media Extensions')
|
|
|
|
|
|
|
|
@depends('--enable-eme', fmp4)
|
|
|
|
def eme(value, fmp4):
|
|
|
|
enabled = bool(value)
|
|
|
|
if value.origin == 'default':
|
|
|
|
enabled = enabled or fmp4
|
|
|
|
if enabled and not fmp4:
|
|
|
|
error('Encrypted Media Extension support requires '
|
|
|
|
'Fragmented MP4 support')
|
|
|
|
if enabled:
|
2016-03-22 04:44:00 +00:00
|
|
|
set_define('MOZ_EME', True)
|
2016-03-22 05:21:32 +00:00
|
|
|
return True
|
|
|
|
|
|
|
|
@depends('--enable-eme')
|
|
|
|
def eme_modules(value):
|
2016-03-16 08:52:20 +00:00
|
|
|
# Theoretically, we could pass `value` directly when it is a
|
|
|
|
# PositiveOptionValue, but somehow, the JSON serialization in configure.py
|
|
|
|
# outputs inconsistent data in some cases when we do (a closing bracket
|
|
|
|
# without an opening one).
|
2016-03-22 05:21:32 +00:00
|
|
|
return list(value) if value else []
|
|
|
|
|
|
|
|
set_config('MOZ_EME', eme)
|
|
|
|
set_config('MOZ_EME_MODULES', eme_modules)
|