0ad/libraries/source/spidermonkey/patches/UpstreamCustomARFlags.patch
Olivier Tilloy 6436ba3af9 Spidermonkey build: cherry-pick an upstream commit to create thin archives
This saves a sizeable amount of disk space during the build, by not creating
a very large libjs_static.a (~1.5 GB) that contains a copy of all the symbols
in the object files generated during the build.

Upstream bug: https://bugzilla.mozilla.org/show_bug.cgi?id=2008085
Upstream commit: https://hg.mozilla.org/mozilla-central/rev/a924182c4e55

Note that the upstream commit doesn't apply cleanly to Spidermonkey 128.13.0,
it had to be rebased.
2026-01-25 10:58:33 +01:00

61 lines
1.9 KiB
Diff

# HG changeset patch
# User serge-sans-paille <sguelton@mozilla.com>
# Date 1768903043 0
# Node ID a924182c4e55e19b1b8dbd5904e8f9ca99e79b98
# Parent cd5449e09b6cd3e3b0bb1f2d6d8a8048e8883535
Bug 2008085 - Provide AR_FLAGS customization point r=glandium
In a similar way to other customization flags.
That way users can specify `--thin` if they want to to reduce disk
pressure.
Differential Revision: https://phabricator.services.mozilla.com/D278841
diff --git a/build/moz.configure/toolchain.configure b/build/moz.configure/toolchain.configure
--- a/build/moz.configure/toolchain.configure
+++ b/build/moz.configure/toolchain.configure
@@ -4,6 +4,13 @@
# 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/.
+option(
+ env="AR_FLAGS",
+ help="Extra flags for creating static archives",
+ nargs=1,
+ default="",
+)
+
# Code optimization
# ==============================================================
@@ -3346,12 +3353,14 @@
if not toolchain_prefix:
toolchain_prefix = dependable(None)
- @depends(toolchain_prefix, c_compiler)
- def ar_config(toolchain_prefix, c_compiler):
+ @depends(toolchain_prefix, c_compiler, "AR_FLAGS")
+ @imports(_from="mozbuild.shellutil", _import="split")
+ def ar_config(toolchain_prefix, c_compiler, env_flags):
+ extra_ar_flags = tuple(split(env_flags[0]))
if c_compiler.type == "clang-cl":
return namespace(
names=("llvm-lib",),
- flags=("-llvmlibthin", "-out:$@"),
+ flags=("-llvmlibthin", "-out:$@") + extra_ar_flags,
)
names = tuple("%s%s" % (p, "ar") for p in (toolchain_prefix or ()) + ("",))
@@ -3368,7 +3377,7 @@
return namespace(
names=names,
- flags=("crs", "$@"),
+ flags=("crs",) + extra_ar_flags + ("$@",),
)
return ar_config