Skip to content

Commit

Permalink
Bug 1041941 - Use templates for Gecko XPCOM components. r=gps
Browse files Browse the repository at this point in the history
  • Loading branch information
glandium committed Aug 24, 2014
1 parent 4cfdc80 commit 9461e86
Show file tree
Hide file tree
Showing 12 changed files with 44 additions and 101 deletions.
11 changes: 1 addition & 10 deletions browser/components/build/moz.build
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@ SOURCES += [
'nsModule.cpp',
]

LIBRARY_NAME = 'browsercomps'

IS_COMPONENT = True
XPCOMBinaryComponent('browsercomps')

LOCAL_INCLUDES += [
'../about',
Expand All @@ -24,13 +22,6 @@ LOCAL_INCLUDES += [
'../shell',
]

USE_LIBS += [
'mozalloc',
'nspr',
'xpcomglue_s',
'xul',
]

if CONFIG['OS_ARCH'] == 'WINNT':
OS_LIBS += [
'ole32',
Expand Down
31 changes: 31 additions & 0 deletions build/templates.mozbuild
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# -*- 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 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.
'''
LIBRARY_NAME = name

GeckoBinary()

IS_COMPONENT = True
11 changes: 1 addition & 10 deletions extensions/gnomevfs/moz.build
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,12 @@ SOURCES += [
'nsGnomeVFSProtocolHandler.cpp',
]

LIBRARY_NAME = 'nkgnomevfs'

IS_COMPONENT = True
XPCOMBinaryComponent('nkgnomevfs')

# make sure this component is never statically linked into the main
# application. this is necessary since we don't want to force users
# to install gnome-vfs2 in order to use the rest of mozilla ;-)

USE_LIBS += [
'mozalloc',
'nspr',
'xpcomglue_s',
'xul',
]

CXXFLAGS += CONFIG['MOZ_GNOMEVFS_CFLAGS']

OS_LIBS += CONFIG['MOZ_GNOMEVFS_LIBS']
11 changes: 1 addition & 10 deletions js/xpconnect/tests/components/native/moz.build
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@ UNIFIED_SOURCES += [
'xpctest_params.cpp',
]

LIBRARY_NAME = 'xpctest'

IS_COMPONENT = True
XPCOMBinaryComponent('xpctest')

DEFINES['LIBRARY_FILENAME'] = '%s%s%s' % (
CONFIG['DLL_PREFIX'],
Expand All @@ -23,10 +21,3 @@ DEFINES['LIBRARY_FILENAME'] = '%s%s%s' % (
)

FAIL_ON_WARNINGS = True

USE_LIBS += [
'mozalloc',
'nspr',
'xpcomglue_s',
'xul',
]
2 changes: 2 additions & 0 deletions moz.build
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,5 @@ if CONFIG['COMPILE_ENVIRONMENT'] and not CONFIG['LIBXUL_SDK']:
if not CONFIG['JS_STANDALONE']:
# Bring in the configuration for the configured application.
include('/' + CONFIG['MOZ_BUILD_APP'] + '/app.mozbuild')

include('build/templates.mozbuild')
11 changes: 1 addition & 10 deletions toolkit/system/dbus/moz.build
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,7 @@ SOURCES += [
'nsNetworkManagerListener.cpp',
]

LIBRARY_NAME = 'dbusservice'

IS_COMPONENT = True

USE_LIBS += [
'mozalloc',
'nspr',
'xpcomglue_s',
'xul',
]
XPCOMBinaryComponent('dbusservice')

CXXFLAGS += CONFIG['TK_CFLAGS']
CXXFLAGS += CONFIG['MOZ_DBUS_GLIB_CFLAGS']
Expand Down
10 changes: 1 addition & 9 deletions toolkit/system/gnome/moz.build
Original file line number Diff line number Diff line change
Expand Up @@ -24,22 +24,14 @@ if CONFIG['MOZ_ENABLE_GIO']:
'nsGSettingsService.cpp',
]

LIBRARY_NAME = 'mozgnome'
XPCOMBinaryComponent('mozgnome')

FAIL_ON_WARNINGS = True
IS_COMPONENT = True

LOCAL_INCLUDES += [
'/toolkit/components/build/',
]

USE_LIBS += [
'mozalloc',
'nspr',
'xpcomglue_s',
'xul',
]

CXXFLAGS += CONFIG['MOZ_GCONF_CFLAGS']
CXXFLAGS += CONFIG['MOZ_GNOMEVFS_CFLAGS']
CXXFLAGS += CONFIG['MOZ_GIO_CFLAGS']
Expand Down
14 changes: 2 additions & 12 deletions xpcom/sample/moz.build
Original file line number Diff line number Diff line change
Expand Up @@ -29,24 +29,14 @@ EXTRA_COMPONENTS += [
'nsSample.manifest',
]

# LIBRARY_NAME names the library generated by this makefile,
# XPCOMBinaryComponent names the library generated by this makefile,
# i.e. dist/bin/components/libxpcomsample.so
LIBRARY_NAME = 'xpcomsample'

# IS_COMPONENT indicates that this makefile builds a component shared library.
IS_COMPONENT = True
XPCOMBinaryComponent('xpcomsample')

RESOURCE_FILES.samples += [
'xpconnect-sample.html',
]

USE_LIBS += [
'mozalloc',
'nspr',
'xpcomglue_s',
'xul',
]

# Need to link with CoreFoundation on Mac
if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa':
OS_LIBS += CONFIG['TK_LIBS']
11 changes: 1 addition & 10 deletions xpcom/tests/bug656331_component/moz.build
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,14 @@ SOURCES += [
'TestComponent.cpp',
]

LIBRARY_NAME = 'test656331'

IS_COMPONENT = True
XPCOMBinaryComponent('test656331')

DEFINES['LIBRARY_FILENAME'] = '%s%s%s' % (
CONFIG['DLL_PREFIX'],
LIBRARY_NAME,
CONFIG['DLL_SUFFIX']
)

USE_LIBS += [
'mozalloc',
'nspr',
'xpcomglue_s',
'xul',
]

# Need to link with CoreFoundation on Mac
if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa':
OS_LIBS += CONFIG['TK_LIBS']
11 changes: 1 addition & 10 deletions xpcom/tests/component/moz.build
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,14 @@ SOURCES += [
'TestComponent.cpp',
]

LIBRARY_NAME = 'testcomponent'

IS_COMPONENT = True
XPCOMBinaryComponent('testcomponent')

DEFINES['LIBRARY_FILENAME'] = '%s%s%s' % (
CONFIG['DLL_PREFIX'],
LIBRARY_NAME,
CONFIG['DLL_SUFFIX']
)

USE_LIBS += [
'mozalloc',
'nspr',
'xpcomglue_s',
'xul',
]

# Need to link with CoreFoundation on Mac
if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa':
OS_LIBS += CONFIG['TK_LIBS']
11 changes: 1 addition & 10 deletions xpcom/tests/component_no_aslr/moz.build
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,14 @@ SOURCES += [
'TestComponent.cpp',
]

LIBRARY_NAME = 'testcompnoaslr'

IS_COMPONENT = True
XPCOMBinaryComponent('testcompnoaslr')

DEFINES['LIBRARY_FILENAME'] = '%s%s%s' % (
CONFIG['DLL_PREFIX'],
LIBRARY_NAME,
CONFIG['DLL_SUFFIX']
)

USE_LIBS += [
'mozalloc',
'nspr',
'xpcomglue_s',
'xul',
]

# Need to link with CoreFoundation on Mac
if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa':
OS_LIBS += CONFIG['TK_LIBS']
11 changes: 1 addition & 10 deletions xulrunner/examples/simple/components/src/moz.build
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,11 @@ SOURCES += [
'SimpleTest.cpp',
]

LIBRARY_NAME = 'simpletest'
XPCOMBinaryComponent('simpletest')

EXTRA_COMPONENTS += [
'SimpleTest.js',
'SimpleTest.manifest',
]

IS_COMPONENT = True

XPI_NAME = 'simple'

USE_LIBS += [
'mozalloc',
'nspr',
'xpcomglue_s',
'xul',
]

0 comments on commit 9461e86

Please sign in to comment.