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
This commit is contained in:
Mike Hommey
2021-12-30 20:56:43 +00:00
parent 863c68436c
commit 48e9e01469
28 changed files with 72 additions and 6 deletions

View File

@@ -92,8 +92,11 @@ USE_LIBS += [
] ]
OS_LIBS += [ OS_LIBS += [
"advapi32",
"uuid",
"rpcrt4", "rpcrt4",
"oleacc", "oleacc",
"user32",
] ]
RCINCLUDE = "AccessibleHandler.rc" RCINCLUDE = "AccessibleHandler.rc"

View File

@@ -78,6 +78,10 @@ if CONFIG["OS_ARCH"] == "WINNT":
LOCAL_INCLUDES += [ LOCAL_INCLUDES += [
"/browser/app/winlauncher", "/browser/app/winlauncher",
] ]
OS_LIBS += [
"advapi32",
"uuid",
]
DELAYLOAD_DLLS += [ DELAYLOAD_DLLS += [
"advapi32.dll", "advapi32.dll",
"oleaut32.dll", "oleaut32.dll",
@@ -115,6 +119,9 @@ if CONFIG["MOZ_SANDBOX"] and CONFIG["OS_ARCH"] == "WINNT":
"sandbox_s", "sandbox_s",
] ]
OS_LIBS += [
"winmm",
]
DELAYLOAD_DLLS += [ DELAYLOAD_DLLS += [
"winmm.dll", "winmm.dll",
"user32.dll", "user32.dll",

View File

@@ -9,6 +9,7 @@ FINAL_TARGET = "_tests/xpcshell/browser/components/migration/tests/unit"
Program("InsertIEHistory") Program("InsertIEHistory")
OS_LIBS += [ OS_LIBS += [
"ole32", "ole32",
"uuid",
] ]
SOURCES += [ SOURCES += [
"InsertIEHistory.cpp", "InsertIEHistory.cpp",

View File

@@ -69,6 +69,7 @@ elif CONFIG["OS_TARGET"] == "SunOS":
elif CONFIG["OS_TARGET"] == "WINNT": elif CONFIG["OS_TARGET"] == "WINNT":
OS_LIBS += [ OS_LIBS += [
"advapi32", "advapi32",
"wsock32",
"ws2_32", "ws2_32",
"mswsock", "mswsock",
"winmm", "winmm",

View File

@@ -23,6 +23,7 @@ SharedLibrary("fake")
if CONFIG["OS_ARCH"] == "WINNT": if CONFIG["OS_ARCH"] == "WINNT":
OS_LIBS += [ OS_LIBS += [
"ole32", "ole32",
"user32",
] ]
USE_STATIC_LIBS = True USE_STATIC_LIBS = True

View File

@@ -37,7 +37,10 @@ if CONFIG["OS_ARCH"] == "WINNT":
] ]
OS_LIBS += [ OS_LIBS += [
"advapi32",
"user32",
"version", "version",
"winmm",
] ]
USE_LIBS += [ USE_LIBS += [

View File

@@ -509,6 +509,10 @@ if CONFIG["ENABLE_TRACE_LOGGING"]:
] ]
if CONFIG["OS_ARCH"] == "WINNT": if CONFIG["OS_ARCH"] == "WINNT":
OS_LIBS += [
"advapi32",
"winmm",
]
UNIFIED_SOURCES += [ UNIFIED_SOURCES += [
"threading/windows/CpuCount.cpp", "threading/windows/CpuCount.cpp",
"threading/windows/WindowsThread.cpp", "threading/windows/WindowsThread.cpp",

View File

@@ -404,8 +404,6 @@ case "$target" in
fi fi
DSO_LDOPTS='-shared' DSO_LDOPTS='-shared'
# mingw doesn't require kernel32, user32, and advapi32 explicitly
LIBS="$LIBS -lusp10 -lgdi32 -lwinmm -lwsock32"
MOZ_FIX_LINK_PATHS= MOZ_FIX_LINK_PATHS=
# Silence problematic clang warnings # Silence problematic clang warnings
@@ -522,7 +520,6 @@ case "$target" in
# warning insists on complaining about the latter case, which # warning insists on complaining about the latter case, which
# is annoying, and rather noisy. # is annoying, and rather noisy.
CXXFLAGS="$CXXFLAGS -Wno-used-but-marked-unused" 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' MOZ_DEBUG_LDFLAGS='-DEBUG'
if test "$HOST_OS_ARCH" != "WINNT"; then if test "$HOST_OS_ARCH" != "WINNT"; then
# %_PDB% is a special signal to emit only the PDB basename. This # %_PDB% is a special signal to emit only the PDB basename. This

View File

@@ -39,7 +39,10 @@ if CONFIG["OS_ARCH"] == "WINNT":
] ]
OS_LIBS += [ OS_LIBS += [
"advapi32",
"user32",
"version", "version",
"winmm",
] ]
USE_LIBS += [ USE_LIBS += [

View File

@@ -37,6 +37,7 @@ if CONFIG["OS_ARCH"] == "WINNT":
OS_LIBS += [ OS_LIBS += [
"mfuuid", "mfuuid",
"uuid",
] ]
DEFINES["ENABLE_WMF"] = True DEFINES["ENABLE_WMF"] = True

View File

@@ -33,6 +33,7 @@ if CONFIG["MOZ_REPLACE_MALLOC_STATIC"] and (CONFIG["MOZ_DMD"] or CONFIG["MOZ_PHC
if CONFIG["OS_ARCH"] == "WINNT": if CONFIG["OS_ARCH"] == "WINNT":
OS_LIBS += [ OS_LIBS += [
"advapi32",
"dbghelp", "dbghelp",
] ]

View File

@@ -38,6 +38,12 @@ if CONFIG["MOZ_TSAN"]:
if CONFIG["OS_TARGET"] == "WINNT": if CONFIG["OS_TARGET"] == "WINNT":
if CONFIG["MOZ_MEMORY"]: if CONFIG["MOZ_MEMORY"]:
DEFFILE = "mozglue.def" DEFFILE = "mozglue.def"
OS_LIBS += [
"advapi32",
"user32",
"winmm",
"uuid",
]
# We'll break the DLL blocklist if we immediately load user32.dll. # We'll break the DLL blocklist if we immediately load user32.dll.
# For the same reason, we delayload these other DLLs to avoid eager # For the same reason, we delayload these other DLLs to avoid eager
# dependencies on user32.dll. # dependencies on user32.dll.

View File

@@ -478,8 +478,6 @@ case "$target" in
fi fi
DSO_LDOPTS='-shared' 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_FIX_LINK_PATHS=
MOZ_OPTIMIZE_FLAGS="-O2" MOZ_OPTIMIZE_FLAGS="-O2"
@@ -598,7 +596,6 @@ case "$target" in
CXXFLAGS="$CXXFLAGS -Wno-used-but-marked-unused" CXXFLAGS="$CXXFLAGS -Wno-used-but-marked-unused"
# Silence VS2017 15.5+ TR1 deprecation warnings hit by older gtest versions # Silence VS2017 15.5+ TR1 deprecation warnings hit by older gtest versions
CXXFLAGS="$CXXFLAGS -D_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING" 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' MOZ_DEBUG_LDFLAGS='-DEBUG'
if test "$HOST_OS_ARCH" != "WINNT"; then if test "$HOST_OS_ARCH" != "WINNT"; then
# %_PDB% is a special signal to emit only the PDB basename. This # %_PDB% is a special signal to emit only the PDB basename. This

View File

@@ -24,6 +24,7 @@ if CONFIG["OS_TARGET"] == "Android":
if CONFIG["OS_ARCH"] == "WINNT": if CONFIG["OS_ARCH"] == "WINNT":
OS_LIBS += [ OS_LIBS += [
"advapi32",
"userenv", "userenv",
"ws2_32", "ws2_32",
] ]

View File

@@ -12,6 +12,7 @@ UNIFIED_SOURCES += [
if CONFIG["OS_ARCH"] == "WINNT": if CONFIG["OS_ARCH"] == "WINNT":
OS_LIBS += [ OS_LIBS += [
"advapi32",
"crypt32", "crypt32",
"kernel32", "kernel32",
"ncrypt", "ncrypt",

View File

@@ -23,7 +23,10 @@ elif CONFIG["MOZ_WIDGET_TOOLKIT"] == "windows":
if CONFIG["CC_TYPE"] in ("clang", "gcc"): if CONFIG["CC_TYPE"] in ("clang", "gcc"):
WIN32_EXE_LDFLAGS += ["-municode"] WIN32_EXE_LDFLAGS += ["-municode"]
OS_LIBS += [ OS_LIBS += [
"advapi32",
"gdi32",
"gdiplus", "gdiplus",
"user32",
] ]
NO_PGO = True NO_PGO = True

View File

@@ -20,6 +20,12 @@ USE_LIBS += [
"mozglue", "mozglue",
] ]
if CONFIG["OS_ARCH"] == "WINNT":
OS_LIBS += [
"advapi32",
"uuid",
]
if CONFIG["COMPILE_ENVIRONMENT"]: if CONFIG["COMPILE_ENVIRONMENT"]:
shared_library = "!%sTestShellEx%s" % (CONFIG["DLL_PREFIX"], CONFIG["DLL_SUFFIX"]) shared_library = "!%sTestShellEx%s" % (CONFIG["DLL_PREFIX"], CONFIG["DLL_SUFFIX"])
TEST_HARNESS_FILES.testing.mochitest.browser.toolkit.components.aboutthirdparty.tests.browser += [ TEST_HARNESS_FILES.testing.mochitest.browser.toolkit.components.aboutthirdparty.tests.browser += [

View File

@@ -50,6 +50,9 @@ OS_LIBS += [
"ws2_32", "ws2_32",
"shell32", "shell32",
"shlwapi", "shlwapi",
"user32",
"userenv",
"uuid",
] ]
if CONFIG["ENABLE_TESTS"]: if CONFIG["ENABLE_TESTS"]:

View File

@@ -44,11 +44,14 @@ if CONFIG["OS_ARCH"] == "WINNT":
"nss", "nss",
] ]
OS_LIBS += [ OS_LIBS += [
"advapi32",
"comctl32", "comctl32",
"gdi32",
"ole32", "ole32",
"shell32", "shell32",
"wininet", "wininet",
"shlwapi", "shlwapi",
"user32",
] ]
elif CONFIG["OS_ARCH"] == "Darwin": elif CONFIG["OS_ARCH"] == "Darwin":
UNIFIED_SOURCES += [ UNIFIED_SOURCES += [

View File

@@ -7,6 +7,7 @@ USE_LIBS += [
] ]
OS_LIBS += [ OS_LIBS += [
"advapi32",
"bcrypt", "bcrypt",
] ]

View File

@@ -269,11 +269,14 @@ if CONFIG["OS_ARCH"] == "FreeBSD":
if CONFIG["OS_ARCH"] == "WINNT": if CONFIG["OS_ARCH"] == "WINNT":
OS_LIBS += [ OS_LIBS += [
"crypt32", "crypt32",
"gdi32",
"shell32", "shell32",
"ntdll", "ntdll",
"ole32", "ole32",
"version", "version",
"winspool", "winspool",
"userenv",
"uuid",
] ]
if CONFIG["OS_ARCH"] == "Linux" and CONFIG["OS_TARGET"] != "Android": if CONFIG["OS_ARCH"] == "Linux" and CONFIG["OS_TARGET"] != "Android":

View File

@@ -40,6 +40,8 @@ LOCAL_INCLUDES += [
if CONFIG["OS_ARCH"] == "WINNT": if CONFIG["OS_ARCH"] == "WINNT":
OS_LIBS += [ OS_LIBS += [
"shlwapi", "shlwapi",
"user32",
"uuid",
] ]
USE_LIBS += [ USE_LIBS += [

View File

@@ -38,6 +38,10 @@ if CONFIG["OS_ARCH"] == "WINNT":
"shlwapi", "shlwapi",
"crypt32", "crypt32",
"advapi32", "advapi32",
"gdi32",
"user32",
"userenv",
"uuid",
] ]
USE_LIBS += [ USE_LIBS += [

View File

@@ -15,3 +15,7 @@ RCFILE = "TestDllBlocklist_NoOpEntryPoint.rc"
if CONFIG["COMPILE_ENVIRONMENT"]: if CONFIG["COMPILE_ENVIRONMENT"]:
TEST_HARNESS_FILES.gtest += ["!TestDllBlocklist_NoOpEntryPoint.dll"] TEST_HARNESS_FILES.gtest += ["!TestDllBlocklist_NoOpEntryPoint.dll"]
OS_LIBS += [
"uuid",
]

View File

@@ -23,10 +23,12 @@ if CONFIG["CPU_ARCH"] in ("x86", "x86_64"):
) )
OS_LIBS += [ OS_LIBS += [
"advapi32",
"ntdll", "ntdll",
"ole32", "ole32",
"shlwapi", "shlwapi",
"user32", "user32",
"uuid",
] ]
DELAYLOAD_DLLS += [ DELAYLOAD_DLLS += [

View File

@@ -27,8 +27,10 @@ DisableStlWrapping()
USE_STATIC_LIBS = True USE_STATIC_LIBS = True
OS_LIBS += [ OS_LIBS += [
"advapi32",
"comctl32", "comctl32",
"shell32", "shell32",
"userenv",
"ws2_32", "ws2_32",
] ]

View File

@@ -19,6 +19,7 @@ OS_LIBS += [
"shell32", "shell32",
"shlwapi", "shlwapi",
"urlmon", "urlmon",
"uuid",
] ]
if CONFIG["OS_TARGET"] == "WINNT" and CONFIG["CC_TYPE"] in ("gcc", "clang"): if CONFIG["OS_TARGET"] == "WINNT" and CONFIG["CC_TYPE"] in ("gcc", "clang"):

View File

@@ -5,3 +5,8 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/. # file, You can obtain one at http://mozilla.org/MPL/2.0/.
SimplePrograms(["windbgdlg"]) SimplePrograms(["windbgdlg"])
OS_LIBS += [
"advapi32",
"user32",
]