summaryrefslogtreecommitdiffstats
path: root/build/gecko_templates.mozbuild
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 01:47:29 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 01:47:29 +0000
commit0ebf5bdf043a27fd3dfb7f92e0cb63d88954c44d (patch)
treea31f07c9bcca9d56ce61e9a1ffd30ef350d513aa /build/gecko_templates.mozbuild
parentInitial commit. (diff)
downloadfirefox-esr-upstream/115.8.0esr.tar.xz
firefox-esr-upstream/115.8.0esr.zip
Adding upstream version 115.8.0esr.upstream/115.8.0esr
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'build/gecko_templates.mozbuild')
-rw-r--r--build/gecko_templates.mozbuild124
1 files changed, 124 insertions, 0 deletions
diff --git a/build/gecko_templates.mozbuild b/build/gecko_templates.mozbuild
new file mode 100644
index 0000000000..51aae5b870
--- /dev/null
+++ b/build/gecko_templates.mozbuild
@@ -0,0 +1,124 @@
+# -*- Mode: python; 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/.
+
+@template
+def GeckoBinary(linkage='dependent', mozglue=None):
+ '''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-real',
+ ]
+ elif linkage == 'standalone':
+ DEFINES['XPCOM_GLUE'] = True
+
+ USE_LIBS += [
+ 'xpcomglue',
+ ]
+ elif linkage != None:
+ error('`linkage` must be "dependent", "standalone" or None')
+
+ if mozglue:
+ if mozglue == 'program':
+ USE_LIBS += ['mozglue']
+ DEFINES['MOZ_HAS_MOZGLUE'] = True
+ if CONFIG['MOZ_GLUE_IN_PROGRAM'] and CONFIG['CC_TYPE'] in ('clang', 'gcc'):
+ LDFLAGS += ['-rdynamic']
+ elif mozglue == 'library':
+ LIBRARY_DEFINES['MOZ_HAS_MOZGLUE'] = True
+ if not CONFIG['MOZ_GLUE_IN_PROGRAM']:
+ USE_LIBS += ['mozglue']
+ else:
+ error('`mozglue` must be "program" or "library"')
+
+
+@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)
+
+ kwargs.setdefault('mozglue', 'program')
+
+ GeckoBinary(linkage=linkage, **kwargs)
+
+
+@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)
+
+ kwargs.setdefault('mozglue', 'program')
+
+ GeckoBinary(**kwargs)
+
+
+@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)
+
+ kwargs.setdefault('mozglue', 'program')
+
+ GeckoBinary(**kwargs)
+
+
+@template
+def GeckoSharedLibrary(name, output_category=None, **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, output_category)
+
+ kwargs.setdefault('mozglue', 'library')
+
+ GeckoBinary(**kwargs)
+
+
+@template
+def GeckoFramework(name, output_category=None, **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, output_category)
+
+ kwargs.setdefault('mozglue', 'library')
+
+ GeckoBinary(**kwargs)