gecko/toolkit/library/moz.build
Mike Hommey d667f4bb59 Bug 1077148 part 4 - Add and use new moz.build templates for Gecko programs and libraries. r=gps
There are, sadly, many combinations of linkage in use throughout the tree.
The main differentiator, though, is between program/libraries related to
Gecko or not. Kind of. Some need mozglue, some don't. Some need dependent
linkage, some standalone.

Anyways, these new templates remove the need to manually define the
right dependencies against xpcomglue, nspr, mozalloc and mozglue
in most cases.

Places that build programs and were resetting MOZ_GLUE_PROGRAM_LDFLAGS
or that build libraries and were resetting MOZ_GLUE_LDFLAGS can now
just not use those Gecko-specific templates.
2014-10-30 13:06:12 +09:00

383 lines
8.6 KiB
Python

# -*- 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 Libxul(name):
MSVC_ENABLE_PGO = True
if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa':
# This is going to be a framework named "XUL", not an ordinary library named
# "libxul.dylib"
GeckoFramework(name, linkage=None)
SHARED_LIBRARY_NAME = 'XUL'
else:
GeckoSharedLibrary(name, linkage=None)
SHARED_LIBRARY_NAME = 'xul'
DELAYLOAD_DLLS += [
'comdlg32.dll',
'dbghelp.dll',
'psapi.dll',
'rasapi32.dll',
'rasdlg.dll',
'secur32.dll',
'wininet.dll',
'winspool.drv'
]
if CONFIG['MOZ_METRO']:
DELAYLOAD_DLLS += [
'API-MS-WIN-CORE-WINRT-L' + CONFIG['CRTEXPDLLVERSION'] + '.DLL',
'API-MS-WIN-CORE-WINRT-STRING-L' + CONFIG['CRTEXPDLLVERSION'] + '.DLL',
'uiautomationcore.dll'
]
if CONFIG['ACCESSIBILITY']:
DELAYLOAD_DLLS += ['oleacc.dll']
if CONFIG['MOZ_WEBRTC']:
DELAYLOAD_DLLS += ['msdmo.dll']
if CONFIG['OS_ARCH'] == 'WINNT' and not CONFIG['GNU_CC']:
LOCAL_INCLUDES += [
'/widget/windows',
'/xpcom/base',
]
# config/version.mk says $(srcdir)/$(RCINCLUDE), and this needs to
# be valid in both toolkit/library and toolkit/library/gtest.
# Eventually, the make backend would do its own path canonicalization
# and config/version.mk would lift the $(srcdir)
RCINCLUDE = '$(DEPTH)/toolkit/library/xulrunner.rc'
LIBRARY_DEFINES['MOZILLA_INTERNAL_API'] = True
LIBRARY_DEFINES['IMPL_LIBXUL'] = True
if not CONFIG['JS_SHARED_LIBRARY']:
LIBRARY_DEFINES['STATIC_EXPORTABLE_JS_API'] = True
Libxul('xul')
SDK_LIBRARY = True
FORCE_STATIC_LIB = True
STATIC_LIBRARY_NAME = 'xul_s'
SOURCES += [
'StaticXULComponentsStart.cpp',
]
MSVC_ENABLE_PGO = True
# This, combined with the fact the file is first, makes the start pointer
# it contains first in Windows PGO builds.
SOURCES['StaticXULComponentsStart.cpp'].no_pgo = True
# Don't let LTO reorder StaticXULComponentsStart.o.
if '-flto' in CONFIG['OS_CXXFLAGS']:
SOURCES['StaticXULComponentsStart.cpp'].flags += ['-fno-lto']
if CONFIG['OS_ARCH'] == 'WINNT':
SOURCES += [
'nsDllMain.cpp',
]
LOCAL_INCLUDES += [
'/config',
# need widget/windows for resource.h (included from widget.rc)
'/widget/windows',
]
if CONFIG['OS_ARCH'] == 'WINNT' and not CONFIG['GNU_CC']:
LOCAL_INCLUDES += [
'/xpcom/base',
]
FAIL_ON_WARNINGS = True
DIRS += ['gtest']
# js needs to come after xul for now, because it is an archive and its content
# is discarded when it comes first.
USE_LIBS += [
'js',
]
if CONFIG['MOZ_SANDBOX'] and CONFIG['OS_ARCH'] == 'WINNT':
USE_LIBS += [
'sandboxbroker',
]
if CONFIG['MOZ_DMD']:
USE_LIBS += [
'dmd',
]
USE_LIBS += [
'gkmedias',
'mozalloc',
'nspr',
'nss',
'sqlite',
'zlib',
]
if CONFIG['USE_ICU']:
USE_LIBS += [
'icu',
]
if CONFIG['MOZ_WIDGET_GTK'] and CONFIG['MOZ_ENABLE_GTK3']:
USE_LIBS += [
'mozgtk_stub',
]
if CONFIG['MOZ_JPROF']:
USE_LIBS += [
'jprof',
]
if CONFIG['MOZ_WIDGET_GTK'] or CONFIG['MOZ_WIDGET_TOOLKIT'] == 'qt' or \
CONFIG['MOZ_TREE_FREETYPE']:
USE_LIBS += [
'freetype',
]
if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa':
CXXFLAGS += CONFIG['TK_CFLAGS']
if CONFIG['MOZ_WEBRTC']:
if CONFIG['OS_TARGET'] == 'WINNT':
OS_LIBS += [
'secur32',
'crypt32',
'iphlpapi',
'strmiids',
'dmoguids',
'wmcodecdspuuid',
'amstrmid',
'msdmo',
'wininet',
]
if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa':
OS_LIBS += [
'-framework OpenGL',
'-framework SystemConfiguration',
'-framework QTKit',
'-framework IOKit',
'-F%s' % CONFIG['MACOS_PRIVATE_FRAMEWORKS_DIR'],
'-framework CoreUI',
'cups',
]
if CONFIG['MOZ_WMF']:
OS_LIBS += [
'mfuuid',
'wmcodecdspuuid',
'strmiids',
]
if CONFIG['MOZ_DIRECTSHOW']:
OS_LIBS += [
'dmoguids',
'wmcodecdspuuid',
'strmiids',
'msdmo',
]
if CONFIG['OS_ARCH'] == 'FreeBSD':
OS_LIBS += [
'util',
]
if CONFIG['OS_ARCH'] == 'WINNT':
OS_LIBS += [
'shell32',
'ole32',
'version',
'winspool',
]
if CONFIG['MOZ_B2G_BT_BLUEZ'] and CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk':
OS_LIBS += [
'dbus',
]
if CONFIG['MOZ_B2G_CAMERA']:
OS_LIBS += [
'stagefright',
'stagefright_omx',
]
if CONFIG['OS_ARCH'] == 'Linux' and CONFIG['OS_TARGET'] != 'Android':
OS_LIBS += [
'rt',
]
OS_LIBS += CONFIG['MOZ_CAIRO_OSLIBS']
OS_LIBS += CONFIG['MOZ_WEBRTC_X11_LIBS']
if CONFIG['MOZ_NATIVE_JPEG']:
OS_LIBS += CONFIG['MOZ_JPEG_LIBS']
if CONFIG['MOZ_NATIVE_PNG']:
OS_LIBS += CONFIG['MOZ_PNG_LIBS']
if CONFIG['MOZ_NATIVE_HUNSPELL']:
OS_LIBS += CONFIG['MOZ_HUNSPELL_LIBS']
if CONFIG['MOZ_NATIVE_LIBEVENT']:
OS_LIBS += CONFIG['MOZ_LIBEVENT_LIBS']
if CONFIG['MOZ_NATIVE_LIBVPX']:
OS_LIBS += CONFIG['MOZ_LIBVPX_LIBS']
if not CONFIG['MOZ_TREE_PIXMAN']:
OS_LIBS += CONFIG['MOZ_PIXMAN_LIBS']
if CONFIG['MOZ_ALSA']:
OS_LIBS += CONFIG['MOZ_ALSA_LIBS']
if CONFIG['HAVE_CLOCK_MONOTONIC']:
OS_LIBS += CONFIG['REALTIME_LIBS']
if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'android':
OS_LIBS += [
'GLESv2',
]
if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk':
OS_LIBS += [
'ui',
'media',
'hardware_legacy',
'hardware',
'utils',
'cutils',
'sysutils',
'camera_client',
'sensorservice',
'stagefright',
'stagefright_foundation',
'stagefright_omx',
'binder',
'gui',
'mtp',
]
if 'rtsp' in CONFIG['NECKO_PROTOCOLS']:
OS_LIBS += [
'stagefright_foundation',
]
OS_LIBS += CONFIG['ICONV_LIBS']
if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa':
OS_LIBS += CONFIG['TK_LIBS']
if CONFIG['OS_ARCH'] == 'OpenBSD':
OS_LIBS += [
'sndio',
]
if CONFIG['MOZ_ENABLE_DBUS']:
OS_LIBS += CONFIG['MOZ_DBUS_GLIB_LIBS']
if CONFIG['MOZ_WIDGET_GTK']:
if CONFIG['MOZ_ENABLE_GTK3']:
OS_LIBS += [l for l in CONFIG['TK_LIBS']
if l not in ('-lgtk-3', '-lgdk-3')]
else:
OS_LIBS += CONFIG['TK_LIBS']
OS_LIBS += CONFIG['XLDFLAGS']
OS_LIBS += CONFIG['XLIBS']
OS_LIBS += CONFIG['XEXT_LIBS']
OS_LIBS += CONFIG['MOZ_PANGO_LIBS']
OS_LIBS += CONFIG['XT_LIBS']
OS_LIBS += [
'gthread-2.0',
]
if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'qt':
OS_LIBS += CONFIG['XLDFLAGS']
OS_LIBS += CONFIG['XLIBS']
OS_LIBS += CONFIG['XT_LIBS']
OS_LIBS += CONFIG['MOZ_QT_LIBS']
OS_LIBS += CONFIG['MOZ_PANGO_LIBS']
if CONFIG['MOZ_ENABLE_STARTUP_NOTIFICATION']:
OS_LIBS += CONFIG['MOZ_STARTUP_NOTIFICATION_LIBS']
if CONFIG['MOZ_ENABLE_LIBPROXY']:
OS_LIBS += CONFIG['MOZ_LIBPROXY_LIBS']
if CONFIG['OS_ARCH'] == 'SunOS':
OS_LIBS += [
'elf',
]
if CONFIG['GNU_CC']:
OS_LIBS += [
'demangle',
]
if CONFIG['OS_ARCH'] == 'FreeBSD':
OS_LIBS += [
'util',
]
if CONFIG['OS_ARCH'] == 'WINNT':
OS_LIBS += [
'shell32',
'ole32',
'version',
'winspool',
'comdlg32',
'imm32',
'msimg32',
'shlwapi',
'psapi',
'ws2_32',
'dbghelp',
'rasapi32',
'rasdlg',
'iphlpapi',
'uxtheme',
'setupapi',
'secur32',
'sensorsapi',
'portabledeviceguids',
'windowscodecs',
'wininet',
'wbemuuid',
'wintrust',
'wtsapi32',
]
if CONFIG['ACCESSIBILITY']:
OS_LIBS += [
'oleacc',
]
if CONFIG['MOZ_METRO']:
OS_LIBS += [
'uiautomationcore',
'runtimeobject',
]
if CONFIG['MOZ_ENABLE_QT']:
OS_LIBS += CONFIG['XEXT_LIBS']
if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa' and CONFIG['MOZ_GSTREAMER']:
OS_LIBS += CONFIG['GSTREAMER_LIBS']
if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows':
OS_LIBS += [
'usp10',
'oleaut32',
]
# This needs to be last
USE_LIBS += ['StaticXULComponentsEnd']