build/templates.mozbuild
author ffxbld
Mon, 05 Jan 2015 23:57:37 -0500
branchMOBILE350b10_2015010523_RELBRANCH
changeset 236516 fe2e5b4fdb1a18e3c919b5e549bb27e2916b7a97
parent 228010 338372590fc44d51ac28d183ad46afc674caed39
child 239238 afdcad4e027ea8cf14ee4e5ce4e0420e2c9cb2bf
permissions -rw-r--r--
Added FENNEC_35_0b10_RELEASE FENNEC_35_0b10_BUILD1 tag(s) for changeset d62b81f9aad4. DONTBUILD CLOSED TREE a=release

# -*- 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/.

@template
def StdCppCompat():
    '''Template for libstdc++ compatibility for target binaries.'''

    if CONFIG['MOZ_LIBSTDCXX_TARGET_VERSION']:
        USE_LIBS += ['stdc++compat']


@template
def Program(name):
    '''Template for program executables.'''
    PROGRAM = name

    StdCppCompat()


@template
def SimplePrograms(names, ext='.cpp'):
    '''Template for simple program executables.

    Those have a single source with the same base name as the executable.
    '''
    SIMPLE_PROGRAMS += names
    SOURCES += ['%s%s' % (name, ext) for name in names]

    StdCppCompat()


@template
def CppUnitTests(names, ext='.cpp'):
    '''Template for C++ unit tests.

    Those have a single source with the same base name as the executable.
    '''
    CPP_UNIT_TESTS += names
    SOURCES += ['%s%s' % (name, ext) for name in names]

    StdCppCompat()


@template
def Library(name):
    '''Template for libraries.'''
    LIBRARY_NAME = name


@template
def SharedLibrary(name):
    '''Template for shared libraries.'''
    Library(name)

    FORCE_SHARED_LIB = True

    StdCppCompat()


@template
def Framework(name):
    '''Template for OSX Frameworks.'''
    SharedLibrary(name)

    IS_FRAMEWORK = True


@template
def HostStdCppCompat():
    '''Template for libstdc++ compatibility for host binaries.'''

    if CONFIG['MOZ_LIBSTDCXX_HOST_VERSION']:
        HOST_USE_LIBS += ['host_stdc++compat']


@template
def HostProgram(name):
    '''Template for build tools executables.'''
    HOST_PROGRAM = name

    HostStdCppCompat()


@template
def HostSimplePrograms(names, ext='.cpp'):
    '''Template for simple build tools executables.

    Those have a single source with the same base name as the executable.
    '''
    HOST_SIMPLE_PROGRAMS += names
    HOST_SOURCES += ['%s%s' % (name.replace('host_', ''), ext)
        for name in names]

    HostStdCppCompat()


@template
def HostLibrary(name):
    '''Template for build tools libraries.'''
    HOST_LIBRARY_NAME = name


@template
def GeckoBinary():
    '''Template for binaries using Gecko.

    This template is meant to be used in other templates.
    '''
    USE_LIBS += [
        'mozalloc',
        'nspr',
        'xpcomglue_s',
        'xul',
    ]


@template
def XPCOMBinaryComponent(name):
    '''Template defining an XPCOM binary component for Gecko.

    name is the name of the component.
    '''
    SharedLibrary(name)

    GeckoBinary()

    IS_COMPONENT = True