summaryrefslogtreecommitdiffstats
path: root/js/sub.configure
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
commit26a029d407be480d791972afb5975cf62c9360a6 (patch)
treef435a8308119effd964b339f76abb83a57c29483 /js/sub.configure
parentInitial commit. (diff)
downloadfirefox-26a029d407be480d791972afb5975cf62c9360a6.tar.xz
firefox-26a029d407be480d791972afb5975cf62c9360a6.zip
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'js/sub.configure')
-rw-r--r--js/sub.configure89
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