From 1acc37c7a6c593f6f4687294b842e8d4851bd305 Mon Sep 17 00:00:00 2001 From: Mike Hommey <mh+mozilla@glandium.org> Date: Thu, 30 Dec 2021 20:56:43 +0000 Subject: [PATCH] Bug 1747756 - Move Windows system libraries from LIBS to moz.build. r=firefox-build-system-reviewers,mhentges While mingw builds don't require user32 and advapi32 explicitly, it doesn't hurt for them to be there (and they're required for clang-cl build). Likewise, while clang-builds don't require uuid and userenv explicitly because they're pulled in via #pragmas in the source code, mingw doesn't support those #pragmas and needs them explicitly, which doesn't hurt the clang-cl builds. Differential Revision: https://phabricator.services.mozilla.com/D134737 --- accessible/ipc/win/handler/moz.build | 3 +++ browser/app/moz.build | 7 +++++++ .../migration/tests/unit/insertIEHistory/moz.build | 1 + config/external/nspr/pr/moz.build | 1 + dom/media/fake-cdm/moz.build | 1 + ipc/app/moz.build | 3 +++ js/src/moz.build | 4 ++++ js/src/old-configure.in | 3 --- js/xpconnect/shell/moz.build | 3 +++ media/gmp-clearkey/0.1/moz.build | 1 + memory/replace/logalloc/replay/moz.build | 1 + mozglue/build/moz.build | 6 ++++++ old-configure.in | 3 --- .../manager/ssl/ipcclientcerts/dynamic-library/moz.build | 1 + .../manager/ssl/osclientcerts/dynamic-library/moz.build | 1 + testing/tools/screenshot/moz.build | 3 +++ .../components/aboutthirdparty/tests/TestShellEx/moz.build | 6 ++++++ toolkit/components/maintenanceservice/moz.build | 3 +++ toolkit/crashreporter/client/moz.build | 3 +++ toolkit/crashreporter/mozwer/moz.build | 1 + toolkit/library/moz.build | 3 +++ toolkit/mozapps/update/tests/moz.build | 2 ++ toolkit/mozapps/update/updater/updater-common.build | 4 ++++ .../tests/gtest/TestDllBlocklist_NoOpEntryPoint/moz.build | 4 ++++ toolkit/xre/dllservices/tests/moz.build | 2 ++ toolkit/xre/test/win/moz.build | 2 ++ widget/windows/tests/moz.build | 1 + xpcom/windbgdlg/moz.build | 5 +++++ 28 files changed, 72 insertions(+), 6 deletions(-) diff --git a/accessible/ipc/win/handler/moz.build b/accessible/ipc/win/handler/moz.build index 4e99d4e687729..1242bb6b8c02f 100644 --- a/accessible/ipc/win/handler/moz.build +++ b/accessible/ipc/win/handler/moz.build @@ -92,8 +92,11 @@ USE_LIBS += [ ] OS_LIBS += [ + "advapi32", + "uuid", "rpcrt4", "oleacc", + "user32", ] RCINCLUDE = "AccessibleHandler.rc" diff --git a/browser/app/moz.build b/browser/app/moz.build index c3ca45a770fab..f280dbd909691 100644 --- a/browser/app/moz.build +++ b/browser/app/moz.build @@ -78,6 +78,10 @@ if CONFIG["OS_ARCH"] == "WINNT": LOCAL_INCLUDES += [ "/browser/app/winlauncher", ] + OS_LIBS += [ + "advapi32", + "uuid", + ] DELAYLOAD_DLLS += [ "advapi32.dll", "oleaut32.dll", @@ -115,6 +119,9 @@ if CONFIG["MOZ_SANDBOX"] and CONFIG["OS_ARCH"] == "WINNT": "sandbox_s", ] + OS_LIBS += [ + "winmm", + ] DELAYLOAD_DLLS += [ "winmm.dll", "user32.dll", diff --git a/browser/components/migration/tests/unit/insertIEHistory/moz.build b/browser/components/migration/tests/unit/insertIEHistory/moz.build index 33c261c74688e..61ca96d48a953 100644 --- a/browser/components/migration/tests/unit/insertIEHistory/moz.build +++ b/browser/components/migration/tests/unit/insertIEHistory/moz.build @@ -9,6 +9,7 @@ FINAL_TARGET = "_tests/xpcshell/browser/components/migration/tests/unit" Program("InsertIEHistory") OS_LIBS += [ "ole32", + "uuid", ] SOURCES += [ "InsertIEHistory.cpp", diff --git a/config/external/nspr/pr/moz.build b/config/external/nspr/pr/moz.build index 4e06a37323a41..dc9fa0aefc363 100644 --- a/config/external/nspr/pr/moz.build +++ b/config/external/nspr/pr/moz.build @@ -69,6 +69,7 @@ elif CONFIG["OS_TARGET"] == "SunOS": elif CONFIG["OS_TARGET"] == "WINNT": OS_LIBS += [ "advapi32", + "wsock32", "ws2_32", "mswsock", "winmm", diff --git a/dom/media/fake-cdm/moz.build b/dom/media/fake-cdm/moz.build index 00faf01c75e9b..6c7aafd9b4bbd 100644 --- a/dom/media/fake-cdm/moz.build +++ b/dom/media/fake-cdm/moz.build @@ -23,6 +23,7 @@ SharedLibrary("fake") if CONFIG["OS_ARCH"] == "WINNT": OS_LIBS += [ "ole32", + "user32", ] USE_STATIC_LIBS = True diff --git a/ipc/app/moz.build b/ipc/app/moz.build index dd63c7f75da8d..69bf726c04223 100644 --- a/ipc/app/moz.build +++ b/ipc/app/moz.build @@ -37,7 +37,10 @@ if CONFIG["OS_ARCH"] == "WINNT": ] OS_LIBS += [ + "advapi32", + "user32", "version", + "winmm", ] USE_LIBS += [ diff --git a/js/src/moz.build b/js/src/moz.build index ffac6bfc447a5..bb4148408609b 100755 --- a/js/src/moz.build +++ b/js/src/moz.build @@ -509,6 +509,10 @@ if CONFIG["ENABLE_TRACE_LOGGING"]: ] if CONFIG["OS_ARCH"] == "WINNT": + OS_LIBS += [ + "advapi32", + "winmm", + ] UNIFIED_SOURCES += [ "threading/windows/CpuCount.cpp", "threading/windows/WindowsThread.cpp", diff --git a/js/src/old-configure.in b/js/src/old-configure.in index 5419a9b2cec77..6ab5e7b9b2be7 100644 --- a/js/src/old-configure.in +++ b/js/src/old-configure.in @@ -404,8 +404,6 @@ case "$target" in fi DSO_LDOPTS='-shared' - # mingw doesn't require kernel32, user32, and advapi32 explicitly - LIBS="$LIBS -lusp10 -lgdi32 -lwinmm -lwsock32" MOZ_FIX_LINK_PATHS= # Silence problematic clang warnings @@ -522,7 +520,6 @@ case "$target" in # warning insists on complaining about the latter case, which # is annoying, and rather noisy. CXXFLAGS="$CXXFLAGS -Wno-used-but-marked-unused" - LIBS="$LIBS kernel32.lib user32.lib gdi32.lib winmm.lib wsock32.lib advapi32.lib" MOZ_DEBUG_LDFLAGS='-DEBUG' if test "$HOST_OS_ARCH" != "WINNT"; then # %_PDB% is a special signal to emit only the PDB basename. This diff --git a/js/xpconnect/shell/moz.build b/js/xpconnect/shell/moz.build index 5048fa7608aec..de3b050b79723 100644 --- a/js/xpconnect/shell/moz.build +++ b/js/xpconnect/shell/moz.build @@ -39,7 +39,10 @@ if CONFIG["OS_ARCH"] == "WINNT": ] OS_LIBS += [ + "advapi32", + "user32", "version", + "winmm", ] USE_LIBS += [ diff --git a/media/gmp-clearkey/0.1/moz.build b/media/gmp-clearkey/0.1/moz.build index 15348d8386dd1..928abd6cfb1fd 100644 --- a/media/gmp-clearkey/0.1/moz.build +++ b/media/gmp-clearkey/0.1/moz.build @@ -37,6 +37,7 @@ if CONFIG["OS_ARCH"] == "WINNT": OS_LIBS += [ "mfuuid", + "uuid", ] DEFINES["ENABLE_WMF"] = True diff --git a/memory/replace/logalloc/replay/moz.build b/memory/replace/logalloc/replay/moz.build index 7a6f2098e24c1..8f6291aa860a4 100644 --- a/memory/replace/logalloc/replay/moz.build +++ b/memory/replace/logalloc/replay/moz.build @@ -33,6 +33,7 @@ if CONFIG["MOZ_REPLACE_MALLOC_STATIC"] and (CONFIG["MOZ_DMD"] or CONFIG["MOZ_PHC if CONFIG["OS_ARCH"] == "WINNT": OS_LIBS += [ + "advapi32", "dbghelp", ] diff --git a/mozglue/build/moz.build b/mozglue/build/moz.build index f0862de290230..e27c323d1c0c0 100644 --- a/mozglue/build/moz.build +++ b/mozglue/build/moz.build @@ -38,6 +38,12 @@ if CONFIG["MOZ_TSAN"]: if CONFIG["OS_TARGET"] == "WINNT": if CONFIG["MOZ_MEMORY"]: DEFFILE = "mozglue.def" + OS_LIBS += [ + "advapi32", + "user32", + "winmm", + "uuid", + ] # We'll break the DLL blocklist if we immediately load user32.dll. # For the same reason, we delayload these other DLLs to avoid eager # dependencies on user32.dll. diff --git a/old-configure.in b/old-configure.in index 92f72cc002090..f76c90f0a7d2d 100644 --- a/old-configure.in +++ b/old-configure.in @@ -478,8 +478,6 @@ case "$target" in fi DSO_LDOPTS='-shared' - # mingw doesn't require kernel32, user32, and advapi32 explicitly - LIBS="$LIBS -luuid -lusp10 -lgdi32 -lwinmm -lwsock32 -luserenv -lsecur32" MOZ_FIX_LINK_PATHS= MOZ_OPTIMIZE_FLAGS="-O2" @@ -598,7 +596,6 @@ case "$target" in CXXFLAGS="$CXXFLAGS -Wno-used-but-marked-unused" # Silence VS2017 15.5+ TR1 deprecation warnings hit by older gtest versions CXXFLAGS="$CXXFLAGS -D_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING" - LIBS="$LIBS user32.lib gdi32.lib winmm.lib wsock32.lib advapi32.lib secur32.lib" MOZ_DEBUG_LDFLAGS='-DEBUG' if test "$HOST_OS_ARCH" != "WINNT"; then # %_PDB% is a special signal to emit only the PDB basename. This diff --git a/security/manager/ssl/ipcclientcerts/dynamic-library/moz.build b/security/manager/ssl/ipcclientcerts/dynamic-library/moz.build index 57c1f919cef40..f338eae36453e 100644 --- a/security/manager/ssl/ipcclientcerts/dynamic-library/moz.build +++ b/security/manager/ssl/ipcclientcerts/dynamic-library/moz.build @@ -24,6 +24,7 @@ if CONFIG["OS_TARGET"] == "Android": if CONFIG["OS_ARCH"] == "WINNT": OS_LIBS += [ + "advapi32", "userenv", "ws2_32", ] diff --git a/security/manager/ssl/osclientcerts/dynamic-library/moz.build b/security/manager/ssl/osclientcerts/dynamic-library/moz.build index abd66ba6af029..f68e5c0d39912 100644 --- a/security/manager/ssl/osclientcerts/dynamic-library/moz.build +++ b/security/manager/ssl/osclientcerts/dynamic-library/moz.build @@ -12,6 +12,7 @@ UNIFIED_SOURCES += [ if CONFIG["OS_ARCH"] == "WINNT": OS_LIBS += [ + "advapi32", "crypt32", "kernel32", "ncrypt", diff --git a/testing/tools/screenshot/moz.build b/testing/tools/screenshot/moz.build index 829405856f1b7..eb87b72f64c54 100644 --- a/testing/tools/screenshot/moz.build +++ b/testing/tools/screenshot/moz.build @@ -23,7 +23,10 @@ elif CONFIG["MOZ_WIDGET_TOOLKIT"] == "windows": if CONFIG["CC_TYPE"] in ("clang", "gcc"): WIN32_EXE_LDFLAGS += ["-municode"] OS_LIBS += [ + "advapi32", + "gdi32", "gdiplus", + "user32", ] NO_PGO = True diff --git a/toolkit/components/aboutthirdparty/tests/TestShellEx/moz.build b/toolkit/components/aboutthirdparty/tests/TestShellEx/moz.build index d98b6c33d5219..aec43210f75b4 100644 --- a/toolkit/components/aboutthirdparty/tests/TestShellEx/moz.build +++ b/toolkit/components/aboutthirdparty/tests/TestShellEx/moz.build @@ -20,6 +20,12 @@ USE_LIBS += [ "mozglue", ] +if CONFIG["OS_ARCH"] == "WINNT": + OS_LIBS += [ + "advapi32", + "uuid", + ] + if CONFIG["COMPILE_ENVIRONMENT"]: shared_library = "!%sTestShellEx%s" % (CONFIG["DLL_PREFIX"], CONFIG["DLL_SUFFIX"]) TEST_HARNESS_FILES.testing.mochitest.browser.toolkit.components.aboutthirdparty.tests.browser += [ diff --git a/toolkit/components/maintenanceservice/moz.build b/toolkit/components/maintenanceservice/moz.build index db8a7ba8bd4cc..a4dae3f8baf75 100644 --- a/toolkit/components/maintenanceservice/moz.build +++ b/toolkit/components/maintenanceservice/moz.build @@ -50,6 +50,9 @@ OS_LIBS += [ "ws2_32", "shell32", "shlwapi", + "user32", + "userenv", + "uuid", ] if CONFIG["ENABLE_TESTS"]: diff --git a/toolkit/crashreporter/client/moz.build b/toolkit/crashreporter/client/moz.build index 48c4499914d71..c52a7ebe715db 100644 --- a/toolkit/crashreporter/client/moz.build +++ b/toolkit/crashreporter/client/moz.build @@ -44,11 +44,14 @@ if CONFIG["OS_ARCH"] == "WINNT": "nss", ] OS_LIBS += [ + "advapi32", "comctl32", + "gdi32", "ole32", "shell32", "wininet", "shlwapi", + "user32", ] elif CONFIG["OS_ARCH"] == "Darwin": UNIFIED_SOURCES += [ diff --git a/toolkit/crashreporter/mozwer/moz.build b/toolkit/crashreporter/mozwer/moz.build index a3d4736e80666..1f6418fd48829 100644 --- a/toolkit/crashreporter/mozwer/moz.build +++ b/toolkit/crashreporter/mozwer/moz.build @@ -7,6 +7,7 @@ USE_LIBS += [ ] OS_LIBS += [ + "advapi32", "bcrypt", ] diff --git a/toolkit/library/moz.build b/toolkit/library/moz.build index cb04762bf632e..b2c1ab78befe5 100644 --- a/toolkit/library/moz.build +++ b/toolkit/library/moz.build @@ -269,11 +269,14 @@ if CONFIG["OS_ARCH"] == "FreeBSD": if CONFIG["OS_ARCH"] == "WINNT": OS_LIBS += [ "crypt32", + "gdi32", "shell32", "ntdll", "ole32", "version", "winspool", + "userenv", + "uuid", ] if CONFIG["OS_ARCH"] == "Linux" and CONFIG["OS_TARGET"] != "Android": diff --git a/toolkit/mozapps/update/tests/moz.build b/toolkit/mozapps/update/tests/moz.build index 689bd1853e08d..1a52a88b5fcbf 100644 --- a/toolkit/mozapps/update/tests/moz.build +++ b/toolkit/mozapps/update/tests/moz.build @@ -40,6 +40,8 @@ LOCAL_INCLUDES += [ if CONFIG["OS_ARCH"] == "WINNT": OS_LIBS += [ "shlwapi", + "user32", + "uuid", ] USE_LIBS += [ diff --git a/toolkit/mozapps/update/updater/updater-common.build b/toolkit/mozapps/update/updater/updater-common.build index 95d1ab892485a..7c58d374bbc29 100644 --- a/toolkit/mozapps/update/updater/updater-common.build +++ b/toolkit/mozapps/update/updater/updater-common.build @@ -38,6 +38,10 @@ if CONFIG["OS_ARCH"] == "WINNT": "shlwapi", "crypt32", "advapi32", + "gdi32", + "user32", + "userenv", + "uuid", ] USE_LIBS += [ diff --git a/toolkit/xre/dllservices/tests/gtest/TestDllBlocklist_NoOpEntryPoint/moz.build b/toolkit/xre/dllservices/tests/gtest/TestDllBlocklist_NoOpEntryPoint/moz.build index 57fae737c420f..e9a10a150a367 100644 --- a/toolkit/xre/dllservices/tests/gtest/TestDllBlocklist_NoOpEntryPoint/moz.build +++ b/toolkit/xre/dllservices/tests/gtest/TestDllBlocklist_NoOpEntryPoint/moz.build @@ -15,3 +15,7 @@ RCFILE = "TestDllBlocklist_NoOpEntryPoint.rc" if CONFIG["COMPILE_ENVIRONMENT"]: TEST_HARNESS_FILES.gtest += ["!TestDllBlocklist_NoOpEntryPoint.dll"] + +OS_LIBS += [ + "uuid", +] diff --git a/toolkit/xre/dllservices/tests/moz.build b/toolkit/xre/dllservices/tests/moz.build index f79a2667940bb..eee1b22ae3036 100644 --- a/toolkit/xre/dllservices/tests/moz.build +++ b/toolkit/xre/dllservices/tests/moz.build @@ -23,10 +23,12 @@ if CONFIG["CPU_ARCH"] in ("x86", "x86_64"): ) OS_LIBS += [ + "advapi32", "ntdll", "ole32", "shlwapi", "user32", + "uuid", ] DELAYLOAD_DLLS += [ diff --git a/toolkit/xre/test/win/moz.build b/toolkit/xre/test/win/moz.build index 8dbdbe5389fc9..93faee0e7f7f4 100644 --- a/toolkit/xre/test/win/moz.build +++ b/toolkit/xre/test/win/moz.build @@ -27,8 +27,10 @@ DisableStlWrapping() USE_STATIC_LIBS = True OS_LIBS += [ + "advapi32", "comctl32", "shell32", + "userenv", "ws2_32", ] diff --git a/widget/windows/tests/moz.build b/widget/windows/tests/moz.build index 8d6c88c5e2c8a..60e83d34a5b7d 100644 --- a/widget/windows/tests/moz.build +++ b/widget/windows/tests/moz.build @@ -19,6 +19,7 @@ OS_LIBS += [ "shell32", "shlwapi", "urlmon", + "uuid", ] if CONFIG["OS_TARGET"] == "WINNT" and CONFIG["CC_TYPE"] in ("gcc", "clang"): diff --git a/xpcom/windbgdlg/moz.build b/xpcom/windbgdlg/moz.build index 2361552ad614b..7d1798b545a8c 100644 --- a/xpcom/windbgdlg/moz.build +++ b/xpcom/windbgdlg/moz.build @@ -5,3 +5,8 @@ # file, You can obtain one at http://mozilla.org/MPL/2.0/. SimplePrograms(["windbgdlg"]) + +OS_LIBS += [ + "advapi32", + "user32", +] -- GitLab