2020-08-05 01:29:04 +03:00
|
|
|
# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
|
|
|
|
# vim: set filetype=python:
|
2019-01-17 02:12:20 +03:00
|
|
|
# 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/.
|
|
|
|
|
2020-10-26 21:34:53 +03:00
|
|
|
|
Bug 1669633 - Don't recurse into js/src for the python-part of configure. r=firefox-build-system-reviewers,rstewart
Instead, we now run js/src/old-configure from the top-level configure
after having run old-configure and extracted a few variables to inherit
from it.
Because we're now running from the top-level, $_objdir is always the
top-level objdir, which simplifies some things. The topobjdir in
js/src/config.status, however, needs to stay in js/src because of the
build frontend expecting it there.
When running js/src/old-configure, we used to need some special
treatment for a large number of variables for historic reasons, where
we'd take values from the assigned values before running old-configure
for some, or from AC_SUBSTs after running old-configure.
Now that both old-configure and js/src/old-configure get the same
assignments from old-configure.vars, we don't need anything special for
the former. And only a few remaining variables still need manual work
for the latter.
One notable difference, though, is that the new code doesn't try to
avoid running js subconfigure, which added complexity, and was actually
error-prone.
Differential Revision: https://phabricator.services.mozilla.com/D92725
2020-10-08 00:13:19 +03:00
|
|
|
@depends(check_build_environment)
|
2019-01-17 00:44:54 +03:00
|
|
|
@imports("logging")
|
|
|
|
@imports(_from="__builtin__", _import="object")
|
|
|
|
@imports(_from="mozbuild.configure.util", _import="ConfigureOutputHandler")
|
Bug 1669633 - Don't recurse into js/src for the python-part of configure. r=firefox-build-system-reviewers,rstewart
Instead, we now run js/src/old-configure from the top-level configure
after having run old-configure and extracted a few variables to inherit
from it.
Because we're now running from the top-level, $_objdir is always the
top-level objdir, which simplifies some things. The topobjdir in
js/src/config.status, however, needs to stay in js/src because of the
build frontend expecting it there.
When running js/src/old-configure, we used to need some special
treatment for a large number of variables for historic reasons, where
we'd take values from the assigned values before running old-configure
for some, or from AC_SUBSTs after running old-configure.
Now that both old-configure and js/src/old-configure get the same
assignments from old-configure.vars, we don't need anything special for
the former. And only a few remaining variables still need manual work
for the latter.
One notable difference, though, is that the new code doesn't try to
avoid running js subconfigure, which added complexity, and was actually
error-prone.
Differential Revision: https://phabricator.services.mozilla.com/D92725
2020-10-08 00:13:19 +03:00
|
|
|
def old_js_configure(build_env):
|
2019-01-17 00:44:54 +03:00
|
|
|
class PrefixOutput(object):
|
|
|
|
def __init__(self, prefix, fh):
|
|
|
|
self._fh = fh
|
|
|
|
self._begin_line = True
|
|
|
|
self._prefix = prefix
|
|
|
|
|
|
|
|
def write(self, content):
|
|
|
|
if self._begin_line:
|
|
|
|
self._fh.write(self._prefix)
|
|
|
|
self._fh.write(("\n" + self._prefix).join(content.splitlines()))
|
|
|
|
self._begin_line = content.endswith("\n")
|
|
|
|
if self._begin_line:
|
|
|
|
self._fh.write("\n")
|
|
|
|
|
|
|
|
def flush(self):
|
|
|
|
self._fh.flush()
|
|
|
|
|
|
|
|
logger = logging.getLogger("moz.configure")
|
2019-01-17 02:42:12 +03:00
|
|
|
formatter = logging.Formatter("js/src> %(levelname)s: %(message)s")
|
2019-01-17 00:44:54 +03:00
|
|
|
for handler in logger.handlers:
|
2019-01-17 02:42:12 +03:00
|
|
|
handler.setFormatter(formatter)
|
2019-01-17 00:44:54 +03:00
|
|
|
if isinstance(handler, ConfigureOutputHandler):
|
|
|
|
handler._stdout = PrefixOutput("js/src> ", handler._stdout)
|
Bug 1669633 - Don't recurse into js/src for the python-part of configure. r=firefox-build-system-reviewers,rstewart
Instead, we now run js/src/old-configure from the top-level configure
after having run old-configure and extracted a few variables to inherit
from it.
Because we're now running from the top-level, $_objdir is always the
top-level objdir, which simplifies some things. The topobjdir in
js/src/config.status, however, needs to stay in js/src because of the
build frontend expecting it there.
When running js/src/old-configure, we used to need some special
treatment for a large number of variables for historic reasons, where
we'd take values from the assigned values before running old-configure
for some, or from AC_SUBSTs after running old-configure.
Now that both old-configure and js/src/old-configure get the same
assignments from old-configure.vars, we don't need anything special for
the former. And only a few remaining variables still need manual work
for the latter.
One notable difference, though, is that the new code doesn't try to
avoid running js subconfigure, which added complexity, and was actually
error-prone.
Differential Revision: https://phabricator.services.mozilla.com/D92725
2020-10-08 00:13:19 +03:00
|
|
|
return os.path.join(build_env.topsrcdir, "js", "src", "old-configure")
|
2019-01-17 00:44:54 +03:00
|
|
|
|
2019-01-17 02:12:20 +03:00
|
|
|
|
Bug 1669633 - Don't recurse into js/src for the python-part of configure. r=firefox-build-system-reviewers,rstewart
Instead, we now run js/src/old-configure from the top-level configure
after having run old-configure and extracted a few variables to inherit
from it.
Because we're now running from the top-level, $_objdir is always the
top-level objdir, which simplifies some things. The topobjdir in
js/src/config.status, however, needs to stay in js/src because of the
build frontend expecting it there.
When running js/src/old-configure, we used to need some special
treatment for a large number of variables for historic reasons, where
we'd take values from the assigned values before running old-configure
for some, or from AC_SUBSTs after running old-configure.
Now that both old-configure and js/src/old-configure get the same
assignments from old-configure.vars, we don't need anything special for
the former. And only a few remaining variables still need manual work
for the latter.
One notable difference, though, is that the new code doesn't try to
avoid running js subconfigure, which added complexity, and was actually
error-prone.
Differential Revision: https://phabricator.services.mozilla.com/D92725
2020-10-08 00:13:19 +03:00
|
|
|
@depends(old_configure.substs, mozconfig)
|
|
|
|
def old_js_configure_env(substs, mozconfig):
|
|
|
|
substs = dict(substs)
|
2019-01-17 02:12:20 +03:00
|
|
|
# Here, we mimic what we used to do from old-configure, which makes this
|
|
|
|
# all awkward.
|
|
|
|
|
|
|
|
# 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`.
|
Bug 1669633 - Don't recurse into js/src for the python-part of configure. r=firefox-build-system-reviewers,rstewart
Instead, we now run js/src/old-configure from the top-level configure
after having run old-configure and extracted a few variables to inherit
from it.
Because we're now running from the top-level, $_objdir is always the
top-level objdir, which simplifies some things. The topobjdir in
js/src/config.status, however, needs to stay in js/src because of the
build frontend expecting it there.
When running js/src/old-configure, we used to need some special
treatment for a large number of variables for historic reasons, where
we'd take values from the assigned values before running old-configure
for some, or from AC_SUBSTs after running old-configure.
Now that both old-configure and js/src/old-configure get the same
assignments from old-configure.vars, we don't need anything special for
the former. And only a few remaining variables still need manual work
for the latter.
One notable difference, though, is that the new code doesn't try to
avoid running js subconfigure, which added complexity, and was actually
error-prone.
Differential Revision: https://phabricator.services.mozilla.com/D92725
2020-10-08 00:13:19 +03:00
|
|
|
extra_env = {}
|
|
|
|
|
2020-05-02 00:21:55 +03:00
|
|
|
for var in (
|
Bug 1669633 - Don't recurse into js/src for the python-part of configure. r=firefox-build-system-reviewers,rstewart
Instead, we now run js/src/old-configure from the top-level configure
after having run old-configure and extracted a few variables to inherit
from it.
Because we're now running from the top-level, $_objdir is always the
top-level objdir, which simplifies some things. The topobjdir in
js/src/config.status, however, needs to stay in js/src because of the
build frontend expecting it there.
When running js/src/old-configure, we used to need some special
treatment for a large number of variables for historic reasons, where
we'd take values from the assigned values before running old-configure
for some, or from AC_SUBSTs after running old-configure.
Now that both old-configure and js/src/old-configure get the same
assignments from old-configure.vars, we don't need anything special for
the former. And only a few remaining variables still need manual work
for the latter.
One notable difference, though, is that the new code doesn't try to
avoid running js subconfigure, which added complexity, and was actually
error-prone.
Differential Revision: https://phabricator.services.mozilla.com/D92725
2020-10-08 00:13:19 +03:00
|
|
|
"MOZ_DEV_EDITION",
|
|
|
|
"STLPORT_LIBS",
|
|
|
|
"MOZ_LINKER",
|
|
|
|
"ZLIB_IN_MOZGLUE",
|
|
|
|
"RANLIB",
|
2020-05-02 00:21:55 +03:00
|
|
|
):
|
Bug 1669633 - Don't recurse into js/src for the python-part of configure. r=firefox-build-system-reviewers,rstewart
Instead, we now run js/src/old-configure from the top-level configure
after having run old-configure and extracted a few variables to inherit
from it.
Because we're now running from the top-level, $_objdir is always the
top-level objdir, which simplifies some things. The topobjdir in
js/src/config.status, however, needs to stay in js/src because of the
build frontend expecting it there.
When running js/src/old-configure, we used to need some special
treatment for a large number of variables for historic reasons, where
we'd take values from the assigned values before running old-configure
for some, or from AC_SUBSTs after running old-configure.
Now that both old-configure and js/src/old-configure get the same
assignments from old-configure.vars, we don't need anything special for
the former. And only a few remaining variables still need manual work
for the latter.
One notable difference, though, is that the new code doesn't try to
avoid running js subconfigure, which added complexity, and was actually
error-prone.
Differential Revision: https://phabricator.services.mozilla.com/D92725
2020-10-08 00:13:19 +03:00
|
|
|
if var in substs:
|
2019-01-17 02:12:20 +03:00
|
|
|
value = substs[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)
|
Bug 1669633 - Don't recurse into js/src for the python-part of configure. r=firefox-build-system-reviewers,rstewart
Instead, we now run js/src/old-configure from the top-level configure
after having run old-configure and extracted a few variables to inherit
from it.
Because we're now running from the top-level, $_objdir is always the
top-level objdir, which simplifies some things. The topobjdir in
js/src/config.status, however, needs to stay in js/src because of the
build frontend expecting it there.
When running js/src/old-configure, we used to need some special
treatment for a large number of variables for historic reasons, where
we'd take values from the assigned values before running old-configure
for some, or from AC_SUBSTs after running old-configure.
Now that both old-configure and js/src/old-configure get the same
assignments from old-configure.vars, we don't need anything special for
the former. And only a few remaining variables still need manual work
for the latter.
One notable difference, though, is that the new code doesn't try to
avoid running js subconfigure, which added complexity, and was actually
error-prone.
Differential Revision: https://phabricator.services.mozilla.com/D92725
2020-10-08 00:13:19 +03:00
|
|
|
extra_env[var] = value
|
2019-01-17 02:29:19 +03:00
|
|
|
|
Bug 1669633 - Don't recurse into js/src for the python-part of configure. r=firefox-build-system-reviewers,rstewart
Instead, we now run js/src/old-configure from the top-level configure
after having run old-configure and extracted a few variables to inherit
from it.
Because we're now running from the top-level, $_objdir is always the
top-level objdir, which simplifies some things. The topobjdir in
js/src/config.status, however, needs to stay in js/src because of the
build frontend expecting it there.
When running js/src/old-configure, we used to need some special
treatment for a large number of variables for historic reasons, where
we'd take values from the assigned values before running old-configure
for some, or from AC_SUBSTs after running old-configure.
Now that both old-configure and js/src/old-configure get the same
assignments from old-configure.vars, we don't need anything special for
the former. And only a few remaining variables still need manual work
for the latter.
One notable difference, though, is that the new code doesn't try to
avoid running js subconfigure, which added complexity, and was actually
error-prone.
Differential Revision: https://phabricator.services.mozilla.com/D92725
2020-10-08 00:13:19 +03:00
|
|
|
return extra_env
|
2019-01-17 02:12:20 +03:00
|
|
|
|
2019-01-17 02:29:19 +03:00
|
|
|
|
Bug 1669633 - Don't recurse into js/src for the python-part of configure. r=firefox-build-system-reviewers,rstewart
Instead, we now run js/src/old-configure from the top-level configure
after having run old-configure and extracted a few variables to inherit
from it.
Because we're now running from the top-level, $_objdir is always the
top-level objdir, which simplifies some things. The topobjdir in
js/src/config.status, however, needs to stay in js/src because of the
build frontend expecting it there.
When running js/src/old-configure, we used to need some special
treatment for a large number of variables for historic reasons, where
we'd take values from the assigned values before running old-configure
for some, or from AC_SUBSTs after running old-configure.
Now that both old-configure and js/src/old-configure get the same
assignments from old-configure.vars, we don't need anything special for
the former. And only a few remaining variables still need manual work
for the latter.
One notable difference, though, is that the new code doesn't try to
avoid running js subconfigure, which added complexity, and was actually
error-prone.
Differential Revision: https://phabricator.services.mozilla.com/D92725
2020-10-08 00:13:19 +03:00
|
|
|
old_js_configure = old_configure_for(old_js_configure, extra_env=old_js_configure_env)
|
|
|
|
set_config("OLD_JS_CONFIGURE_SUBSTS", old_js_configure.substs)
|
|
|
|
set_config("OLD_JS_CONFIGURE_DEFINES", old_js_configure.defines)
|
2019-01-17 02:29:19 +03:00
|
|
|
|
2019-01-17 02:42:12 +03:00
|
|
|
|
Bug 1669633 - Don't recurse into js/src for the python-part of configure. r=firefox-build-system-reviewers,rstewart
Instead, we now run js/src/old-configure from the top-level configure
after having run old-configure and extracted a few variables to inherit
from it.
Because we're now running from the top-level, $_objdir is always the
top-level objdir, which simplifies some things. The topobjdir in
js/src/config.status, however, needs to stay in js/src because of the
build frontend expecting it there.
When running js/src/old-configure, we used to need some special
treatment for a large number of variables for historic reasons, where
we'd take values from the assigned values before running old-configure
for some, or from AC_SUBSTs after running old-configure.
Now that both old-configure and js/src/old-configure get the same
assignments from old-configure.vars, we don't need anything special for
the former. And only a few remaining variables still need manual work
for the latter.
One notable difference, though, is that the new code doesn't try to
avoid running js subconfigure, which added complexity, and was actually
error-prone.
Differential Revision: https://phabricator.services.mozilla.com/D92725
2020-10-08 00:13:19 +03:00
|
|
|
@dependable
|
|
|
|
@imports("logging")
|
|
|
|
@imports(_from="mozbuild.configure.util", _import="ConfigureOutputHandler")
|
|
|
|
def post_old_js_configure():
|
2019-01-17 02:42:12 +03:00
|
|
|
# Restore unprefixed logging.
|
|
|
|
formatter = logging.Formatter("%(levelname)s: %(message)s")
|
Bug 1669633 - Don't recurse into js/src for the python-part of configure. r=firefox-build-system-reviewers,rstewart
Instead, we now run js/src/old-configure from the top-level configure
after having run old-configure and extracted a few variables to inherit
from it.
Because we're now running from the top-level, $_objdir is always the
top-level objdir, which simplifies some things. The topobjdir in
js/src/config.status, however, needs to stay in js/src because of the
build frontend expecting it there.
When running js/src/old-configure, we used to need some special
treatment for a large number of variables for historic reasons, where
we'd take values from the assigned values before running old-configure
for some, or from AC_SUBSTs after running old-configure.
Now that both old-configure and js/src/old-configure get the same
assignments from old-configure.vars, we don't need anything special for
the former. And only a few remaining variables still need manual work
for the latter.
One notable difference, though, is that the new code doesn't try to
avoid running js subconfigure, which added complexity, and was actually
error-prone.
Differential Revision: https://phabricator.services.mozilla.com/D92725
2020-10-08 00:13:19 +03:00
|
|
|
logger = logging.getLogger("moz.configure")
|
2019-01-17 02:42:12 +03:00
|
|
|
for handler in logger.handlers:
|
|
|
|
handler.setFormatter(formatter)
|
|
|
|
if isinstance(handler, ConfigureOutputHandler):
|
|
|
|
handler._stdout.flush()
|
|
|
|
handler._stdout = handler._stdout._fh
|