From 98a5c8dac854bb42b97e3836a4e488901920d53d Mon Sep 17 00:00:00 2001 From: Nick Alexander Date: Thu, 18 Aug 2022 16:31:09 +0000 Subject: [PATCH] Bug 1782837 - Add `MOZ_NOTIFICATION_SERVER`; don't build notification server under MinGW. r=firefox-build-system-reviewers,glandium Differential Revision: https://phabricator.services.mozilla.com/D154467 --- browser/config/mozconfigs/win32/mingwclang | 1 + browser/config/mozconfigs/win64/mingwclang | 1 + browser/installer/Makefile.in | 4 ++++ browser/installer/package-manifest.in | 2 +- build/moz.configure/update-programs.configure | 18 ++++++++++++++++++ toolkit/moz.build | 4 +++- 6 files changed, 28 insertions(+), 2 deletions(-) diff --git a/browser/config/mozconfigs/win32/mingwclang b/browser/config/mozconfigs/win32/mingwclang index b0a77eb9f1bc..a8db230fb680 100644 --- a/browser/config/mozconfigs/win32/mingwclang +++ b/browser/config/mozconfigs/win32/mingwclang @@ -32,6 +32,7 @@ ac_add_options --disable-webrtc # Bug 1393901 ac_add_options --disable-geckodriver # Bug 1489320 ac_add_options --disable-update-agent # Bug 1561797 ac_add_options --disable-default-browser-agent # WinToast does not build on mingw +ac_add_options --disable-notification-server # Toast notifications don't build on mingw. # Find our toolchain HOST_CC="$MOZ_FETCHES_DIR/clang/bin/clang" diff --git a/browser/config/mozconfigs/win64/mingwclang b/browser/config/mozconfigs/win64/mingwclang index 52747d1ea65d..46a5b79020d5 100755 --- a/browser/config/mozconfigs/win64/mingwclang +++ b/browser/config/mozconfigs/win64/mingwclang @@ -32,6 +32,7 @@ ac_add_options --disable-webrtc # Bug 1393901 ac_add_options --disable-geckodriver # Bug 1489320 ac_add_options --disable-update-agent # Bug 1561797 ac_add_options --disable-default-browser-agent # WinToast does not build on mingw +ac_add_options --disable-notification-server # Toast notifications don't build on mingw. # Find our toolchain HOST_CC="$MOZ_FETCHES_DIR/clang/bin/clang" diff --git a/browser/installer/Makefile.in b/browser/installer/Makefile.in index 2e10e16f59a6..5d365bd6a4c8 100644 --- a/browser/installer/Makefile.in +++ b/browser/installer/Makefile.in @@ -98,6 +98,10 @@ ifdef MOZ_DEFAULT_BROWSER_AGENT DEFINES += -DMOZ_DEFAULT_BROWSER_AGENT=1 endif +ifdef MOZ_NOTIFICATION_SERVER +DEFINES += -DMOZ_NOTIFICATION_SERVER=1 +endif + ifdef MOZ_BACKGROUNDTASKS DEFINES += -DMOZ_BACKGROUNDTASKS=1 endif diff --git a/browser/installer/package-manifest.in b/browser/installer/package-manifest.in index b351742901a6..9229a0bd0e04 100644 --- a/browser/installer/package-manifest.in +++ b/browser/installer/package-manifest.in @@ -421,7 +421,7 @@ bin/libfreebl_64int_3.so ; [ Notification COM Server ] ; -#if defined(XP_WIN) +#if defined(MOZ_NOTIFICATION_SERVER) @BINPATH@/@DLL_PREFIX@notificationserver@DLL_SUFFIX@ #endif diff --git a/build/moz.configure/update-programs.configure b/build/moz.configure/update-programs.configure index b7ffb18e3b54..123cc52152f9 100644 --- a/build/moz.configure/update-programs.configure +++ b/build/moz.configure/update-programs.configure @@ -134,3 +134,21 @@ def default_agent_flag(enabled): set_config("MOZ_DEFAULT_BROWSER_AGENT", default_agent_flag) + + +# Enable or disable the notification server, which allows Windows native +# notifications to persist when the application is not running and relaunch as +# necessary. +# ============================================================================== +@depends(target, build_project) +def notification_server_default(target, build_project): + return target.os == "WINNT" and build_project == "browser" + + +option( + "--disable-notification-server", + when=notification_server_default, + help="Disable building the notification server", +) + +set_config("MOZ_NOTIFICATION_SERVER", True, when="--enable-notification-server") diff --git a/toolkit/moz.build b/toolkit/moz.build index a9e58e51200a..779723b491c3 100644 --- a/toolkit/moz.build +++ b/toolkit/moz.build @@ -25,7 +25,9 @@ DIRS += [ ] if CONFIG["OS_ARCH"] == "WINNT": - DIRS += ["mozapps/notificationserver"] + if CONFIG["MOZ_NOTIFICATION_SERVER"]: + DIRS += ["mozapps/notificationserver"] + if CONFIG["MOZ_DEFAULT_BROWSER_AGENT"]: DIRS += ["mozapps/defaultagent"]