gecko-dev/toolkit/moz.configure

123 строки
4.4 KiB
Plaintext
Исходник Обычный вид История

# -*- 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/.
include('../js/moz.configure')
# 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-', '')
set_config('MOZ_WIDGET_TOOLKIT', widget_toolkit)
add_old_configure_assignment('MOZ_WIDGET_TOOLKIT', widget_toolkit)
if widget_toolkit == 'gtk2':
set_define('MOZ_WIDGET_GTK', '2')
elif widget_toolkit == 'gtk3':
set_define('MOZ_WIDGET_GTK', '3')
elif widget_toolkit != 'windows':
set_define('MOZ_WIDGET_%s' % widget_toolkit.upper(), '1')
return widget_toolkit
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:
set_config('MOZ_ENABLE_XREMOTE', '1')
set_define('MOZ_ENABLE_XREMOTE', '1')
set_config('MOZ_X11', '1')
set_define('MOZ_X11', '1')
add_old_configure_assignment('MOZ_X11', '1')
return value and toolkit in x11_toolkits
# GL Provider
# ==============================================================
option('--with-gl-provider', nargs=1, help='Set GL provider backend type')
@depends('--with-gl-provider', x11)
def gl_provider(value, x11):
if value:
provider = value[0]
set_config('MOZ_GL_PROVIDER', provider)
set_define('MOZ_GL_PROVIDER', 'GLContextProvider%s' % provider)
set_config('MOZ_GL_DEFAULT_PROVIDER', provider)
set_define('GL_PROVIDER_%s' % provider, '1')
elif x11:
set_config('MOZ_GL_DEFAULT_PROVIDER', 'GLX')
set_define('GL_PROVIDER_GLX', '1')
# PDF printing
# ==============================================================
@depends(toolkit)
def pdf_printing(toolkit):
if toolkit in ('windows', 'gtk2', 'gtk3', 'qt', 'android', 'gonk'):
set_config('MOZ_PDF_PRINTING', '1')
set_config('PDF_SURFACE_FEATURE', '#define CAIRO_HAS_PDF_SURFACE 1')
else:
# CONFIGURE_SUBST_FILES need explicit empty values.
set_config('PDF_SURFACE_FEATURE', '')