Issue #1676 - Part 3: Split DEFINES out of js/src/moz.build

This commit is contained in:
Matt A. Tobin 2020-11-03 15:20:38 -05:00 • committed by roytam1
commit 55c2ff2df2
2 changed files with 37 additions and 36 deletions

32
js/src/js-config.mozbuild Normal file
View file

@ -0,0 +1,32 @@
# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
# 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/.
# Also set in shell/moz.build
DEFINES['ENABLE_SHARED_ARRAY_BUFFER'] = True
DEFINES['EXPORT_JS_API'] = True
if CONFIG['NIGHTLY_BUILD']:
DEFINES['ENABLE_BINARYDATA'] = True
if CONFIG['NIGHTLY_BUILD']:
DEFINES['ENABLE_SIMD'] = True
if CONFIG['JS_HAS_CTYPES']:
DEFINES['JS_HAS_CTYPES'] = True
for var in ('DLL_PREFIX', 'DLL_SUFFIX'):
DEFINES[var] = '"%s"' % CONFIG[var]
if CONFIG['MOZ_LINKER']:
DEFINES['MOZ_LINKER'] = True
if CONFIG['JS_HAS_CTYPES']:
if not CONFIG['MOZ_SYSTEM_FFI']:
# Windows needs this to be linked with a static library.
DEFINES['FFI_BUILDING'] = True
if CONFIG['OS_ARCH'] == 'WINNT':
DEFINES['_CRT_RAND_S'] = True
DEFINES['NOMINMAX'] = True

View file

@ -3,6 +3,7 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this # 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/. # file, You can obtain one at http://mozilla.org/MPL/2.0/.
include('js-config.mozbuild')
include('js-cxxflags.mozbuild') include('js-cxxflags.mozbuild')
include('js-testing.mozbuild') include('js-testing.mozbuild')
@ -37,7 +38,6 @@ CONFIGURE_DEFINE_FILES += [
if CONFIG['HAVE_DTRACE']: if CONFIG['HAVE_DTRACE']:
GENERATED_FILES += ['javascript-trace.h'] GENERATED_FILES += ['javascript-trace.h']
EXPORTS += ['!javascript-trace.h'] EXPORTS += ['!javascript-trace.h']
# Changes to internal header files, used externally, massively slow down # Changes to internal header files, used externally, massively slow down
@ -538,7 +538,6 @@ if CONFIG['OS_ARCH'] == 'WINNT':
'threading/windows/Thread.cpp', 'threading/windows/Thread.cpp',
] ]
# _CRT_RAND_S must be #defined before #including stdlib.h to get rand_s() # _CRT_RAND_S must be #defined before #including stdlib.h to get rand_s()
DEFINES['_CRT_RAND_S'] = True
else: else:
SOURCES += [ SOURCES += [
'threading/posix/ConditionVariable.cpp', 'threading/posix/ConditionVariable.cpp',
@ -615,24 +614,6 @@ USE_LIBS += [
'zlib', 'zlib',
] ]
if CONFIG['NIGHTLY_BUILD']:
DEFINES['ENABLE_BINARYDATA'] = True
if CONFIG['NIGHTLY_BUILD']:
DEFINES['ENABLE_SIMD'] = True
# Also set in shell/moz.build
DEFINES['ENABLE_SHARED_ARRAY_BUFFER'] = True
DEFINES['EXPORT_JS_API'] = True
if CONFIG['JS_HAS_CTYPES']:
DEFINES['JS_HAS_CTYPES'] = True
for var in ('DLL_PREFIX', 'DLL_SUFFIX'):
DEFINES[var] = '"%s"' % CONFIG[var]
if CONFIG['MOZ_LINKER']:
DEFINES['MOZ_LINKER'] = True
if CONFIG['_MSC_VER']: if CONFIG['_MSC_VER']:
if CONFIG['CPU_ARCH'] == 'x86': if CONFIG['CPU_ARCH'] == 'x86':
@ -641,19 +622,13 @@ if CONFIG['_MSC_VER']:
SOURCES['ctypes/CTypes.cpp'].no_pgo = True # Bug 810661 SOURCES['ctypes/CTypes.cpp'].no_pgo = True # Bug 810661
if CONFIG['OS_ARCH'] not in ('WINNT'): if CONFIG['OS_ARCH'] not in ('WINNT'):
OS_LIBS += [ OS_LIBS += ['m']
'm',
]
if CONFIG['OS_ARCH'] == 'FreeBSD': if CONFIG['OS_ARCH'] == 'FreeBSD':
OS_LIBS += [ OS_LIBS += ['-pthread']
'-pthread',
]
if CONFIG['OS_ARCH'] == 'Linux': if CONFIG['OS_ARCH'] == 'Linux':
OS_LIBS += [ OS_LIBS += ['dl']
'dl',
]
if CONFIG['OS_ARCH'] == 'SunOS': if CONFIG['OS_ARCH'] == 'SunOS':
OS_LIBS += [ OS_LIBS += [
@ -706,15 +681,9 @@ selfhosted.inputs = [
'builtin/WeakSet.js' 'builtin/WeakSet.js'
] ]
if CONFIG['JS_HAS_CTYPES']:
if not CONFIG['MOZ_SYSTEM_FFI']:
# Windows needs this to be linked with a static library.
DEFINES['FFI_BUILDING'] = True
# Suppress warnings in third-party code. # Suppress warnings in third-party code.
# We are keeping this in the main moz.build because it is file specific # We are keeping this in the main moz.build because it is file specific
if CONFIG['CLANG_CXX'] or CONFIG['GNU_CXX']: if CONFIG['CLANG_CXX'] or CONFIG['GNU_CXX']:
SOURCES['jsdtoa.cpp'].flags += ['-Wno-implicit-fallthrough'] SOURCES['jsdtoa.cpp'].flags += ['-Wno-implicit-fallthrough']
if CONFIG['OS_ARCH'] == 'WINNT':
DEFINES['NOMINMAX'] = True