commit 977d1ecafcd443cdd1a52e79d668ce015bee6f7d
parent 2a53c8b5c00f83dfc24c1eb2192171f4947ce0c1
Author: Mike Hommey <mh+mozilla@glandium.org>
Date: Mon, 20 Oct 2025 22:59:07 +0000
Bug 1981063 - Consistently enable desktop launcher in artifact vs. normal builds. r=firefox-build-system-reviewers,cdupuis,browser-installer-reviewers,sergesanspaille
Differential Revision: https://phabricator.services.mozilla.com/D267346
Diffstat:
9 files changed, 116 insertions(+), 106 deletions(-)
diff --git a/browser/app/desktop-launcher/moz.build b/browser/app/desktop-launcher/moz.build
@@ -1,53 +1,51 @@
-# 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/.
-
-
-# Try to sort out our building/branding model into something a C
-# preprocessor can understand
-if CONFIG["MOZ_BRANDING_DIRECTORY"] == "browser/branding/official":
- if CONFIG["MOZ_UPDATE_CHANNEL"] == "beta":
- DEFINES["MOZ_BRANDING_IS_BETA"] = 1
- else:
- DEFINES["MOZ_BRANDING_IS_OFFICIAL"] = 1
-elif CONFIG["MOZ_BRANDING_DIRECTORY"] == "browser/branding/nightly":
- DEFINES["MOZ_BRANDING_IS_NIGHTLY"] = 1
-elif CONFIG["MOZ_BRANDING_DIRECTORY"] == "browser/branding/aurora":
- DEFINES["MOZ_BRANDING_IS_DEVEDITION"] = 1
-else:
- DEFINES["MOZ_BRANDING_IS_UNOFFICIAL"] = 1
-
-SPHINX_TREES["/browser/desktop-launcher"] = "docs"
-
-# Only build on Windows. Don't build with MinGW, since it doesn't support WinHTTP
-if CONFIG["OS_ARCH"] == "WINNT" and CONFIG["CC_TYPE"] == "clang-cl":
- UNIFIED_SOURCES += [
- "download_firefox.cpp",
- "file_sink.cpp",
- "find_firefox.cpp",
- "main.cpp",
- "tempfile_name.cpp",
- ]
-
- OS_LIBS += [
- "advapi32",
- "rpcrt4",
- "shell32",
- "winhttp",
- ]
- LOCAL_INCLUDES += [
- "/toolkit/xre",
- ]
- DIST_SUBDIR = "desktop-launcher"
- TEST_DIRS += ["tests/gtest", "tests/lib"]
- LDFLAGS = ["-SUBSYSTEM:WINDOWS", "-ENTRY:wmainCRTStartup"]
- USE_STATIC_MSVCRT = True
- Program("desktop-launcher")
- DisableStlWrapping()
- DEFINES["FIREFOX_ICO"] = '"%s/%s/%s.ico"' % (
- TOPSRCDIR,
- CONFIG["MOZ_BRANDING_DIRECTORY"],
- "firefox",
- )
-
- RCINCLUDE = "desktop-launcher.rc"
+# 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/.
+
+
+# Try to sort out our building/branding model into something a C
+# preprocessor can understand
+if CONFIG["MOZ_BRANDING_DIRECTORY"] == "browser/branding/official":
+ if CONFIG["MOZ_UPDATE_CHANNEL"] == "beta":
+ DEFINES["MOZ_BRANDING_IS_BETA"] = 1
+ else:
+ DEFINES["MOZ_BRANDING_IS_OFFICIAL"] = 1
+elif CONFIG["MOZ_BRANDING_DIRECTORY"] == "browser/branding/nightly":
+ DEFINES["MOZ_BRANDING_IS_NIGHTLY"] = 1
+elif CONFIG["MOZ_BRANDING_DIRECTORY"] == "browser/branding/aurora":
+ DEFINES["MOZ_BRANDING_IS_DEVEDITION"] = 1
+else:
+ DEFINES["MOZ_BRANDING_IS_UNOFFICIAL"] = 1
+
+SPHINX_TREES["/browser/desktop-launcher"] = "docs"
+
+UNIFIED_SOURCES += [
+ "download_firefox.cpp",
+ "file_sink.cpp",
+ "find_firefox.cpp",
+ "main.cpp",
+ "tempfile_name.cpp",
+]
+
+OS_LIBS += [
+ "advapi32",
+ "rpcrt4",
+ "shell32",
+ "winhttp",
+]
+LOCAL_INCLUDES += [
+ "/toolkit/xre",
+]
+DIST_SUBDIR = "desktop-launcher"
+TEST_DIRS += ["tests/gtest", "tests/lib"]
+LDFLAGS = ["-SUBSYSTEM:WINDOWS", "-ENTRY:wmainCRTStartup"]
+USE_STATIC_MSVCRT = True
+Program("desktop-launcher")
+DisableStlWrapping()
+DEFINES["FIREFOX_ICO"] = '"%s/%s/%s.ico"' % (
+ TOPSRCDIR,
+ CONFIG["MOZ_BRANDING_DIRECTORY"],
+ "firefox",
+)
+
+RCINCLUDE = "desktop-launcher.rc"
diff --git a/browser/app/desktop-launcher/tests/lib/moz.build b/browser/app/desktop-launcher/tests/lib/moz.build
@@ -1,39 +1,37 @@
-# 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/.
-
-# Try to sort out our building/branding model into something a C
-# preprocessor can understand
-if CONFIG["MOZ_BRANDING_DIRECTORY"] == "browser/branding/official":
- if CONFIG["MOZ_UPDATE_CHANNEL"] == "beta":
- DEFINES["MOZ_BRANDING_IS_BETA"] = 1
- else:
- DEFINES["MOZ_BRANDING_IS_OFFICIAL"] = 1
-elif CONFIG["MOZ_BRANDING_DIRECTORY"] == "browser/branding/nightly":
- DEFINES["MOZ_BRANDING_IS_NIGHTLY"] = 1
-elif CONFIG["MOZ_BRANDING_DIRECTORY"] == "browser/branding/aurora":
- DEFINES["MOZ_BRANDING_IS_DEVEDITION"] = 1
-else:
- DEFINES["MOZ_BRANDING_IS_UNOFFICIAL"] = 1
-
-# Only build on platforms that have WinHTTP.h (i.e. not mingw)
-if CONFIG["OS_ARCH"] == "WINNT" and CONFIG["HAVE_WINHTTP_H"]:
- UNIFIED_SOURCES += [
- "../../download_firefox.cpp",
- "../../file_sink.cpp",
- "../../find_firefox.cpp",
- "../../main.cpp",
- "../../tempfile_name.cpp",
- ]
-
- OS_LIBS += [
- "advapi32",
- "rpcrt4",
- "shell32",
- "winhttp",
- ]
- DEFFILE = "desktop-launcher-test.def"
- Library("desktop-launcher-test")
- DisableStlWrapping()
-
- FINAL_LIBRARY = "xul-gtest"
+# 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/.
+
+# Try to sort out our building/branding model into something a C
+# preprocessor can understand
+if CONFIG["MOZ_BRANDING_DIRECTORY"] == "browser/branding/official":
+ if CONFIG["MOZ_UPDATE_CHANNEL"] == "beta":
+ DEFINES["MOZ_BRANDING_IS_BETA"] = 1
+ else:
+ DEFINES["MOZ_BRANDING_IS_OFFICIAL"] = 1
+elif CONFIG["MOZ_BRANDING_DIRECTORY"] == "browser/branding/nightly":
+ DEFINES["MOZ_BRANDING_IS_NIGHTLY"] = 1
+elif CONFIG["MOZ_BRANDING_DIRECTORY"] == "browser/branding/aurora":
+ DEFINES["MOZ_BRANDING_IS_DEVEDITION"] = 1
+else:
+ DEFINES["MOZ_BRANDING_IS_UNOFFICIAL"] = 1
+
+UNIFIED_SOURCES += [
+ "../../download_firefox.cpp",
+ "../../file_sink.cpp",
+ "../../find_firefox.cpp",
+ "../../main.cpp",
+ "../../tempfile_name.cpp",
+]
+
+OS_LIBS += [
+ "advapi32",
+ "rpcrt4",
+ "shell32",
+ "winhttp",
+]
+DEFFILE = "desktop-launcher-test.def"
+Library("desktop-launcher-test")
+DisableStlWrapping()
+
+FINAL_LIBRARY = "xul-gtest"
diff --git a/browser/app/moz.build b/browser/app/moz.build
@@ -77,7 +77,6 @@ if CONFIG["OS_ARCH"] == "WINNT":
RCINCLUDE = "splash.rc"
DIRS += [
"installation_dir_layout",
- "desktop-launcher",
"pbproxy",
"winlauncher",
]
@@ -114,6 +113,11 @@ if CONFIG["OS_ARCH"] == "WINNT":
# only enable it for processes that are not using JIT in xul.dll.
LINK_FLAGS["CETCOMPAT"] = []
+if CONFIG["DESKTOP_LAUNCHER_ENABLED"]:
+ DIRS += [
+ "desktop-launcher",
+ ]
+
if CONFIG["OS_ARCH"] == "Darwin":
OS_LIBS += [
"-framework CoreFoundation",
diff --git a/browser/installer/Makefile.in b/browser/installer/Makefile.in
@@ -157,7 +157,3 @@ package-compare::
ifdef ENABLE_WEBDRIVER
DEFINES += -DENABLE_WEBDRIVER=1
endif
-
-ifdef HAVE_WINHTTP_H
-DEFINES += -DDESKTOP_LAUNCHER_ENABLED=1
-endif
diff --git a/browser/installer/windows/nsis/defines.nsi.in b/browser/installer/windows/nsis/defines.nsi.in
@@ -114,8 +114,7 @@
!define MOZ_MAINTENANCE_SERVICE
#endif
-# Only build on platforms that have WinHTTP.h (i.e. not mingw)
-#ifdef HAVE_WINHTTP_H
+#ifdef DESKTOP_LAUNCHER_ENABLED
!define DESKTOP_LAUNCHER_ENABLED
#endif
diff --git a/browser/moz.build b/browser/moz.build
@@ -42,10 +42,6 @@ export("DIST_SUBDIR")
# These defines are read in firefox.js
DEFINES["APP_VERSION"] = CONFIG["MOZ_APP_VERSION"]
-# We only include the desktop launcher in non-mingw Windows builds
-if CONFIG["OS_ARCH"] == "WINNT" and CONFIG["CC_TYPE"] == "clang-cl":
- DEFINES["DESKTOP_LAUNCHER_ENABLED"] = True
-
for cdm in CONFIG["MOZ_EME_MODULES"]:
DEFINES["MOZ_%s_EME" % cdm.upper()] = True
diff --git a/build/moz.configure/compile-checks.configure b/build/moz.configure/compile-checks.configure
@@ -92,7 +92,13 @@ def try_link(
# conditional on the value of that function.
@template
def check_header(
- header, language="C++", flags=None, includes=None, when=None, onerror=lambda: None
+ header,
+ language="C++",
+ body="",
+ flags=None,
+ includes=None,
+ when=None,
+ onerror=lambda: None,
):
if when is None:
when = always
@@ -105,6 +111,7 @@ def check_header(
have_header = try_compile(
includes=includes,
+ body=body,
language=language,
flags=flags,
check_msg="for %s" % header,
diff --git a/build/moz.configure/windows.configure b/build/moz.configure/windows.configure
@@ -593,8 +593,6 @@ with only_when(depends(c_compiler)(lambda c: c.type == "clang-cl")):
set_define("HAVE_SEH_EXCEPTIONS", True)
set_define("HAVE_IO_H", True)
- set_define("HAVE_WINHTTP_H", True)
- set_config("HAVE_WINHTTP_H", True)
def win32_subsystem_version():
return "10.0"
diff --git a/toolkit/moz.configure b/toolkit/moz.configure
@@ -4300,3 +4300,17 @@ set_define(
True,
when=moz_debug | milestone.is_early_beta_or_earlier,
)
+
+
+# Desktop Launcher
+# ==============================================================
+with only_when(target_is_windows):
+ desktop_launcher_enabled = artifact_builds | check_header(
+ "winhttp.h",
+ includes=["windows.h"],
+ body="auto flag = WINHTTP_FLAG_SECURE_DEFAULTS",
+ language="C++",
+ when=~artifact_builds,
+ )
+ set_config("DESKTOP_LAUNCHER_ENABLED", True, when=desktop_launcher_enabled)
+ set_define("DESKTOP_LAUNCHER_ENABLED", True, when=desktop_launcher_enabled)