diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
commit | 36d22d82aa202bb199967e9512281e9a53db42c9 (patch) | |
tree | 105e8c98ddea1c1e4784a60a5a6410fa416be2de /js/sub.configure | |
parent | Initial commit. (diff) | |
download | firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.tar.xz firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.zip |
Adding upstream version 115.7.0esr.upstream/115.7.0esr
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'js/sub.configure')
-rw-r--r-- | js/sub.configure | 89 |
1 files changed, 89 insertions, 0 deletions
diff --git a/js/sub.configure b/js/sub.configure new file mode 100644 index 0000000000..a331a9356b --- /dev/null +++ b/js/sub.configure @@ -0,0 +1,89 @@ +# -*- Mode: python; 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/. + + +@depends(build_environment) +@imports("logging") +@imports(_from="__builtin__", _import="object") +@imports(_from="mozbuild.configure.util", _import="ConfigureOutputHandler") +def old_js_configure(build_env): + 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") + formatter = logging.Formatter("js/src> %(levelname)s: %(message)s") + for handler in logger.handlers: + handler.setFormatter(formatter) + if isinstance(handler, ConfigureOutputHandler): + handler._stdout = PrefixOutput("js/src> ", handler._stdout) + return os.path.join(build_env.topsrcdir, "js", "src", "old-configure") + + +@depends(old_configure.substs, mozconfig) +def old_js_configure_env(substs, mozconfig): + substs = dict(substs) + # 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`. + extra_env = {} + + for var in ( + "MOZ_DEV_EDITION", + "STLPORT_LIBS", + ): + if var in substs: + 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) + extra_env[var] = value + + return extra_env + + +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) + + +@dependable +@imports("logging") +@imports(_from="mozbuild.configure.util", _import="ConfigureOutputHandler") +def post_old_js_configure(): + # Restore unprefixed logging. + formatter = logging.Formatter("%(levelname)s: %(message)s") + logger = logging.getLogger("moz.configure") + for handler in logger.handlers: + handler.setFormatter(formatter) + if isinstance(handler, ConfigureOutputHandler): + handler._stdout.flush() + handler._stdout = handler._stdout._fh |