2016-07-14 19:16:42 +03:00
|
|
|
# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
|
2014-10-30 07:06:12 +03: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/.
|
|
|
|
|
|
|
|
@template
|
2017-12-05 09:36:52 +03:00
|
|
|
def GeckoBinary(linkage='dependent', mozglue=None):
|
2014-10-30 07:06:12 +03:00
|
|
|
'''Template for Gecko-related binaries.
|
|
|
|
|
|
|
|
This template is meant to be used in other templates.
|
|
|
|
|
|
|
|
`linkage` indicates the wanted xpcom linkage type. Valid values are
|
|
|
|
'dependent', 'standalone' or None. 'dependent' is the default. It is
|
|
|
|
used for e.g. XPCOM components and executables with direct dependencies
|
|
|
|
on libxul. Most executables should use the 'standalone' linkage, which
|
|
|
|
uses the standalone XPCOM glue to load libxul. None means no XPCOM glue
|
|
|
|
or libxul linkage at all.
|
|
|
|
|
|
|
|
`mozglue` indicates whether to link against the mozglue library, and if
|
|
|
|
so, what linkage to apply. Valid values are None (mozglue not linked),
|
|
|
|
'program' (mozglue linked to an executable program), or 'library' (mozglue
|
|
|
|
linked to a shared library).
|
|
|
|
'''
|
|
|
|
if linkage == 'dependent':
|
|
|
|
USE_LIBS += [
|
|
|
|
'nspr',
|
|
|
|
'xul',
|
|
|
|
]
|
|
|
|
elif linkage == 'standalone':
|
|
|
|
DEFINES['XPCOM_GLUE'] = True
|
|
|
|
|
|
|
|
USE_LIBS += [
|
2017-12-05 09:36:52 +03:00
|
|
|
'xpcomglue',
|
2014-10-30 07:06:12 +03:00
|
|
|
]
|
|
|
|
elif linkage != None:
|
|
|
|
error('`linkage` must be "dependent", "standalone" or None')
|
|
|
|
|
|
|
|
if mozglue:
|
2016-07-06 19:01:38 +03:00
|
|
|
LDFLAGS += CONFIG['MOZ_GLUE_WRAP_LDFLAGS']
|
|
|
|
if mozglue == 'program':
|
|
|
|
USE_LIBS += ['mozglue']
|
2016-11-08 11:53:00 +03:00
|
|
|
DEFINES['MOZ_HAS_MOZGLUE'] = True
|
2017-12-08 00:09:15 +03:00
|
|
|
if CONFIG['MOZ_GLUE_IN_PROGRAM'] and CONFIG['CC_TYPE'] in ('clang', 'gcc'):
|
2017-09-20 08:23:57 +03:00
|
|
|
LDFLAGS += ['-rdynamic']
|
2016-07-06 19:01:38 +03:00
|
|
|
elif mozglue == 'library':
|
2016-11-08 11:53:00 +03:00
|
|
|
LIBRARY_DEFINES['MOZ_HAS_MOZGLUE'] = True
|
2016-07-06 19:01:38 +03:00
|
|
|
if not CONFIG['MOZ_GLUE_IN_PROGRAM']:
|
2014-10-30 07:06:12 +03:00
|
|
|
USE_LIBS += ['mozglue']
|
|
|
|
else:
|
2016-07-06 19:01:38 +03:00
|
|
|
error('`mozglue` must be "program" or "library"')
|
2014-10-30 07:06:12 +03:00
|
|
|
|
|
|
|
|
|
|
|
@template
|
|
|
|
def GeckoProgram(name, linkage='standalone', **kwargs):
|
|
|
|
'''Template for program executables related to Gecko.
|
|
|
|
|
|
|
|
`name` identifies the executable base name.
|
|
|
|
|
|
|
|
See the documentation for `GeckoBinary` for other possible arguments,
|
|
|
|
with the notable difference that the default for `linkage` is 'standalone'.
|
|
|
|
'''
|
|
|
|
Program(name)
|
|
|
|
|
2014-11-21 03:38:08 +03:00
|
|
|
kwargs.setdefault('mozglue', 'program')
|
|
|
|
|
|
|
|
GeckoBinary(linkage=linkage, **kwargs)
|
2014-10-30 07:06:12 +03:00
|
|
|
|
|
|
|
|
|
|
|
@template
|
|
|
|
def GeckoSimplePrograms(names, **kwargs):
|
|
|
|
'''Template for simple program executables related to Gecko.
|
|
|
|
|
|
|
|
`names` identifies the executable base names for each executable.
|
|
|
|
|
|
|
|
See the documentation for `GeckoBinary` for other possible arguments.
|
|
|
|
'''
|
|
|
|
SimplePrograms(names)
|
|
|
|
|
2014-11-21 03:38:08 +03:00
|
|
|
kwargs.setdefault('mozglue', 'program')
|
|
|
|
|
|
|
|
GeckoBinary(**kwargs)
|
2014-10-30 07:06:12 +03:00
|
|
|
|
|
|
|
|
|
|
|
@template
|
|
|
|
def GeckoCppUnitTests(names, **kwargs):
|
|
|
|
'''Template for C++ unit tests related to Gecko.
|
|
|
|
|
|
|
|
`names` identifies the executable base names for each executable.
|
|
|
|
|
|
|
|
See the documentation for `GeckoBinary` for other possible arguments.
|
|
|
|
'''
|
|
|
|
CppUnitTests(names)
|
|
|
|
|
2014-11-21 03:38:08 +03:00
|
|
|
kwargs.setdefault('mozglue', 'program')
|
|
|
|
|
|
|
|
GeckoBinary(**kwargs)
|
2014-10-30 07:06:12 +03:00
|
|
|
|
|
|
|
|
|
|
|
@template
|
|
|
|
def GeckoSharedLibrary(name, **kwargs):
|
|
|
|
'''Template for shared libraries related to Gecko.
|
|
|
|
|
|
|
|
`name` identifies the library base name.
|
|
|
|
See the documentation for `GeckoBinary` for other possible arguments.
|
|
|
|
'''
|
|
|
|
SharedLibrary(name)
|
|
|
|
|
2014-11-21 03:38:08 +03:00
|
|
|
kwargs.setdefault('mozglue', 'library')
|
|
|
|
|
|
|
|
GeckoBinary(**kwargs)
|
2014-10-30 07:06:12 +03:00
|
|
|
|
|
|
|
|
|
|
|
@template
|
|
|
|
def GeckoFramework(name, **kwargs):
|
|
|
|
'''Template for OSX frameworks related to Gecko.
|
|
|
|
|
|
|
|
`name` identifies the library base name.
|
|
|
|
See the documentation for `GeckoBinary` for other possible arguments.
|
|
|
|
'''
|
|
|
|
Framework(name)
|
|
|
|
|
2014-11-21 03:38:08 +03:00
|
|
|
kwargs.setdefault('mozglue', 'library')
|
|
|
|
|
|
|
|
GeckoBinary(**kwargs)
|