gecko-dev/toolkit/library/moz.build

376 строки
10 KiB
Python

# -*- 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 Libxul_defines():
LIBRARY_DEFINES['MOZILLA_INTERNAL_API'] = True
LIBRARY_DEFINES['IMPL_LIBXUL'] = True
if not CONFIG['JS_SHARED_LIBRARY']:
LIBRARY_DEFINES['STATIC_EXPORTABLE_JS_API'] = True
@template
def Libxul(name, output_category=None):
if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('cocoa', 'uikit'):
# This is going to be a framework named "XUL", not an ordinary library named
# "libxul.dylib"
GeckoFramework(name, output_category=output_category, linkage=None)
SHARED_LIBRARY_NAME = 'XUL'
else:
GeckoSharedLibrary(name, output_category=output_category, linkage=None)
SHARED_LIBRARY_NAME = 'xul'
DELAYLOAD_DLLS += [
'comdlg32.dll',
'hid.dll',
'msimg32.dll',
'netapi32.dll',
'secur32.dll',
'wininet.dll',
'winspool.drv'
]
if CONFIG['ACCESSIBILITY']:
DELAYLOAD_DLLS += ['oleacc.dll']
if CONFIG['MOZ_WEBRTC']:
DELAYLOAD_DLLS += ['msdmo.dll']
if CONFIG['OS_ARCH'] == 'WINNT':
DELAYLOAD_DLLS += [
'api-ms-win-core-winrt-l1-1-0.dll',
'api-ms-win-core-winrt-string-l1-1-0.dll',
]
if CONFIG['OS_ARCH'] == 'WINNT' and CONFIG['ACCESSIBILITY']:
LOCAL_INCLUDES += ['!/accessible/interfaces/gecko/']
if CONFIG['OS_ARCH'] == 'WINNT' and CONFIG['CC_TYPE'] not in ('clang', 'gcc'):
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'
# BFD ld doesn't create multiple PT_LOADs as usual when an unknown section
# exists. Using an implicit linker script to make it fold that section in
# .data.rel.ro makes it create multiple PT_LOADs. That implicit linker
# script however makes gold misbehave, first because it doesn't like that
# the linker script is given after crtbegin.o, and even past that, replaces
# the default section rules with those from the script instead of
# supplementing them. Which leads to a lib with a huge load of sections.
if CONFIG['OS_TARGET'] not in ('OpenBSD', 'WINNT') and \
CONFIG['LINKER_KIND'] == 'bfd':
LDFLAGS += [TOPSRCDIR + '/toolkit/library/StaticXULComponents.ld']
Libxul_defines()
if CONFIG['MOZ_NEEDS_LIBATOMIC']:
OS_LIBS += ['atomic']
# This option should go away in bug 1290972, but we need to wait until
# Rust 1.12 has been released.
# We're also linking against libresolv to solve bug 1367932.
if CONFIG['OS_ARCH'] == 'Darwin':
LDFLAGS += ['-lresolv']
if CONFIG['MOZ_DEBUG_SYMBOLS'] and CONFIG['CC_TYPE'] in ('msvc', 'clang-cl'):
LDFLAGS += ['-NATVIS:%s/toolkit/library/gecko.natvis' % TOPSRCDIR]
Libxul('xul')
FORCE_STATIC_LIB = True
STATIC_LIBRARY_NAME = 'xul_s'
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 CONFIG['CC_TYPE'] not in ('clang', 'gcc'):
LOCAL_INCLUDES += [
'/xpcom/base',
]
DIRS += ['gtest']
if CONFIG['OS_ARCH'] == 'WINNT':
DIRS += ['dummydll']
# 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',
]
USE_LIBS += [
'lgpllibs',
'nspr',
'nss',
'psshparser',
'sqlite',
'zlib',
]
if CONFIG['USE_ICU']:
USE_LIBS += [
'icu',
]
if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gtk3':
USE_LIBS += [
'mozgtk_stub',
]
if CONFIG['MOZ_WAYLAND']:
USE_LIBS += [
'mozwayland',
]
if CONFIG['MOZ_JPROF']:
USE_LIBS += [
'jprof',
]
if 'gtk' in CONFIG['MOZ_WIDGET_TOOLKIT'] 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',
'iphlpapi',
'strmiids',
'dmoguids',
'wmcodecdspuuid',
'amstrmid',
'msdmo',
'wininet',
]
if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa':
OS_LIBS += [
'-framework OpenGL',
'-framework SystemConfiguration',
'-framework AVFoundation',
'-framework CoreMedia',
'-framework IOKit',
'-F%s' % CONFIG['MACOS_PRIVATE_FRAMEWORKS_DIR'],
'-framework CoreUI',
'-framework CoreSymbolication',
'cups',
]
if CONFIG['MOZ_WMF']:
OS_LIBS += [
'mfuuid',
'wmcodecdspuuid',
'strmiids',
]
if CONFIG['OS_ARCH'] == 'FreeBSD':
OS_LIBS += [
'util',
]
if CONFIG['OS_ARCH'] == 'WINNT':
OS_LIBS += [
'crypt32',
'shell32',
'ole32',
'version',
'winspool',
]
if CONFIG['OS_ARCH'] == 'Linux' and CONFIG['OS_TARGET'] != 'Android':
OS_LIBS += [
'rt',
]
if CONFIG['MOZ_ANDROID_GOOGLE_VR']:
OS_LIBS += [
'-L%s' % CONFIG['MOZ_ANDROID_GOOGLE_VR_LIBS'],
'-lgvr',
]
OS_LIBS += CONFIG['MOZ_CAIRO_OSLIBS']
OS_LIBS += CONFIG['MOZ_WEBRTC_X11_LIBS']
if CONFIG['MOZ_LIB_SECRET']:
OS_LIBS += CONFIG['MOZ_LIB_SECRET_LIBS']
if CONFIG['MOZ_SYSTEM_JPEG']:
OS_LIBS += CONFIG['MOZ_JPEG_LIBS']
if CONFIG['MOZ_SYSTEM_PNG']:
OS_LIBS += CONFIG['MOZ_PNG_LIBS']
if CONFIG['MOZ_SYSTEM_WEBP']:
OS_LIBS += CONFIG['MOZ_WEBP_LIBS']
if CONFIG['MOZ_SYSTEM_LIBEVENT']:
OS_LIBS += CONFIG['MOZ_LIBEVENT_LIBS']
if CONFIG['MOZ_SYSTEM_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']
OS_LIBS += CONFIG['ICONV_LIBS']
if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('cocoa', 'uikit'):
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 'gtk' in CONFIG['MOZ_WIDGET_TOOLKIT']:
if CONFIG['MOZ_WIDGET_TOOLKIT'] == '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_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['CC_TYPE'] in ('clang', 'gcc'):
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',
'netapi32',
'shlwapi',
'ws2_32',
'dwmapi',
'iphlpapi',
'uxtheme',
'setupapi',
'secur32',
'sensorsapi',
'portabledeviceguids',
'wininet',
'wbemuuid',
'wintrust',
'wtsapi32',
'locationapi',
'sapi',
'dxguid',
'dhcpcsvc',
]
if CONFIG['CC_TYPE'] in ('msvc', 'clang-cl'):
OS_LIBS += [
'runtimeobject',
]
if CONFIG['ACCESSIBILITY']:
OS_LIBS += [
'oleacc',
]
if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows':
OS_LIBS += [
'usp10',
'oleaut32',
]
if CONFIG['COMPILE_ENVIRONMENT']:
if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('cocoa', 'uikit'):
full_libname = SHARED_LIBRARY_NAME
else:
full_libname = '%s%s%s' % (
CONFIG['DLL_PREFIX'],
LIBRARY_NAME,
CONFIG['DLL_SUFFIX']
)
GENERATED_FILES += [('dependentlibs.list', 'dependentlibs.list.gtest')]
dep_libs_list = GENERATED_FILES[('dependentlibs.list', 'dependentlibs.list.gtest')]
dep_libs_list.script = 'dependentlibs.py:gen_list'
dep_libs_list.inputs = [
'!%s' % full_libname,
]
FINAL_TARGET_FILES += ['!dependentlibs.list', '!dependentlibs.list.gtest']
if CONFIG['OS_ARCH'] == 'Linux' and CONFIG['OS_TARGET'] != 'Android':
GENERATED_FILES += ['symverscript']
GENERATED_FILES['symverscript'].script = '/build/gen_symverscript.py'
GENERATED_FILES['symverscript'].inputs = ['symverscript.in']
GENERATED_FILES['symverscript'].flags = [
'xul%s' % CONFIG['MOZILLA_SYMBOLVERSION']
]
SYMBOLS_FILE = '!symverscript'
# Generate GDB pretty printer-autoload files only on Linux. OSX's GDB is
# too old to support Python pretty-printers; if this changes, we could
# make this 'ifdef GNU_CC'.
if CONFIG['OS_ARCH'] == 'Linux':
# Create a GDB Python auto-load file alongside the libxul shared library
# in the build directory.
DEFINES['topsrcdir'] = TOPSRCDIR
OBJDIR_PP_FILES.toolkit.library += ['libxul.so-gdb.py.in']
# This library is entirely composed of Rust code, and needs to come after
# all the C++ code so any possible C++ -> Rust calls can be resolved.
USE_LIBS += ['gkrust']