From 1857d81adaf4528dfc3d0de6b7221ae5eab73800 Mon Sep 17 00:00:00 2001 From: Mike Hommey Date: Mon, 20 Jan 2025 20:51:51 +0000 Subject: [PATCH] Bug 1941695 - Rename USE_STATIC_LIBS. r=firefox-build-system-reviewers,application-update-reviewers,media-playback-reviewers,padenot,bytesized,sergesanspaille The name is confusing, as it doesn't apply to all libraries, and only on Windows non-mingw. Differential Revision: https://phabricator.services.mozilla.com/D234260 --- build/pure_virtual/moz.build | 2 +- build/win32/crashinjectdll/moz.build | 2 +- build/win32/moz.build | 2 +- dom/media/fake-cdm/moz.build | 2 +- dom/media/gmp-plugin-openh264/moz.build | 2 +- modules/libmar/sign/moz.build | 2 +- modules/libmar/src/moz.build | 2 +- modules/libmar/tool/moz.build | 2 +- modules/libmar/verify/moz.build | 2 +- modules/xz-embedded/moz.build | 2 +- other-licenses/bsdiff/moz.build | 2 +- python/mozbuild/mozbuild/frontend/context.py | 3 ++- python/mozbuild/mozbuild/frontend/emitter.py | 8 ++++---- testing/tools/minidumpwriter/moz.build | 2 +- testing/tools/screenshot/moz.build | 2 +- toolkit/components/maintenanceservice/moz.build | 2 +- toolkit/crashreporter/mozwer/moz.build | 2 +- toolkit/mozapps/update/common/moz.build | 2 +- toolkit/mozapps/update/tests/moz.build | 2 +- toolkit/mozapps/update/updater/bspatch/moz.build | 2 +- toolkit/mozapps/update/updater/updater-common.build | 2 +- toolkit/xre/test/win/moz.build | 2 +- 22 files changed, 26 insertions(+), 25 deletions(-) diff --git a/build/pure_virtual/moz.build b/build/pure_virtual/moz.build index 2e5169fec62801..70707ea7ce6409 100644 --- a/build/pure_virtual/moz.build +++ b/build/pure_virtual/moz.build @@ -10,7 +10,7 @@ SOURCES += ["pure_virtual.c"] FORCE_STATIC_LIB = True -USE_STATIC_LIBS = True +USE_STATIC_MSVCRT = True # Build a real library so that the linker can remove it if the symbol # is never used. diff --git a/build/win32/crashinjectdll/moz.build b/build/win32/crashinjectdll/moz.build index ff113f61e6c104..3027954f5de08f 100644 --- a/build/win32/crashinjectdll/moz.build +++ b/build/win32/crashinjectdll/moz.build @@ -12,5 +12,5 @@ SharedLibrary("crashinjectdll") DEFFILE = "crashinjectdll.def" -USE_STATIC_LIBS = True +USE_STATIC_MSVCRT = True NO_PGO = True diff --git a/build/win32/moz.build b/build/win32/moz.build index d8d61a22db473f..a29552cf447130 100644 --- a/build/win32/moz.build +++ b/build/win32/moz.build @@ -11,7 +11,7 @@ if CONFIG["ENABLE_TESTS"]: SOURCES += [ "crashinject.cpp", ] - USE_STATIC_LIBS = True + USE_STATIC_MSVCRT = True NO_PGO = True diff --git a/dom/media/fake-cdm/moz.build b/dom/media/fake-cdm/moz.build index 6c7aafd9b4bbd4..76663235c246cf 100644 --- a/dom/media/fake-cdm/moz.build +++ b/dom/media/fake-cdm/moz.build @@ -26,7 +26,7 @@ if CONFIG["OS_ARCH"] == "WINNT": "user32", ] -USE_STATIC_LIBS = True +USE_STATIC_MSVCRT = True NoVisibilityFlags() # Don't use STL wrappers; this isn't Gecko code DisableStlWrapping() diff --git a/dom/media/gmp-plugin-openh264/moz.build b/dom/media/gmp-plugin-openh264/moz.build index e85a50673e4459..05551c9886fb94 100644 --- a/dom/media/gmp-plugin-openh264/moz.build +++ b/dom/media/gmp-plugin-openh264/moz.build @@ -18,7 +18,7 @@ SOURCES += [ SharedLibrary("fakeopenh264") -USE_STATIC_LIBS = True +USE_STATIC_MSVCRT = True NoVisibilityFlags() # Don't use STL wrappers; this isn't Gecko code DisableStlWrapping() diff --git a/modules/libmar/sign/moz.build b/modules/libmar/sign/moz.build index 82f9623b713d94..8bfe6a5c33455b 100644 --- a/modules/libmar/sign/moz.build +++ b/modules/libmar/sign/moz.build @@ -21,4 +21,4 @@ LOCAL_INCLUDES += [ DEFINES["MAR_NSS"] = True if CONFIG["OS_ARCH"] == "WINNT": - USE_STATIC_LIBS = True + USE_STATIC_MSVCRT = True diff --git a/modules/libmar/src/moz.build b/modules/libmar/src/moz.build index ee72adb3ad93ad..a8d00a04d0de40 100644 --- a/modules/libmar/src/moz.build +++ b/modules/libmar/src/moz.build @@ -28,4 +28,4 @@ if CONFIG["MOZ_BUILD_APP"] != "tools/update-packaging": FORCE_STATIC_LIB = True if CONFIG["OS_ARCH"] == "WINNT": - USE_STATIC_LIBS = True + USE_STATIC_MSVCRT = True diff --git a/modules/libmar/tool/moz.build b/modules/libmar/tool/moz.build index 16e937889a2ffb..e8abf3b2a34016 100644 --- a/modules/libmar/tool/moz.build +++ b/modules/libmar/tool/moz.build @@ -39,7 +39,7 @@ if CONFIG["MOZ_BUILD_APP"] != "tools/update-packaging": DEFINES["MAR_NSS"] = True if CONFIG["OS_ARCH"] == "WINNT": - USE_STATIC_LIBS = True + USE_STATIC_MSVCRT = True OS_LIBS += [ "ws2_32", diff --git a/modules/libmar/verify/moz.build b/modules/libmar/verify/moz.build index 4b82e13e443e02..aa03f3eebd4cdf 100644 --- a/modules/libmar/verify/moz.build +++ b/modules/libmar/verify/moz.build @@ -14,7 +14,7 @@ UNIFIED_SOURCES += [ FORCE_STATIC_LIB = True if CONFIG["OS_ARCH"] == "WINNT": - USE_STATIC_LIBS = True + USE_STATIC_MSVCRT = True elif CONFIG["OS_ARCH"] == "Darwin" and not CONFIG["MOZ_USE_NSS_FOR_MAR"]: UNIFIED_SOURCES += [ "MacVerifyCrypto.cpp", diff --git a/modules/xz-embedded/moz.build b/modules/xz-embedded/moz.build index f80c93c65b6f6a..0dcb2ff785984f 100644 --- a/modules/xz-embedded/moz.build +++ b/modules/xz-embedded/moz.build @@ -29,6 +29,6 @@ DEFINES['XZ_DEC_X86'] = 1 DEFINES['XZ_USE_CRC64'] = 1 if CONFIG['OS_ARCH'] == 'WINNT': - USE_STATIC_LIBS = True + USE_STATIC_MSVCRT = True Library('xz-embedded') diff --git a/other-licenses/bsdiff/moz.build b/other-licenses/bsdiff/moz.build index c7080a6e249f4f..c34941f149151b 100644 --- a/other-licenses/bsdiff/moz.build +++ b/other-licenses/bsdiff/moz.build @@ -14,7 +14,7 @@ if CONFIG['HOST_OS_ARCH'] == 'WINNT': HOST_OS_LIBS += [ 'ws2_32', ] - USE_STATIC_LIBS = True + USE_STATIC_MSVCRT = True LOCAL_INCLUDES += [ '/toolkit/mozapps/update/updater', diff --git a/python/mozbuild/mozbuild/frontend/context.py b/python/mozbuild/mozbuild/frontend/context.py index 5a9530d98aaeff..9e1895d170243f 100644 --- a/python/mozbuild/mozbuild/frontend/context.py +++ b/python/mozbuild/mozbuild/frontend/context.py @@ -1738,7 +1738,7 @@ def aggregate(files): """Whether the library in this directory is a static library. """, ), - "USE_STATIC_LIBS": ( + "USE_STATIC_MSVCRT": ( bool, bool, """Whether the code in this directory is a built against the static @@ -3112,6 +3112,7 @@ def Program(name): DIST_FILES += [ 'foo' ] """, + "USE_STATIC_LIBS": "Please use the USE_STATIC_MSVCRT variable instead.", } # Make sure that all template variables have a deprecation hint. diff --git a/python/mozbuild/mozbuild/frontend/emitter.py b/python/mozbuild/mozbuild/frontend/emitter.py index df06acbb1ea30c..94039c25dd18c9 100644 --- a/python/mozbuild/mozbuild/frontend/emitter.py +++ b/python/mozbuild/mozbuild/frontend/emitter.py @@ -1311,17 +1311,17 @@ def emit_from_context(self, context): passthru.variables["NO_DIST_INSTALL"] = True # Ideally, this should be done in templates, but this is difficult at - # the moment because USE_STATIC_LIBS can be set after a template + # the moment because USE_STATIC_MSVCRT can be set after a template # returns. Eventually, with context-based templates, it will be # possible. if ( context.config.substs.get("OS_ARCH") == "WINNT" and context.config.substs.get("CC_TYPE") == "clang-cl" ): - use_static_lib = context.get( - "USE_STATIC_LIBS" + use_static_msvcrt = context.get( + "USE_STATIC_MSVCRT" ) and not context.config.substs.get("MOZ_ASAN") - rtl_flag = "-MT" if use_static_lib else "-MD" + rtl_flag = "-MT" if use_static_msvcrt else "-MD" if context.config.substs.get("MOZ_DEBUG") and not context.config.substs.get( "MOZ_NO_DEBUG_RTL" ): diff --git a/testing/tools/minidumpwriter/moz.build b/testing/tools/minidumpwriter/moz.build index 7528da9430d53f..8d9d2cbfaca2d4 100644 --- a/testing/tools/minidumpwriter/moz.build +++ b/testing/tools/minidumpwriter/moz.build @@ -12,7 +12,7 @@ if CONFIG["ENABLE_TESTS"] and CONFIG["OS_ARCH"] == "WINNT": SOURCES += [ "minidumpwriter.cpp", ] - USE_STATIC_LIBS = True + USE_STATIC_MSVCRT = True if CONFIG["CC_TYPE"] in ("clang", "gcc"): WIN32_EXE_LDFLAGS += ["-municode"] diff --git a/testing/tools/screenshot/moz.build b/testing/tools/screenshot/moz.build index 14b9b321ba7d32..28bc4c89ed60fe 100644 --- a/testing/tools/screenshot/moz.build +++ b/testing/tools/screenshot/moz.build @@ -17,7 +17,7 @@ elif CONFIG["MOZ_WIDGET_TOOLKIT"] == "windows": SOURCES += [ "win32-screenshot.cpp", ] - USE_STATIC_LIBS = True + USE_STATIC_MSVCRT = True if CONFIG["CC_TYPE"] in ("clang", "gcc"): WIN32_EXE_LDFLAGS += ["-municode"] OS_LIBS += [ diff --git a/toolkit/components/maintenanceservice/moz.build b/toolkit/components/maintenanceservice/moz.build index b4b891d3a5fcf2..d48600e8c4befc 100644 --- a/toolkit/components/maintenanceservice/moz.build +++ b/toolkit/components/maintenanceservice/moz.build @@ -36,7 +36,7 @@ LOCAL_INCLUDES += [ "/toolkit/xre", ] -USE_STATIC_LIBS = True +USE_STATIC_MSVCRT = True if CONFIG["CC_TYPE"] == "clang-cl": WIN32_EXE_LDFLAGS += ["-ENTRY:wmainCRTStartup"] diff --git a/toolkit/crashreporter/mozwer/moz.build b/toolkit/crashreporter/mozwer/moz.build index 41aed9b59b8c55..425ada66bea05b 100644 --- a/toolkit/crashreporter/mozwer/moz.build +++ b/toolkit/crashreporter/mozwer/moz.build @@ -19,6 +19,6 @@ if CONFIG["RUSTC_VERSION"] and CONFIG["RUSTC_VERSION"] >= "1.78.0": ] DEFFILE = "mozwer.def" -USE_STATIC_LIBS = True +USE_STATIC_MSVCRT = True SharedLibrary("mozwer") diff --git a/toolkit/mozapps/update/common/moz.build b/toolkit/mozapps/update/common/moz.build index df32b227a4c779..acc1a7bb28286e 100644 --- a/toolkit/mozapps/update/common/moz.build +++ b/toolkit/mozapps/update/common/moz.build @@ -30,7 +30,7 @@ if CONFIG["OS_ARCH"] == "WINNT": Library("updatecommon") DEFINES["NS_NO_XPCOM"] = True -USE_STATIC_LIBS = True +USE_STATIC_MSVCRT = True if CONFIG["DISABLE_UPDATER_AUTHENTICODE_CHECK"]: DEFINES["DISABLE_UPDATER_AUTHENTICODE_CHECK"] = True diff --git a/toolkit/mozapps/update/tests/moz.build b/toolkit/mozapps/update/tests/moz.build index e323384c2eaef5..da4c281e8f33e1 100644 --- a/toolkit/mozapps/update/tests/moz.build +++ b/toolkit/mozapps/update/tests/moz.build @@ -69,7 +69,7 @@ if CONFIG["CC_TYPE"] == "clang-cl": if CONFIG["OS_ARCH"] == "WINNT": DEFINES["UNICODE"] = True DEFINES["_UNICODE"] = True - USE_STATIC_LIBS = True + USE_STATIC_MSVCRT = True if CONFIG["CC_TYPE"] in ("clang", "gcc"): WIN32_EXE_LDFLAGS += ["-municode"] diff --git a/toolkit/mozapps/update/updater/bspatch/moz.build b/toolkit/mozapps/update/updater/bspatch/moz.build index 46c6d11fadd623..c7132cce7169c1 100644 --- a/toolkit/mozapps/update/updater/bspatch/moz.build +++ b/toolkit/mozapps/update/updater/bspatch/moz.build @@ -5,7 +5,7 @@ # file, You can obtain one at http://mozilla.org/MPL/2.0/. if CONFIG["OS_ARCH"] == "WINNT": - USE_STATIC_LIBS = True + USE_STATIC_MSVCRT = True EXPORTS += [ "bspatch.h", diff --git a/toolkit/mozapps/update/updater/updater-common.build b/toolkit/mozapps/update/updater/updater-common.build index 600c03de7cd1f2..e1d01c6ad19c6e 100644 --- a/toolkit/mozapps/update/updater/updater-common.build +++ b/toolkit/mozapps/update/updater/updater-common.build @@ -43,7 +43,7 @@ if CONFIG["OS_ARCH"] == "WINNT": RCINCLUDE = "%supdater.rc" % updater_rel_path DEFINES["UNICODE"] = True DEFINES["_UNICODE"] = True - USE_STATIC_LIBS = True + USE_STATIC_MSVCRT = True # Pick up nsWindowsRestart.cpp LOCAL_INCLUDES += [ diff --git a/toolkit/xre/test/win/moz.build b/toolkit/xre/test/win/moz.build index fc622f89658966..cce8eb447c8894 100644 --- a/toolkit/xre/test/win/moz.build +++ b/toolkit/xre/test/win/moz.build @@ -28,7 +28,7 @@ LOCAL_INCLUDES += [ ] DisableStlWrapping() -USE_STATIC_LIBS = True +USE_STATIC_MSVCRT = True OS_LIBS += [ "advapi32",