Bumping manifests a=b2g-bump
[gecko.git] / build / templates.mozbuild
blob1d99f3a27dc2701d13cdb56000b6f36efb1e3410
1 # -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
2 # vim: set filetype=python:
3 # This Source Code Form is subject to the terms of the Mozilla Public
4 # License, v. 2.0. If a copy of the MPL was not distributed with this
5 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
7 @template
8 def Binary():
9     '''Generic template for target binaries. Meant to be used by other
10     templates.'''
12     if CONFIG['MOZ_LIBSTDCXX_TARGET_VERSION']:
13         USE_LIBS += ['stdc++compat']
15     # Ideally, we'd support not adding this to the LIB_IS_C_ONLY case,
16     # but that variable is actually only set in db/sqlite/src, which
17     # doesn't build a shared library on the relevant platforms anyways.
18     # Eventually, though, we should detect LIB_IS_C_ONLY based on the
19     # associated SOURCES (and there might actually be places where we
20     # haven't set it but should have).
21     if CONFIG['STLPORT_LIBS']:
22         OS_LIBS += [CONFIG['STLPORT_LIBS']]
23     elif CONFIG['OS_TARGET'] == 'Android':
24         USE_LIBS += ['stlport']
27 @template
28 def Program(name):
29     '''Template for program executables.'''
30     PROGRAM = name
32     Binary()
35 @template
36 def SimplePrograms(names, ext='.cpp'):
37     '''Template for simple program executables.
39     Those have a single source with the same base name as the executable.
40     '''
41     SIMPLE_PROGRAMS += names
42     SOURCES += ['%s%s' % (name, ext) for name in names]
44     Binary()
47 @template
48 def CppUnitTests(names, ext='.cpp'):
49     '''Template for C++ unit tests.
51     Those have a single source with the same base name as the executable.
52     '''
53     CPP_UNIT_TESTS += names
54     SOURCES += ['%s%s' % (name, ext) for name in names]
56     Binary()
59 @template
60 def Library(name):
61     '''Template for libraries.'''
62     LIBRARY_NAME = name
65 @template
66 def SharedLibrary(name):
67     '''Template for shared libraries.'''
68     Library(name)
70     FORCE_SHARED_LIB = True
72     Binary()
75 @template
76 def Framework(name):
77     '''Template for OSX Frameworks.'''
78     SharedLibrary(name)
80     IS_FRAMEWORK = True
83 @template
84 def HostStdCppCompat():
85     '''Template for libstdc++ compatibility for host binaries.'''
87     if CONFIG['MOZ_LIBSTDCXX_HOST_VERSION']:
88         HOST_USE_LIBS += ['host_stdc++compat']
91 @template
92 def HostProgram(name):
93     '''Template for build tools executables.'''
94     HOST_PROGRAM = name
96     HostStdCppCompat()
99 @template
100 def HostSimplePrograms(names, ext='.cpp'):
101     '''Template for simple build tools executables.
103     Those have a single source with the same base name as the executable.
104     '''
105     HOST_SIMPLE_PROGRAMS += names
106     HOST_SOURCES += ['%s%s' % (name.replace('host_', ''), ext)
107         for name in names]
109     HostStdCppCompat()
112 @template
113 def HostLibrary(name):
114     '''Template for build tools libraries.'''
115     HOST_LIBRARY_NAME = name
118 include('gecko_templates.mozbuild')