diff --git a/js/src/Makefile.in b/js/src/Makefile.in index c9e3acc896e5..00030759faca 100644 --- a/js/src/Makefile.in +++ b/js/src/Makefile.in @@ -33,13 +33,6 @@ FORCE_SHARED_LIB = 1 endif DIST_INSTALL = 1 -############################################### -# BEGIN include sources for low-level code shared with mfbt -# -MFBT_ROOT = $(srcdir)/../../mfbt -VPATH += $(MFBT_ROOT) -include $(MFBT_ROOT)/exported_headers.mk - VPATH += \ $(srcdir) \ $(srcdir)/builtin \ @@ -133,8 +126,6 @@ endif endif # JS_HAS_CTYPES -LOCAL_INCLUDES += -I$(MFBT_ROOT)/double-conversion - # PerfMeasurement is available regardless of low-level support for it; # it just doesn't necessarily do anything useful. There is one # implementation source file per supported operating system, plus a stub @@ -149,13 +140,6 @@ else SDK_LIBRARY = $(SHARED_LIBRARY) endif -ifeq (,$(MOZ_GLUE_PROGRAM_LDFLAGS)) -# When building standalone, we need to include mfbt sources, and to declare -# "exported" mfbt symbols on its behalf when we use its headers. -include $(MFBT_ROOT)/sources.mk -DEFINES += -DIMPL_MFBT -endif - EXTRA_DSO_LDOPTS += $(NSPR_LIBS) # Define keyword generator before rules.mk, see bug 323979 comment 50 diff --git a/js/src/configure.in b/js/src/configure.in index 3094c8a00629..1283b6a8cf70 100644 --- a/js/src/configure.in +++ b/js/src/configure.in @@ -2970,6 +2970,19 @@ MOZ_ARG_HEADER(Application) ENABLE_TESTS=1 +dnl ======================================================== +dnl Tell the build system that ../../mfbt exists outside +dnl the source tree, but files from there are included from +dnl inside the tree. +dnl +dnl This should probably be a --with-external-source-dir +dnl option, like the root mozilla-central configure, but +dnl then anyone building the standalone js shell would need +dnl to remember to pass it, and it is only used in one file. +dnl ======================================================== +EXTERNAL_SOURCE_DIR=../../mfbt +AC_SUBST(EXTERNAL_SOURCE_DIR) + USE_ARM_KUSER= case "${target}" in diff --git a/js/src/moz.build b/js/src/moz.build index 46282eda107d..2a2063a535c2 100644 --- a/js/src/moz.build +++ b/js/src/moz.build @@ -20,8 +20,15 @@ TEST_DIRS += ['jsapi-tests', 'tests', 'gdb'] MODULE = 'js' +mfbt_root = '../../mfbt' +LOCAL_INCLUDES += ['%s/double-conversion' % mfbt_root] + if CONFIG['JS_STANDALONE']: LIBRARY_NAME = 'mozjs-%s' % CONFIG['MOZILLA_SYMBOLVERSION'] + + # When building standalone, we need to include mfbt sources, and to declare + # "exported" mfbt symbols on its behalf when we use its headers. + include('%s/common.mozbuild' % mfbt_root) else: LIBRARY_NAME = 'mozjs' diff --git a/mfbt/Makefile.in b/mfbt/Makefile.in index 34c626d324c2..ded3e30ce192 100644 --- a/mfbt/Makefile.in +++ b/mfbt/Makefile.in @@ -3,16 +3,3 @@ # file, You can obtain one at http://mozilla.org/MPL/2.0/. STL_FLAGS = - -# exported_headers.mk defines the headers exported by mfbt. It is included by -# mfbt itself and by the JS engine, which, when built standalone, must do the -# work to install mfbt's exported headers itself. -include $(srcdir)/exported_headers.mk - -# sources.mk defines the source files built for mfbt. It is included by mfbt -# itself and by the JS engine, which, when built standalone, must do the work -# to build mfbt sources itself. -MFBT_ROOT = $(srcdir) -include $(MFBT_ROOT)/sources.mk - -DEFINES += -DIMPL_MFBT diff --git a/mfbt/common.mozbuild b/mfbt/common.mozbuild new file mode 100644 index 000000000000..2fa4e51d2b5e --- /dev/null +++ b/mfbt/common.mozbuild @@ -0,0 +1,84 @@ +# -*- 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/. + +# This file defines the headers exported by and the sources build for mfbt. +# It is included by mfbt itself and by the JS engine, which, when built +# standalone, must install mfbt's exported headers and build mfbt sources +# itself. It expects that mfbt_root is set to the relative path to mfbt +# before this file in included. + +mfbt_headers = [ + 'Alignment.h', + 'AllocPolicy.h', + 'Array.h', + 'Assertions.h', + 'Atomics.h', + 'Attributes.h', + 'BloomFilter.h', + 'Casting.h', + 'Char16.h', + 'CheckedInt.h', + 'Compiler.h', + 'Compression.h', + 'Constants.h', + 'DebugOnly.h', + 'decimal/Decimal.h', + 'Endian.h', + 'EnumSet.h', + 'FloatingPoint.h', + 'GuardObjects.h', + 'HashFunctions.h', + 'IntegerPrintfMacros.h', + 'Likely.h', + 'LinkedList.h', + 'MathAlgorithms.h', + 'Maybe.h', + 'MemoryChecking.h', + 'MemoryReporting.h', + 'Move.h', + 'MSIntTypes.h', + 'NullPtr.h', + 'NumericLimits.h', + 'PodOperations.h', + 'Poison.h', + 'Range.h', + 'RangedPtr.h', + 'ReentrancyGuard.h', + 'RefPtr.h', + 'Scoped.h', + 'SHA1.h', + 'SplayTree.h', + 'TemplateLib.h', + 'ThreadLocal.h', + 'TypedEnum.h', + 'Types.h', + 'TypeTraits.h', + 'Util.h', + 'Vector.h', + 'WeakPtr.h', +] + +mfbt_sources = [ + 'Compression.cpp', + 'decimal/Decimal.cpp', + 'double-conversion/bignum-dtoa.cc', + 'double-conversion/bignum.cc', + 'double-conversion/cached-powers.cc', + 'double-conversion/diy-fp.cc', + 'double-conversion/double-conversion.cc', + 'double-conversion/fast-dtoa.cc', + 'double-conversion/fixed-dtoa.cc', + 'double-conversion/strtod.cc', + 'FloatingPoint.cpp', + 'HashFunctions.cpp', + 'Poison.cpp', + 'SHA1.cpp', +] + +DEFINES['IMPL_MFBT'] = True + +EXPORTS.mozilla += ['%s/%s' % (mfbt_root, header) for header in mfbt_headers] +SOURCES += ['%s/%s' % (mfbt_root, src) for src in mfbt_sources] diff --git a/mfbt/exported_headers.mk b/mfbt/exported_headers.mk deleted file mode 100644 index c814a92c36a9..000000000000 --- a/mfbt/exported_headers.mk +++ /dev/null @@ -1,61 +0,0 @@ -# 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/. - -# This file defines the headers exported by mfbt. It is included by mfbt -# itself and by the JS engine, which, when built standalone, must install -# mfbt's exported headers itself. - -EXPORTS_mozilla_DEST := $(DIST)/include/mozilla -EXPORTS_mozilla_TARGET := export -INSTALL_TARGETS += EXPORTS_mozilla -EXPORTS_mozilla_FILES += \ - Alignment.h \ - AllocPolicy.h \ - Array.h \ - Assertions.h \ - Atomics.h \ - Attributes.h \ - BloomFilter.h \ - Casting.h \ - Char16.h \ - CheckedInt.h \ - Compiler.h \ - Compression.h \ - Constants.h \ - DebugOnly.h \ - decimal/Decimal.h \ - Endian.h \ - EnumSet.h \ - FloatingPoint.h \ - GuardObjects.h \ - HashFunctions.h \ - IntegerPrintfMacros.h \ - Likely.h \ - LinkedList.h \ - MathAlgorithms.h \ - Maybe.h \ - MemoryChecking.h \ - MemoryReporting.h \ - MSIntTypes.h \ - Move.h \ - NullPtr.h \ - NumericLimits.h \ - PodOperations.h \ - Poison.h \ - Range.h \ - RangedPtr.h \ - ReentrancyGuard.h \ - RefPtr.h \ - Scoped.h \ - SHA1.h \ - SplayTree.h \ - TemplateLib.h \ - ThreadLocal.h \ - TypedEnum.h \ - Types.h \ - TypeTraits.h \ - Util.h \ - Vector.h \ - WeakPtr.h \ - $(NULL) diff --git a/mfbt/moz.build b/mfbt/moz.build index d51d45934f23..fe832a6db404 100644 --- a/mfbt/moz.build +++ b/mfbt/moz.build @@ -11,3 +11,6 @@ MODULE = 'mozglue' LIBRARY_NAME = 'mfbt' FORCE_STATIC_LIB = True + +mfbt_root = '.' +include('common.mozbuild') diff --git a/mfbt/sources.mk b/mfbt/sources.mk deleted file mode 100644 index 9323d65b0c39..000000000000 --- a/mfbt/sources.mk +++ /dev/null @@ -1,39 +0,0 @@ -# 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/. - -ifndef MFBT_ROOT -$(error Before including this file, you must define MFBT_ROOT to point to \ -the MFBT source directory) -endif - -CPPSRCS += \ - Compression.cpp \ - FloatingPoint.cpp \ - HashFunctions.cpp \ - Poison.cpp \ - SHA1.cpp \ - $(NULL) - -# Imported double-conversion sources. -VPATH += $(MFBT_ROOT)/double-conversion \ - $(NULL) - -CPPSRCS += \ - bignum-dtoa.cc \ - bignum.cc \ - cached-powers.cc \ - diy-fp.cc \ - double-conversion.cc \ - fast-dtoa.cc \ - fixed-dtoa.cc \ - strtod.cc \ - $(NULL) - -# Imported decimal sources. -VPATH += $(MFBT_ROOT)/decimal \ - $(NULL) - -CPPSRCS += \ - Decimal.cpp -