Bug 1036894 part 1 - Move MAKE_FRAMEWORK, SDK_LIBRARY, SHARED_LIBRARY_NAME and STATIC_LIBRARY_NAME to moz.build. r=gps

At the same time, make the Library data more useful in the build frontend.
This commit is contained in:
Mike Hommey
2014-07-23 13:29:09 +09:00
parent 13488dca0e
commit 374a9e1abc
44 changed files with 274 additions and 201 deletions

View File

@@ -16,8 +16,6 @@ LIBRARY_NAME = 'browsercomps'
IS_COMPONENT = True
FORCE_SHARED_LIB = True
LOCAL_INCLUDES += [
'../about',
'../dirprovider',

View File

@@ -6,7 +6,7 @@ MODULES = stlport
# Force to build a static library, instead of a fake library, without
# installing it in dist/lib.
LIBRARY = $(LIB_PREFIX)$(LIBRARY_NAME).$(LIB_SUFFIX)
NO_EXPAND_LIBS = 1
include $(topsrcdir)/config/rules.mk

View File

@@ -56,6 +56,7 @@ _MOZBUILD_EXTERNAL_VARIABLES := \
JS_MODULES_PATH \
LD_VERSION_SCRIPT \
LIBRARY_NAME \
MAKE_FRAMEWORK \
MODULE \
MSVC_ENABLE_PGO \
NO_DIST_INSTALL \
@@ -63,8 +64,11 @@ _MOZBUILD_EXTERNAL_VARIABLES := \
PROGRAM \
RESOURCE_FILES \
SDK_HEADERS \
SDK_LIBRARY \
SHARED_LIBRARY_NAME \
SIMPLE_PROGRAMS \
SONAME \
STATIC_LIBRARY_NAME \
TEST_DIRS \
TIERS \
TOOL_DIRS \
@@ -335,32 +339,6 @@ ifdef LIBXUL_LIBRARY
ifdef IS_COMPONENT
$(error IS_COMPONENT is set, but is not compatible with LIBXUL_LIBRARY)
endif
ifeq (,$(filter xul xul-%,$(LIBRARY_NAME)))
FORCE_STATIC_LIB=1
endif
endif
# If we are building this component into an extension/xulapp, it cannot be
# statically linked. In the future we may want to add a xulapp meta-component
# build option.
ifdef XPI_NAME
ifdef IS_COMPONENT
FORCE_STATIC_LIB=
FORCE_SHARED_LIB=1
endif
endif
ifndef SHARED_LIBRARY_NAME
ifdef LIBRARY_NAME
SHARED_LIBRARY_NAME=$(LIBRARY_NAME)
endif
endif
ifndef STATIC_LIBRARY_NAME
ifdef LIBRARY_NAME
STATIC_LIBRARY_NAME=$(LIBRARY_NAME)
endif
endif
# PGO on MSVC is opt-in

View File

@@ -137,15 +137,14 @@ endif # ENABLE_TESTS
#
ifndef LIBRARY
ifdef STATIC_LIBRARY_NAME
REAL_LIBRARY := $(LIB_PREFIX)$(STATIC_LIBRARY_NAME).$(LIB_SUFFIX)
ifdef REAL_LIBRARY
# Only build actual library if it is installed in DIST/lib or SDK
ifeq (,$(SDK_LIBRARY)$(DIST_INSTALL)$(NO_EXPAND_LIBS))
LIBRARY := $(REAL_LIBRARY).$(LIBS_DESC_SUFFIX)
else
LIBRARY := $(REAL_LIBRARY) $(REAL_LIBRARY).$(LIBS_DESC_SUFFIX)
endif
endif # STATIC_LIBRARY_NAME
endif # REAL_LIBRARY
endif # LIBRARY
ifndef HOST_LIBRARY
@@ -162,44 +161,12 @@ ifdef LIB_IS_C_ONLY
MKSHLIB = $(MKCSHLIB)
endif
ifneq (,$(filter WINNT,$(OS_ARCH)))
IMPORT_LIBRARY := $(LIB_PREFIX)$(SHARED_LIBRARY_NAME).$(IMPORT_LIB_SUFFIX)
endif
ifdef MAKE_FRAMEWORK
SHARED_LIBRARY := $(SHARED_LIBRARY_NAME)
else
SHARED_LIBRARY := $(DLL_PREFIX)$(SHARED_LIBRARY_NAME)$(DLL_SUFFIX)
endif
EMBED_MANIFEST_AT=2
endif # MKSHLIB
endif # FORCE_SHARED_LIB
endif # LIBRARY
ifdef MKSHLIB
ifdef SONAME
DSO_SONAME = $(DLL_PREFIX)$(SONAME)$(DLL_SUFFIX)
else
DSO_SONAME = $(notdir $@)
endif
endif # MKSHLIB
ifdef FORCE_STATIC_LIB
ifndef FORCE_SHARED_LIB
SHARED_LIBRARY := $(NULL)
DEF_FILE := $(NULL)
IMPORT_LIBRARY := $(NULL)
endif
endif
ifdef FORCE_SHARED_LIB
ifndef FORCE_STATIC_LIB
LIBRARY := $(NULL)
endif
endif
ifeq ($(OS_ARCH),WINNT)
ifndef GNU_CC
@@ -306,7 +273,7 @@ ALL_TRASH = \
$(GARBAGE) $(TARGETS) $(OBJS) $(PROGOBJS) LOGS TAGS a.out \
$(filter-out $(ASFILES),$(OBJS:.$(OBJ_SUFFIX)=.s)) $(OBJS:.$(OBJ_SUFFIX)=.ii) \
$(OBJS:.$(OBJ_SUFFIX)=.i) $(OBJS:.$(OBJ_SUFFIX)=.i_o) \
$(HOST_PROGOBJS) $(HOST_OBJS) $(IMPORT_LIBRARY) $(DEF_FILE)\
$(HOST_PROGOBJS) $(HOST_OBJS) $(IMPORT_LIBRARY) \
$(EXE_DEF_FILE) so_locations _gen _stubs $(wildcard *.res) $(wildcard *.RES) \
$(wildcard *.pdb) $(CODFILE) $(IMPORT_LIBRARY) \
$(SHARED_LIBRARY:$(DLL_SUFFIX)=.exp) $(wildcard *.ilk) \
@@ -653,7 +620,7 @@ ifdef PROGRAM
endif
ifdef SHARED_LIBRARY
$(PYTHON) $(topsrcdir)/build/win32/pgomerge.py \
$(SHARED_LIBRARY_NAME) $(DIST)/bin
$(patsubst $(DLL_PREFIX)%$(DLL_SUFFIX),%,$(SHARED_LIBRARY)) $(DIST)/bin
endif
endif # SHARED_LIBRARY || PROGRAM
endif # WINNT_
@@ -868,7 +835,7 @@ endif
# symlinks back to the originals. The symlinks are a no-op for stabs debugging,
# so no need to conditionalize on OS version or debugging format.
$(SHARED_LIBRARY): $(OBJS) $(DEF_FILE) $(RESFILE) $(LIBRARY) $(EXTRA_DEPS) $(GLOBAL_DEPS)
$(SHARED_LIBRARY): $(OBJS) $(RESFILE) $(LIBRARY) $(EXTRA_DEPS) $(GLOBAL_DEPS)
$(REPORT_BUILD)
ifndef INCREMENTAL_LINKER
$(RM) $@
@@ -877,10 +844,10 @@ ifdef DTRACE_LIB_DEPENDENT
ifndef XP_MACOSX
dtrace -G -C -s $(MOZILLA_DTRACE_SRC) -o $(DTRACE_PROBE_OBJ) $(shell $(EXPAND_LIBS) $(MOZILLA_PROBE_LIBS))
endif
$(EXPAND_MKSHLIB) $(SHLIB_LDSTARTFILE) $(OBJS) $(SUB_SHLOBJS) $(DTRACE_PROBE_OBJ) $(MOZILLA_PROBE_LIBS) $(RESFILE) $(LDFLAGS) $(WRAP_LDFLAGS) $(SHARED_LIBRARY_LIBS) $(EXTRA_DSO_LDOPTS) $(MOZ_GLUE_LDFLAGS) $(OS_LIBS) $(EXTRA_LIBS) $(DEF_FILE) $(SHLIB_LDENDFILE) $(if $(LIB_IS_C_ONLY),,$(STLPORT_LIBS))
$(EXPAND_MKSHLIB) $(SHLIB_LDSTARTFILE) $(OBJS) $(SUB_SHLOBJS) $(DTRACE_PROBE_OBJ) $(MOZILLA_PROBE_LIBS) $(RESFILE) $(LDFLAGS) $(WRAP_LDFLAGS) $(SHARED_LIBRARY_LIBS) $(EXTRA_DSO_LDOPTS) $(MOZ_GLUE_LDFLAGS) $(OS_LIBS) $(EXTRA_LIBS) $(SHLIB_LDENDFILE) $(if $(LIB_IS_C_ONLY),,$(STLPORT_LIBS))
@$(RM) $(DTRACE_PROBE_OBJ)
else # ! DTRACE_LIB_DEPENDENT
$(EXPAND_MKSHLIB) $(SHLIB_LDSTARTFILE) $(OBJS) $(SUB_SHLOBJS) $(RESFILE) $(LDFLAGS) $(WRAP_LDFLAGS) $(SHARED_LIBRARY_LIBS) $(EXTRA_DSO_LDOPTS) $(MOZ_GLUE_LDFLAGS) $(OS_LIBS) $(EXTRA_LIBS) $(DEF_FILE) $(SHLIB_LDENDFILE) $(if $(LIB_IS_C_ONLY),,$(STLPORT_LIBS))
$(EXPAND_MKSHLIB) $(SHLIB_LDSTARTFILE) $(OBJS) $(SUB_SHLOBJS) $(RESFILE) $(LDFLAGS) $(WRAP_LDFLAGS) $(SHARED_LIBRARY_LIBS) $(EXTRA_DSO_LDOPTS) $(MOZ_GLUE_LDFLAGS) $(OS_LIBS) $(EXTRA_LIBS) $(SHLIB_LDENDFILE) $(if $(LIB_IS_C_ONLY),,$(STLPORT_LIBS))
endif # DTRACE_LIB_DEPENDENT
$(call CHECK_BINARY,$@)

View File

@@ -8,7 +8,6 @@
# unicharutil_s which is built in the internal/ subdirectory.
DIST_INSTALL = 1
SDK_LIBRARY = $(LIBRARY)
include $(topsrcdir)/config/rules.mk

View File

@@ -25,6 +25,8 @@ LIBRARY_NAME = 'unicharutil_external_s'
FORCE_STATIC_LIB = True
SDK_LIBRARY = True
LOCAL_INCLUDES += [
'../src',
]

View File

@@ -15,7 +15,6 @@ endif
TOPLEVEL_BUILD := 1
run_for_side_effects := $(shell echo 'MAKE: $(MAKE)')
STATIC_LIBRARY_NAME = js_static
LIBS = $(NSPR_LIBS)
DIST_INSTALL = 1
@@ -49,12 +48,6 @@ endif # JS_HAS_CTYPES
DASH_R = -r
ifneq (,$(filter WINNT,$(OS_ARCH)))
SDK_LIBRARY = $(IMPORT_LIBRARY)
else
SDK_LIBRARY = $(SHARED_LIBRARY)
endif
EXTRA_DSO_LDOPTS += $(NSPR_LIBS)
# Define keyword generator before rules.mk, see bug 323979 comment 50

View File

@@ -428,8 +428,10 @@ HOST_SIMPLE_PROGRAMS += [
if CONFIG['JS_SHARED_LIBRARY']:
FORCE_SHARED_LIB = True
SDK_LIBRARY = True
FORCE_STATIC_LIB = True
STATIC_LIBRARY_NAME = 'js_static'
if CONFIG['MOZ_ETW']:
GENERATED_FILES = [

View File

@@ -16,8 +16,6 @@ LIBRARY_NAME = 'xpctest'
IS_COMPONENT = True
FORCE_SHARED_LIB = True
DEFINES['LIBRARY_FILENAME'] = '%s%s%s' % (
CONFIG['DLL_PREFIX'],
LIBRARY_NAME,

View File

@@ -4,7 +4,6 @@
STLFLAGS =
ifdef MOZ_GLUE_PROGRAM_LDFLAGS
SDK_LIBRARY = $(REAL_LIBRARY)
DIST_INSTALL = 1
endif

View File

@@ -38,6 +38,9 @@ if CONFIG['MOZ_REPLACE_MALLOC']:
LIBRARY_NAME = 'memory'
if CONFIG['MOZ_GLUE_PROGRAM_LDFLAGS']:
SDK_LIBRARY = True
# Keep jemalloc separated when mozglue is statically linked
if CONFIG['MOZ_MEMORY'] and (CONFIG['OS_TARGET'] in ('WINNT', 'Darwin', 'Android') or
CONFIG['MOZ_NATIVE_JEMALLOC']):

View File

@@ -3,7 +3,6 @@
# You can obtain one at http://mozilla.org/MPL/2.0/.
ifdef MOZ_GLUE_PROGRAM_LDFLAGS
SDK_LIBRARY = $(REAL_LIBRARY)
DIST_INSTALL = 1
endif

View File

@@ -40,6 +40,9 @@ LIBRARY_NAME = 'jemalloc'
FORCE_STATIC_LIB = True
if CONFIG['MOZ_GLUE_PROGRAM_LDFLAGS']:
SDK_LIBRARY = True
if CONFIG['_MSC_VER']:
DEFINES['DLLEXPORT'] = True
LOCAL_INCLUDES += ['src/include/msvc_compat']

View File

@@ -4,9 +4,3 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
DIST_INSTALL = 1
ifneq (,$(filter WINNT,$(OS_ARCH)))
SDK_LIBRARY = $(IMPORT_LIBRARY)
else
SDK_LIBRARY = $(SHARED_LIBRARY)
endif

View File

@@ -63,6 +63,7 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk':
FORCE_STATIC_LIB = True
else:
FORCE_SHARED_LIB = True
SDK_LIBRARY = True
# The strndup declaration in string.h is in an ifdef __USE_GNU section
DEFINES['_GNU_SOURCE'] = True

View File

@@ -8,20 +8,6 @@ DIST_INSTALL = 1
# For FORCE_SHARED_LIB
include $(topsrcdir)/config/config.mk
ifneq (1_1,$(MOZ_MEMORY)_$(or $(MOZ_NATIVE_JEMALLOC),$(FORCE_SHARED_LIB)))
ifneq (,$(filter WINNT,$(OS_ARCH)))
SDK_LIBRARY = $(IMPORT_LIBRARY)
else
ifdef FORCE_SHARED_LIB
SDK_LIBRARY = $(SHARED_LIBRARY)
else
SDK_LIBRARY = $(REAL_LIBRARY)
endif
endif
endif
MOZ_GLUE_LDFLAGS = # Don't link against ourselves
SHARED_LIBRARY_LIBS += $(call EXPAND_LIBNAME_PATH,mfbt,$(DEPTH)/mfbt)

View File

@@ -12,6 +12,8 @@ else:
FORCE_SHARED_LIB = False
FORCE_STATIC_LIB = True
SDK_LIBRARY = True
if CONFIG['MOZ_MEMORY'] and (CONFIG['MOZ_NATIVE_JEMALLOC'] or FORCE_SHARED_LIB):
pass
# TODO: SHARED_LIBRARY_LIBS go here

View File

@@ -108,6 +108,18 @@ class ConfigEnvironment(object):
self.substs = dict(substs)
self.topsrcdir = mozpath.normsep(topsrcdir)
self.topobjdir = mozpath.normsep(topobjdir)
self.lib_prefix = self.substs.get('LIB_PREFIX', '')
if 'LIB_SUFFIX' in self.substs:
self.lib_suffix = '.%s' % self.substs['LIB_SUFFIX']
self.dll_prefix = self.substs.get('DLL_PREFIX', '')
self.dll_suffix = self.substs.get('DLL_SUFFIX', '')
if self.substs.get('IMPORT_LIB_SUFFIX'):
self.import_prefix = self.lib_prefix
self.import_suffix = '.%s' % self.substs['IMPORT_LIB_SUFFIX']
else:
self.import_prefix = self.dll_prefix
self.import_suffix = self.dll_suffix
global_defines = [name for name, value in defines
if not name in non_global_defines]
self.substs['ACDEFINES'] = ' '.join(['-D%s=%s' % (name,

View File

@@ -37,7 +37,7 @@ from ..frontend.data import (
JARManifest,
JavaJarData,
JavaScriptModules,
LibraryDefinition,
Library,
LocalInclude,
PerSourceFlag,
Program,
@@ -460,8 +460,8 @@ class RecursiveMakeBackend(CommonBackend):
else:
return
elif isinstance(obj, LibraryDefinition):
self._process_library_definition(obj, backend_file)
elif isinstance(obj, Library):
self._process_library(obj, backend_file)
else:
return
@@ -1099,8 +1099,22 @@ class RecursiveMakeBackend(CommonBackend):
rule.add_commands(['$(call py_action,process_install_manifest,%s)' % ' '.join(args)])
fragment.dump(backend_file.fh, removal_guard=False)
def _process_library_definition(self, libdef, backend_file):
backend_file.write('LIBRARY_NAME = %s\n' % libdef.basename)
def _process_library(self, libdef, backend_file):
backend_file.write('LIBRARY_NAME := %s\n' % libdef.basename)
if libdef.kind in (libdef.STATIC, libdef.STATIC + libdef.SHARED):
backend_file.write('FORCE_STATIC_LIB := 1\n')
backend_file.write('REAL_LIBRARY := %s\n' % libdef.static_name)
if libdef.kind != libdef.STATIC:
backend_file.write('FORCE_SHARED_LIB := 1\n')
backend_file.write('IMPORT_LIBRARY := %s\n' % libdef.import_name)
backend_file.write('SHARED_LIBRARY := %s\n' % libdef.shared_name)
if libdef.kind == libdef.COMPONENT:
backend_file.write('IS_COMPONENT := 1\n')
if libdef.soname:
backend_file.write('DSO_SONAME := %s\n' % libdef.soname)
if libdef.is_sdk:
backend_file.write('SDK_LIBRARY := %s\n' % libdef.import_name)
thisobjdir = libdef.objdir
topobjdir = libdef.topobjdir.replace(os.sep, '/')
for objdir, basename in libdef.static_libraries:

View File

@@ -20,7 +20,7 @@ from mozpack.files import FileFinder
from .common import CommonBackend
from ..frontend.data import (
Defines,
LibraryDefinition,
Library,
LocalInclude,
VariablePassthru,
)
@@ -103,7 +103,7 @@ class VisualStudioBackend(CommonBackend):
s = self._paths_to_sources.setdefault(reldir, set())
s.update(v)
elif isinstance(obj, LibraryDefinition):
elif isinstance(obj, Library):
self._libs_to_paths[obj.basename] = reldir
elif isinstance(obj, Defines):

View File

@@ -360,8 +360,8 @@ class HostSimpleProgram(BaseProgram):
"""Sandbox container object for each program in HOST_SIMPLE_PROGRAMS"""
class LibraryDefinition(SandboxDerived):
"""Partial definition for a library
class Library(SandboxDerived):
"""Sandbox container object for libraries.
The static_libraries member tracks the list of relative directory and
library names of static libraries that are meant to be linked into
@@ -369,14 +369,66 @@ class LibraryDefinition(SandboxDerived):
"""
__slots__ = (
'basename',
'import_name',
'is_sdk',
'shared_name',
'static_name',
'soname',
'static_libraries',
'refcount',
)
def __init__(self, sandbox, basename):
STATIC = 1
SHARED = 2
# STATIC + SHARED = 3
FRAMEWORK = 4
COMPONENT = 5
MAX_TYPE = 6
def __init__(self, sandbox, basename, kind=None, soname=None,
static_name=None, shared_name=None, is_sdk=False):
assert(kind in range(1, self.MAX_TYPE))
SandboxDerived.__init__(self, sandbox)
self.basename = basename
self.kind = kind
self.static_name = self.shared_name = None
if kind in (self.STATIC, self.STATIC + self.SHARED):
self.static_name = static_name or self.basename
if self.static_name:
self.static_name = '%s%s%s' % (
sandbox.config.lib_prefix,
self.static_name,
sandbox.config.lib_suffix
)
self.import_name = self.static_name
if kind != self.STATIC:
self.shared_name = shared_name or self.basename
if self.shared_name:
if kind == self.FRAMEWORK:
self.shared_name = shared_name
self.import_name = shared_name
else:
self.import_name = '%s%s%s' % (
sandbox.config.import_prefix,
self.shared_name,
sandbox.config.import_suffix,
)
self.shared_name = '%s%s%s' % (
sandbox.config.dll_prefix,
self.shared_name,
sandbox.config.dll_suffix,
)
if soname:
self.soname = '%s%s%s' % (
sandbox.config.dll_prefix,
soname,
sandbox.config.dll_suffix,
)
else:
self.soname = self.shared_name
self.is_sdk = is_sdk
self.refcount = 0
self.static_libraries = []

View File

@@ -11,7 +11,9 @@ import traceback
import sys
import time
from collections import OrderedDict
from mach.mixin.logging import LoggingMixin
from mozbuild.util import OrderedDefaultDict
import mozpack.path as mozpath
import manifestparser
@@ -34,7 +36,7 @@ from .data import (
IPDLFile,
JARManifest,
JavaScriptModules,
LibraryDefinition,
Library,
LocalInclude,
PerSourceFlag,
PreprocessedTestWebIDLFile,
@@ -83,7 +85,7 @@ class TreeMetadataEmitter(LoggingMixin):
k = k.encode('ascii')
self.info[k] = v
self._libs = {}
self._libs = OrderedDefaultDict(OrderedDict)
self._final_libs = []
def emit(self, output):
@@ -231,12 +233,9 @@ class TreeMetadataEmitter(LoggingMixin):
'EXTRA_PP_JS_MODULES',
'FAIL_ON_WARNINGS',
'FILES_PER_UNIFIED_FILE',
'FORCE_SHARED_LIB',
'FORCE_STATIC_LIB',
'USE_STATIC_LIBS',
'GENERATED_FILES',
'HOST_LIBRARY_NAME',
'IS_COMPONENT',
'IS_GYP_DIR',
'JS_MODULES_PATH',
'LIBS',
@@ -247,7 +246,6 @@ class TreeMetadataEmitter(LoggingMixin):
'RESFILE',
'RCINCLUDE',
'DEFFILE',
'SDK_LIBRARY',
'WIN32_EXE_LDFLAGS',
'LD_VERSION_SCRIPT',
]
@@ -380,25 +378,107 @@ class TreeMetadataEmitter(LoggingMixin):
if not libname and final_lib:
# If no LIBRARY_NAME is given, create one.
libname = sandbox['RELATIVEDIR'].replace('/', '_')
if libname:
self._libs.setdefault(libname, {})[sandbox['OBJDIR']] = \
LibraryDefinition(sandbox, libname)
if final_lib:
if isinstance(sandbox, MozbuildSandbox) and \
sandbox.get('FORCE_STATIC_LIB'):
raise SandboxValidationError(
'FINAL_LIBRARY implies FORCE_STATIC_LIB', sandbox)
self._final_libs.append((sandbox['OBJDIR'], libname, final_lib))
passthru.variables['FORCE_STATIC_LIB'] = True
static_lib = sandbox.get('FORCE_STATIC_LIB')
shared_lib = sandbox.get('FORCE_SHARED_LIB')
static_name = sandbox.get('STATIC_LIBRARY_NAME')
shared_name = sandbox.get('SHARED_LIBRARY_NAME')
is_framework = sandbox.get('IS_FRAMEWORK')
is_component = sandbox.get('IS_COMPONENT')
soname = sandbox.get('SONAME')
if soname:
if not sandbox.get('FORCE_SHARED_LIB'):
if final_lib:
if isinstance(sandbox, MozbuildSandbox):
if static_lib:
raise SandboxValidationError(
'FINAL_LIBRARY implies FORCE_STATIC_LIB. '
'Please remove the latter.', sandbox)
if shared_lib:
raise SandboxValidationError(
'SONAME applicable only for shared libraries', sandbox)
else:
passthru.variables['SONAME'] = soname
'FINAL_LIBRARY conflicts with FORCE_SHARED_LIB. '
'Please remove one.', sandbox)
if is_framework:
raise SandboxValidationError(
'FINAL_LIBRARY conflicts with IS_FRAMEWORK. '
'Please remove one.', sandbox)
if is_component:
raise SandboxValidationError(
'FINAL_LIBRARY conflicts with IS_COMPONENT. '
'Please remove one.', sandbox)
self._final_libs.append((sandbox['OBJDIR'], libname, final_lib))
static_lib = True
if libname:
args = {
'kind': 0,
}
if is_component:
if shared_lib:
raise SandboxValidationError(
'IS_COMPONENT implies FORCE_SHARED_LIB. '
'Please remove the latter.', sandbox)
if is_framework:
raise SandboxValidationError(
'IS_COMPONENT conflicts with IS_FRAMEWORK. '
'Please remove one.', sandbox)
if static_lib:
raise SandboxValidationError(
'IS_COMPONENT conflicts with FORCE_STATIC_LIB. '
'Please remove one.', sandbox)
shared_lib = True
args['kind'] = Library.COMPONENT
if is_framework:
if shared_lib:
raise SandboxValidationError(
'IS_FRAMEWORK implies FORCE_SHARED_LIB. '
'Please remove the latter.', sandbox)
if static_lib:
raise SandboxValidationError(
'IS_FRAMEWORK conflicts with FORCE_STATIC_LIB. '
'Please remove one.', sandbox)
if soname:
raise SandboxValidationError(
'IS_FRAMEWORK conflicts with SONAME. '
'Please remove one.', sandbox)
shared_lib = True
args['kind'] = Library.FRAMEWORK
if static_name:
if not static_lib:
raise SandboxValidationError(
'STATIC_LIBRARY_NAME requires FORCE_STATIC_LIB', sandbox)
args['static_name'] = static_name
if shared_name:
if not shared_lib:
raise SandboxValidationError(
'SHARED_LIBRARY_NAME requires FORCE_SHARED_LIB', sandbox)
args['shared_name'] = shared_name
if soname:
if not shared_lib:
raise SandboxValidationError(
'SONAME requires FORCE_SHARED_LIB', sandbox)
args['soname'] = soname
if not static_lib and not shared_lib:
static_lib = True
if not args['kind']:
if static_lib:
args['kind'] += Library.STATIC
if shared_lib:
args['kind'] += Library.SHARED
if sandbox.get('SDK_LIBRARY'):
args['is_sdk'] = True
self._libs[libname][sandbox['OBJDIR']] = \
Library(sandbox, libname, **args)
# While there are multiple test manifests, the behavior is very similar
# across them. We enforce this by having common handling of all

View File

@@ -273,6 +273,8 @@ VARIABLES = {
'IS_COMPONENT': (bool, bool,
"""Whether the library contains a binary XPCOM component manifest.
Implies FORCE_SHARED_LIB.
""", None),
'PARALLEL_DIRS': (list, list,
@@ -306,8 +308,9 @@ VARIABLES = {
""", None),
'LIBRARY_NAME': (unicode, unicode,
"""The name of the library generated for a directory.
"""The code name of the library generated for a directory.
By default STATIC_LIBRARY_NAME and SHARED_LIBRARY_NAME take this name.
In ``example/components/moz.build``,::
LIBRARY_NAME = 'xpcomsample'
@@ -316,6 +319,27 @@ VARIABLES = {
``example/components/xpcomsample.lib`` on Windows.
""", 'binaries'),
'SHARED_LIBRARY_NAME': (unicode, unicode,
"""The name of the static library generated for a directory, if it needs to
differ from the library code name.
Implies FORCE_SHARED_LIB.
""", None),
'IS_FRAMEWORK': (bool, bool,
"""Whether the library to build should be built as a framework on OSX.
This implies the name of the library won't be prefixed nor suffixed.
Implies FORCE_SHARED_LIB.
""", None),
'STATIC_LIBRARY_NAME': (unicode, unicode,
"""The name of the static library generated for a directory, if it needs to
differ from the library code name.
Implies FORCE_STATIC_LIB.
""", None),
'LIBS': (StrictOrderingOnAppendList, list,
"""Linker libraries and flags.
@@ -395,11 +419,10 @@ VARIABLES = {
RESOURCE_FILES.fonts['baz.res.in'].preprocess = True
""", None),
'SDK_LIBRARY': (StrictOrderingOnAppendList, list,
"""Elements of the distributed SDK.
'SDK_LIBRARY': (bool, bool,
"""Whether the library built in the directory is part of the SDK.
Files on this list will be copied into ``SDK_LIB_DIR``
(``$DIST/sdk/lib``).
The library will be copied into ``SDK_LIB_DIR`` (``$DIST/sdk/lib``).
""", None),
'SIMPLE_PROGRAMS': (StrictOrderingOnAppendList, list,

View File

@@ -21,8 +21,6 @@ LIBS = ['bar.lib', 'foo.lib']
OS_LIBS = ['foo.so', '-l123', 'bar.a']
SDK_LIBRARY = ['bar.sdk', 'foo.sdk']
SOURCES += ['bar.c', 'foo.c']
SOURCES += ['bar.mm', 'foo.mm']

View File

@@ -310,10 +310,6 @@ class TestRecursiveMakeBackend(BackendTester):
'OS_LIBS += -l123',
'OS_LIBS += bar.a',
],
'SDK_LIBRARY': [
'SDK_LIBRARY += bar.sdk',
'SDK_LIBRARY += foo.sdk',
],
'SSRCS': [
'SSRCS += baz.S',
'SSRCS += foo.S',

View File

@@ -21,8 +21,6 @@ LIBS += ['fans.lib', 'tans.lib']
OS_LIBS += ['foo.so', '-l123', 'aaa.a']
SDK_LIBRARY += ['fans.sdk', 'tans.sdk']
SOURCES += ['fans.c', 'tans.c']
SOURCES += ['fans.mm', 'tans.mm']
@@ -34,8 +32,6 @@ MSVC_ENABLE_PGO = True
NO_DIST_INSTALL = True
FORCE_SHARED_LIB = True
IS_COMPONENT = True
NO_VISIBILITY_FLAGS = True
DELAYLOAD_DLLS = ['foo.dll', 'bar.dll']

View File

@@ -165,16 +165,13 @@ class TestEmitterBasic(unittest.TestCase):
EXTRA_JS_MODULES=['bar.jsm', 'foo.jsm'],
EXTRA_PP_JS_MODULES=['bar.pp.jsm', 'foo.pp.jsm'],
FAIL_ON_WARNINGS=True,
FORCE_SHARED_LIB=True,
HOST_CPPSRCS=['fans.cpp', 'tans.cpp'],
HOST_CSRCS=['fans.c', 'tans.c'],
HOST_LIBRARY_NAME='host_fans',
IS_COMPONENT=True,
LIBS=['fans.lib', 'tans.lib'],
MSVC_ENABLE_PGO=True,
NO_DIST_INSTALL=True,
OS_LIBS=['foo.so', '-l123', 'aaa.a'],
SDK_LIBRARY=['fans.sdk', 'tans.sdk'],
SSRCS=['bans.S', 'fans.S'],
VISIBILITY_FLAGS='',
DELAYLOAD_LDFLAGS=['-DELAYLOAD:foo.dll', '-DELAYLOAD:bar.dll'],

View File

@@ -16,6 +16,7 @@ import stat
import sys
import time
from collections import OrderedDict
from StringIO import StringIO
@@ -667,3 +668,17 @@ def shell_quote(s):
# be closed, an escaped single quote added, and reopened.
t = type(s)
return t("'%s'") % s.replace(t("'"), t("'\\''"))
class OrderedDefaultDict(OrderedDict):
'''A combination of OrderedDict and defaultdict.'''
def __init__(self, default_factory, *args, **kwargs):
OrderedDict.__init__(self, *args, **kwargs)
self._default_factory = default_factory
def __getitem__(self, key):
try:
return OrderedDict.__getitem__(self, key)
except KeyError:
value = self[key] = self._default_factory()
return value

View File

@@ -361,12 +361,6 @@ GARBAGE += \
endif # GCC_USE_GNU_LD
endif # WINNT
ifneq (,$(filter WINNT,$(OS_ARCH)))
SDK_LIBRARY = $(IMPORT_LIBRARY)
else
SDK_LIBRARY = $(SHARED_LIBRARY)
endif
endif # MOZ_FOLD_LIBS
include $(topsrcdir)/config/rules.mk

View File

@@ -9,6 +9,7 @@ if CONFIG['MOZ_FOLD_LIBS']:
LIBRARY_NAME = 'nss3'
FORCE_SHARED_LIB = True
SDK_LIBRARY = True
if CONFIG['OS_TARGET'] == 'WINNT':
DEFFILE = 'nss3.def'

View File

@@ -9,12 +9,6 @@ ifeq (WINNT_1,$(OS_TARGET)_$(MOZ_PROFILE_USE))
LD := $(PYTHON) $(topsrcdir)/build/link.py $(DEPTH)/toolkit/library/linker-vsize $(LD)
endif
ifneq (,$(filter WINNT,$(OS_ARCH)))
SDK_LIBRARY = $(IMPORT_LIBRARY)
else
SDK_LIBRARY = $(SHARED_LIBRARY)
endif
include $(topsrcdir)/config/rules.mk
ifdef COMPILE_ENVIRONMENT

View File

@@ -5,5 +5,6 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
LIBRARY_NAME = 'xul-shared'
SDK_LIBRARY = True
include('../libxul.mozbuild')

View File

@@ -2,18 +2,6 @@
# 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/.
ifeq ($(MOZ_WIDGET_TOOLKIT),cocoa)
# This is going to be a framework named "XUL", not an ordinary library named
# "libxul.dylib"
SHARED_LIBRARY_NAME=XUL
# Setting MAKE_FRAMEWORK makes DLL_PREFIX and DLL_SUFFIX be ignored when
# setting SHARED_LIBRARY; we need to leave DLL_PREFIX and DLL_SUFFIX
# as-is so that dependencies of the form -ltracemalloc still work.
MAKE_FRAMEWORK=1
else
SHARED_LIBRARY_NAME=xul
endif
SHARED_LIBRARY_LIBS += $(call EXPAND_LIBNAME_PATH,xul,$(DEPTH)/toolkit/library)
EXTRA_DEPS += $(topsrcdir)/toolkit/library/libxul.mk
@@ -36,7 +24,7 @@ EXTRA_DSO_LDOPTS += -Wl,-version-script,symverscript
symverscript: $(topsrcdir)/toolkit/library/symverscript.in
$(call py_action,preprocessor, \
-DVERSION='$(SHARED_LIBRARY_NAME)$(MOZILLA_SYMBOLVERSION)' $< -o $@)
-DVERSION='xul$(MOZILLA_SYMBOLVERSION)' $< -o $@)
EXTRA_DEPS += symverscript
endif

View File

@@ -6,7 +6,15 @@
MSVC_ENABLE_PGO = True
FORCE_SHARED_LIB = True
if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa':
# This is going to be a framework named "XUL", not an ordinary library named
# "libxul.dylib"
SHARED_LIBRARY_NAME = 'XUL'
IS_FRAMEWORK = True
else:
SHARED_LIBRARY_NAME = 'xul'
FORCE_SHARED_LIB = True
DELAYLOAD_DLLS += [
'comdlg32.dll',

View File

@@ -13,5 +13,3 @@ SOURCES += [
LIBRARY_NAME = 'dbusservice'
IS_COMPONENT = True
FORCE_SHARED_LIB = True

View File

@@ -29,8 +29,6 @@ LIBRARY_NAME = 'mozgnome'
FAIL_ON_WARNINGS = True
IS_COMPONENT = True
FORCE_SHARED_LIB = True
LOCAL_INCLUDES += [
'/toolkit/components/build/',
]

View File

@@ -97,9 +97,7 @@ UNIFIED_SOURCES += [
LIBRARY_NAME = 'xpcomglue_s'
SDK_LIBRARY = [
"%s%s.%s" % (CONFIG['LIB_PREFIX'], 'xpcomglue_s', CONFIG['LIB_SUFFIX']),
]
SDK_LIBRARY = True
FORCE_STATIC_LIB = True

View File

@@ -16,9 +16,7 @@ UNIFIED_SOURCES += [
LIBRARY_NAME = 'xpcomglue_s_nomozalloc'
SDK_LIBRARY = [
"%s%s.%s" % (CONFIG['LIB_PREFIX'], 'xpcomglue_s_nomozalloc', CONFIG['LIB_SUFFIX']),
]
SDK_LIBRARY = True
# we don't want the shared lib, but we want to force the creation of a static lib.
FORCE_STATIC_LIB = True

View File

@@ -24,9 +24,7 @@ EXPORTS += [
'nsXPCOMGlue.h',
]
SDK_LIBRARY = [
"%s%s.%s" % (CONFIG['LIB_PREFIX'], 'xpcomglue', CONFIG['LIB_SUFFIX']),
]
SDK_LIBRARY = True
FORCE_STATIC_LIB = True

View File

@@ -15,9 +15,7 @@ SOURCES += [
LIBRARY_NAME = 'xpcomglue_staticruntime'
SDK_LIBRARY = [
"%s%s.%s" % (CONFIG['LIB_PREFIX'], 'xpcomglue_staticruntime', CONFIG['LIB_SUFFIX']),
]
SDK_LIBRARY = True
# create a static lib
FORCE_STATIC_LIB = True

View File

@@ -16,9 +16,7 @@ UNIFIED_SOURCES += [
LIBRARY_NAME = 'xpcomglue_staticruntime_s'
SDK_LIBRARY = [
"%s%s.%s" % (CONFIG['LIB_PREFIX'], 'xpcomglue_staticruntime_s', CONFIG['LIB_SUFFIX']),
]
SDK_LIBRARY = True
FORCE_STATIC_LIB = True

View File

@@ -14,8 +14,6 @@ LIBRARY_NAME = 'test656331'
IS_COMPONENT = True
FORCE_SHARED_LIB = True
DEFINES['LIBRARY_FILENAME'] = '%s%s%s' % (
CONFIG['DLL_PREFIX'],
LIBRARY_NAME,

View File

@@ -14,8 +14,6 @@ LIBRARY_NAME = 'testcomponent'
IS_COMPONENT = True
FORCE_SHARED_LIB = True
DEFINES['LIBRARY_FILENAME'] = '%s%s%s' % (
CONFIG['DLL_PREFIX'],
LIBRARY_NAME,

View File

@@ -14,8 +14,6 @@ LIBRARY_NAME = 'testcompnoaslr'
IS_COMPONENT = True
FORCE_SHARED_LIB = True
DEFINES['LIBRARY_FILENAME'] = '%s%s%s' % (
CONFIG['DLL_PREFIX'],
LIBRARY_NAME,