gecko-dev/js/sub.configure

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

93 lines
3.7 KiB
Plaintext
Raw Normal View History

# 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/.
@depends(check_build_environment, prepare_configure_options, prepare_mozconfig,
old_configure, old_configure_assignments, '--cache-file')
@imports('itertools')
@imports('os')
@imports('subprocess')
@imports('sys')
@imports(_from='mozbuild.util', _import='encode')
def js_subconfigure(build_env, prepare_configure_options, mozconfig,
old_configure, old_configure_assignments, cache_file):
substs = dict(old_configure['substs'])
assignments = dict(old_configure_assignments)
environ = dict(os.environ)
if prepare_configure_options.extra_env:
environ.update(prepare_configure_options.extra_env)
options = [
o for o in prepare_configure_options.options
# --with-system-nspr will have been converted into the relevant $NSPR_CFLAGS
# and $NSPR_LIBS.
if not o.startswith('--with-system-nspr')
]
if not substs.get('ENABLE_INTL_API'):
options.append('--without-intl-api')
if substs.get('NSPR_CFLAGS') or substs.get('NSPR_LIBS'):
options.append(
'--with-nspr-cflags=%s' % ' '.join(substs.get('NSPR_CFLAGS', [])))
options.append(
'--with-nspr-libs=%s' % ' '.join(substs.get('NSPR_LIBS', [])))
options.append('--prefix=%s/dist' % build_env.topobjdir)
if substs.get('ZLIB_IN_MOZGLUE'):
substs['MOZ_ZLIB_LIBS'] = ''
environ['MOZILLA_CENTRAL_PATH'] = build_env.topsrcdir
if 'MOZ_BUILD_APP' in environ:
del environ['MOZ_BUILD_APP']
# Here, we mimic what we used to do from old-configure, which makes this
# all awkward.
# The following variables were saved at the beginning of old-configure,
# and restored before invoking the subconfigure. Which means their value
# should be taken from the old_configure_assignments or mozconfig.
from_assignment = set(
('CC', 'CXX', 'CPPFLAGS', 'CFLAGS', 'CXXFLAGS', 'LDFLAGS', 'HOST_CC',
'HOST_CXXFLAGS', 'HOST_LDFLAGS'))
# Variables that were explicitly exported from old-configure, and those
# explicitly set in the environment when invoking old-configure, were
# automatically inherited from subconfigure. We assume the relevant ones
# have a corresponding AC_SUBST in old-configure, making them available
# in `substs`.
for var in itertools.chain((
'MOZ_SYSTEM_ZLIB', 'MOZ_ZLIB_CFLAGS', 'MOZ_ZLIB_LIBS',
'MOZ_APP_NAME', 'MOZ_APP_REMOTINGNAME', 'MOZ_DEV_EDITION',
'STLPORT_LIBS', 'DIST', 'MOZ_LINKER', 'ZLIB_IN_MOZGLUE', 'RANLIB',
'AR', 'CPP', 'CC', 'CXX', 'CPPFLAGS', 'CFLAGS', 'CXXFLAGS',
'LDFLAGS', 'HOST_CC', 'HOST_CXX', 'HOST_CPPFLAGS',
'HOST_CXXFLAGS', 'HOST_LDFLAGS'
), prepare_configure_options.extra_env):
if var not in from_assignment and var in substs:
value = substs[var]
elif var in assignments:
value = assignments[var]
elif mozconfig and var in mozconfig and \
not mozconfig[var][1].startswith('removed'):
value = mozconfig[var][0]
else:
continue
if isinstance(value, list):
value = ' '.join(value)
environ[var] = value
ret = subprocess.call([
sys.executable,
os.path.join(build_env.topsrcdir, 'build', 'subconfigure.py'),
build_env.topsrcdir
] + options + [
'JS_STANDALONE=',
'--cache-file=%s' % (cache_file or './config.cache'),
], env=encode(environ))
if ret:
log.error('subconfigure failed')
sys.exit(ret)